Large-Scale MoE Model Deployment and Parallelism Strategies Explained

    This article breaks down how to deploy large-scale Mixture-of-Experts (MoE) models for inference, focusing on three decisive variables: attention compression rate, parallel domain width, and cache hierarchy. It shows how to derive the minimum parallel domain from weight size, why prefill and decode stages require separate tuning, and how to evaluate deployments using multiple metrics rather than a single number. Readers will find a practical checklist for validating feasibility, performance, and cost in order.

    1. The Starting Point: Why You Cannot Reuse the Training Configuration

    When moving a large-parameter Mixture-of-Experts (MoE) model from a training environment to an online inference environment, the most common mistake is reusing the parallelism configuration from training. Training optimizes for global throughput and convergence stability, while inference optimizes for output per unit cost under a given latency constraint. Because the objective functions differ, the optimal partitioning differs too.

    From a generational perspective, the differences across system generations are not mysterious. They converge on three dimensions: the compression rate of the attention module, the upper bound on parallel domain width, and the layering of the cache. Once you grasp these three threads, you can make an a priori judgment about most deployment plans instead of re-testing every version through trial and error.

    2. Three Decisive Variables

    2.1 Attention Compression Rate

    Early schemes based on Multi-head Latent Attention (MLA) kept the KV cache at roughly 70 KB per token. By the fourth-generation scheme, this had dropped to about 890 B per token, a reduction of nearly two orders of magnitude. This is not a minor engineering tweak. It turns “cache size” from a variable that can exhaust GPU memory into an object that can be moved freely within a machine or even across machines.

    The compression rate directly determines three things: the number of concurrent sequences a single card can hold, the upper bound on context length, and whether the cache can be reused across layers. The higher the compression rate, the more easily the cache fits into higher-tier storage, and the higher the hit rate for prefix reuse.

    2.2 Parallel Domain Width

    The parallel domain refers to the range of cards covered by a single collective communication operation. A wider domain means more communication participants, and therefore greater latency and bandwidth pressure. A narrower domain means more redundant replicas of weights and cache, and therefore lower memory efficiency. As a result, there is a lower bound determined jointly by the weight size and the memory requirement of a single replica. This is the “minimum parallel domain.”

    A typical pattern is this: a flagship version with larger weights cannot fit a single replica, so it must pair a relatively wide expert parallelism with data parallelism, for example a combination of 8-way data parallelism and expert parallelism within a single machine. A lightweight version has smaller weights and a lower single-replica memory requirement, so 4-way data parallelism plus expert parallelism is enough to run it. Parallel domain width is not “the wider the better”; it is a lower bound pushed up by memory.

    2.3 Cache Hierarchy

    Once the per-token cache drops to the hundreds-of-bytes range, the cache can be placed in tiers: the fastest on-chip and GPU memory tier holds hot prefixes, host memory holds warm data, and a remote shared cache service holds cold data. More tiers make the tradeoff between hit rate and transfer cost more complex, but the overall economics improve significantly.

    3. Deriving the Minimum Parallel Domain from Weight Size

    You can use a rough but useful estimation flow:

    1. Single-replica memory requirement ≈ weight bytes + activation peak + framework and communication buffers
    2. Minimum data parallelism ≈ ceil(single-replica memory requirement / usable memory per card)
    3. If a single card cannot hold the full set of experts → introduce expert parallelism (EP) so each card holds only part of the experts
    4. Final parallel domain width = DP × EP (constrained by intra-machine interconnect bandwidth)

    The practical implication is clear: first decide whether it fits, then discuss whether it is fast. Skipping the memory feasibility check and tuning concurrency parameters directly is the most common source of rework during deployment.

    4. Two-Stage Tuning After Separating Prefill and Decode

    Once prefill and decode are split across different resource pools, the bottlenecks of the two stages are completely different. Prefill is compute-intensive and pursues large batches and compute utilization. Decode is memory-access-intensive and pursues low latency and high concurrency. You must therefore set concurrency and batch limits separately for each stage; a single set of parameters will not work.

    1. prefill: larger max_batch_tokens, moderate concurrency, focus on time to first token
    2. decode: larger number of concurrent sequences, batch limit constrained by cache capacity, focus on per-token latency

    The two stages are connected through cache transfer, and the higher the cache compression rate, the lower the handoff overhead. If the compression rate is insufficient, cross-pool transfer becomes a new bottleneck and the gains from separation are offset.

    5. A Quantitative View of Generational Efficiency Gains

    Cross-generation comparisons show that in million-token context scenarios, the per-token floating-point operations and cache usage of the fourth-generation flagship version are about 27% and 10% of the previous mid-generation version, respectively. The significance of such numbers lies not in the specific values but in what they reveal about the source of optimization: model architecture and system implementation must work together. Neither changing the architecture alone nor changing the scheduling alone can achieve gains of this magnitude.

    6. Evaluation Metrics: Do Not Draw Conclusions from a Single Number

    The relationship between throughput and latency is determined jointly by four factors: hardware interconnect and compute, input length distribution, cache hit rate, and the acceptance rate and configuration of speculative decoding. Reporting only throughput hides tail latency; reporting only latency hides cost. It is advisable to report at least the following together: throughput per unit cost, time-to-first-token percentiles, per-token latency percentiles, and cache hit rate.

    7. Four Limitations of Cross-System Comparison

    • Heterogeneous platform portability: differences in interconnect topology and operator support across accelerator cards can make the same parallel configuration perform very differently.
    • Deterministic inference: concurrent scheduling and reduction order affect result reproducibility, which requires additional constraints for testing and audit scenarios.
    • Cache economics: the gains from cache hits must be offset by storage and transfer costs, otherwise the optimization effect is overestimated.
    • Evaluation methodology differences: when input distributions, context lengths, and concurrency models are not aligned, the numbers cannot be compared directly.

    8. Implementation Recommendations

    When implementing on a cloud platform such as Baidu AI Cloud, you can turn the above judgments into an executable checklist: first use the memory estimation to determine the minimum parallel domain, then set concurrency and batch limits separately for prefill and decode, then use monitoring, alerting, and logging services to observe cache hit rate and latency percentiles, and finally use a container platform for elastic scaling and canary rollouts. Validating the three layers of “feasibility, performance, and cost” in order is more stable than tuning everything at once, and it makes it easier to attribute problems.