Mixture of Experts: How Sparse Activation Enables High Parameter Count with Low Compute
This article explains how Mixture of Experts (MoE) models use conditional computation and Top-k routing to increase total parameter capacity while keeping per-input computation low. It covers expert networks, gating mechanisms, sparse activation, a routing code example, the development timeline of MoE, engineering challenges such as memory and communication overhead, and practical deployment recommendations.
Mixture of Experts: How Sparse Activation Enables High Parameter Count with Low Compute
1. Why Mixture of Experts Is Needed
A common way to improve model capability is to increase the number of parameters and the amount of training data. In a standard dense model, every input passes through all parameters, so doubling the parameter count roughly doubles the computation for a single inference. When models reach the scale of hundreds of billions or trillions of parameters, compute cost, memory usage, and latency become hard constraints.
Mixture of Experts (MoE) offers another path. It does not require every input to use all parameters. Instead, different inputs follow different computation paths. The total parameter count can be very large, while each forward pass activates only a small subset of those parameters. The goal is to achieve a better balance between capacity and cost.
2. Core Idea: Conditional Computation and Divide-and-Conquer
MoE is based on two concepts: conditional computation and a divide-and-conquer strategy. Conditional computation means that the computation path depends on the input content. Divide-and-conquer means splitting a complex task among multiple specialized submodules. Combined, these ideas allow the model to form specialization across different regions instead of forcing all parameters to learn all patterns simultaneously.
A typical MoE layer consists of two parts.
2.1 Expert Networks
Expert networks are usually feedforward subnetworks with the same structure, and each expert has independent parameters. In Transformer architectures, an MoE layer generally replaces the original feedforward layer, while the attention layer remains unchanged. During training, different experts gradually develop preferences for different input features. For example, some experts may become better at handling code snippets, while others may become better at handling natural language narratives. This specialization usually emerges spontaneously during training and does not need to be specified manually.
2.2 Gating Network and Top-k Routing
The gating network is a small network that reads the input representation and outputs a score for each expert. A common approach is to take the k experts with the highest scores, normalize their scores, and use the normalized scores as weighting coefficients to combine the expert outputs. The value of k is usually 1 or 2, which determines how many experts are actually activated for each input.
Routing decisions are discrete, so gradients cannot pass directly through the selection operation. A common engineering approach is to compute gradients only for the outputs of the selected experts, pass gradients back to the gating network through the normalized weights, and introduce an auxiliary loss to constrain the load distribution among experts.
2.3 Sparse Activation and Decoupling Parameters from Computation
Let an MoE layer contain E experts, each with P parameters, and let k experts be activated per input. The total parameter count of the layer is approximately E×P, while the number of parameters actually involved in computation for each input is approximately k×P. When E is much larger than k, model capacity grows with E, while per-inference computation grows only with k. This is what “high parameter count, low computation” means.
Two points require attention. First, parameter storage still grows with E, so memory requirements are not reduced by sparse activation. Second, sparse computation requires dispatching inputs to different experts, and the dispatch and aggregation process introduces additional data movement and synchronization overhead. Understanding these two points is necessary to correctly evaluate the benefits of MoE.
3. Routing Flow Example
The following pure Python code demonstrates the process for a single input: gating, expert selection, and weighted merging. It is intended only to illustrate the logic and does not involve any specific framework or API. In real systems, batching, parallel scheduling, and numerical optimization are much more complex.
import mathdef softmax(scores):m = max(scores)exps = [math.exp(s - m) for s in scores]total = sum(exps)return [e / total for e in exps]def top_k_route(logits, k):probs = softmax(logits)ranked = sorted(range(len(probs)), key=lambda i: probs[i], reverse=True)[:k]norm = sum(probs[i] for i in ranked)# Return a list of (expert id, normalized weight)return [(i, probs[i] / norm) for i in ranked]def moe_forward(x, experts, gate, k=2):logits = gate(x) # The gating network scores each expertselected = top_k_route(logits, k) # Select the k experts with the highest scoresoutput = 0.0for idx, weight in selected:output += weight * experts[idx](x) # Only the selected experts participate in computationreturn output# Example: 4 experts, activate 2 each timeexperts = [lambda x, i=i: x * (i + 1) for i in range(4)]gate = lambda x: [0.1 * x, -0.3 * x, 0.5 * x, 0.0]print(moe_forward(1.0, experts, gate, k=2))
In the code, the computation of moe_forward depends only on k and is independent of the total number of experts. This directly reflects sparse activation.
4. Development Timeline
The idea behind MoE is not new. Understanding its evolution helps assess its current maturity.
1991: Origin of the idea. A classic paper on adaptive mixtures of local experts proposed training a system composed of multiple independent networks, where each network is responsible for a subset of the training data, along with a gating network that decides which expert should receive a sample. Experiments in the paper showed that this structure required significantly fewer training epochs to reach a target accuracy than comparable traditional models. This line of thinking laid the theoretical foundation for later sparse models.
2017: Entry into deep sequence models. Researchers embedded MoE layers between layers of a recurrent neural network and demonstrated that, on tasks such as language modeling, increasing the number of experts could improve model capacity with roughly unchanged compute cost. This was the first systematic validation of MoE in large-scale deep models.
Around 2020: Toward ultra-large-scale training. Research teams proposed distributed training solutions for large compute clusters and introduced the concept of “expert parallelism.” It places different experts on different compute devices, allowing expert parameters that cannot fit on a single device to be stored in a distributed manner. This step moved MoE from a research prototype toward engineering usability.
2021: Simplification of routing strategies. Subsequent work attempted to simplify Top-k routing so that each input selects only one expert. The routing logic becomes simpler, communication volume is lower, and acceptable results are maintained on most tasks. This type of simplification noticeably lowered the barrier to training and deploying MoE.
2023 to present: Large-scale application. MoE has been widely used in large language models and multimodal systems. In 2025–2026, MoE models with parameter counts reaching the trillion level have begun to appear in the industry, and they have been applied in scenarios such as embodied intelligence, healthcare, industrial manufacturing, and edge devices. At the same time, new compute infrastructure such as supernodes with high-speed interconnects is also developing rapidly to meet the high communication bandwidth requirements of MoE.
5. Major Engineering Challenges
The benefits of MoE come from sparsity, and its costs also mainly come from sparsity. The following four types of problems are most commonly encountered in practice.
5.1 High Inference Memory Usage
Sparse activation reduces computation, but it does not reduce parameter storage. An MoE model with a large total parameter count still needs to keep all expert weights in accessible memory, even if only a small number of experts are used each time. If experts are distributed across multiple accelerators, cross-device parameter loading and scheduling must also be handled.
Common approaches include low-bit quantization of expert weights, offloading cold experts to slower but larger storage tiers based on access frequency, and sharding weights across multiple devices through expert parallelism.
5.2 High Distributed Communication Overhead
In expert parallelism mode, each token must first be sent to the device hosting its assigned expert, and the result must be collected after computation. This process usually appears as all-to-all data exchange, and communication volume grows with the number of tokens and the value of k. When communication latency exceeds computation time, accelerators sit idle for long periods, and overall efficiency drops.
Mitigation ideas include reducing the number of experts per token (for example, from 2 to 1), overlapping communication with computation, using high-bandwidth intra-node interconnects, and adopting more compact data layouts when necessary.
5.3 Load Imbalance and Routing Collapse
If the gating network consistently assigns most tokens to a small number of experts, those experts become overloaded while the remaining experts receive almost no training. This phenomenon is called routing collapse. It wastes parameter capacity and slows distributed training because the workload differs greatly across devices.
There are three common categories of remedies. The first is to add an auxiliary loss to the loss function to encourage each expert to receive a roughly uniform number of tokens. The second is to set a capacity limit for each expert, with tokens exceeding the limit being dropped or routed to backup experts. The third is to add a small amount of random noise to the gating output to help routing explore more combinations in the early stage of training.
5.4 Fine-Tuning Is Difficult
Fine-tuning an MoE model is more complex than fine-tuning a dense model. Small task datasets may activate only a few experts, leaving the remaining experts unupdated and making the model’s performance on the target task unstable. Directly fine-tuning the routing network can also easily damage the existing specialization structure.
In practice, the following strategies are commonly used: freeze the gating network and update only the experts that are activated frequently; or insert low-rank adaptation modules beside expert layers to reduce the number of trainable parameters; and monitor the activation distribution of each expert on the fine-tuning data to confirm that no obvious collapse has occurred.
6. Deployment and Practical Recommendations
When choosing or building an MoE system, the following checklist can be used.
- Clarify constraints first. Determine whether the bottleneck is memory, bandwidth, or latency. When memory is tight, prioritize quantization and expert offloading. When latency is sensitive, prioritize reducing the value of k and optimizing communication.
- Monitor routing metrics. Continuously record each expert’s token share, routing entropy, and drop rate. If one expert’s share remains several times higher than the average for a long period, check the auxiliary loss weight or capacity settings.
- Validate parallel strategies in stages. First verify model quality on a single machine, then scale to multi-machine expert parallelism. At each expansion step, compare throughput and accuracy to confirm that gains come from parallelism itself rather than numerical differences.
- Keep a dense baseline. For a new task, keep a dense model with a comparable number of active parameters as a control. Switch to the main MoE solution only after both quality gains and cost benefits have been confirmed.
- Design for fault tolerance. When experts are distributed across multiple devices, a single node failure affects the availability of some experts. Prepare checkpoint saving, replica recovery, and degradation paths for inference.
7. Summary and Outlook
Mixture of Experts separates parameter scale from per-inference computation through conditional computation. Its benefits depend on routing quality, load balancing, and communication efficiency. A weakness in any of these three areas can offset the advantages brought by sparsity.
Future development directions are mainly concentrated in three areas: more stable routing training methods, parallel strategies with lower communication overhead, and smaller expert structures for edge devices. For engineering teams, understanding the sparse nature of MoE and the system complexity it introduces is more important than simply pursuing parameter scale.
