Lesson 10.7 · 7 of 7 · 7 min read · Reviewed 24 Nov 2026
Mixture-of-experts: total and active parameters
By the end, you can
- Explain how a mixture-of-experts layer routes each token to a few experts.
- Size memory and compute for an MoE model from its total and active parameters.
Every transformerTransformer: The neural network architecture behind modern LLMs, built from stacked attention and feed-forward layers. layer has two parts: attentionAttention: The mechanism that lets each token weigh every other token in the context when building its representation. (10.1) and a feed-forward block, a small network applied to each tokenToken: The unit a model reads and writes: a word, part of a word, a space or a symbol, mapped to an integer id. on its own. In a normal, dense model every token passes through the same feed-forward block, so every parameter does work for every token. A mixture-of-expertsMixture-of-experts (MoE): A model design where each layer has many expert blocks and a router that sends each token to only a few of them. model changes that one part.
How an MoE layer works
token vector
|
router -> scores for 8 experts: [0.02, 0.41, 0.03, 0.05, 0.33, 0.06, 0.04, 0.06]
|
pick the top 2: expert 2 (0.41) and expert 5 (0.33)
|
output = 0.55 x expert2(token) + 0.45 x expert5(token) (weights renormalised over the two)
- The feed-forward block is replaced by many experts, each a feed-forward block of its own. Models use anything from 8 to a few hundred.
- A small router scores every expert for this token.
- Only the top k experts run, often 1, 2 or 8. Their outputs are mixed by the router’s weights.
- The next token, or the same token in the next layer, may pick different experts.
Attention is usually shared, so it still runs for every token. Some designs also keep one shared expert that every token uses, plus the routed ones.
Experts don’t neatly specialise in topics like “maths” or “French”. They tend to pick up finer patterns of tokens. Treat “expert” as a name for a block, not a promise about what it knows.
Total and active parameters
This is the number an architect must read correctly.
| Dense 70B | MoE, 400B total, 20B active (illustrative) | |
|---|---|---|
| Parameters stored | 70B | 400B |
| Parameters used per token | 70B | about 20B |
| Weights at 8-bit | about 70 GB | about 400 GB |
| Compute per output token | 2 x 70B = 140 GFLOPs | 2 x 20B = about 40 GFLOPs |
- Memory follows total parameters. The router can pick any expert for the next token, so all of them must be loaded (30.2). Add the KV cacheKV cache: Stored attention keys and values for tokens already processed, so they are not recomputed for each new token. on top (10.5).
- Compute and speed follow active parametersActive parameters: The parameters a mixture-of-experts model actually uses for each token, as opposed to the total it stores.. Each token does the work of a much smaller model, so an MoE generates faster and serves cheaper per token than a dense model of the same total size, once it fits.
- Quality usually lands between the two. An MoE often matches a dense model larger than its active size, because it holds more knowledge in total.
What this means for builders
- Hosted APIs: MoE is why some very capable models are priced well below what their total size suggests. You don’t manage experts at all.
- Self-hosting: you need the GPU memory for the total, usually across several GPUs. Serving stacks spread experts across devices (expert parallelism), which adds network traffic between GPUs.
- Batching matters more. At small batch sizes each token touches different experts, so a lot of memory is read for little work. ThroughputThroughput: How much work a system completes per unit of time, such as requests per second or tokens per minute. improves as batches grow.
- Local use: a quantisedQuantization: Storing model weights with fewer bits, such as 4 or 8 instead of 16, to cut memory and speed up inference. MoE with few active parameters can run surprisingly fast on a machine with lots of ordinary memory, because speed depends on the active weights read per token.
- Fine-tuningFine-tuning: Continuing to train a model on your own examples to change its behaviour or specialise it.: adapters (29.3) work, but routers can be sensitive. Start from the publisher’s recommended recipe.
Training notes, briefly
Routers tend to send most tokens to a few favourite experts, leaving the rest untrained. Training adds a load-balancing objective or a routingRouting: A workflow pattern that classifies an input and sends it to a specialised prompt, model or handler. rule so tokens spread out, and caps how many tokens each expert takes per batch. Getting this right is a large part of why MoE models are harder to train than dense ones.
Common mistakes
- Sizing hardware from active parameters. A “20B active” model can still need hundreds of gigabytes.
- Comparing models by one number. Ask for both total and active parameters, then compare on your own evalEval: A repeatable test that measures how well an AI system performs on a set of cases with defined success criteria..
- Expecting expert names to mean topics. Routing is learned and rarely maps to human categories.
Key points
- A mixture-of-experts (MoE) model replaces each feed-forward block with many expert blocks and a small router that picks a few experts per token.
- Total parameters set the memory you need; active parameters set the compute per token.
- MoE gives the knowledge of a big model at the per-token cost of a much smaller one, but every expert must still sit in memory.
- Most frontier and many open-weight models are MoE, so read both numbers on a model card.
Size a mixture-of-experts model for hosting
Read total and active parameters from two real model cards and work out memory and compute for each.
You will have: A short table for one dense and one MoE open-weight model: total and active parameters, weight memory at 16, 8 and 4 bits, compute per token, and the smallest GPU setup that holds the weights.
Steps
- Choose one dense and one mixture-of-experts open-weight model and find their total and active parameters on the model cards.
- Work out weight memory at 16, 8 and 4 bits from the total parameters.
- Work out compute per output token as about 2 FLOPs per active parameter.
- Add room for the KV cache at your context length (10.5) and pick a GPU setup that fits.
- Use the 99.7 explorer to check your numbers.
Done when
- Memory is computed from total parameters and compute from active parameters.
- The GPU setup leaves room for the KV cache, not just the weights.
- The table says which model would be faster per token once both fit.
Finished the chapter? Take the chapter check.