Splitting prefill and decode
Prefill slows decode
When prefill and decode share a GPU, a long prompt's prefill fills the GPU for a moment. Every user decoding there waits for their next token, so their ITL jumps. This is interference. Chunked prefill makes each stall smaller, but the two jobs still share one GPU.
Separate pools
Disaggregated serving runs prefill on one group of GPUs and decode on another. Each group is a pool. The prefill pool reads the prompt and makes the first token. The decode pool writes the rest of the answer. Decode users never stall behind long prompts.
Moving the KV cache
After prefill, the request's KV cache sits on the prefill GPU. It must be copied to a decode GPU before decode can start. For a long prompt this can be a few GB. So the pools need fast links: NVLink inside a machine, or InfiniBand between machines. A slow link can make users wait longer than with no split at all.
Tune each pool
Prefill is compute-bound: lots of math on many tokens at once. Decode is memory-bound: each step reads all the weights for a few new tokens. So each pool can be sized and set up on its own:
- Slow first token (TTFT): add prefill GPUs.
- Uneven or slow streaming (ITL): add decode GPUs.
- Long prompts and short answers need more prefill; short prompts and long answers need more decode.
When traffic changes, tune the split again.
When it pays off
Disaggregation helps most at scale, with many GPUs and strict latency goals. In small setups, the KV copies, idle pools and extra parts cost more than they save. Measure first, and try chunked prefill before splitting.
Remember
- Prefill on a shared GPU stalls everyone's decode.
- Disaggregation: a prefill pool and a decode pool.
- The KV cache must be copied between them over fast links.
- Size each pool for its own limit.
- Worth it at scale with strict latency goals, not for small setups.