Large-Scale MoE Model Deployment and Parallelism Strategies
This article explains how to design deployment and parallelism strategies for large-scale Mixture-of-Experts (MoE) models. It highlights three cross-generation differences—attention compression rate, parallelism domain width, and cache hierarchy—and shows how GPU memory constraints determine the minimum parallelism domain. It also covers dual-stage prefill/decode configurations, quantitative efficiency comparisons, why throughput and latency need multiple metrics, limitations of cross-system comparisons, and practical deployment recommendations.
1. Why Deployment and Parallelism Must Be Designed Together
Serving large-scale Mixture-of-Experts (MoE) models is far more than loading weights into GPU memory and running a forward pass. What really determines production service quality is how well the model structure aligns with the system implementation. The same model generation can perform several times differently across hardware, input length distributions, and cache hit rates. Likewise, a parallelism configuration that is optimal for one model generation may become unusable on another.
Deployment discussions therefore need to cover three dimensions at once:
- Model-side structural parameters: attention compression rate, expert granularity, and weight size.
- System-side parallelism domain organization: the combined width of data parallelism and expert parallelism.
- Storage-side cache hierarchy: the division of labor across GPU memory, host memory, and remote caches.
These three dimensions constrain one another. Tuning any one in isolation tends to hit a bottleneck.
2. Three Key Cross-Generation Differences
2.1 Attention Compression Rate
The attention mechanism determines cache overhead in long-context scenarios. The earlier widely used Multi-head Latent Attention (MLA) approach compressed the key-value cache to roughly 70 KB per token through low-rank compression. Later generations reduced this to about 890 B per token—nearly a two-order-of-magnitude reduction. The implication is that long context is no longer an unaffordable burden on GPU memory, and the cost of serving million-token contexts drops substantially.
2.2 Parallelism Domain Width
A parallelism domain is the smallest set of devices that must cooperate in a single forward pass. Larger weights require more GPU memory per replica, which widens the minimum parallelism domain. In practice, this produces a clear tiering: flagship models at larger scales typically use 8-way data parallelism plus expert parallelism as a standard single-node configuration, while lighter versions can converge to 4-way data parallelism plus expert parallelism on the same hardware. This is not a tuning preference but a hard constraint set by GPU memory capacity and communication overhead together.
2.3 Cache Hierarchy
Caching is no longer a single layer. A sensible hierarchy usually works as follows: GPU memory holds hot data and the key-value cache for the current batch; host memory takes reusable prefix caches; and a remote cache service shares high-frequency prefixes across instances. More layers yield higher hit rates, but also increase the complexity of consistency and invalidation management.
3. How GPU Memory Constraints Determine the Minimum Parallelism Domain
A simplified estimation flow can identify feasible configurations:
Per-GPU memory demand ≈ weight shard + optimizer/runtime overhead + expert routing buffer + key-value cacheKey-value cache ≈ bytes per token × context length × concurrent batchMinimum parallelism domain ≥ ceil(total demand per replica / usable memory per GPU)
The key takeaway is that the key-value cache grows linearly with concurrency and context length. The minimum parallelism domain is therefore not a fixed value but a range that shifts with business concurrency targets. When a workload moves from 32K context with low concurrency to 1M context with high concurrency, the parallelism domain may need to double even if weight size stays the same.
4. Dual-Stage Configuration After Separating Prefill and Decode
Splitting prefill and decode into separate resource pools has become a common practice for long-text serving. The two stages have very different resource profiles: prefill is compute-intensive and aims for compute utilization and batch throughput, while decode is memory-access-intensive and aims for low latency and a stable per-token output rate.
Once separated, each stage needs its own concurrency and batch limits, as illustrated below:
prefill:max_batch_tokens: 32768 # batch limit in tokensconcurrency: 16parallelism: tensor+expertdecode:max_running_requests: 128max_new_tokens: 4096parallelism: data+expertspeculative: enabled
Reusing a single unified configuration often leads to one of two outcomes: oversized prefill batches that squeeze decode latency, or insufficient decode concurrency that leaves compute idle. In addition, the key-value cache must be passed explicitly between the two stages, and transfer bandwidth and serialization overhead must be included in the end-to-end latency budget.
5. A Quantitative View of Efficiency Gains
For cross-generation comparisons, apply the “three-same” principle: same input distribution, same output length, and same hardware. One reference quantitative result is that, under million-token context conditions, the per-token floating-point operations and key-value cache size of the new flagship generation are about 27% and 10% of the previous generation, respectively. Such data shows that low-rank compression and sparse activation on the model side work together with operator fusion and communication overlap on the system side; the gains cannot be attributed to a single optimization.
6. Throughput and Latency: Do Not Judge by a Single Metric
Throughput and latency are not a simple trade-off. Their relationship is jointly determined by four variables: the compute-to-bandwidth ratio of the hardware, the input length distribution, the prefix cache hit rate, and whether speculative decoding is enabled. The same model may double throughput while lowering latency under short inputs with high cache hits, or see both throughput and latency worsen under long inputs with zero cache hits.
Evaluation should therefore include at least: time-to-first-token percentiles, per-output-token latency percentiles, effective token throughput per unit time, cache hit rate, and compute cost per request.
7. Four Limitations of Cross-System Comparisons
- Heterogeneous platform portability: Differences in operator support and communication topology across accelerator cards can significantly change the optimal parallelism partitioning.
- Deterministic inference: The batching order of concurrent requests affects numerical results, so scenarios requiring reproducible output need extra constraints.
- Cache economics: Cache hierarchy benefits must be accounted for together with memory usage and invalidation overhead.
- Evaluation methodology differences: Different input/output lengths, sampling parameters, and warm-up strategies make results not directly comparable.
8. Practical Recommendations
When deploying on cloud platforms such as Baidu AI Cloud, consider using a container platform to host elastic resource pools, object storage to distribute model weights, and monitoring, alerting, and logging services to observe latency percentiles and cache hit rates. Treat parallelism configurations as version-controlled parameters and validate them through canary rollouts. Overall, a reliable path is to first determine the lower bound of the parallelism domain from GPU memory constraints, then set the upper bound based on business concurrency, and finally fine-tune with dual-stage configuration and caching strategies.
