A mixture of experts (MoE) is a neural network layer made of many smaller sub-networks, called experts, plus a router that sends each token to only a few of them. The model can hold a huge number of parameters while using only a small fraction for any single token.
That is how Kimi K2 has 1 trillion parameters but activates 32 billion per token, and why most of the largest open models released in 2025 and 2026 are MoE designs.
This guide explains the idea in seven diagrams and charts: how the router decides, why “total” and “active” parameters are different numbers, what goes wrong when experts are used unevenly, and what MoE costs you in memory and engineering.
It also includes a small routing simulation I ran to show load imbalance and the bias-based fix used in DeepSeek-V3.

Key takeaways
- A mixture of experts replaces one big feed-forward layer with many small experts and a router that picks a few per token.
- Compute per token follows the active parameters; memory follows the total parameters. DeepSeek-V3 activates 37B of its 671B parameters.
- Routers tend to overload a few experts. In my simulation, plain top-k routing gave the busiest expert twice its fair share and dropped 24% of assignments at capacity factor 1.0.
- A simple per-expert bias, the approach DeepSeek-V3 describes, cut that to 2% in the same simulation.
- MoE suits large-scale serving with plenty of GPU memory. For a single consumer GPU, a dense model of the same active size is usually easier.
What is a mixture of experts?
A mixture of experts is a way to make a model bigger without making every prediction more expensive. A dense model runs every parameter for every token. An MoE model keeps many parallel experts and runs only the few that the router picks.
The idea is old. Jacobs, Jordan, Nowlan and Hinton described “adaptive mixtures of local experts” in 1991. The modern version starts with Shazeer and colleagues in 2017, who placed a sparsely gated MoE layer between LSTM layers and trained models with up to 137 billion parameters. Google’s Switch Transformer in 2021 simplified routing to one expert per token and scaled to 1.6 trillion parameters.
MoE reached a wide audience with Mixtral 8x7B in December 2023. Since then it has become the default for the largest open-weight language models.
Mixture of experts in one table
| Term | Meaning |
|---|---|
| Expert | a small feed-forward network; there are many per MoE layer |
| Router (gate) | a small layer that scores every expert for each token |
| Top-k | the number of experts each token is sent to |
| Total parameters | all weights in the model, every expert included |
| Active parameters | the weights used for one token |
| Shared expert | an expert every token uses, alongside the routed ones |
| Load balancing | techniques that keep tokens spread across experts |
| Capacity factor | how many tokens each expert may accept in a batch, relative to an even share |
Idea 1: a mixture of experts replaces the feed-forward layer

In a transformer, each block has an attention layer and a feed-forward network (FFN). The FFN holds most of the parameters. In a Llama 3 8B shaped block, for example, the FFN has about 176 million parameters against 42 million in attention. Our transformer architecture guide breaks this down.
An MoE transformer keeps the attention layer as it is and swaps the single FFN for a set of experts:
- Dense block: every token goes through the same FFN.
- MoE block: a router looks at the token, picks k experts, sends the token through those experts and adds their outputs together, weighted by the router’s scores.
Attention stays dense because every token must still exchange information with the others. The experts specialise the per-token processing, which is where most of the parameters, and most of the stored knowledge, live.
Idea 2: the router picks a few experts per token

The router is usually a single linear layer. For each token it outputs one score per expert. The routing step then runs like this:
- Score: multiply the token’s vector by the router weights to get one number per expert.
- Select: keep the k highest scores (k = 2 in Mixtral, 8 in DeepSeek-V3 and Qwen3, 4 in gpt-oss).
- Weight: turn the kept scores into weights with a softmax (or a sigmoid, in DeepSeek-V3).
- Compute: send the token through each chosen expert.
- Combine: add the experts’ outputs, each multiplied by its weight.
In code, the core of a router is only a few lines:
import numpy as np
def route(x, W_router, k=2):
scores = x @ W_router # one score per expert, per token
top = np.argsort(-scores, axis=1)[:, :k] # the k best experts for each token
picked = np.take_along_axis(scores, top, axis=1)
weights = np.exp(picked) / np.exp(picked).sum(1, keepdims=True) # softmax over the chosen k
return top, weights # which experts, and how much each counts
The router is trained along with the rest of the model. Experts that turn out useful for certain tokens get chosen for them more often, and they become better at those tokens, a feedback loop that leads to specialisation.
Do experts specialise in topics?
Less than the name suggests. The Mixtral paper looked for topic-based patterns and reported that it did “not observe obvious patterns in the assignment of experts based on the topic”, with only small differences for a synthetic maths dataset. Expert choice tracked syntax more than subject, and consecutive tokens often went to the same expert. An “expert” is a learned slice of computation, not a biology expert or a coding expert.
Shared experts and fine-grained experts
DeepSeek introduced two refinements that many newer models copy:
- Fine-grained experts: instead of 8 large experts, use many small ones (256 routed experts in each DeepSeek-V3 MoE layer) and activate more of them per token. More combinations give the router finer control.
- Shared experts: one or more experts that every token always uses. They capture common knowledge, so routed experts do not all have to learn it again.
DeepSeek-V3 combines both: 1 shared expert and 256 routed experts per MoE layer, with 8 routed experts active for each token.
Idea 3: total parameters are not active parameters

