Unit 8 of 9 · about 5 hours · derive, explain

Prefill-decode disaggregation and KV transfer

Prefill is compute-bound and decode is memory-bound, so colocation forces one phase to wait for the other. Disaggregation removes the interference at the price of one KV transfer per request.

You'll be able to

  • Derive KV transfer bytes and transfer time for a stated model and sequence length, and call the disaggregation crossover against colocated interference.
  • Contrast DistServe, Splitwise and Mooncake placement, hardware and scheduling choices for a stated TTFT and TPOT SLO.
  • Explain the NIXL connector path from memory registration through metadata exchange to transfer completion.

Covers

Prefill and decode disaggregation as a performance mechanismKey-value transfer bytes, bandwidth, latency and crossoverNIXL and connector data-path identityDistServe, Splitwise and Mooncake architectural trade-offs
1

Read

In this order, only the parts listed

0 of 5 done

  1. Disaggregation, interference and goodputDistServe

    Sections 2.3 (prefill-decoding interference and why chunked prefill cannot remove it), 3.1 to 3.3 (phase analysis with the 512-token OPT-66B transfer sizing), and 4.1 to 4.2 (high and low node-affinity placement); read arXiv:2401.09670v3

  2. Disaggregated pools, KV sizing and hardware splitAI Systems Performance Engineering - Chapters 4, 15, 17 and 18

    Chapter 17, Why Prefill-Decode Disaggregation? with Disaggregated Prefill and Decode Cluster Pools; Chapter 18, Fast KV Cache Transfer Between Prefill and Decode with Connector and Data Path Design and Compute-Optimized Versus Memory-Optimized Hardware

  3. Transfer API and backendsNVIDIA Inference Xfer Library

    docs/nixl.md Design and Example procedure: create_agent, register_memory, metadata exchange, then create_xfer_req, post_transfer_request and get_xfer_status; docs/BackendGuide.md for the backend side (registerMem, prepXfer, postXfer, checkXfer) and how the agent picks a backend by memory type

    Inspect the API and run only supported single-host transports. Multi-node RDMA paths need multi-node RDMA hardware; with one GPU, use single-host transports and label the analytical projection simulation.

  4. Phase-specific machinesSplitwise: Efficient Generative LLM Inference Using Phase Splitting

    arXiv:2311.18677v2 (ISCA 2024): phase characterization with homogeneous and heterogeneous cluster designs: up to 1.4x higher throughput at 20 percent lower cost, or 2.35x more throughput under the same power and cost

  5. KVCache-centric disaggregationMooncake: Trading More Storage for Less Computation

    KVCache-centric architecture with the global cache, transfer engine, prefill scheduling and early rejection: 59 to 498 percent higher effective capacity on the paper's traces

2

Focus on

  • Goodput is the maximum request rate served within both TTFT and TPOT at a stated attainment such as 90 percent. DistServe reports up to 7.4x more requests and 12.6x tighter SLOs on its workloads; treat both as paper-specific, not portable speedups.
  • KV bytes per token are for layers, key-value heads, head dim and bytes per element. The short form without dtype and grouped-query heads undercounts grouped models by the head ratio.
  • A 40-layer, 40-head, dim-128 FP16 model holds about 0.82 MB per token, or 3.36 GB decimal for 4096 tokens. At 100 GB/s that transfer takes about 34 ms; disaggregation wins only when the removed interference exceeds it.
  • Move KV in slabs, not blocks: coalesce 16-token paged blocks into roughly 128-token payloads per RDMA write, overlap the transfer with decode compute, and keep first-token logits off the transfer path.
Common mistakes · 3
  • Quoting the paper's 1.13GB transfer without recomputing. The byte count behind it is about 1.2e9 bytes (1.13 GiB scale) for 512 tokens on OPT-66B; recompute from the formula and label GB versus GiB before sizing any link.
  • Trusting a rule of thumb for KV size. Llama-2-70B (80 layers, 8 KV heads, head dim 128) holds about 0.33 MB per token in FP16, or 1.34 GB for 4096 tokens; with all 64 heads as KV it would hold 2.6 MB per token. Size from the formula with the stated heads and dtype, and size the transfer buffer from that result plus headers.
  • Believing chunked prefill removes interference. It trades TPOT relief for extra prefill work with quadratic KV reloads across chunks; only separate pools remove the coupling.
3

Try it yourself

Closed-book, before checking anything

