Separating prefill and decode can reduce resource interference, but evaluate its benefit including KV transfers and queues in both pools.
Differences between prefill and decode
Prefill processes input tokens together and creates the KV cache. Decode repeatedly reads that cache to generate output tokens. Large prefills tend to be compute intensive and small-batch decodes often face memory-bandwidth limits, but input length and batching change the bottleneck.
| Stage | Main latency measure | Resource considerations |
|---|---|---|
| Prefill | Time to first token (TTFT) | Input processing capacity, queue time |
| Decode | Time per output token (TPOT) | Batching, cache capacity, memory reads |
A long prefill on a shared GPU can delay ongoing decodes. Separating stages permits independent resource and parallelism choices. It also creates a state-transfer boundary.
Evidence for disaggregated serving
DistServe, published at OSDI 2024, separates GPUs for the two stages and selects configurations under joint TTFT and TPOT requirements. Splitwise, published at ISCA 2024, also studies phase separation based on resource differences. These papers support the design, not a universal GPU-pool ratio.
flowchart LR
R["Request"] --> P["Prefill pool"]
P --> K["KV cache transfer"]
K --> D["Decode pool"]
D --> O["Output tokens"]
DistServe reports up to 7.4× more requests than its baselines under the evaluated models, workloads, and latency requirements. A separate comparison reports up to 12.6× tighter SLOs, with over 90% of requests satisfying latency constraints. The two maxima are not simultaneous gains for one configuration.
Transfer volume and cumulative reads
A single network handoff differs from repeated GPU memory reads during decoding. The following arithmetic estimates a request's ordinary uncompressed KV tensor size. Account separately for parallel partitioning, replication, and protocol overhead.
KV bytes = 2 × layer count × KV head count × head dimension
× cached token count × bytes per element
Ideal transfer time = KV bytes / effective transfer bandwidthFor dense causal attention with prompt length (S) and (T) generation steps, the sum of repeatedly read token counts is (TS+T(T-1)/2). With model dimensions fixed, cumulative reads are (O(TS+T^2)). Here (S) is not batch size, and this expression is not the complexity of a network handoff.
| Cost | Main growth factors |
|---|---|
| One KV handoff | Cache size at transfer time, replication, and transfer path |
| Repeated decode reads | Prompt and generation lengths, concurrent requests |
| Queuing | Arrival rate, capacity of each pool, scheduling |
For MLA or quantized caches, adapt the byte calculation to the stored representation. Transfers and computation can overlap. Adding every stage duration therefore need not equal observed latency.
Cache reuse and pool load
Mooncake is a KV-cache-centered serving architecture published at FAST 2025. It combines separated prefill and decode with a cache hierarchy using CPU memory and storage resources. Its scheduler makes request placement part of the cache design.
Maximizing hits alone can queue requests at a node holding a popular prefix. Sending them to an idle node can require recomputation or transfer. The following proposed measurements expose that tradeoff.
| Measurement | Decision it informs |
|---|---|
| Queues and utilization by pool | Which stage lacks capacity |
| KV bytes and transfer time | The cost introduced by separation |
| Reuse and load by node | Whether cache benefit offsets queuing |
| TTFT and TPOT compliance | Whether both stages meet requirements |
Summary
Prefill–decode separation reduces stage interference and allows independent resource placement. Its benefit depends on transfer costs, queuing, the model, and the workload. Distinguish cumulative GPU cache reads from a single network handoff. Before adoption, compare throughput meeting both latency requirements under the same hardware budget.