This is the single most useful fact about any mixture of experts model. The headline size tells you how much memory the model needs. The active size tells you roughly how much compute each token costs.
| Model | Released | Total parameters | Active per token | Active share |
|---|---|---|---|---|
| Mixtral 8x7B | Dec 2023 | 47B | 13B | 28% |
| DeepSeek-V3 | Dec 2024 | 671B | 37B | 5.5% |
| Qwen3-235B-A22B | 2025 | 235B | 22B | 9.4% |
| Kimi K2 | Jul 2025 | 1T | 32B | 3.2% |
| gpt-oss-120b | Aug 2025 | 117B | 5.1B | 4.4% |
| DeepSeek-V4-Flash | Apr 2026 | 284B | 13B | 4.6% |
| DeepSeek-V4-Pro | Apr 2026 | 1.6T | 49B | 3.1% |
The trend is clear. Early MoE models activated over a quarter of their weights. Recent ones activate 3% to 5%, using many more, smaller experts.
A useful rule of thumb: a forward pass costs about 2 floating-point operations per active parameter per token. DeepSeek-V3 therefore needs roughly 74 billion operations per token, about the same as a 37B dense model, while storing the knowledge capacity of a much larger one.
What this means for training cost
Because compute tracks active parameters, MoE models are cheap to train for their size. The DeepSeek-V3 technical report states that full training took 2.788 million H800 GPU hours for a 671B-parameter model trained on 14.8 trillion tokens. Kimi K2 was pre-trained on 15.5 trillion tokens with 32B active parameters. A dense model with the same total size would cost many times more per token.
Idea 4: routers overload some experts
Left alone, the router in a mixture of experts layer tends to favour a handful of experts. Popular experts get more training, which makes them better, which makes the router pick them even more often. Meanwhile other experts barely learn anything. This is called routing collapse, and it wastes most of the model’s capacity.
It also causes a hardware problem. Experts are spread across GPUs. If one expert receives three times its share of tokens, the GPU holding it becomes the bottleneck while others sit idle.
A small routing simulation
To show the effect, I simulated an MoE layer with 32 experts and top-4 routing. Tokens came from six clusters of similar vectors (standing in for patterns in real text), and the router weights were random. No training was involved; this measures routing behaviour only. I ran 200 batches of 4,096 tokens each and measured the last 50.
| Measure | Plain top-k routing | With bias balancing |
|---|---|---|
| Busiest expert, as a multiple of its fair share | 2.00x | 1.10x |
| Quietest expert, as a multiple of its fair share | 0.14x | 0.90x |
| Assignments dropped at capacity factor 1.0 | 24.3% | 2.0% |
| Dropped at capacity factor 1.25 | 13.6% | 0.0% |
| Dropped at capacity factor 1.5 | 5.8% | 0.0% |
| Dropped at capacity factor 2.0 | 0.1% | 0.0% |

With plain routing, the busiest expert got twice its share while the quietest got 14%. When each expert can only accept its fair share of tokens (capacity factor 1.0), the overflow gets dropped: almost a quarter of all token-expert assignments in this simulation. Raising the capacity limit reduces drops, but every extra slot is memory and compute reserved in case it is needed.
Idea 5: how models balance the load