Closed-book, compute per-token and per-request KV bytes for a stated layer count, key-value heads, head dim, dtype and sequence length, convert to transfer time at two stated link rates, and call whether disaggregation wins given stated TTFT and TPOT slack.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.What are the KV bytes for 4096 tokens on a 40-layer, 40-head, dim-128 FP16 model?Answer

    bytes per token, about 0.82 MB, times 4096 is about 3.36 GB decimal. Transfer time is that divided by the effective link rate.

  2. 2.At 10 rps with 1.2 GB per request, what link does the transfer need?Answer

    12 GB/s, or about 96 Gbps before overheads. That is why link sizing matters: a 100 Gb/s link saturates while an 800 Gb/s link stays comfortable.

  3. 3.What distinguishes Splitwise placement from DistServe placement?Answer

    Splitwise assigns phases to different machine types (compute-optimized prefill, memory-optimized decode, including heterogeneous mixes), while DistServe co-optimizes GPU counts and parallelism per phase for goodput under TTFT and TPOT.

  4. 4.What does Mooncake add beyond separating prefill and decode pools?Answer

    A KVCache-centric global cache that reuses stored KV across requests plus SLO-aware scheduling with early rejection when a request cannot meet its objectives.

  5. 5.When does NCCL serve the transfer and when does NIXL?Answer

    NCCL for many-to-many synchronized collectives such as gradient or activation reductions; NIXL for one-to-one asynchronous KV moves that are polled for completion. NCCL send and receive can carry KV, but the book notes many deployments prefer NIXL or UCX for lower tail latency and better overlap.

5

Practice

  • AI Systems companion code ch15: single-GPU KV handoff and cache math

    Run baseline_single_gpu_kv_handoff.py against optimized_single_gpu_kv_handoff.py with kv_cache_management_math.py; compute the transfer crossover for your sequence lengths

    Single-host paths only. Multi-GPU disaggregated pairs need two GPUs, so record them as blockers with the topology dump. With one GPU, compute the transfer crossover with the analytical model checked against published nccl-tests results and label it simulation.

You're done when

Your hand KV sizing matches the math script, your crossover calls the measured handoff correctly, and you can defend the DistServe, Splitwise and Mooncake choice for one stated SLO.

Only when you can do this without notes.

Leads to

Notes

Resources · 5 for this unit, 8 more in the section
  • AI Systems Performance Engineering - Chapters 4, 15, 17 and 18Chris Fregly · primary

    Read Chapter 4 on distributed networking communication, the parallelism parts of Chapter 15, and Chapters 17 and 18 on disaggregated prefill and decode and KV-cache transfer. Re-derive every volume and crossover for the hardware you actually have.

  • DistServeDistServe Authors · required

    Study prefill-decode interference, phase-specific parallelism and goodput optimization. Build a small simulator or measured two-pool experiment and test the key-value transfer crossover rather than reproducing the complete serving system.

  • NVIDIA Inference Xfer LibraryNVIDIA · support

    Inspect memory registration, transfer backends and metadata APIs as the state-movement layer for disaggregation. Run only supported local transports and compare measured transfer setup and steady-state cost with the model.

  • Splitwise: Efficient Generative LLM Inference Using Phase SplittingMicrosoft Research · support

    Read arXiv:2311.18677v2 (ISCA 2024) for the phase characterization and the homogeneous and heterogeneous cluster designs. Test the throughput, cost and power claims as hardware-specific results, and compare its placement with DistServe on your workload.

  • Mooncake: Trading More Storage for Less ComputationUSENIX FAST 25 · support

    Study the KVCache-centric disaggregated architecture, the global cache with its transfer engine, and the prefill scheduling with early rejection. Test the effective-capacity claims as trace-specific results.

Also in this section

  • AI Systems Performance Engineering companion code - Chapters 4, 15 and 17Chris Fregly · support

    Use compatible examples from code/ch04, code/ch15 and code/ch17 for NCCL, topology, overlap and disaggregated inference. Run preflight checks, lock and record clocks through the harness, and mark unsupported transport or topology paths as explicit blockers.

  • AI Performance Engineering - Distributed InferenceWafer · reference

    A curated index. Use Section 5 only to find primary papers for a communication mechanism you are measuring.

  • NCCLNVIDIA · required

    Study the collective API, communicator and topology behavior, then run a bounded nccl-tests message-size sweep when multiple GPUs are available. Correlate algorithm bandwidth, bus bandwidth and rank timelines with the - model.

  • UCSD CSE 291A/DSC 291 (Spring 2026) PA2 Part 2 - Tensor Parallel CommunicationUC San Diego · required

    Build all-reduce and all-to-all from point-to-point MPI calls (Section 2.1), then the data split, layer initialization and naive model-parallel forward and backward communication (Sections 2.2 to 2.5) against the provided mpi-test.py cases and pytest files. It runs on CPU processes with Open MPI and mpi4py.

  • CS336 Assignment 2 - Section 8.1 Communication PrimitivesStanford University · support

    Work alternate_ring_all_reduce and the communication-volume reasoning in Section 8.1 as a written check on your cost model.

  • TensorTonic Language Modeling from Scratch - collective problemsTensorTonic · support

    Solve Simulate Distributed Collectives, Calculate Collective Effective Bandwidth, Synchronize Data-Parallel Gradients and Reconstruct a Column-Parallel MLP Layer after the collective units.

  • GPU MODE - Collective CommunicationGPU MODE · support

    Use Lectures 17, 67, 70 and 78 for NCCL, NVSHMEM, fault-tolerant collectives and multi-GPU Triton. Implement or inspect one communication mechanism only after the volume and topology model is written.

  • DeepEPDeepSeek · depth

    Reconstruct expert dispatch and combine paths, low-latency versus high-throughput modes and hardware assumptions. Test a small supported path only after a standard collective baseline and load-skew model exist.