Skip to main content
← CONCEPTS / AI & MACHINE LEARNING SYSTEMS
An end-to-end domain learning journey

Disaggregated LLM Serving (Prefill
vs. Decode Pools).

Disaggregated LLM serving separates prompt prefill (compute-bound TTFT) and autoregressive token decode (HBM-bandwidth-bound ITL) onto independent GPU pools, transferring computed KV-cache blocks over RDMA or NVLink without stalling in-flight decode batches.
Start the journey7 sections· Last modified Nov 21, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

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.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Model Serving & GPU Batching
Group concurrent inference requests into tensor batches on the GPU to shift workloads from memory-bandwidth-bound to compute-bound without blowing tail latency.
LLM Quantization, GPTQ/AWQ & Inference Performance
LLM quantization compresses 16-bit model weights and KV caches into 8-bit or 4-bit representations (FP8, AWQ, GPTQ, GGUF) to slash VRAM usage by 2-4x and accelerate memory-bandwidth-bound token generation.
Transformer Attention
Self-attention lets every token dynamically weight and aggregate information from all other tokens in a sequence in parallel, replacing sequential recurrent bottlenecks with matrix multiplications over Query, Key, and Value projections.
Full walkthrough · 7 stages
01
STAGE 01 · THE MECHANISML5 · APPLIED DESIGN

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.

Disaggregated Serving Path

Prefill Pool -> RDMA KV Transfer -> Decode Pool

Prompt QueueRoute by prompt lenPrefill PoolCompute-bound TTFTRDMA KV BridgeAsync block transferDecode PoolContinuous batch ITL

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.

02
STAGE 02 · THE PROBLEML5 · APPLIED DESIGN

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.

Request & State Flow

Why Colocation Causes Tail-Latency Collapse

User / AgentModel RouterVector / PrefixCacheGPU InferenceWorker1. Submit prompt + ACL context2. Fetch KV prefix / hybrid RAGchunks3. Prefill & continuous-batcheddecode4. Stream tokens via SSE +guardrails
Engineering Decision Framework
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.
Decision Exercise · Make the Call

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).

03
STAGE 03 · WHERE IT IS USEDL5 · APPLIED DESIGN

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.

Lifecycle & Failure Recovery

When to Disaggregate (and When Colocated Chunked Prefill Wins)

KV blocks allocatedtoken sampledVRAM > 90%Prefill(Compute-Bound)Decode (Memory-BW)SSE StreamingKV Cache Pressure
04
STAGE 04 · HOW IT IS MANAGEDL6 · SCALE & TRADE-OFFS

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.

Component Topology

KV-Cache Transfer Budgeting, Layer-Wise Pipelining & Fallback

Caller / AgentingressLLM GatewaycomputeRadix / VectorstorageGPU Poolcontrolpromptprefix / RAGbatched decode
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
05
STAGE 05 · THE TRADE-OFFL6 · SCALE & TRADE-OFFS

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.

ChoiceWhat it buysWhat it costs
Colocated Chunked PrefillZero network KV-transfer overhead; works over standard Ethernet.Prefill and decode compete for HBM bandwidth and SM compute; mixed workloads degrade goodput.
Disaggregated Prefill / DecodeZero prefill-decode interference; independent TP/batching and autoscaling per phase.Requires high-speed RDMA/NVLink and distributed KV-block registry coordination.
06
STAGE 06 · PRODUCTION ARCHITECTUREL7 · STAFF / PRINCIPAL

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.

Request Lifecycle

Disaggregated Request & KV Handoff States

First token + KV readyBlocks pinned in DecodeNext turn (prefix hit)PREFILLINGCompute-bound SMsKV_TRANSFERRDMA / NVLinkDECODINGSSE token stream

Caption: Once Prefill computes the initial KV blocks and first token, RDMA pins them on a Decode worker for uninterrupted token streaming.

07
STAGE 07 · APPLIED PROBLEMSL7 · STAFF / PRINCIPAL

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 · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why does colocating a 32K-token RAG prompt prefill with active chat decode streams spike Inter-Token Latency (ITL)?

Recommended Learning Flow