A Practical Guide to Evaluating Local Deployment of Large-Scale MoE Models
This guide explains why asking "how many accelerators are enough" is the wrong starting point for deploying large-scale Mixture-of-Experts (MoE) models locally. It breaks down memory requirements beyond active parameters, defines five key variables that shape capacity planning, and outlines a four-stage benchmarking process to turn those variables into measurable numbers. Readers will learn how to build a reproducible evaluation workflow and reach conclusions based on real workloads.
1. The Starting Problem: Why “How Many Cards Are Enough?” Is the Wrong Question
Once a large-scale Mixture-of-Experts (MoE) model moves into local deployment, the most common question is how many accelerators are needed to run it. The question is hard to answer because it conflates two different things: whether the model can start, and whether it can support the business. The first is a boolean judgment that a single launch test can usually settle. The second is a capacity planning problem that depends on the combined constraints of context length, concurrency, request type, and response targets (latency or throughput). The latter is what ultimately determines the final configuration.
So instead of declaring which specific cards can run a model, this guide reconstructs a reproducible evaluation process: first clarify the resource composition, then identify the key variables, and finally use staged stress testing to turn those variables into numbers.
2. Resource Composition: Active Parameters Are Not Memory Requirements
A typical large-scale MoE model has a total parameter count far larger than the number of parameters activated in a single inference pass. For example, one class of models has roughly three hundred billion total parameters while a single forward pass activates only about twenty billion. This design improves the effective utilization of compute per unit, but it is easily misread as meaning memory only needs to hold the active portion.
Two points must be clarified:
- Active parameters determine computation (FLOPs) and memory access intensity, not the resident size of the weights.
- Memory must hold at least the full weights, runtime framework overhead, activation tensors, and room for the KV Cache to grow.
A rough breakdown of the memory budget:
Per-card memory requirement ≈ weight shard + framework and communication buffers + peak activations + KV Cache + safety marginKV Cache size ≈ 2 × layers × KV heads × head dimension × sequence length × concurrency × bytes per element
The KV Cache grows linearly with sequence length and concurrency, making it the item most likely to spiral out of control in long-context scenarios. With tensor parallelism, weights are split across cards, but communication buffers and some activations still rise with the degree of parallelism; excessive parallelism also introduces additional synchronization overhead, causing throughput gains to show diminishing returns.
Precision choice affects the budget as well. Native FP8 weights, for instance, can significantly reduce weight footprint compared with higher precision, but you need to verify on real business data whether the accuracy regression is acceptable, rather than drawing conclusions only from general evaluation sets.
3. Five Key Variables
3.1 Context Length
Distinguish between the maximum context the model supports and the context the business actually uses. Most workloads concentrate at 32K and 128K, while 256K and beyond typically appear only in specific scenarios such as long-document understanding and repository-level code analysis. Every doubling of context raises KV Cache and attention computation costs in tandem, and memory fragmentation and scheduling jitter become more pronounced with long sequences.
3.2 Concurrency and Request Shape
Single-request low latency and multi-request high throughput are two different optimization goals. Interactive Q&A cares about time to first token and the stability of token-by-token output; batch offline processing cares about the total tokens completed per unit time. The two differ completely in batching strategy, queuing strategy, and how memory is reserved.
3.3 Request Type
The prefill stage is compute-intensive, while the decode stage is memory-access-intensive. If the business is mainly long input and short output, the bottleneck is prefill compute; if it is mainly short input and long output, the bottleneck is decode bandwidth and KV Cache capacity. Mixed workloads require more complex scheduling.
3.4 Response Targets
Targets should be written as acceptance-ready metrics, such as an upper bound on time to first token, an upper bound on the interval between output tokens, a lower bound on tokens per unit time, and an acceptable retry rate.
3.5 Optimization Toggles
Optimizations such as prefix caching, multi-token prediction (MTP), and continuous batching can significantly change measured numbers. When taking baseline measurements, turn everything off first to get a clean reference, then enable each item one by one and record the gains, so optimization benefits are not mistaken for hardware headroom.
4. A Staged Stress Testing Method
Proceed in four steps, keeping reproducible records at each step:
- Baseline stage: fix precision, parallelism strategy, and context length, turn off all optional optimizations, and record whether startup is stable, single-request latency, and peak memory.
- Single-variable stage: change only context length or concurrency, plot the latency-throughput curve, and find the inflection point.
- Optimization stage: enable prefix caching, batching, and speculative decoding–type optimizations one by one, quantifying each gain and side effect.
- Business replay stage: replay with the real request distribution and observe tail latency, failure rate, and memory watermark.
Illustrative stress test call (pseudocode, expressing the flow only):
for ctx in [32768, 131072]:for conc in [1, 4, 8, 16]:result = bench(model, max_len=ctx, concurrency=conc,prefill_only=False, optimizations=[])report.append(result) # record TTFT, TPOT, tokens/s, peak memory
5. Common Pitfalls
- Treating active parameters as the memory requirement, leading to a severely underestimated budget.
- Testing only whether the model starts, without testing tail latency and failure rate.
- Taking the baseline with all optimizations enabled, making it impossible to locate bottlenecks later.
- Ignoring framework and communication buffers, then hitting unexpected overflow at high parallelism.
- Substituting general evaluation accuracy for accuracy validation on business data.
6. Practical Recommendations
To quickly obtain all of the above metrics in a controlled environment, you can use general capabilities such as the container platform, monitoring and alerting, and logging services from Baidu AI Cloud to build a stress testing and observability pipeline, capturing memory watermark, latency percentiles, and throughput curves as a capacity baseline that can be tracked continuously. The final conclusion should come from real workloads: first answer how long the context needs to be, how much concurrency is required, and what response targets apply, then answer how many accelerators are needed.
