When batching and tail latency compete for accelerator cycles, prefill and decode sit on opposite sides of the GPU Roofline model; colocating them forces long prompts to stall every streaming decode user, whereas disaggregating lets each pool scale and parallelize independently.
TL;DR30-second simplified summary▾
Core Mechanics: LLM inference splits into two physics-opposite phases: Prefill (compute-bound GEMMs over all prompt tokens, governing Time-to-First-Token TTFT) and Decode (HBM-bandwidth-bound single-token generation, governing Inter-Token Latency ITL). Colocating both on one GPU causes 16K-token prefills to freeze active decode streams.
Visual & Structural Flow: Depicts Prompt Queue -> Prefill Pool (Compute-Bound GPUs) -> RDMA / NVLink KV Transfer (KV Blocks transferred without stalling decode) -> Decode Pool (HBM-Bandwidth-Bound GPUs) running Continuous Batching (ITL < 25ms) -> SSE Client, achieving Zero Prefill-Decode Interference.
Trade-Offs & Production: Disaggregation requires high-bandwidth interconnects (InfiniBand RDMA or NVLink) so KV transfer time stays below TTFT budgets, and allows asymmetric tensor/pipeline parallelism (e.g., high TP on Prefill, high DP/batching on Decode).
Failure Modes & Application: Bound KV-transfer queues with admission backpressure and fall back to local chunked prefill if RDMA links degrade.
Prefill vs. Decode Physics & Disaggregated Pools.
Why this matters: The mechanism: understand why separating compute-bound prefill and bandwidth-bound decode unlocks strict TTFT and ITL SLOs.
In a standard colocated vLLM/TensorRT-LLM replica, a single scheduler interleaves prompt prefill and autoregressive decode on the same GPUs. Prefill processes N prompt tokens in parallel (O(N) matrix-matrix multiplications), saturating Tensor Core FLOPs. Decode generates 1 token per sequence per step, streaming model weights and KV-cache from HBM (HBM-bandwidth-bound).
Disaggregated serving (used in DistServe, Splitwise, and Mooncake) assigns dedicated Prefill GPUs to compute the initial KV-cache and first token, streams the KV-cache blocks asynchronously over RDMA / NVLink (mooncake / NIXL), and hands the sequence to Decode GPUs optimized for large continuous batches.
Prefill Pool -> RDMA KV Transfer -> Decode Pool
1.Zero Interference: Long 32K prefills never preempt or stall active decode iterations.
2.Asymmetric Tuning: Prefill uses high Tensor Parallelism (TP); Decode scales batch size + FP8 KV.
3.KV Transfer Math: Transfer bytes = 2 * layers * kv_heads * head_dim * seq_len * dtype_bytes.
Caption: Separating Prefill and Decode lets each pool optimize for its side of the GPU Roofline while RDMA transfers KV blocks asynchronously.
Why Colocation Causes Tail-Latency Collapse.
Why this matters: The problem: trace how a single 32K-token RAG prompt stalls 64 concurrent streaming users.
Think of Why Colocation Causes Tail-Latency Collapse as the intuition layer for Disaggregated LLM Serving (Prefill vs. Decode Pools): The problem: trace how a single 32K-token RAG prompt stalls 64 concurrent streaming users.
Even with chunked prefill, colocating 32K-token RAG prompts with 100-token chat streams forces a painful tug-of-war: smaller prefill chunks protect decode ITL (<25 ms) at the cost of multi-second TTFT, while larger prefill chunks violate ITL SLOs for every user currently streaming tokens on that GPU.
Why Colocation Causes Tail-Latency Collapse
- Problem
- How to implement Disaggregated LLM Serving (Prefill vs. Decode Pools) without hitting unbounded tail latency, state divergence, or operational fragility.
- Naive Solution
- Use a single unpartitioned path with unbounded retries and synchronous global coordination.
- Why It Fails
- Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
- Alternatives
- Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
- Engineering Decision
- When batching and tail latency compete for accelerator cycles, prefill and decode sit on opposite sides of the GPU Roofline model; colocating them forces long prompts to stall every streaming decode user, whereas disaggregating lets each pool scale and parallelize independently.
- Trade-Offs
- Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
When Disaggregated LLM Serving (Prefill vs. Decode Pools) experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?
Goodput vs. Raw Throughput
Measuring requests/sec that satisfy BOTH TTFT and ITL SLOs reveals colocated GPUs lose up to 40% goodput under mixed prompt lengths.
Network Bandwidth Requirement
A 70B GQA-8 model in FP8 generates ~80 KB of KV-cache per token; a 10K-token prompt transfers ~800 MB (~2 ms on 400 Gbps RDMA, ~64 ms on 100 Gbps Ethernet).
When to Disaggregate (and When Colocated Chunked Prefill Wins).
Why this matters: Scope boundary: choose disaggregation for high-QPS long-context clusters with RDMA, not single-node deployments.
Think of When to Disaggregate (and When Colocated Chunked Prefill Wins) as the intuition layer for Disaggregated LLM Serving (Prefill vs. Decode Pools): Scope boundary: choose disaggregation for high-QPS long-context clusters with RDMA, not single-node deployments.
Adopt disaggregated serving when serving long-context RAG, coding assistants, or agentic workloads across multi-node InfiniBand/RoCEv2 clusters with strict TTFT + ITL SLAs. For small single-node 8B deployments or <1K-token prompts, colocated chunked prefill avoids network KV-transfer complexity.
When to Disaggregate (and When Colocated Chunked Prefill Wins)
KV-Cache Transfer Budgeting, Layer-Wise Pipelining & Fallback.
Why this matters: Operational control: overlap KV-block transfers with layer computation and bound transfer queues.
Think of KV-Cache Transfer Budgeting, Layer-Wise Pipelining & Fallback as the intuition layer for Disaggregated LLM Serving (Prefill vs. Decode Pools): Operational control: overlap KV-block transfers with layer computation and bound transfer queues.
Overlap layer-wise KV transfer (NIXL / GPUDirect RDMA) so Layer i's KV blocks begin transferring while Prefill computes Layer i+1. Pair with prefix caching on the Prefill pool so shared system prompts are neither recomputed nor re-transferred when the Decode pool already holds those KV block hashes.
KV-Cache Transfer Budgeting, Layer-Wise Pipelining & Fallback
def estimate_kv_transfer_ms(layers: int, kv_heads: int, head_dim: int, seq_len: int, bytes_per_elem: int, link_gbps: float) -> float:
"""Compute theoretical KV-cache transfer time between Prefill and Decode pools."""
if link_gbps <= 0:
raise ValueError("Interconnect bandwidth must be positive")
total_bytes = 2 * layers * kv_heads * head_dim * seq_len * bytes_per_elem
bytes_per_sec = (link_gbps * 1e9) / 8.0
return (total_bytes / bytes_per_sec) * 1000.0
Colocated Chunked Prefill vs. Disaggregated Serving.
Why this matters: The trade-off: balance interconnect cost against independent prefill/decode autoscaling.
Think of Colocated Chunked Prefill vs. Disaggregated Serving as the intuition layer for Disaggregated LLM Serving (Prefill vs. Decode Pools): The trade-off: balance interconnect cost against independent prefill/decode autoscaling.
Colocated chunked prefill minimizes hardware fragmentation on small clusters, whereas disaggregation maximizes SLA goodput and lets you autoscale Prefill GPUs separately from Decode GPUs.
| Choice | What it buys | What it costs |
|---|---|---|
| Colocated Chunked Prefill | Zero network KV-transfer overhead; works over standard Ethernet. | Prefill and decode compete for HBM bandwidth and SM compute; mixed workloads degrade goodput. |
| Disaggregated Prefill / Decode | Zero prefill-decode interference; independent TP/batching and autoscaling per phase. | Requires high-speed RDMA/NVLink and distributed KV-block registry coordination. |
KV-Aware Router + Mooncake/NIXL Disaggregated Pool.
Why this matters: Production architecture: route prompts by prefix-cache affinity and stream KV blocks over RDMA.
Think of KV-Aware Router + Mooncake/NIXL Disaggregated Pool as the intuition layer for Disaggregated LLM Serving (Prefill vs. Decode Pools): Production architecture: route prompts by prefix-cache affinity and stream KV blocks over RDMA.
A KV-aware gateway router hashes the prompt prefix to pick a Prefill worker with warm prefix blocks, streams newly computed KV blocks via GPUDirect RDMA to an available Decode worker with free PagedAttention slots, and fails over to local chunked prefill if RDMA congestion exceeds threshold.
Disaggregated Request & KV Handoff States
Caption: Once Prefill computes the initial KV blocks and first token, RDMA pins them on a Decode worker for uninterrupted token streaming.
Related Inference & KV-Cache Problems.
Why this matters: Applied problems: connect disaggregated serving to PagedAttention and speculative decoding.
Think of Related Inference & KV-Cache Problems as the intuition layer for Disaggregated LLM Serving (Prefill vs. Decode Pools): Applied problems: connect disaggregated serving to PagedAttention and speculative decoding.
Dive deeper into virtual KV-cache paging and draft-verify speculative decoding.
Practice: Make the trade-off yourself.
Why does colocating a 32K-token RAG prompt prefill with active chat decode streams spike Inter-Token Latency (ITL)?