Unit 6 of 11 · about 4 hours · explain, derive
Prefill-decode disaggregation and independent phase capacity
Disaggregation removes one source of phase interference and introduces a new queue and transfer boundary. Pool sizes must follow service demand and SLOs, not just the input-to-output token ratio.
You'll be able to
- Trace a request through prefill, KV handoff and decode, locating each queue and duplicated model copy.
- Derive independent phase demand and a bottleneck capacity bound for a declared workload.
- Explain how phase-specific batching and parallelism can improve isolation while stranding capacity in the other pool.
Covers
Read
In this order, only the parts listed
0 of 3 done
- The independent phase trade-offDistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM Serving
arXiv:2401.09670v3, Section 2.3 Problems and Opportunities, then Sections 3.1 Analysis for Prefill Instance and 3.2 Analysis for Decoding Instance
Use the phase and queue models, not the paper's speedups as targets. Its constant-service, Poisson-arrival queue approximation is not a tail-SLO model for arbitrary prompt mixtures.
- What each phase pool ownsAI Systems Performance Engineering - Chapters 15 and 17, distributed and disaggregated inference
Chapter 15, Disaggregated Prefill and Decode Architecture; Chapter 17, Disaggregated Prefill and Decode Cluster Pools
Read the architecture, memory-management and phase-worker design. Skip deployment snippets and fixed hardware recommendations; use Dynamo v1.5.1 for the current orchestration path.
- Where phase separation helps and losesNVIDIA Dynamo - Disaggregated Serving and KV-Aware Routing
Dynamo v1.5.1, Performance Characteristics - Prefill saturation, Decode memory tradeoff and Capacity effects of disaggregation
Focus on
- Build on Mixing prefill and decode, and chunked prefill to protect decode. Separate pools remove same-device mixed-phase execution, but not queueing, host contention, shared-link contention or decode KV pressure.
- DistServe prefill produces prompt KV and the first sampled token. Follow the first token explicitly: receiving it is not the same event as having KV ready for the next decode step.
- For arrival rate , mean prompt length and mean output length , prompt demand is . If prefill emits the first token, subsequent decode demand is . Declare that convention before using token/s capacities.
- An idealized fixed-throughput bound is the minimum of each pool's token capacity divided by its per-request token demand. Actual capacity must also satisfy KV admission, transfers, arrivals and latency tails; token rates vary with batch, lengths and cache reuse.
Common mistakes · 3
- Sizing pool counts from token ratio alone. One prompt token and one decode token need not consume equal service time or memory.
- Treating phase isolation as independent end-to-end latency. The request still depends on both pools and its handoff.
- Removing GPUs from decode to add prefill without accounting for stranded weights and lost decode KV capacity.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.In the synthetic example, what is the rate bound after prefill capacity doubles?Answer
Still 20 requests/s. Decode must produce 20 subsequent tokens per request from its unchanged 400-token/s capacity.
2.Why must both phase pools hold model weights?Answer
Both execute the model's layers, although their parallel layouts may differ. Separating phases does not let the decode pool operate from KV alone without model weights.
3.Why is operation exactly at the ideal rate bound unsafe?Answer
Variability, bursts and finite buffers create waiting, and any capacity loss can make the backlog grow. A latency contract needs headroom and a workload-specific queue test.
4.Can higher decode batch size change the phase ratio you should provision?Answer
Yes. It changes effective decode throughput, token latency and workspace or KV availability. Recompute the ratio under the chosen operating point.
You're done when
Your request trace names every phase queue and first-token event, and your capacity derivation identifies the limiting phase without treating its ceiling as an SLO-qualified rate.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 10 more in the section
- DistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM ServingPeking University and Microsoft Research · primary
Read the interference model, independent phase parallelism, placement, KV transfer and goodput evaluation. Reuse the break-even method with your workload and topology; do not transfer the paper's speedups to different hardware.
- AI Systems Performance Engineering - Chapters 15 and 17, distributed and disaggregated inferenceChris Fregly (O'Reilly) · required
Read the disaggregated prefill and decode architecture and the MoE parallelism strategies in Chapter 15, then Chapter 17 on disaggregated pools, routing policies and scalability. Reproduce every communication and KV-transfer estimate for a small declared topology.
- NVIDIA Dynamo - Disaggregated Serving and KV-Aware RoutingNVIDIA · required
Trace frontend, prefill router, prefill worker, KV transfer, decode routing and decode worker. Record how load, cache overlap, worker discovery and transfer metadata affect placement; implement only a small simulated or available-hardware slice.
Also in this section
- AI Systems Performance Engineering companion code - Chapters 15 and 17Chris Fregly · required
Use the single-device KV-handoff and simulation paths before the multi-GPU pairs. Then choose one disaggregation, routing or MoE target compatible with available hardware and keep bundled results separate from newly captured evidence.
- Hands-On LLM Serving and Optimization - Chapter 7, multi-GPU and disaggregationChi Wang and Peiheng Hu (O'Reilly) · support
Read "Multi-GPU and Multi-Node Inferencing" (data, tensor, pipeline and expert parallelism) and "Prefill-Decode Disaggregation" (architecture, KV transfer, when to use it) in Chapter 7.
- TensorRT-LLM Disaggregated Serving and KV Cache ExchangeNVIDIA · required
Study the KV exchange abstraction, unique request identity, layout conversion, overlap and fleet-worker model. Use its reproducible benchmark sections only on supported hardware and pin the release.
- SGLang documentation - PD DisaggregationSGLang Project · support
Use the transfer backends, router integration, heartbeat, timeout and cleanup behavior as a second engine's view of the same handoff.
- Mooncake: A KVCache-Centric Disaggregated Architecture for LLM ServingMoonshot AI · support
Read the KV-centric architecture, transfer engine and scheduling sections to understand remote cache pools. Compare its assumptions with DistServe and your simpler handoff; defer reproduction requiring a large cluster.
- 100 Days of LLM Inference - Days 12, 17 and 18Elizabeth Thomas · support
Use the Dynamo, model-parallelism and disaggregation notebooks for a compact topology simulator and request-handoff trace. Label notebook outputs as local analytical or simulated evidence unless real devices were used.
- TensorTonic Language Modeling from Scratch - Route Cache-Aware Prefill RequestsTensorTonic · support
Solve after the routing unit and compare its cost rule with your own placement model.
- LLM Inference: From scratch, one token at a time - Module 09Tushar Amrit · support
Work the Distributed Inference module's communication arithmetic before the tensor and pipeline parallel units.
- AI Performance Engineering - Distributed InferenceWafer · reference
A curated index. Use Section 5 only to find a distributed-serving paper the other entries lack.
- Python 3.14 hashlib - byte digests for KV integrity checksPython Software Foundation · reference
Usage and Hash Objects only: compute and compare a SHA-256 digest over a declared canonical KV payload. Add request/version checks separately; a byte digest is not cache compatibility or authentication.