Why colocated prefill and decode interfere under mixed traffic
As covered in prefill vs. decode, the two phases of autoregressive serving want opposite hardware regimes. Prefill is compute-bound: it multiplies dense weight tiles against thousands of prompt tokens simultaneously and saturates Tensor Cores. Decode is memory-bandwidth-bound: each active request contributes one token per step, so latency tracks how fast HBM streams model weights and cached keys and values.
| Dimension | Prefill worker pool | Decode worker pool |
|---|---|---|
| Primary metric | Time to first token (TTFT) | Time per output token (TPOT) / ITL |
| Dominant hardware resource | Tensor Core FLOPs | HBM capacity and memory bandwidth |
| Batching goal | High token throughput per forward pass | Large concurrent sequence batch within TPOT budget |
| Parallelism preference | Smaller TP or pipeline/data scaling when compute-saturated | Wider TP or high-HBM GPUs to hold large KV pools and lower TPOT |
Chunked prefill softens stalls inside a single replica by slicing long prompts into fixed token budgets, yet colocated replicas still couple prefill and decode parallelism, GPU SKU choice, and autoscaling ratios. DistServe and Splitwise showed that placing prefill and decode on dedicated GPU pools raises goodput—requests meeting both TTFT and TPOT targets per GPU.
Dedicated prefill and decode pools connected by KV transfer
- KV-aware routePick worker balancing prefix cache hit against queue wait
- Parallel prompt passSaturate Tensor Cores on uncached suffix tokens
- Emit KV blocks + token 1Transfer layer KV blocks over NIXL / RDMA / NVLink
- Reserve paged blocksAllocate destination KV slots before pulling state
- Join continuous batchProtected from long-prompt compute spikes
- Stream output tokensSteady inter-token latency until stop condition
Size the KV-cache transfer bottleneck before disaggregating
Disaggregation is not free: once a prefill worker processes a prompt, every layer’s key and value blocks must move to the chosen decode worker before token 2 can generate (unless hidden behind pipelined layer-wise transfer). Use this script to calculate transfer time across interconnects for an illustrative 70B GQA checkpoint.
# Illustrative 80-layer GQA model (8 KV heads, head_dim 128) at 8,192 prompt tokens.
layers, kv_heads, head_dim, tokens = 80, 8, 128, 8192
links_gb_s = {
"100 GbE TCP/RDMA (12.5 GB/s peak)": 12.5,
"400 Gb/s RoCE/IB (50.0 GB/s peak)": 50.0,
"Intra-node NVLink (450.0 GB/s peak)": 450.0,
}
for label, bytes_per_elem in (("BF16 KV", 2), ("FP8 KV", 1)):
kv_bytes = 2 * layers * kv_heads * head_dim * tokens * bytes_per_elem
print(f"{label}: {kv_bytes / 2**30:.2f} GiB ({kv_bytes / 2**20:.0f} MiB)")
for link, peak_gb_s in links_gb_s.items():
effective_bytes_s = peak_gb_s * 1e9 * 0.80 # 80% effective link utilization
transfer_ms = (kv_bytes / effective_bytes_s) * 1000
print(f" {link:<35} -> {transfer_ms:6.1f} ms")
BF16 KV: 2.50 GiB (2560 MiB)
100 GbE TCP/RDMA (12.5 GB/s peak) -> 268.4 ms
400 Gb/s RoCE/IB (50.0 GB/s peak) -> 67.1 ms
Intra-node NVLink (450.0 GB/s peak) -> 7.5 ms
FP8 KV: 1.25 GiB (1280 MiB)
100 GbE TCP/RDMA (12.5 GB/s peak) -> 134.2 ms
400 Gb/s RoCE/IB (50.0 GB/s peak) -> 33.6 ms
Intra-node NVLink (450.0 GB/s peak) -> 3.7 msMoving 2.50 GiB over a 100 GbE link adds more than a quarter second per 8K request unless layers stream asynchronously during prefill. High-throughput disaggregation relies on zero-copy GPU-to-GPU transports such as NVIDIA NIXL, GPUDirect RDMA, or intra-node NVLink, paired with quantized KV transfers or prefix caching so cached blocks are never recomputed or resent. Compare single-replica compute vs bandwidth bottlenecks first in our roofline latency calculator.
How KV-aware routers trade prefix overlap against queue load
Round-robin and least-connections load balancers ignore where cached prompt prefixes already live. Across eight replicas, random routing cuts an achievable 95% multi-turn or shared-agent prefix hit rate down near 1 / 8 unless every replica duplicates the same blocks in VRAM.
A KV-aware router—such as the distributed router in NVIDIA Dynamo, vLLM disaggregated prefill, or SGLang PD disaggregation—scores each candidate worker by combining cached prefix token overlap (saved prefill compute) with active queue/decode load (avoiding hot spots):
- High overlap, moderate queue: Route to the warm worker when skipping thousands of prefill tokens saves more time than waiting behind its short queue.
- Popular shared system prompt under burst load: Spill excess traffic onto a second worker once queue wait exceeds the cost of computing the prefix fresh, naturally replicating hot prefixes only when demand justifies it.
- Prefix eviction awareness: Keep the router synchronized with worker block-eviction events or periodic radix-tree digests so stale cache hints do not misroute requests.
When disaggregated serving pays off—and when to stay colocated
- Stay colocated with chunked prefill first when running one or two nodes, short prompts (
< 1,024tokens), or commodity Ethernet without RDMA. - Add KV-aware routing before splitting pools whenever multi-turn chat, RAG templates, or tool schemas share long prefixes across replicas.
- Adopt disaggregated prefill and decode when long-prompt spikes break strict streaming ITL/TPOT SLOs, or when large MoE models benefit from narrow-TP prefill nodes feeding wide-EP decode pools.
- Design the full distributed stack. Start with our free What is NVIDIA Dynamo? unit, then build KV routing, NIXL transfers, and Kubernetes scaling in the NVIDIA Dynamo course.
Disaggregated serving and KV routing FAQ
Does disaggregated serving improve single-request latency on an idle cluster?
Usually no—an idle colocated replica has zero queue interference and avoids cross-worker KV transfer. Disaggregation improves tail TTFT, steady ITL, and cluster goodput under concurrent mixed-length load.
Should prefill push KV blocks to decode or let decode pull them?
Both patterns exist in NIXL and engine connectors: decode-initiated RDMA reads let the decode scheduler allocate destination paged blocks just before pulling, avoiding buffer exhaustion on bursty arrivals.
What ratio of prefill GPUs to decode GPUs should I deploy?
Size the ratio from workload arrival rates: long-input summarization or RAG workloads need more prefill FLOPs, whereas long-output reasoning models need a larger decode pool to hold active KV caches.
Sources and further reading
Primary documentation and research behind this guide.
- DistServe: Disaggregating Prefill and Decoding for Goodput-optimized LLM Serving (2024)
- Splitwise: Efficient Generative LLM Inference Using Phase Splitting (2024)
- NVIDIA Dynamo distributed inference framework
- NVIDIA Inference Xfer Library (NIXL)
- vLLM v0.30.0: Disaggregated prefill
- SGLang: Prefill-decode disaggregation
