AI Glossary / Generative AI and language / Intermediate
Mixture of experts
Definition
A mixture of experts, or MoE, is a model design that combines multiple component networks called experts through a gating or routing mechanism. In a sparse MoE, only a selected subset of experts processes a particular input or token. This can increase the model's total parameter capacity without requiring every parameter to participate in every computation.
What it means
The word expert describes a learned computational component, not necessarily a named subject specialist. One expert is not automatically the mathematics department and another the marketing department. Routing may reflect patterns that do not align neatly with human categories. MoE is a broader concept than its use in language models; in modern language-model architectures, expert networks often replace some feed-forward layers. Shared attention and other components still process tokens. Consequently, a model can have many total parameters while using fewer active parameters for each token, and both figures matter when describing it.
How it works
At an MoE layer, a router computes scores for the available experts from an input representation. A sparse routing rule selects one or several experts, which transform that representation. Their outputs are combined according to the design, often using router-derived weights. Training learns both useful expert transformations and routing behavior. Practical implementations must manage how much work reaches each expert: if nearly every token chooses the same expert, capacity and efficiency can suffer. Models may use balancing objectives, capacity limits, or other routing mechanisms. When experts reside on different devices, sending tokens to the selected experts introduces communication costs. Sparse arithmetic therefore does not automatically imply low latency.
Three practical examples
- A language-model developer adds sparse expert layers to explore higher parameter capacity within a particular computation budget.
- A serving team compares dense and MoE models using real request sizes, because routing and device communication can affect throughput differently.
- A researcher inspects routing patterns across domains to understand whether experts specialize, while avoiding unsupported assumptions that each expert has a single human-readable skill.
Think of it this way
Think of a workshop that sends each item to selected workstations instead of passing every item through every station. The workshop has more available equipment than any one item uses. This illustrates conditional computation. The analogy has limits: neural experts are mathematical transformations learned during training, and their roles may overlap. Routing to an expert does not give the system a human professional's judgment or guarantee that the most appropriate real-world expertise has been consulted.
Worked example
Imagine a simplified MoE layer with eight experts, each containing ten million parameters, plus a router whose size we temporarily ignore. The experts together contain eighty million parameters. If each token is sent to two experts, twenty million expert parameters participate for that token at this layer. This is one quarter of the layer's expert parameters, but it does not mean the whole model needs only one quarter of the memory or takes one quarter of the time. All eight experts may still need to be stored, and the model also contains shared layers, routing, activations, and communication. For a toy output calculation, suppose the two selected experts return scalar values 4 and 10 with normalized weights 0.75 and 0.25. Their weighted output is 0.75 times 4 plus 0.25 times 10 = 5.5. Real expert outputs are usually vectors, and routing-weight conventions vary by implementation.
Illustrative case study
Fictional case: Willow Systems evaluates an MoE model for a document assistant. The advertised active-parameter count suggests a manageable computation load, but the deployment team discovers that storing and distributing all experts changes its hardware requirements. It benchmarks short interactive requests and larger batches separately, then examines whether quality remains acceptable on its document collection. The team chooses based on measured quality, cost, and latency rather than total parameters alone. The case illustrates a deployment assessment, not a claim that sparse models are always faster or slower than dense alternatives.
Common misconceptions and mistakes
A common misconception is that sparse activation means unused experts can simply be deleted without affecting other inputs. Those experts may be needed by different tokens. Another is treating expert count as a direct measure of intelligence or subject coverage. MoE also differs from asking several independent chatbots to produce complete answers and then choosing one. The latter is a system-level ensemble; an MoE layer combines internal computations within a model. Finally, a larger total parameter count does not guarantee better task performance. Training data, optimization, routing, architecture, and evaluation conditions all matter.
Business use
When assessing an MoE system, request separate descriptions of total parameters, active computation, memory needs, and measured serving performance. Compare models on the same task set and realistic traffic patterns. Examine the effects of batch size, context length, device topology, and routing balance. If experts are distributed, include communication overhead in the measurement. Treat claimed specialization as a hypothesis to test, particularly when it is used to justify business reliability. Operational simplicity can be valuable, so the benefit of added capacity should be weighed against the complexity of training and deployment.
People also ask
Are all mixture-of-experts models sparse?
No. Mixtures can combine many or all expert outputs; sparse designs deliberately activate a subset.
Does an expert correspond to a whole separate language model?
Not necessarily. In common sparse Transformer designs, it may be a feed-forward subnetwork inside a layer.
Can a token use different experts in different layers?
Yes, depending on the architecture and router decisions. Routing need not assign an entire conversation permanently to one expert.
Check your understanding
A model has 100 billion total parameters and activates 20 billion per token. Can its weight-storage requirement automatically be calculated as though it contained only 20 billion parameters?
Answer: No. The inactive experts still exist and may be needed for other tokens. Storage depends on the full model, numeric formats, and deployment strategy.
Related terms
- Feed-forward network
- Model capacity
- conditional computation
- router
- sparse activation
- dense model
- expert parallelism
- load balancing
Learn next
Draw one layer with a router and four experts. Route several imaginary tokens and count how many each expert receives. Then distinguish arithmetic work from storage and communication, which helps explain why balanced routing and hardware layout affect practical performance.
More in Generative AI and language
- Machine translation - Machine translation is the automatic conversion of text or speech content from one human language into another by a computer system.
- Masked language model - A masked language model is a language model trained to predict selected hidden or corrupted tokens using the surrounding text.
- Masked language modeling - Masked language modeling is a self-supervised training task in which selected tokens in a text are hidden or altered and a model learns to predict their...
- Model Quantization - Model quantization represents a model's numerical values using a more limited set of values, often with fewer bits than the original representation.
- Modular Language Model - A modular language model is a language-model design organized around distinct components that can be selected, combined, adapted, or replaced through a...
- Monte Carlo sampling - Monte Carlo sampling uses random draws from specified probability distributions to explore a system or estimate a numerical quantity.
Sources
Shazeer and colleagues, Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer: https://arxiv.org/abs/1701.06538 Fedus, Zoph, and Shazeer, Switch Transformers: https://arxiv.org/abs/2101.03961
Previous: Mixture of conjugate priors Next: Mixture of factor analyzers