The Evolution of LLM Inference Architecture: MoE and Prefill/Decode Disaggregation Practices

    This article explains why mainstream LLM inference architectures are being split apart. It covers how Mixture-of-Experts (MoE) creates uneven compute distribution through sparse activation, why decode-only autoregressive models produce two fundamentally different workloads (compute-bound prefill and memory-bound decode), and the two core pain points of mixed deployment: cross-phase interference between TTFT and TPOT, and coupled resource allocation and parallelism strategies. It then walks through prefill/decode (PD) disaggregation, KV cache transfer over high-speed RDMA-capable networks, and why only K and V are cached. Further decoupling of expert computation, practical guidance, and common pitfalls are included.

    1. The Starting Point: Why Mainstream Inference Architectures Need to Be Split Apart

    Today’s mainstream LLM inference setup can be abstracted as two orthogonal design choices stacked on top of each other: a Mixture-of-Experts (MoE) model structure, and a decode-only autoregressive network structure. Each choice brings capability gains, and each also brings an uneven resource profile. When the two are combined and pushed into large-scale serving, coupling problems at the deployment layer get significantly amplified. The first step in understanding inference optimization is not memorizing conclusions, but breaking down the resource consumption characteristics of the computation itself.

    1.1 Mixture of Experts: Sparse Activation Creates Uneven Compute Distribution

    An MoE model consists of a gating network and several expert subnetworks. The gating network scores the input for routing and selects the small number of experts that best match the semantics of the current request; all other experts stay silent. Because each token activates only a subset of experts, the total parameter count can be made very large while the actual compute per token stays low. That is the essence of sparse activation: capacity and compute are decoupled.

    For inference serving, this has two direct consequences. First, memory footprint and compute load are not proportional: all expert weights must either stay resident or be swappable in quickly, yet at any given moment only a few experts are working, which makes memory the hard constraint. Second, load distribution drifts with input semantics: different requests hit different experts, so the workload across devices differs noticeably, and batching efficiency and parallel partitioning strategies become more sensitive.

    1.2 Decode-Only Architecture: Prefill and Decode Are Two Completely Different Workloads

    Autoregressive decoding generates one token at a time, so inference naturally splits into two phases. The prefill phase processes the entire input in one pass, turning the prompt into the key-value states attention needs and producing the first token; it is highly parallel, involves large matrices, and is compute-intensive. The decode phase reuses the existing KV cache and advances only one token per step; weight reads far exceed compute, making it memory-bandwidth-intensive.

    The key conclusion: these two phases have opposite preferences for compute, memory bandwidth, batch size, and parallelism. Putting them on the same set of devices for mixed scheduling means the optimal configuration for either side is the inverse of the optimal configuration for the other.

    2. Two Core Pain Points of Mixed Deployment

    2.1 Strong Cross-Phase Interference

    On a shared pool of resources, a long-prompt prefill task can occupy the compute units for an extended period, blocking decode requests that are streaming tokens one by one; the direct symptom is TPOT jitter. In the other direction, a large volume of decode requests continuously consumes memory bandwidth, which stretches the time to first token for new requests. Two core metrics, time to first token (TTFT) and average time per output token (TPOT), end up fighting over the same resources, and tuning becomes a seesaw.

    2.2 Resource Allocation and Parallelism Strategy Are Coupled

    Under mixed deployment, tensor parallelism degree, pipeline parallel partitioning, and batch organization must all fit both phases at once. Prefill prefers coarse-grained parallelism to compress compute time; decode prefers fine-grained, low-communication-overhead configurations to reduce per-step synchronization cost. Forcing one unified setup can only land on a compromise, and any single adjustment ripples across the whole system. Capacity planning and elastic scaling also become hard to perform independently per phase.

    3. PD Disaggregation: Cutting the Coupling Point

    Disaggregated deployment exists precisely to remove the coupling above. The basic approach places prefill and decode on different devices, or on different accelerators within the same machine, each with its own parallelism strategy and batching logic. Metric optimization shifts from “mutual compromise” to “each side optimal.”

    What has to be passed between the two phases is the KV cache. In engineering practice this typically relies on a high-speed network with remote direct memory access capability (such as an RDMA-capable interconnect) for the transfer, with transfer overhead hidden through tiered caching, overlap of transfer and computation, and request-level scheduling. One detail worth thinking about: why cache only K and V and not Q? In autoregressive generation, the keys and values of historical tokens are reused at every subsequent step, while the query vector only serves the output of the current step and is discarded immediately after use. Caching it has no reuse value and only wastes memory and bandwidth.

    The phase split can be understood schematically like this:

    1. Request arrives
    2. ├─ Routing and admission (length, priority, estimated expert hits)
    3. ├─ Prefill pool: compute-intensive, optimized for TTFT
    4. │ └─ Produces first token + KV cache
    5. ├─ KV transfer layer: moved over high-speed network, overlapped with compute as much as possible
    6. └─ Decode pool: memory-intensive, optimized for TPOT
    7. └─ Iterates token by token until completion, then releases cache

    4. Further Decoupling for MoE

    On top of PD disaggregation, sparse activation also allows “expert computation” to be split off from the main flow as another layer. When experts sit on different devices, the gating result determines which experts a request must reach, so routing, expert execution, and result reduction can scale independently. Combined with expert caching and replication of hot experts, this can mitigate load drift. Note that this kind of split adds one extra communication hop; whether it pays off depends on network bandwidth, expert granularity, and hit rate, and must be decided with measured data rather than enabled by default.

    5. Practical Takeaways and Common Pitfalls

    • Layer the metrics first: split TTFT and TPOT into independent SLOs before deciding resource ratios, and avoid letting a single average latency hide the long tail.
    • Cache is a scarce resource: KV cache grows linearly with tokens, so control the memory watermark with paging, prefix reuse, and eviction policies.
    • Transfer must not become the new bottleneck: after disaggregation, if the network is the weak link the gains are cancelled out, so prioritize overlapping in-phase compute with transfer.
    • Scale elastically per phase: the prefill pool and the decode pool have different scale-out triggers, and elastic policies should be set separately.
    • Fall back on general observability: building a per-phase metrics dashboard on top of general-purpose capabilities such as container platforms, logging services, and monitoring and alerting is the prerequisite for locating the source of interference.
    • Beware over-splitting: every decoupling introduces communication and scheduling complexity, so end-to-end throughput and cost should be the only judge.

    6. Summary

    MoE resolves the tension between capacity and compute, decode-only defines the heterogeneity of the two phase workloads, and PD disaggregation resolves the resource and strategy coupling between phases. Stacked together, the three form the main line of improving LLM inference serving efficiency: first identify differences in workload profiles, then use decoupling to buy room for independent optimization, and finally validate with data whether each split actually delivers end-to-end gains. On the general compute and network capabilities of platforms such as Baidu AI Cloud, this methodology can be turned directly into measurable performance optimization practice.