How Does Mixture of Experts Work?
A 10-minute read
Mixture of experts replaces one big network layer with many small experts and a router that picks one or two per token, so size grows without more compute.
Mixture of experts works by swapping a transformer’s single feed-forward layer for a bank of many smaller ones, and adding a router that decides for each token which two of them should run. The rest sit dormant. The result is a model whose total parameter count can be enormous while the arithmetic per token stays close to that of a much smaller dense model.
The idea predates the current wave of large language models. In January 2017 a Google Brain team published a sparsely-gated layer that delivered more than a thousand times the capacity of the network around it at almost no extra cost, and by 2021 a spin-off of the same idea had produced GLaM, a 1.2 trillion parameter model trained on roughly a third of the energy GPT-3 had consumed. What changed in 2024 and 2025 was not the concept but the plumbing: better load balancing, cheaper communication between devices, and serving stacks that stopped falling over.
The short answer
Mixture of experts is a way to give a neural network more parameters without giving it more per-token computation. Instead of one large feed-forward network that every token passes through, the layer is replaced with dozens or hundreds of smaller expert networks, and a learned router sends each token to only the top one or two of them. The total parameter count can reach hundreds of billions while the compute per token stays close to a model an order of magnitude smaller.
The full picture
Why scale usually costs compute
A dense transformer uses every parameter on every token. That coupling has been a central constraint for years: making a model smarter usually means making it bigger, and making it bigger usually means paying for more arithmetic on every word it processes. The transformer architecture that modern language models are built on has an attention half and a feed-forward half, and as models scale the feed-forward half takes an increasing share of the work. In large transformers, most of the parameters sit in the feed-forward layers rather than in attention.
That distribution is what makes the trick possible. If the majority of a model’s knowledge lives in feed-forward blocks, you can make those blocks numerous, small and only partially active, and the attention machinery keeps its original shape.
What the router actually does
The router, or gating network, is the smallest and most important piece. It is usually a single linear layer: take the current token’s hidden vector, multiply it by a small matrix, and you get one score per expert. A softmax turns those scores into probabilities, the top k are kept, the rest are set to negative infinity, and the surviving weights are renormalized so they sum to one. Each chosen expert processes the token and the outputs are combined as a weighted sum.
The original sparsely-gated design added random noise to the routing scores during training, which nudges the router to explore experts it would otherwise never pick. That noise is a load balancing tool rather than a curiosity, and the reasons why come up shortly.
Sparsity is measured by k. A value of k equals 1 means one expert per token, and that configuration is the Switch Transformer. Values of 1 and 2 dominate real deployments, because the whole economics of the approach depend on a small k. The Sparse Upcycling paper from 2022 showed that a trained dense model can be converted into a sparse one by initializing each expert as a copy of the original feed-forward layers and adding a randomly initialized router.
Where the parameter counts come from
The numbers are where this stops sounding abstract. GLaM, from Google, reached 1.2 trillion parameters with each sparse layer routing to the top two of 64 experts, roughly seven times the size of GPT-3 while using a third of its training energy and half the inference FLOPs.
Mistral’s Mixtral 8x7B, released in December 2023 under an Apache 2.0 license, is the clearest illustration of the split between what a model holds and what it uses. It has 46.7 billion parameters spread across 8 experts, with the top 2 selected per token. The model card puts it plainly: each token has access to 47 billion parameters but only about 13 billion are active during inference.
DeepSeek-V3 pushed the same trick much further, with 671 billion total parameters and 37 billion activated per token. It was pretrained on 14.8 trillion tokens using 2.788 million H800 GPU hours, and the technical report notes that the team never hit an irrecoverable loss spike or needed to roll back a checkpoint.
Load balancing is the price of admission
Sparse models fail in a specific and unhelpful way: the router develops favorites. A handful of experts accumulate most of the traffic, other experts receive almost nothing, and an expert that receives almost nothing never learns anything useful, which makes it even less likely to be chosen. The failure is self-reinforcing, and the Wikipedia overview of the technique lays out the standard remedy, an auxiliary loss added to the training objective that penalizes imbalanced routing across a batch.
Switch Transformer simplified that to a single loss term and used it well enough to reach up to 7x higher pre-training speed than T5 on identical hardware, and to pretrain models with up to a trillion parameters at a 4x speedup over T5-XXL. A capacity factor bounds the damage: each expert is allowed to process at most c times its fair share of tokens, and the ST-MoE work found that values between 1.25 and 2 work well in practice. Tokens that overflow their expert are dropped, though in a transformer with residual connections a dropped token simply passes through the layer unchanged rather than disappearing.
DeepSeek later offered a cleaner alternative with an auxiliary-loss-free strategy: give each expert a bias term, and adjust the bias up when an expert is neglected and down when it is overloaded. The bias affects which experts get picked but not how their outputs are combined.
The 2026 problems are subtler
The obvious failures are largely solved. The current frontier is the quieter ways a sparse model goes wrong, and recent work has started naming them precisely. One October 2026 study of the Muon optimizer found that using it roughly doubled the spread of the routing biases in the first sparse layer of a model, and that the busiest expert was averaging four to seven times its fair share of tokens shortly after warmup. Subtracting the batch mean from the router’s inputs removed most of the overload within the first 3,000 steps while barely moving the loss.
A companion paper on softmax routing dynamics describes the same disease from the other side: routing probability can concentrate on a subset of experts and stay there, suppressing access to the rest of the pool. Recovery is possible but slow, and the authors show that removing a class-conditional contrast from the router gradient delays it.
There is also a security angle. Researchers have found that fine-tuned sparse models memorize the routing pathway used during training, creating a fingerprint that can be recovered from unconditional generation using only routing and output logits, with no access to the training data. That signature behaves like a membership-inference leak, and it survives fine-tuning.
Experts have to live somewhere
This is what turns an elegant idea into an infrastructure project. When 64 experts are spread across 16 GPUs, a token that needs expert 37 has to travel there and come back, and every token in a batch does this simultaneously. The communication is an all-to-all exchange, and at scale it can cost more than the expert arithmetic it enables. This is why MoE training and serving are usually discussed as expert parallelism, and why libraries such as DeepSpeed-MoE treat the routing problem as a systems problem.
Newer serving work confirms the balance is delicate. One November 2026 systems paper found that the standard trick of prefetching likely experts can actually be counterproductive when a GPU already holds an expert cache, because a fuller cache makes expert prediction less accurate. Scheduling requests well instead of predicting well produced up to 3.46x the decode throughput of llama.cpp on local hardware.
Turning experts off, and the safety cost
Serving engineers have noticed that if two experts per token is enough, maybe one is enough, or maybe the number can adapt to how hard the input looks. The speedups are real: keeping roughly two thirds of the selected experts sped up offline decoding by 15 to 28 percent at batch size 8 in one vLLM test. The SafeStart paper from November 2026 documents the cost. Under a jailbreak prompt that instructs the model not to refuse, cutting experts raised the share of harmful requests the model answered by 18.4 percentage points on Qwen1.5-MoE, 9.5 points on OLMoE and 6.6 points on DeepSeek-V2-Lite, while benchmark accuracy dropped by less than two points. Running all experts for the prompt and the first eight generated tokens, then trimming, restores refusal behavior while keeping most of the speedup.
Why it matters
Sparse models change what a fixed compute budget can buy. GLaM reached roughly seven times GPT-3’s parameter count at a third of the training energy, and DeepSeek-V3 trained a 671 billion parameter model on 2.788 million GPU hours without a single unrecoverable training failure. The DeepSeek-V2 report puts the savings in context: against DeepSeek 67B, the sparse successor cut training costs by 42.5 percent and boosted maximum generation throughput by 5.76 times.
The gains are not only laboratory numbers. Nemotron 3.5 Super and Lightning, released in October 2026, are sparse hybrid Mamba-Transformer models at 120 billion total and 12 billion active parameters for the Super model, and 30 billion total with 3 billion active for Lightning. Super scored 51.78 percent on SWE-bench Pro while using roughly 4.6 times fewer active parameters than the model it beat, and the serving stack reached up to 4,856 output tokens per second per GPU on GB200 hardware while sustaining at least 50 tokens per second for each user.
For a reader, the practical consequence is that the numbers attached to frontier models are no longer comparable. A 671 billion parameter model and a 37 billion parameter model can now produce comparable answers on standard benchmarks, because one is paying for 37 billion parameters of arithmetic per token and the other is paying for 671 billion. Parameter counts, once a rough proxy for capability, have become a statement about memory footprint instead. That also means training cost is no longer the ceiling it was, and the bottleneck has moved to communication and serving, which is a different set of hard problems with different failure modes.
Common misconceptions
“A mixture of experts model is just a big model that is slow to run.” The opposite. The compute per token is set by the number of active parameters, not the total. Switch Transformer reached up to 7x the pre-training speed of T5 on the same hardware while scaling to a trillion parameters, and Mixtral 8x7B matched or beat Llama 2 70B and GPT-3.5 on most evaluated benchmarks despite activating only about 13 billion parameters per token.
“Each expert specializes in a distinct topic.” Experts specialize by statistical properties of the tokens they receive, mostly frequency, position and surface form, and the boundaries are not human-recognizable. There is a related refinement worth knowing: DeepSeek’s DeepSeekMoE architecture splits experts into finer-grained pieces and adds shared experts that are always active, because the team found that forcing every expert to be used equally made them all relearn the same shared capability, such as English grammar. Their 145 billion parameter model matched the 67 billion parameter DeepSeek while using 28.5 percent of the computation.
“If some experts are skipped, the model must be weaker than a dense model of the same size.” A dense model of that size would be several times slower per token, which usually means it cannot be served at all at a given price. And there are routing strategies that invert the usual arrangement: in expert choice routing, experts pick tokens instead of tokens picking experts, each expert holding a fixed-size bucket, and that approach improved training convergence time by more than 2x over both Switch-style top-1 and GShard-style top-2 gating.
Key terms
Router (gating network): The small trained layer that scores experts for a given token and selects the top k. It holds a tiny fraction of the model’s parameters but decides which parts of the model run.
Sparsity (k): How many experts handle each token. A k of 1 is a Switch Transformer, and k of 2 is the most common setting in deployed sparse models.
Active parameters: The subset of parameters that participate in a single forward pass. Mixtral’s 46.7 billion total parameters reduce to roughly 13 billion active per token.
Load balancing loss: An auxiliary training loss that penalizes routers which send most tokens to a few experts, keeping the rest of the pool in use.
Capacity factor: The hard cap on how many tokens one expert may handle in a batch, expressed as a multiple of its fair share. Values between 1.25 and 2 have worked well in practice.
Expert parallelism: The deployment pattern where different experts live on different accelerators, requiring an all-to-all token exchange for every layer.
Shared expert: An expert that is always activated and captures common capability, letting routed experts specialize on the rarer cases. DeepSeekMoE introduced the pattern.
Common questions
Does a mixture of experts model use all of its parameters?
No. Each token is routed to only the top one or top two experts out of the pool, so most of the parameters sit idle on any given forward pass. Mixtral 8x7B has 46.7 billion parameters in total, but each token only activates about 13 billion of them.
Is a mixture of experts just a larger dense model with extra steps?
No. A dense model of the same total size would spend that entire size on every single token. A mixture of experts model keeps the total parameter count high while holding the per-token computation roughly constant, which is how a sparse model with hundreds of billions of parameters can run at the speed of a dense model with far fewer.
Does each expert learn a distinct subject, like grammar or poetry?
Mostly not. Experts tend to specialize by token frequency, position and surface form rather than by any topic a person would recognize. DeepSeek's researchers found that pushing experts toward perfectly equal use made them all relearn the same core capacity, such as English grammar, and proposed always-active shared experts to hold that core instead.
If only some experts run per token, why do mixture of experts models still need a lot of hardware?
Because every token still has to reach the right experts, wherever they happen to live. When experts are spread across many GPUs, each token has to be shuffled between devices, and that all-to-all communication frequently costs more than the arithmetic the experts actually perform.
Are mixture of experts models cheaper to serve than dense models?
The arithmetic is favorable, because the operations per token depend on active parameters rather than total parameters. The memory footprint is a different story, since it is set by the total parameter count. Whether a sparse model is actually cheaper to run depends on batching, interconnect and how well the experts happen to spread across devices.
That's the distilled version.