Large Model Deployment and Parallelism Strategies: A Practical Guide
This article breaks down the core variables behind large model deployment, focusing on the cost and latency asymmetries of sparse MoE architectures, the trade-offs between prefill and decode workloads, and the role of expert parallelism, PD separation, and multi-level caching. It also provides a baseline of terminology and constraints, engineering priorities for each strategy, and a concise selection checklist for choosing a deployment plan.
1. Why Deployment Strategy Is the Core Variable in Large Model Rollout
Once large-scale sparse models move into production, the main challenge on the inference side shifts from “can it run” to “are cost per token and latency under control.” The cost structure is shaped by two asymmetries.
The first asymmetry comes from total parameter count versus activated parameters. Take a common sparse architecture at the hundreds-of-billions scale: total parameters are around 671 billion, while each token activates roughly 37 billion expert parameters. Compute cost therefore scales approximately with activation volume, but GPU memory must hold all expert weights. Memory capacity becomes the hard constraint, while compute may sit idle.
The second asymmetry comes from the two phases. The prefill phase processes all input tokens at once, with large matrices and high parallelism. It is compute-intensive and determines time to first token (TTFT). The decode phase generates tokens autoregressively one at a time, and each step must re-read the full KV cache and the activated expert weights. It is memory-bandwidth-intensive and determines time per output token (TPOT). The two workloads have almost opposite hardware demands, so co-locating them on the same instance inevitably causes interference.
These asymmetries point to three main lines of deployment strategy: use expert parallelism (EP) to spread weights across devices and enlarge the batch for each expert computation; use prefill/decode (PD) separation to isolate the two workloads; and use multi-level caching to cut repeated prefill work. The essential differences across four generations of architecture come down to three points: attention compression ratio, parallel domain width, and cache hierarchy.
2. Terminology and Constraint Baseline
Before discussing parallelism strategies, it helps to align on a shared vocabulary:
- Parallelism dimensions: data parallelism (DP) handles multiple replicas and request sharding; tensor parallelism (TP) splits operators within a single layer; pipeline parallelism (PP) splits layers; expert parallelism (EP) splits MoE layers along the expert dimension; context parallelism (CP) splits long sequences.
- Storage hierarchy: HBM (capacity and bandwidth determine single-device residency), intra-node shared memory, remote distributed cache, and cold-data tiers such as object storage.
- Key metrics: TTFT, TPOT, throughput (tokens/s), cache hit rate, effective batch size, and cost per million tokens.
The hard constraints are equally clear: the minimum parallel domain for a single replica is determined by whether “all expert weights + KV cache + activations and framework overhead” fit into available HBM; cross-node communication bandwidth determines whether an EP group can span machines; and deterministic inference requirements can constrain certain reduction orders and batching strategies.
3. Key Points for Implementing Expert Parallelism
Expert parallelism delivers value on two levels: it spreads weights across devices to reduce per-device memory pressure, and it routes scattered requests to the same expert to form larger batches, which amortizes memory access overhead.
Three things need engineering attention. First, routing balance. If popular experts stay overloaded, a “long tail slows down the whole batch” effect appears, which requires capacity factors and drop policies working together. Second, overlapping communication with computation. All-to-All dispatch and collection are the main overhead and need to be pipelined with expert forward computation. Third, matching parallel domain width to weight size. Larger weights mean higher per-replica memory demand and a wider minimum parallel domain; a typical single-node setup might be 8-way data parallelism combined with expert parallelism, while lighter model specs can compress to 4-way. This difference directly determines deployment density and cost.
An illustrative configuration expression (pseudocode, for explanation only):
parallel_plan = {"dp": 8, # replicas / request sharding"ep": 8, # expert-dimension split, aligned with GPUs per node"tp": 1, # can stay off when weights are small"attn": "mla", # low-rank latent attention, compresses KV"pd_split": True, # separate prefill and decode}
4. Prefill/Decode Separation and Concurrency Governance
After separation, each instance type needs its own concurrency level and batch limit. The prefill side focuses on chunk size and sequence chunking to avoid a single long request blocking the queue. The decode side focuses on the number of resident requests and KV usage to avoid frequent swapping. A common practice is to set independent batch limits, timeouts, and priorities, and to hand requests between the two sides via KV transfer, whose latency must be counted in the TTFT budget.
Long context amplifies KV transfer cost, so the attention compression ratio is a key lever. The industry path is clear: multi-head latent attention (MLA) compresses per-token KV to roughly 70 KB, while a newer structure can bring it down to about 890 B/token. In million-token context scenarios, per-token floating-point operations and KV usage can drop to about 27% and 10% of earlier versions respectively, which directly changes what long-text serving can support.
5. Multi-Level Caching and Scheduling
Repeated prefixes (system prompts, tool definitions, long documents) are the main source of wasted prefill. The multi-level caching idea is to keep hot prefixes in HBM, let intra-node shared memory hold warm data, serve cross-instance reuse from a remote cache pool, and push cold data to object storage. Each step up in hit rate lowers both TTFT and compute cost, but cache economics require accounting for capacity, bandwidth, and eviction policies.
On the scheduling side, note that throughput and latency are a trade-off shaped jointly by hardware, input length, hit rate, and speculative decoding configuration, so a single metric is not enough to evaluate a system. Deterministic inference, portability across heterogeneous platforms, and differences in evaluation methodology are the main limits on cross-system comparison. If running on general-purpose infrastructure such as Baidu AI Cloud with container platforms, object storage, logging services, and monitoring and alerting capabilities, elastic scaling can absorb traffic peaks and the monitoring stack can help locate sources of tail latency.
6. Selection Checklist
- Calculate memory first: derive the minimum parallel domain from weight size before discussing throughput.
- Then split workloads: prioritize phase separation when there is a clear mix of long and short requests.
- Then compress KV: for long context, prioritize a higher attention compression ratio and cache hit rate.
- Tune last: validate jointly on TTFT, TPOT, and cost, and avoid single-point conclusions.
