Definition
Mixture of Experts (MoE)
Updated
What is Mixture of Experts (MoE)?
Mixture of Experts (MoE) is a specialized deep learning architecture designed to make large-scale artificial intelligence models more efficient. In a standard, or “dense,” transformer model, every part of the model processes every piece of incoming data. That works, but it is computationally expensive and slow. MoE changes the equation by replacing dense feed-forward layers with multiple smaller, specialized sub-networks known as “experts.” A learned routing mechanism then acts as a traffic controller, selectively activating only the most relevant experts for any given input.
MoE allows a model to be massive in total size while remaining lean and fast in its daily operation.
A Hospital Analogy
To understand how this works, imagine a busy hospital emergency room. In a traditional “dense” model, you might have one general practitioner who tries to handle every single patient—broken bones, heart conditions, neurological issues, all of it. That doctor would be overwhelmed and inefficient.
In an MoE system, the hospital is staffed by a team of specialists: a cardiologist, an orthopedist, a neurologist, and so on. When a patient arrives, a triage nurse assesses the situation and directs the patient to the specialist best equipped to help. Crucially, this triage nurse is not following a static rulebook—they are learned, meaning the routing decisions improve as the model trains. The hospital as a whole holds a vast amount of medical knowledge, but each patient only interacts with one or two doctors. This is exactly how MoE works: the model stores knowledge across many experts, but only draws on a small fraction of that knowledge for any specific request.
How It Works: Routing and Conditional Computation
The key idea behind MoE is what researchers call “conditional computation.” Because the model does not need to activate every parameter for every token (the basic units of text it processes), it can achieve much larger total parameter counts without a proportional increase in computing power.
The router is a small learned network that decides, in real time, which experts should handle incoming data. Some architectures use “top-1” routing, where only one expert is chosen per token. Others use “top-2” routing, where the two most relevant experts collaborate. The Switch Transformer (Fedus et al., 2021) showed that even top-1 routing works well, simplifying the system while preserving quality.
The Evolution of MoE
While the concept might feel modern, its roots go back to 1991, when Jacobs et al. introduced “Adaptive Mixtures of Local Experts” (Neural Computation, 1991). The idea was simple: let separate networks specialize in different parts of the problem, and train a gating function to choose between them.
The architecture gained real traction as researchers looked for ways to scale large language models beyond the limits of available hardware. In 2017, Shazeer et al. (arXiv, 2017) demonstrated that sparsely-gated MoE layers could scale to 137 billion parameters, achieving over 1,000x improvement in model capacity. GShard (Lepikhin et al., 2020) pushed MoE Transformers beyond 600 billion parameters for multilingual translation. Switch Transformers (Fedus et al., 2021) simplified routing and scaled to 1.6 trillion parameters, achieving a 4x pre-training speedup.
More recently, Mixtral 8x7B (Jiang et al., 2024) demonstrated that a 47-billion-parameter MoE model could match or beat much larger dense models while using only 13 billion active parameters per token. DeepSeekMoE (Dai et al., 2024) refined the approach further with fine-grained expert segmentation—splitting experts into smaller, more specialized units—and shared expert isolation to reduce redundancy.
Why MoE Matters for Scaling
MoE is a cornerstone of modern AI scaling because it breaks the link between model size and computational cost. In a dense model, doubling the knowledge often means doubling the compute required for every interaction. With MoE, you can increase the total number of parameters—letting the model store more information—without making every interaction proportionally slower. This efficiency is what makes it practical to run massive models in data centers on GPUs.
Key Trade-offs
MoE offers real efficiency gains, but it is not a free lunch. There are several challenges engineers must navigate:
- Memory Requirements: Even though only a few experts are active at once, the entire model—all experts—must be loaded into memory. MoE models therefore require significant VRAM (video memory), which can be a bottleneck for deployment.
- Fine-tuning Complexity: MoE models can be more difficult to fine-tune than dense models. They are more prone to overfitting and may require different hyperparameter setups, such as smaller batch sizes and higher learning rates.
- Routing Collapse: Without careful load-balancing, the router can learn to send nearly all traffic to one or two “popular” experts while ignoring the rest. This self-reinforcing pattern—called routing collapse—defeats the purpose of having multiple experts. Modern MoE systems add auxiliary loss functions to encourage balanced expert usage.