Mixture of Experts (MoE): Sparse Activation for Capacity and Efficiency
Mixture of Experts (MoE) is a conditional computation architecture that decouples model capacity from per-token computation through gating and sparse expert activation. This article explains the core routing mechanism, illustrates a simple forward pass, reviews the development timeline, and outlines key challenges in inference memory, distributed training communication, and load balancing.
1. Concept and Basic Idea
Mixture of Experts (MoE) is a conditional computation architecture. The model contains multiple subnetworks called “experts,” along with a gating network, also known as a router. For each input, the gating network first scores the experts, then activates only the few experts with the highest scores to participate in computation, while the remaining experts stay idle.
The key to this design is that it separates two metrics that are usually tied together. The first is the model’s total parameter count, which determines model capacity and the scale of knowledge it can store. The second is the amount of computation in a single forward pass, which determines inference cost and training speed. In a dense model, every parameter participates in every computation, so these two metrics grow almost in tandem. MoE breaks this coupling through sparse activation, allowing a model to have many total parameters while using less computation per pass.
A divide-and-conquer perspective is also useful for understanding MoE. During training, different experts gradually develop the ability to handle different input patterns, and the gating network dispatches inputs to the appropriate experts. The overall effect is close to “divide and conquer.”
2. Core Mechanism: Gating Routing and Sparse Activation
The entire forward process can be divided into three steps.
1. Gating network scoring
For an input vector x, the gating network is usually a linear layer that outputs N scores (logits), where N is the number of experts. After softmax normalization, it produces a weight probability for each expert.
2. Top-k selection
Only the k experts with the highest weights are retained, with common values being 1 or 2. After selection, the retained weights are usually renormalized so that they sum to 1.
3. Weighted combination
The selected experts each compute their outputs, which are then summed according to the normalized weights to produce the final output of that layer.
Below is an illustrative implementation in pure Python. dot and softmax are common vector-operation helper functions. The code is intended only to explain the logic and does not represent any specific implementation.
def moe_forward(x, gate_weights, experts, top_k=2):# 1. The gating network scores each expert and converts scores to probabilitieslogits = [dot(x, w) for w in gate_weights]probs = softmax(logits)# 2. Select the top_k experts with the highest scorestopk_idx = sorted(range(len(probs)), key=lambda i: probs[i], reverse=True)[:top_k]# 3. Compute only the selected experts and combine them by normalized weightsnorm = sum(probs[i] for i in topk_idx)out = [0.0] * len(x)for i in topk_idx:y = experts[i](x)w = probs[i] / normout = [o + w * v for o, v in zip(out, y)]return out
This logic reflects two important points. First, unselected experts do not perform any forward computation at all, which is the source of compute savings. Second, the gating weights are differentiable, so the gating network can be trained together with the experts through gradient descent.
Consider an MoE layer with 8 experts, assuming each expert has P parameters. The total expert parameters in this layer are approximately 8P, but each token activates only top-2, so the expert parameters actually involved in computation are approximately 2P. Compared with a dense layer that activates only 2P parameters, this layer expands parameter capacity by four times while keeping single-pass computation essentially unchanged. This calculation does not include shared parts such as attention layers and embedding layers.
3. Development Timeline
1991: Origin of the idea. A classic paper proposed an adaptive local mixture-of-experts method, training a system composed of multiple independent networks, each handling a subset of the training data, with a gating network determining the assignment rules. Compared with traditional models, the method required about half the number of training iterations to reach the target accuracy.
2017: Entry into mainstream deep learning. Researchers embedded MoE layers into recurrent neural networks for large-scale language modeling and machine translation. Experiments showed that model capacity could be significantly increased with limited growth in computational cost. This work laid the foundation for later applying MoE in Transformers.
2020: Distributed training becomes key. A research team proposed the concept of expert parallelism, placing different experts on different computing devices and solving the problem that a single device cannot hold all expert parameters. During the same period, some research extended MoE to a translation model with more than 600 billion parameters.
2021: Simplified routing strategies. New approaches routed each token to only one expert, reducing communication overhead and implementation complexity and making MoE easier to deploy in Transformers.
2023 onward: Broad adoption. MoE was widely used in very large-scale language models and multimodal systems.
2025–2026: Scaling and industrial deployment. Trillion-parameter MoE models began to emerge, and application areas expanded to embodied intelligence, healthcare, industrial manufacturing, and edge devices. In summer 2026, multiple trillion-level MoE models were open-sourced in succession. At the same time, new computing infrastructure such as super nodes emerged for MoE training and deployment needs.
4. Key Challenges and Mitigation Approaches
4.1 Memory Pressure During Inference
MoE inference memory is determined by the total parameter count rather than the number of activated parameters. Even if only a few experts are used in a single pass, the weights of all experts must remain resident in GPU memory or in quickly accessible memory. Common approaches include distributing experts across multiple accelerators, quantizing expert weights to reduce the footprint of each expert, and loading experts on demand with caching strategies when resources are tight.
4.2 Communication Overhead in Distributed Training
Under expert parallelism, tokens need to be sent to the corresponding devices according to routing results and then returned to the original devices after computation. This all-to-all communication involves a large volume of data and can easily become a training bottleneck. Optimization directions include reducing the precision of communicated data, overlapping communication with computation, restricting routing targets to the same node where possible, and using high-bandwidth interconnect super-node architectures.
4.3 Load Imbalance
The gating network may repeatedly select a small number of popular experts, causing some devices to become overloaded.
