Prefill-Decode Asymmetry in LLM Inference: How to Reduce Inference Costs
This article explains why the Prefill and Decode stages of large language model inference have different compute and memory bottlenecks, and how splitting them across separate node pools (PD disaggregation) can improve hardware utilization. It covers the KV cache transfer costs that come with this design, the workloads where it makes sense, ways to reduce transfer overhead, and practical deployment steps such as stage-specific resource allocation, session-aware routing, and load testing before rollout.
1. What Prefill and Decode Do
LLM inference runs in two steps. The Prefill stage processes the entire user prompt at once, and the Decode stage generates output tokens one at a time. The two stages do very different work, so understanding this difference is the starting point for any discussion of cost.
During Prefill, the model completes two tasks:
- It computes the Key and Value for every token in the prompt and stores them in the KV cache. Later generation steps reuse these values instead of recomputing them.
- It passes the hidden state of the last token through the LM head to predict the first output token.
One point is easy to confuse. Prefill must pass all tokens through the attention and MLP layers, because the Key and Value at layer l depend on the output of layer l-1. The MLP computation for all tokens is therefore a required step for building the KV cache, not wasted work. The LM head is different. It only needs the result for the last token. Mainstream inference frameworks typically compute logits only for the final token during Prefill and skip the vocabulary projection for earlier tokens.
The core of PD asymmetry is not that some computation is wasted. The two stages have different workloads and different bottlenecks.
2. Hardware Bottlenecks of the Two Stages
Prefill is compute-bound. When the model processes several thousand tokens at once, large matrix multiplications can fully use the GPU’s compute capacity, and memory bandwidth pressure is relatively low.
Decode is memory-bound. To generate each token, the GPU must read all model weights and the accumulated KV cache. The longer the context, the larger the KV cache, and the more data each step reads. In this stage, GPU compute often sits idle, and the bottleneck is memory bandwidth.
| Dimension | Prefill | Decode |
|---|---|---|
| Main bottleneck | Compute (FLOPS) | Memory bandwidth |
| Tokens processed per step | The entire prompt, up to thousands of tokens | One token per request per step |
| Main metric affected | Time to first token (TTFT) | Time per output token (TPOT) |
| Better-matched hardware traits | High compute | Large memory capacity and high bandwidth |
If both stages run on the same GPU with the same scheduling policy, resources mismatch. Bandwidth sits idle during Prefill, and compute sits idle during Decode. A long Prefill request also occupies compute resources and slows the Decode requests in the same batch, which causes output stutter. This mismatch is the direct reason for the architectural shift.
3. PD Disaggregation: Benefits and Trade-offs
PD disaggregation deploys Prefill and Decode on two separate node pools. Prefill nodes process the prompt, build the KV cache, and compute the first token. They then send the KV cache to Decode nodes, which complete the rest of the generation.
Separation brings three main benefits:
- Each node type can use hardware and batching strategies suited to its bottleneck, which raises overall hardware utilization.
- Long-prompt Prefill no longer blocks Decode requests that are already generating, so output is smoother.
- Each node pool can scale independently, which gives more room to adjust when the traffic mix changes.
The cost centers on KV cache transfer between nodes. Take a common 70B-class model with 80 layers, 8 KV heads, 128 dimensions per head, and FP16 precision. With these parameters, the KV cache is about 320 KB per token, and about 1.25 GB for 4,096 tokens. On a 10 Gbps network (about 1.25 GB/s), one transfer takes about 1 second. That can exceed the Prefill time of the request itself, which noticeably worsens time to first token. Even on a 100 Gbps network, transferring the same amount of data takes about 0.1 seconds. That is still a significant overhead for short requests.
Common ways to reduce transfer overhead include:
- Using high-speed interconnects such as RDMA or InfiniBand to shorten transfer time.
- Layer-by-layer transfer: Prefill starts sending each layer’s KV cache as soon as that layer finishes, so transfer overlaps with the computation of later layers.
- Quantizing the KV cache, for example from FP16 to FP8, which halves its size. Validate the accuracy impact on your own business evaluation set.
- Enabling prefix caching: KV cache for a shared system prompt can be reused, which avoids repeated computation and repeated transfer.
PD disaggregation does not suit every scenario. Be especially careful in these cases:
- With short prompts (a few hundred tokens), transfer overhead takes a large share of the time. The benefit of separation may be small or even negative.
- At low concurrency, splitting node pools often leaves capacity idle, so total cost does not necessarily go down.
- System complexity increases. You need a dedicated scheduler, KV cache management, and failure retry mechanisms.
Multimodal workloads involve similar trade-offs. Images are encoded into many visual tokens. These tokens also go through Prefill and are written to the KV cache, which makes Prefill much heavier. Visual encoding results can be cached by a hash of the image content, so repeated questions about the same image skip the encoding step.
4. Deployment Recommendations
Allocate resources by stage. On a container platform, create separate Deployments for Prefill and Decode. Give the Prefill side GPUs with stronger compute, and give the Decode side instances with larger memory and higher bandwidth. Set GPU and memory quotas for each. At launch, observe whether TTFT or TPOT exceeds its target first, then adjust the ratio between the two node types.
Make the gateway routing aware of request state. New requests with long prompts should go to the Prefill pool. Continuation requests need to carry a KV cache identifier and must be forwarded to the Decode node that holds the matching cache. Confirm that your load balancer supports session affinity. Otherwise, continuation requests land on other nodes and trigger a new Prefill, which cancels out the benefit of separation.
Use stage-specific scaling metrics. Scale the Prefill pool based on the length of the waiting queue. Scale the Decode pool based on memory usage and tokens generated per second. Set scaling thresholds from load test results rather than copying values from other teams.
Run load tests before launch. Test with the input and output length distribution from your real traffic. Record TTFT, TPOT, KV cache transfer time, and cost per thousand tokens. Invest in the refactor only if these numbers show that separation is clearly more cost-effective.
5. Conclusion
PD asymmetry comes from the nature of autoregressive inference. Prefill processes the whole input, and Decode generates the output one token at a time, so the two stages have different bottlenecks. PD disaggregation improves hardware utilization, but it requires paying the cost of KV cache transfer. Three conditions mainly determine whether it is worth adopting: prompt length, concurrency scale, and network bandwidth. Start with load testing on real traffic before deciding whether to invest in the architecture change.
