LLM Inference Architecture Evolution: Why PD Disaggregation Matters and How to Implement It

    This article explains why disaggregating the prefill and decode stages has become a key trend in large language model (LLM) inference architecture. It covers the two-phase nature of autoregressive decoding, the structural bottlenecks of mixed deployment, how PD disaggregation separates the two stages into independent pipelines, and the engineering practices required to make it work. Readers will learn how to use stage-level metrics to identify bottlenecks and tune TTFT and TPOT independently.

    1. The Starting Point: The Two-Phase Nature of Autoregressive Decoding

    Most mainstream LLM inference systems use a decoder-only autoregressive structure. The model predicts one token at a time based on the existing context, appends the new token back to the context, and repeats until a stop condition is met. This token-by-token process naturally splits a single inference request into two phases with fundamentally different computational characteristics:

    • Prefill phase: The entire user prompt is fed into the model at once. All input tokens are processed in a single parallel forward pass, the first output token is produced, and the key (K) and value (V) tensors required for attention at each layer are written to a cache for reuse.
    • Decode phase: Using the cache and tokens produced in the previous step, the model computes one new token position per iteration, looping until a stop condition is reached.

    The difference between the two phases is not simply workload size, but bottleneck type. Prefill is compute-intensive and saturates compute capacity. Decode is memory-access-intensive and constrained by GPU memory bandwidth and cache capacity. Running both on the same set of devices degrades two core service metrics at once: time to first token (TTFT) and time per output token (TPOT).

    2. Two Structural Problems with Mixed Deployment

    2.1 Strong Interference Between Phases

    The same device must handle both large batched matrix operations for long inputs and many concurrent single-step small operators. The two workloads compete for the same compute and bandwidth. When a long-prompt request arrives, requests already decoding show noticeable stalls and TPOT variance increases. Conversely, an oversized decode batch increases queueing time and pushes up TTFT. The metrics pull against each other, making it hard to optimize both at the same time.

    2.2 Coupling Between Resource Allocation and Parallelism Strategy

    Under mixed deployment, tensor parallelism, pipeline parallelism, and expert parallelism must strike a compromise between the two phases. Prefill favors larger-scale parallelism and more aggressive batching to reduce first-token latency. Decode favors lower communication overhead and partitioning that better matches bandwidth to keep token generation steady. A single configuration serving two goals leaves little room for tuning, and scaling must be done proportionally across the whole deployment, reducing resource utilization.

    3. PD Disaggregation: Splitting the Two Phases into Independent Pipelines

    To address these problems, the industry has proposed PD disaggregation: deploy prefill and decode on different devices (or different GPU groups within the same device), each with its own parallelism strategy, batching parameters, and scaling cadence, exchanging only the KV cache over a high-speed network. With a high-bandwidth, low-latency network such as InfiniBand or RoCE, the cost of moving the cache is manageable, making independent optimization of TTFT and TPOT genuinely feasible.

    One detail that is easy to overlook: why cache only K and V, and not Q? In autoregressive decoding, a new token only acts as the query side, retrieving from historical context. Historical positions never look back at new positions, so historical Q is never reused. Historical K and V, however, are read repeatedly at every subsequent step. Caching Q would only waste memory and bandwidth.

    Illustrative phase separation logic (pseudocode, expressing control flow only):

    1. # Prefill side: compute the full input at once, producing the first token and KV cache
    2. kv_cache = prefill_worker.forward(prompt_tokens)
    3. first_token = kv_cache.last_logits.argmax()
    4. transfer.send(kv_cache, target=decode_group)
    5. # Decode side: loop single-step generation until the stop condition
    6. token = first_token
    7. while not stop(token):
    8. kv_cache = decode_worker.step(token, kv_cache) # Append this step's K/V
    9. token = kv_cache.last_logits.argmax()

    4. Engineering Implementation Essentials

    1. Overlap cache transfer with computation: Pipeline the sending and receiving of the KV cache with the next computation step so that transfer does not become a serial blocking point. For deployments with layer-wise partitioning, handle the arrival order across layers and buffer reuse.
    2. Decouple batch strategies on both sides: On the prefill side, control the total number of tokens per batch to stabilize TTFT. On the decode side, control the number of concurrent sequences and pipeline depth to stabilize TPOT. Tune and observe each side independently.
    3. Elastic scaling and queue isolation: Set up independent queues and scaling metrics for the two phases, and route long and short requests separately so that long inputs do not overwhelm the decode queue.
    4. Observability: Collect queueing latency, first-token latency, per-step latency, cache hit rate, and transfer time separately. Use stage-level metrics to locate bottlenecks rather than relying only on end-to-end averages.
    5. Coordination with sparse expert architectures: In sparsely activated MoE models, the expert activation distributions of the two phases differ significantly. Separated deployment makes it easier to choose expert parallelism and cache placement strategies for each phase. If general capabilities such as cloud container platforms, object storage, logging services, and monitoring alerts are used to support the deployment, elasticity and operations can be further simplified.

    5. Common Misconceptions and Conclusion

    PD disaggregation does not mean “split it and it gets faster.” The gains depend on network bandwidth, cache size, and scheduling quality. Excessive cache transfer overhead, imbalanced load between the two sides, or rigid scheduling policies can all offset the benefits. The sensible approach is to first use stage-level metrics to confirm that the bottleneck really comes from phase interference, then set separate TTFT and TPOT targets according to business SLAs, and gradually move toward separation and independent tuning.