There are three main ways to keep experts evenly used.
Auxiliary balancing loss
The classic fix, used from Shazeer’s 2017 layer through Switch Transformer and many later models, adds an extra term to the training loss that penalises uneven routing. It works, but the extra loss competes with the main goal of predicting the next token, and setting its strength is a balancing act of its own.
Capacity limits and token dropping
Switch Transformer used a capacity factor. Tokens that overflow an expert skip the MoE layer and pass through the residual connection unchanged. It keeps hardware busy evenly, but dropped tokens get less processing, so the capacity factor trades quality for speed.
Bias-based balancing without an extra loss
DeepSeek-V3 introduced an “auxiliary-loss-free” strategy. Each expert gets a bias that is added to its router score only when choosing the top-k experts, not when weighting their outputs. After each step, the bias of an overloaded expert goes down a little and the bias of an underloaded expert goes up.
My simulation used exactly this rule with a step size of 0.02, and it reduced the spread from 0.14x to 2.00x down to 0.90x to 1.10x. Dropped assignments at capacity factor 1.0 fell from 24.3% to 2.0%. Because the bias only affects which experts are chosen, it changes routing without adding a competing term to the training loss.
Idea 6: a mixture of experts trades compute for memory and networking
Sparse activation is not free. You pay in three places.
Memory
Every expert must be loaded, even though each token uses a few. The weights of a 671B model take about 671 GB at 8 bits per weight, more than eight 80 GB GPUs can hold. A dense 37B model at the same precision needs 37 GB.
| What you need | Driven by |
|---|---|
| GPU memory for weights | total parameters |
| Compute per token | active parameters |
| Memory bandwidth during generation | active parameters, plus overhead for scattered experts |
| Network traffic between GPUs | number of experts per token and how experts are spread |
Quantisation helps. OpenAI stored gpt-oss-120b’s expert weights in the 4-bit MXFP4 format, which lets the 117B model run on a single 80 GB GPU. DeepSeek-V4 trained its experts in FP4 and most other parameters in FP8.
Networking

