Explainer
Disaggregated prefill and decode on NVIDIA GPUs
How disaggregated prefill and decode works on NVIDIA GPUs: what the KV-cache handoff costs over NVLink and RDMA, how Dynamo and NIXL move it, and when not to split.
- LLM inference
- Disaggregated serving
- NVIDIA Dynamo
- KV cache
- GPU infrastructure
Disaggregated prefill and decode splits one inference request across two groups of GPUs. One group reads the prompt and builds the key-value (KV) cache. A second group receives that cache and generates the answer token by token. The design pays off when the latency it removes is worth more than the cost of moving the cache between the two groups. On NVIDIA systems, the network topology sets that cost, and so decides whether the split is worth it.
This essay explains the trade in the order an infrastructure team meets it: why the two phases want different machines, what the handoff costs in bytes and milliseconds, how NVLink, InfiniBand, and RoCE (RDMA over Converged Ethernet, where RDMA is remote direct memory access) change that cost, and which parts of the NVIDIA stack do the work. It also covers four consequences that get too little attention:
- whether the handoff can hide behind prefill depends on one ratio that does not change with prompt length;
- grouped-query and latent attention, not serving frameworks, made the handoff cheap enough to split;
- the prefill-to-decode ratio is also a fan-in ratio, so incast decides tail latency on the network;
- a failed decode worker turns into a burst of prefill work that the prefill pool must absorb.
The worked example is Llama 3.1 70B in BF16, which has the same architecture as Llama 3 70B.
Why prefill and decode want different machines
Every request runs in two phases. Prefill processes the whole prompt at once, so the GPU runs large matrix multiplications that keep its tensor cores busy. Prefill sets the time to first token (TTFT).
Decode produces the output one token at a time. Each step reads the model weights and the growing KV cache to make one new token per request. That work moves far more bytes than it computes on, so memory bandwidth limits it. Decode sets the inter-token latency (ITL), which some tools call time per output token.
The usual summary is that prefill is compute-bound and decode is memory-bound. It is a good first approximation, not a law: large decode batches raise arithmetic intensity, short prompts make prefill cheap, and mixture-of-experts models and quantization move the balance again. Treat it as a reason to measure.
The practical problem appears when both phases share the same GPUs. A long prefill that arrives in the middle of a decode batch delays every token in that batch.
Hover a part to see its nameChunked prefill reduces the problem: it splits a long prompt into pieces and mixes them with decode steps. Disaggregation removes the interference: it puts the phases on separate workers.
What disaggregation changes, and what it does not
Each phase gets its own pool. Prefill workers can use a parallelism layout that minimizes TTFT; decode workers can use another layout and large batches that maximize tokens per second at a target ITL. The two pools scale independently.
Hover a part to see its nameDistServe (OSDI 2024) optimized for goodput, the request rate served within both the TTFT and the ITL targets. It reports up to 7.4 times more requests, or a 12.6 times tighter latency target, than the systems it compared against. Splitwise (ISCA 2024) ran the phases on different hardware: 1.4 times the throughput at 20 percent lower cost. Mooncake, the serving system behind Kimi, built its design around the KV cache as the object that moves. Each team measured its own systems, so read these as evidence that the idea works, not as a forecast for your fleet. By late 2025, the DistServe authors wrote that almost every production-grade serving framework had adopted disaggregation in some form.
Disaggregation does not raise raw throughput by itself. The vLLM documentation says so plainly: "Disaggregated prefill DOES NOT improve throughput." Its benefits are separate tuning of TTFT and ITL, and tighter control of tail ITL. The right goal is throughput at a latency target.
The handoff: how large the KV cache is
Every disaggregated request ends prefill with a KV cache that must reach a decode worker. Its size follows from the model:
\begin{aligned}
\text{KV bytes per token} &= 2 \times \text{layers} \times \text{KV heads} \\
&\quad \times \text{head dimension} \times \text{bytes per element}
\end{aligned}The 2 counts keys and values. Llama 3.1 70B has 80 layers, 8 KV heads through grouped-query attention, and a head dimension of 128. In BF16, at 2 bytes per element, that is 327,680 bytes per token, or 320 KiB; FP8 halves it. KV cache size per token shows where this formula breaks for newer models.
Hover a part to see its nameThe times below are line-rate floors with no protocol overhead, computed as in the KV essay: 450 GB/s per direction for NVLink 4 on Hopper, 50 GB/s per 400 Gb/s network interface card (NIC), and 400 GB/s for eight NICs, one per GPU.
| Prompt tokens | KV cache, BF16 | NVLink 4 | 1 x 400G | 8 x 400G |
|---|---|---|---|---|
| 2,048 | 0.625 GiB | 1.5 ms | 13 ms | 1.7 ms |
| 8,192 | 2.5 GiB | 6.0 ms | 54 ms | 6.7 ms |
| 32,768 | 10 GiB | 24 ms | 215 ms | 27 ms |
| 128,000 | 39.1 GiB | 93 ms | 839 ms | 105 ms |
A DGX B200 has eight ConnectX-7 NICs at 400 Gb/s. Blackwell's NVLink 5 gives each GPU 1.8 TB/s, about 900 GB/s each way: about 3 ms for the 8,192-token cache. Mooncake cites about 40 GB for 128k tokens on Llama 3 70B, which matches the last row. The KV cache calculator computes these rows for any model, context, and link.
Measurements agree. The Mooncake Transfer Engine reports up to 87 GB/s over four 200 Gb/s RoCE links and up to 190 GB/s over eight 400 Gb/s links. In an older DistServe example, one 512-token request on OPT-66B carries about 1.13 GB, so ten per second need about 90 Gb/s.
Against a TTFT budget of a few hundred milliseconds, 6 to 7 ms is small; 54 ms, or 215 ms for 32,768 tokens over one NIC, is not. Under load, many requests share the same links. Three techniques shrink the visible cost. An FP8 cache halves the bytes. Layer-wise transfer sends each layer's cache while prefill computes the next; Splitwise reports about 5 ms left without overlap on H100. Larger blocks help: Dynamo's tuning guide suggests 128 tokens for dense models, because small blocks make small transfer chunks.
A ratio that does not depend on prompt length
Can the handoff hide completely behind prefill? The answer is a property of the model and the hardware, not of the prompt. Both costs grow with the number of prompt tokens, : prefill does roughly 2 floating-point operations per parameter per token, and the handoff moves a fixed number of KV bytes per token. Divide one by the other and cancels out:
\begin{aligned}
\text{prefill time} &\approx n \times \frac{2 \times \text{parameters}}{\text{effective FLOPS}} \\
\text{handoff time} &= n \times \frac{\text{KV bytes per token}}{\text{bandwidth}} \\
\frac{\text{handoff time}}{\text{prefill time}} &\approx \frac{\text{KV bytes per token} \times \text{effective FLOPS}}{2 \times \text{parameters} \times \text{bandwidth}}
\end{aligned}Attention adds work that grows faster than linearly for long prompts, which only makes prefill slower and the ratio more favorable.
Take public specifications: eight H100 GPUs at 989 dense BF16 TFLOPS each. I assume 50 percent model FLOPS utilization. Prefill of Llama 3.1 70B then runs at about 28,000 tokens per second: 292 ms for 8,192 tokens. With a BF16 cache, the transfer takes about 2 percent of prefill time over eight 400 Gb/s NICs, and about 18 percent over one. For DeepSeek-V3 over eight NICs it is about 1 percent. That counts only its activated parameters, about 37 billion, because a mixture-of-experts model computes with only those. Its FP8 weights, about 671 GB, do not fit in eight 80 GB H100s; eight H200s hold them with the same compute per GPU, so the ratio does not change.
Hover a part to see its nameBelow 100 percent, layer-wise transfer can in principle finish inside prefill and add almost nothing to TTFT. A team then needs one number per model and hardware pair, not a budget per prompt length, plus a check that the transfer is pipelined. This analysis is mine; it ignores queueing and protocol overhead.
Attention design made disaggregation practical
The same arithmetic shows why disaggregation arrived when it did: KV bytes per token depend on how the model stores attention, and that design changed. The table gives the handoff of 8,192 tokens over one 400 Gb/s NIC, and the ratio above for that NIC.
| Design | Example | Bytes per token, BF16 | 8,192 tokens | Handoff / prefill |
|---|---|---|---|---|
| Multi-head (MHA) | 70B-class, 64 KV heads | 2,621,440 (2.5 MiB) | 430 ms | 147% |
| Grouped-query (GQA) | Llama 3.1 70B, 8 KV heads | 327,680 (320 KiB) | 54 ms | 18% |
| Multi-head latent (MLA) | DeepSeek-V3 | 70,272 (69 KiB) | 11.5 ms | 7.5% |
GQA is 8 times smaller than MHA, and MLA 37 times. The MHA row is hypothetical: Llama 3.1 70B with a KV head for each of its 64 query heads. At 147 percent the transfer can never hide behind compute. DeepSeek-V3 stores one compressed row of 576 values per layer across 61 layers, and its ratio counts its activated parameters.
Hover a part to see its nameThe papers and frameworks of 2024 and 2025 did not make disaggregation cheap on their own: model architects had already shrunk the object that moves. To evaluate a new model, start with KV bytes per token, which compares twelve model types side by side. For many models released since 2024, the formula above is only the first answer.
Topology sets the price: NVLink, NVL72, InfiniBand, and RoCE
There are two very different places to put the cut. Inside an NVLink domain, GPUs read and write each other's memory at NVLink speed. In an HGX or DGX server, the domain is the eight GPUs in the box. A GB200 NVL72 rack joins 72 Blackwell GPUs in one domain with 130 TB/s of aggregate bandwidth, so prefill and decode groups in one rack hand off at NVLink speed, even across trays. That is the main reason rack-scale NVLink matters here.
Outside the domain, the handoff crosses the scale-out network, usually InfiniBand or RoCE through ConnectX NICs. GPUDirect RDMA lets the NIC read the cache straight from GPU memory, with no copy through host memory. It works only when drivers and memory registration are right, and when the GPU and the NIC share the same upstream PCIe root complex, which NVIDIA's documentation requires. Without RDMA, the transfer falls back to TCP; the last section shows the cost.
Hover a part to see its nameDistServe's placement makes the same point: with a fast cross-node network it places instances freely, and without one it keeps each prefill instance and its decode instance on one node, on NVLink. The topology decides the architecture as well as the speed.
Disaggregation also creates incast, a pattern that scale-out networks handle poorly. With several prefill workers per decode worker, several can finish at once and push their caches to the same decode node. Four 8,192-token caches carry about 10.7 GB; even across eight 400 Gb/s NICs, that burst occupies the links for about 27 ms, and later arrivals queue.
Hover a part to see its nameSo the prefill-to-decode ratio is also a fan-in ratio. On RoCE, congestion control, explicit congestion notification (ECN) marking, and priority flow control (PFC) pause behavior decide the tail latency. InfiniBand's credit-based flow control behaves differently but still queues. Size the fabric for the burst at the decode NIC, not for the cluster's average. Spreading handoffs across decode workers in the router helps as much as more bandwidth. Inside an NVL72 rack, the NVLink switch fabric absorbs the fan-in. In practice:
- Measure the bandwidth your application achieves, not the switch's line rate.
- Check that each GPU uses the NIC closest to it on the PCIe tree; a mismatch forces traffic through a slower path.
- Treat InfiniBand and RoCE as configurations to measure: achieved bandwidth, congestion behavior, and tail latency matter more than the fabric's name.
Who does what in the NVIDIA stack
From the top down:
- Dynamo: orchestration and routing. An open-source distributed serving framework above the engines; it does not run the model. Its KV-aware router sends each request to the worker that will recompute the least. Its Planner scales the prefill pool on queued tokens and the decode pool on KV-cache use, against TTFT and ITL targets. Its KV Block Manager offloads blocks to host memory, local disk, and object storage.
- Engines: TensorRT-LLM, vLLM, and SGLang. The engine runs the model on each worker; Dynamo supports all three.
- KV connectors. The engine hands the finished cache to a connector. vLLM's include
NixlConnector,LMCacheConnectorV1, andMooncakeConnector; withNixlConnector, the decode worker pulls the blocks from the prefill worker over RDMA after a short handshake. SGLang offers Mooncake and NIXL as transfer engines; TensorRT-LLM uses NIXL over UCX by default. - NIXL, the transfer library. The NVIDIA Inference Xfer Library is "targeted for accelerating point to point communications in AI inference frameworks." It gives one interface over GPU memory, CPU memory, and storage through plugins such as UCX, GPUDirect Storage, and libfabric, and picks a backend from the source and destination memory types.
- Transport and hardware. NVLink, or InfiniBand or RoCE with GPUDirect RDMA. On NVL72 racks, SGLang's Mooncake engine can also use multi-node NVLink.
Hover a part to see its nameIn vLLM, a minimal split is two engines and a proxy. This example follows the multi-instance setup in the NixlConnector usage guide for vLLM v0.31.0 (opens in a new tab). The guide uses Qwen/Qwen3-0.6B; this example swaps in Llama 3.1 70B and keeps every other setting.
# vLLM v0.31.0. Prefill engine on machine A: it produces KV caches.
VLLM_NIXL_SIDE_CHANNEL_HOST=${IP_A} \
VLLM_NIXL_SIDE_CHANNEL_PORT=5600 \
UCX_NET_DEVICES=all \
vllm serve meta-llama/Llama-3.1-70B-Instruct --port 8000 \
--tensor-parallel-size 8 \
--kv-transfer-config '{
"kv_connector": "NixlConnector",
"kv_role": "kv_producer",
"kv_load_failure_policy": "fail"
}'
# Decode engine on machine B: it reads the KV caches over RDMA.
VLLM_NIXL_SIDE_CHANNEL_HOST=${IP_B} \
VLLM_NIXL_SIDE_CHANNEL_PORT=5600 \
UCX_NET_DEVICES=all \
vllm serve meta-llama/Llama-3.1-70B-Instruct --port 8000 \
--tensor-parallel-size 8 \
--kv-transfer-config '{
"kv_connector": "NixlConnector",
"kv_role": "kv_consumer",
"kv_load_failure_policy": "fail"
}'
# Test proxy from the vLLM repository: prefill first, then decode.
python tests/v1/kv_connector/nixl_integration/toy_proxy_server.py \
--port 8192 \
--prefiller-hosts ${IP_A} --prefiller-ports 8000 \
--decoder-hosts ${IP_B} --decoder-ports 8000The side-channel port carries the NIXL handshake. The policy fail fails a request whose cache does not load, instead of prefilling it again on the decode engine. In production, a router such as Dynamo's replaces the test proxy.
One constraint runs through every layer: Dynamo requires prefill and decode workers to use the same model, data type, block size, and KV layout, because decode reads the blocks exactly as prefill wrote them. In short, NIXL picks a transport for each move, and Dynamo coordinates the engines that run the model.
Routing, prefix reuse, and multi-turn conversations
On a conversation's next turn, the most useful cache is on the decode worker. A naive design recomputes that history on a prefill worker.
Hover a part to see its nameA router that knows where prefixes live can send a request to its cache, or move only the missing part. vLLM v0.31.0 adds the second option to NixlConnector: with bidirectional_kv_xfer set and a stateful proxy, the prefill worker pulls the earlier turns' blocks from the decode worker over RDMA and computes only the new tokens.
Hover a part to see its nameMeasure the prefix-cache hit rate before and after any change to routing: a split that destroys cache locality can lose more than it gains.
Sizing the prefill and decode pools
There is no universal ratio between prefill and decode workers. Long prompts need more prefill capacity, and long answers more decode capacity. Arrival rate and burstiness set each pool's headroom. A strict TTFT target needs spare prefill capacity; a strict ITL target limits decode batch size.
Memory also bounds a decode pool, because a decode worker holds each request's cache until its answer ends. Take an eight-GPU H100 server that serves Llama 3.1 70B in BF16 with tensor parallelism of 8: each GPU holds one eighth of the weights, 16.4 GiB, and one of the 8 KV heads of each request. With vLLM's default memory share, 0.92 in v0.31.0, the server holds at most 181 requests of 8,192 tokens at once, or 45 of 32,768 tokens, before activations and CUDA graph buffers.
Hover a part to see its nameEach pool can use its own parallelism: prefill often gains from more tensor parallelism, decode from more replicas with large batches. Check that the engine and connector support your model architecture, KV-cache data type, and block size. Traffic shifts during the day, so a planner that moves workers between pools beats a fixed ratio.
Failure: a lost decode worker becomes a prefill storm
When a decode worker fails, every request it served must fail or return to the prefill pool and rebuild its cache from the prompt and the tokens generated so far.
Hover a part to see its nameThat traffic lands at once on a pool sized for normal arrivals. A decode worker with 300 conversations of 8,192 tokens holds about 2.5 million tokens of context: at the prefill rate estimated above, close to 90 seconds of work for one prefill worker. New requests miss their TTFT targets while the backlog clears. Offloading KV blocks to host memory or storage, as Dynamo's KV Block Manager can, gives a copy to restore instead of recomputing. Either way, size prefill headroom for steady traffic plus the largest decode worker you can lose. A planner that scales down without draining in-flight requests causes the same storm on purpose; check how yours retires a worker.
How to benchmark disaggregated serving
Compare disaggregated serving against a well-tuned aggregated baseline with chunked prefill, on the same hardware and the same traffic.
Hover a part to see its nameReport at least:
- TTFT and ITL at p50, p95, and p99.
- Goodput: the request rate served within both latency targets.
- Achieved KV-transfer bandwidth in GB/s, and transfer time per request.
- Queueing delay and GPU utilization in each pool.
- Prefix-cache hit rate.
Use a realistic mix of prompt and output lengths. One fixed prompt length hides the case where disaggregation matters most: a long prompt that arrives while many short conversations are decoding.
What the published numbers say
The headline results come mostly from vendors, and each depends on its conditions. Read them as upper bounds on favorable workloads.
| Source | Model and hardware | Conditions | Reported gain | Basis |
|---|---|---|---|---|
| NVIDIA, Dynamo launch, March 2025 | DeepSeek-R1 on GB200 NVL72 | TensorRT-LLM, FP4 weights, 32K input, 8K output tokens | Up to 30 times more requests | Vendor result |
| NVIDIA, Dynamo launch, March 2025 | Llama 70B on Hopper | vLLM, FP8, 3K input, 50 output tokens | More than twice the throughput | Vendor result |
| NVIDIA blog, June 2025 | DeepSeek-R1 on GB200 NVL72 | Simulated, not measured | Up to 6 times the throughput | GPU performance simulator |
| TensorRT-LLM team | DeepSeek-R1 on GB200 | 4,400 input, 1,200 output tokens | 1.4 to 1.8 times, more with multi-token prediction | Vendor result |
| SemiAnalysis | DeepSeek-R1 in FP4, GB200 NVL72 vs B200 | Dynamo and TensorRT-LLM, 125 tokens per second per user | 4.39 times the throughput per GPU | Independent measurement |
SemiAnalysis attributes its result largely to the larger NVLink domain. The pattern is consistent: the largest gains come with long prompts, large mixture-of-experts models, and a big NVLink domain, exactly where the handoff is cheap and the interference is expensive.
When not to disaggregate
Treat disaggregation as an option to measure. NVIDIA's Dynamo documentation puts it directly: "For small models, short prompts, low concurrency, or clusters without a fast KV-transfer fabric, an aggregated deployment is simpler and often faster." Keep an aggregated deployment when:
- Prompts are short, so prefill rarely disrupts decode. Dynamo's tuning guide notes that prefill runs inefficiently below roughly 1,000 input tokens.
- Load is low, so there is little interference to remove.
- Chunked prefill already keeps tail ITL inside your target.
- The handoff must cross a slow or poorly configured network.
- The team cannot yet operate two pools, a router, and a transfer path, and debug failures across all of them.
The network case is the sharpest. Dynamo's RDMA guide says that TCP over Ethernet is 200 to 500 times slower for this transfer: roughly 98 s to first token on TCP against 200 to 500 ms with RDMA.
Hover a part to see its nameDisaggregated serving is worth it when moving the KV cache costs less than letting prefill and decode interfere with each other. On NVIDIA hardware, the topology sets the price of that move.
Questions engineers ask
What is the difference between prefill and decode?
Prefill processes the whole prompt in one parallel pass and builds the KV cache; it sets the time to first token. Decode then generates the output one token at a time from that cache; it sets the time between tokens.
Is disaggregated inference the same as disaggregated serving?
In practice, yes: both mean prefill and decode on separate workers, with the KV cache moved between them. Papers often call it P/D disaggregation.
Does disaggregation need InfiniBand?
No. It needs a fast path for the KV cache: NVLink inside a server or an NVL72 rack, and InfiniBand or RoCE with GPUDirect RDMA across racks. What matters is the bandwidth you achieve and how stable it is under load.
Is chunked prefill an alternative?
Yes. It keeps both phases on the same GPUs and interleaves them, is simpler to operate, and is often good enough. Disaggregation isolates tail latency better, at the cost of a transfer path and a second pool.
References
- vLLM, Disaggregated prefilling (opens in a new tab), v0.31.0.
- NVIDIA, Dynamo disaggregated serving (opens in a new tab).
- NVIDIA, Dynamo RDMA setup (opens in a new tab), v1.5.1.
- NVIDIA, NIXL repository (opens in a new tab), v1.5.0.
- NVIDIA, GB200 NVL72 (opens in a new tab).
- Zhong et al., DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving (opens in a new tab), OSDI 2024.
- Patel et al., Splitwise: Efficient Generative LLM Inference Using Phase Splitting (opens in a new tab), ISCA 2024.
- Qin et al., Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving (opens in a new tab).
- Meta, The Llama 3 Herd of Models (opens in a new tab), for the Llama 3 70B architecture, and a public copy of the Llama 3.1 70B configuration (opens in a new tab), for its 70,553,706,496 parameters.
- DeepSeek-AI, DeepSeek-V3 Technical Report (opens in a new tab), and the model configuration (opens in a new tab), for multi-head latent attention.
- NVIDIA, H100 specifications (opens in a new tab), for the BF16 Tensor Core rate.
- NVIDIA, Dynamo Planner (opens in a new tab), v1.5.1, including its note on scale-down without draining.
- Agrawal et al., Sarathi-Serve: Taming Throughput-Latency Tradeoff in LLM Inference (opens in a new tab), on chunked prefill.
- Hao AI Lab, DistServe retrospective (opens in a new tab).
- Mooncake, Transfer Engine and project README (opens in a new tab).
- NVIDIA, Introducing NVIDIA Dynamo (opens in a new tab).
- NVIDIA, Dynamo disaggregated serving on Kubernetes (opens in a new tab), v1.5.1, for the quote on aggregated deployments and for matching model, data type, block size, and KV layout.
- NVIDIA, Dynamo performance tuning: v1.0.0 (opens in a new tab), on prefill below 1,000 input tokens, and v1.5.1 (opens in a new tab), on 128-token KV blocks.
- NVIDIA, How GB200 NVL72 and Dynamo boost inference performance for MoE models (opens in a new tab).
- NVIDIA, Disaggregated serving in TensorRT-LLM (opens in a new tab).
- NVIDIA, GPUDirect RDMA (opens in a new tab).
- vLLM, NixlConnector usage (opens in a new tab), v0.31.0, for the launch example and bidirectional KV transfer.
- vLLM, cache configuration (opens in a new tab), v0.31.0, for the
gpu_memory_utilizationdefault of 0.92. - SGLang, PD disaggregation (opens in a new tab), v0.5.21.
- SemiAnalysis, GB200 NVL72 vs B200 disaggregated DeepSeek-R1 FP4 (opens in a new tab).