Understanding MoE Architecture: How Total Parameters and Compute Are Decoupled
This article explains why Mixture-of-Experts (MoE) models can have hundreds of billions of total parameters while activating only a small fraction per token. It covers the structural limits of dense Transformers, how MoE replaces a single large FFN with multiple smaller experts plus a router, and design choices such as fine-grained expert splitting and shared experts. It then breaks down the trade-off between total parameters as knowledge capacity and activated parameters as compute, along with the real costs shifted to memory, load balancing, communication, and training stability, and closes with an engineering checklist for capacity planning, parallelism, routing observability, and cost accounting.
1. A Counterintuitive Cost Pattern
When people first see a model with an enormous parameter count, the instinct is to assume that more parameters mean more expensive training and inference. But once training cost is converted into accelerator GPU-hours, some models with total parameter counts in the hundreds of billions turn out to cost less to train than certain dense models with only a few billion parameters. This is not because parameters are free. It reflects a structural difference at the architecture level: these models belong to the sparse Mixture-of-Experts (MoE) family, where the total parameter count determines “knowledge capacity,” while only a small subset of parameters actually participates in computation for each token.
This article explains how a model can be large in size yet light per forward pass, and where the complexity is shifted as a result.
2. The Structural Constraint of Dense Models: Capacity and Compute Are Bound Together
A standard Transformer block has two main parts: an attention sub-layer and a feed-forward network (FFN) sub-layer. Attention handles information exchange between tokens, and its parameter count is tied to the hidden dimension and number of heads. The FFN performs position-wise feature transformation, typically as a two-layer structure that first expands and then reduces dimensionality, and it is usually the largest parameter block within the layer. In a common 70B-class dense model, a single attention layer has roughly 150 million parameters, while the FFN has about 700 million, meaning the FFN accounts for more than 80% of the parameters in that layer.
The rule for dense models is rigid: every token must pass through every FFN in full. Parameter count and compute therefore correspond almost one-to-one. To give the model more capacity, you can only widen and deepen the FFN, and compute grows in step, pushing training and inference costs up linearly. This is the binding of capacity to compute.
3. The Core MoE Operation: Split One Large FFN into Many Small Ones and Add a Router
MoE targets the “heaviest” component, the FFN. A single large FFN is replaced with N structurally identical but independently parameterized small FFNs called experts, plus a lightweight router that computes a match score for each token against every expert and selects only the top few to participate in computation. The remaining experts are not activated at all during that forward pass.
The forward logic can be sketched as:
# Pseudocode: core routing logic of an MoE layerdef moe_layer(x, experts, router, top_k=2):scores = router(x) # score each token against N expertsidx, gate = topk_softmax(scores, k=top_k)y = 0for slot in range(top_k):e = experts[idx[slot]]y = y + gate[slot] * e(x) # only selected experts runreturn y
An early and representative configuration in the industry used 8 experts with 2 selected per token, giving about 47 billion total parameters and roughly 13 billion activated per token. More aggressive designs use fine-grained splitting, for example expanding to 256 routed experts with 8 selected per token, plus 1 shared expert that always participates in computation, reaching hundreds of billions of total parameters with only about 37 billion activated per token.
Two design intentions deserve separate emphasis:
- Fine-grained splitting: smaller and more numerous experts make the number of combinations grow sharply, giving the router stronger expressive power and covering a richer set of “skill combinations” under the same activation budget.
- Shared expert: fixing general-purpose capability in a resident expert lets the routed experts focus on differentiated knowledge, reducing the parameter waste caused by different experts repeatedly learning common patterns.
4. The Payoff of Decoupling: 671B of Capacity, 37B of Compute
The key conclusion follows: total parameters are capacity, activated parameters are compute.
- Total parameters determine how much knowledge the model can hold and how high its ceiling is, affecting memory footprint as well as storage, loading, and distribution costs.
- Activated parameters determine the actual floating-point operations consumed per token, directly driving training throughput, inference latency, and cost per request.
In a dense model these two numbers are the same. Once MoE separates them, the combination of “large capacity, small compute” appears. This is the first layer of meaning behind “large but not heavy,” and the basis for understanding every engineering trade-off that follows: what is saved is compute, not memory.
5. Where the Cost Goes: Complexity Does Not Disappear, It Moves
- Memory and bandwidth: all expert parameters must stay resident, and inference requires reading the weights of the selected experts, making memory capacity and access bandwidth hard constraints while compute utilization does not necessarily improve in step.
- Load balancing: routing naturally exhibits a Matthew effect, where a few experts being over-selected leaves others under-trained. In practice, auxiliary balancing loss, routing noise, capacity factor, and dropping strategies are introduced.
- Communication overhead: experts are usually placed on different devices, so tokens must be sent to the target device, computed, and sent back, forming two collective communication operations, where cross-machine bandwidth and topology significantly affect throughput.
- Training stability: routing is a discrete decision with discontinuous gradient paths, requiring careful design of normalization, initialization, and learning rate strategies.
- Uneven quality: knowledge is spread across different experts, and the splitting and merging strategies under expert parallelism affect actual quality.
6. Engineering Checklist
- Capacity planning: estimate memory from total parameters and compute from activated parameters separately; do not derive all costs from a single number.
- Parallelism strategy: combine expert parallelism, tensor parallelism, and pipeline parallelism, and overlap communication with computation as much as possible.
- Routing observability: monitor expert selection distribution, drop rate, and load skew, and use monitoring, alerting, and logging services to locate long-tail latency.
- Elastic scaling: on the inference side, choose batching and concurrency strategies based on activation scale; let the container platform handle orchestration and scaling, and use object storage to distribute model weights.
- Cost accounting: count training cost in accelerator GPU-hours and inference cost by activated volume per token; accounting for the two separately avoids distortion.
7. Conclusion
The essence of MoE is not making parameters cheaper, but freeing model design from the binding of capacity and compute: routing buys sparsity, sparsity buys compute savings, and engineering effort pays the bill for memory, communication, and stability. Once you understand the decoupling of capacity and compute, you can quickly judge where any ultra-large-scale model’s technical report spends money and where it saves. To adopt this architecture in your own workloads, start at a moderate scale to validate routing balance and parallelism strategies, then scale up gradually, and rely on general-purpose capabilities such as the container platform and monitoring and alerting offered by Baidu AI Cloud for deployment and operations.