Large MoE models use expert parallelism: different experts live on different GPUs. Each MoE layer then needs two rounds of all-to-all communication, one to send tokens to their experts and one to bring the results back. On slow interconnects this communication can dominate the step time, which is why MoE training and serving favour tightly connected GPU clusters.
Engineering complexity
MoE adds more to tune and more to go wrong: routing stability, load balancing, capacity settings, expert placement and quantisation of many small matrices. Fine-tuning can also unsettle the router if the new data routes very differently from the pre-training data.
Idea 7: when to choose a mixture of experts
The MoE versus dense decision depends on who runs the model and on what hardware.
| Situation | Better fit | Why |
|---|---|---|
| Serving many users from a GPU cluster | MoE | high throughput per unit of compute, memory spread over many GPUs |
| Training the most capable model for a fixed compute budget | MoE | more parameters for the same training cost |
| Running locally on one consumer GPU | dense | all weights must fit in limited memory |
| Edge and mobile devices | dense | memory is the tightest constraint |
| Fine-tuning on a small budget | dense, or a small MoE | fewer moving parts, more predictable |
| Low-latency serving of one request at a time | depends | few active weights help, scattered expert reads hurt |
For a reader running models at home, the practical lesson is to look at both numbers on the model card. A “30B-A3B” model needs memory for 30 billion parameters and runs about as fast as a 3B dense model. Our guide to open-weight vs open-source models covers the licence side of choosing one.
Reading mixture of experts model names and cards
Model names now often encode the mixture of experts layout, and the model card fills in the rest. A few patterns are worth knowing:
| Name or field | What it tells you | Example |
|---|---|---|
| “8x7B” | number of experts and the size of a model built from one expert | Mixtral 8x7B: 8 experts, 47B total because attention is shared |
| “235B-A22B” | total parameters and active parameters | Qwen3-235B-A22B: 235B total, 22B active |
| num_experts or n_routed_experts | routed experts per MoE layer | 256 in DeepSeek-V3 |
| num_experts_per_tok | top-k, experts used per token | 8 in DeepSeek-V3 and Qwen3 |
| n_shared_experts | experts every token uses | 1 in DeepSeek-V3 |
| moe_intermediate_size | width of each expert | small values signal fine-grained experts |
The “A” format, total then active, is the most useful convention to come out of the mixture of experts boom, because it puts both numbers that matter in the name.
Fine-tuning a mixture of experts model
Fine-tuning works much as it does for dense models, with a few extra things to watch:
- Memory: even parameter-efficient methods such as LoRA need the full model loaded, so plan for the total size, not the active size.
- Router stability: if your data is very different from the pre-training mix, routing can shift sharply. Many recipes freeze the router or keep a small balancing term during fine-tuning.
- Which weights to adapt: adapters on attention layers are cheap and safe; adapting every expert multiplies the adapter count.
- Evaluation: check that general skills have not dropped, since a narrow dataset can push most tokens through a few experts.
For most teams, a mixture of experts model is something to run and lightly adapt rather than to train from scratch. Pre-training one well needs the routing, balancing and networking work described above at a scale few organisations have.
How mixture of experts models are evaluated
Comparing MoE and dense models fairly is harder than it looks, because “size” means two things. When you read a benchmark claim, check which comparison is being made:
- Same total parameters: the MoE model usually loses slightly, because each token sees fewer weights.
- Same active parameters (same compute per token): the MoE model usually wins clearly, because it has far more capacity.
- Same training compute: the question most labs care about, and the one where MoE has driven the largest models since 2024.
- Same memory: the question that matters for local users, where dense models often come out ahead.
Mixtral’s paper illustrates the second comparison: it reported matching or beating Llama 2 70B on most benchmarks while using about 5 times fewer active parameters.
Common misconceptions about mixture of experts models
- “An 8x7B model is eight separate 7B models.” Only the feed-forward layers are duplicated; attention and embeddings are shared, which is why Mixtral 8x7B has 47B parameters, not 56B.
- “Each expert is a subject specialist.” Studies such as the Mixtral paper found routing follows syntax and token patterns more than topics.
- “MoE models are cheaper to run everywhere.” They are cheaper in compute, not in memory.
- “Only giant models use MoE.” Small MoE models with a few billion active parameters exist for laptops and servers with modest GPUs.
- “The router is a separate model.” It is just a layer inside each MoE block, trained with everything else.
A short history of mixture of experts
| Year | Milestone |
|---|---|
| 1991 | Jacobs, Jordan, Nowlan and Hinton propose adaptive mixtures of local experts |
| 2017 | Shazeer and colleagues train sparsely gated MoE layers with up to 137B parameters |
| 2021 | Switch Transformer routes each token to a single expert and reaches 1.6T parameters |
| 2023 | Mixtral 8x7B brings an open MoE model to a wide audience |
| 2024 | DeepSeek-V3: fine-grained and shared experts, auxiliary-loss-free balancing |
| 2025 | Qwen3, Kimi K2 and gpt-oss make MoE the norm for large open models |
| 2026 | DeepSeek-V4 reaches 1.6T parameters with 49B active and FP4 experts |
FAQ
What is a mixture of experts in simple terms?
It is a model layer with many small sub-networks and a router. For each token, the router picks a few sub-networks to use and ignores the rest. The model can store far more knowledge than it uses on any single token, which keeps each prediction fast.
How is a mixture of experts different from an ensemble?
An ensemble runs several complete models and averages their outputs. A mixture of experts is a single model in which each token passes through only a few experts inside each layer, and the router learns which ones to use. An ensemble multiplies cost; MoE keeps cost close to that of the active part.
Why do MoE models need so much memory?
All experts must be in memory because any token might be routed to any expert. Memory therefore scales with total parameters. DeepSeek-V3 needs storage for 671B parameters even though each token uses 37B.
Is GPT a mixture of experts model?
OpenAI’s open-weight gpt-oss models are MoE models: gpt-oss-120b has 117B total parameters, 5.1B active, with 4 experts per token. OpenAI has not published architecture details for its closed GPT models.
Can I run a mixture of experts model on my own GPU?
Smaller ones, yes. Check the total parameter count to see whether the weights fit in memory after quantisation, then use the active count to estimate speed. A 30B-total model with 3B active can run on a single consumer GPU at 4-bit precision, while trillion-parameter models need multi-GPU servers.
What to remember about mixture of experts
A mixture of experts lets a model be big and fast at the same time by running only a few experts per token. The cost moves from compute to memory and networking, and the hard part is keeping experts evenly used. If you remember one thing, make it the two numbers: total parameters decide where the model can run, active parameters decide how fast it runs there.
For the architecture underneath MoE layers, start with our transformer architecture guide, and for a learning plan that covers both, see the deep learning roadmap for 2027.


