Availit World How AI really works, in your language

Lesson 18 of 4618 minFacts checked October 20, 2026

Mixture of experts: huge models that run like small ones

DeepSeek-V4-Pro has 1.6 trillion parameters, yet each token uses only 49 billion of them, about 3 %. That trick, the mixture of experts (MoE), is inside nearly every big open model of 2026, from DeepSeek and Kimi to GLM and gpt-oss. After this lesson, “671B-A37B” will mean something to you, and you will know why a 117-billion-parameter model can run faster on a laptop than a 27-billion one.

In this lesson you will

  • Explain what an expert and a router are, and how a token picks its experts
  • Tell total parameters from active parameters, and what each one costs
  • Explain load balancing, and DeepSeek’s fine-grained and shared experts
  • Run a large MoE model on your own hardware by splitting it between GPU and RAM
On this page
  1. Many small feed-forward blocks instead of one big one
  2. Total parameters and active parameters
  3. Keeping the experts balanced
  4. The DeepSeek recipe: fine-grained and shared experts
  5. Experts on your own computer
  6. A short history
  7. Remember
  8. Check yourself

Many small feed-forward blocks instead of one big one

In a normal, dense transformer, every token goes through every weight of every feed-forward block. A mixture of experts replaces each feed-forward block with many smaller ones, called experts, plus a small router that picks a few experts for each token. The attention part stays the same.

One MoE layer, for one token
  1. The token’s vectorComing out of attention, as in any transformer block
  2. RouterA small matrix gives one score per expert: 256 scores in DeepSeek-V3
  3. Pick the top kKeep only the best few: 8 of 256 in DeepSeek-V3, 4 of 128 in gpt-oss-120b
  4. Run only those expertsEach is an ordinary SwiGLU feed-forward block, just smaller
  5. Weighted sumMix their outputs by the router’s scores, then add to the residual stream
The router in three lines
s = score(W_router · x)

One score per expert. Softmax in most models; DeepSeek-V3 uses a sigmoid for each.

keep the k highest scores, set the rest to 0

This is what makes it sparse: most experts get nothing.

y = Σ s_i · Expert_i(x)

Only the k chosen experts are ever computed.

Try itRoute the tokens

Different tokens pick different experts, and the shared expert sees them all.

This interactive part needs JavaScript.

Total parameters and active parameters

An MoE model has two sizes. Model names often show both: Qwen3-235B-A22B means 235 billion in total, 22 billion active for each token.

Big MoE models, total and active
ModelTotalActive per tokenRouted experts (used per token)Share used
Mixtral 8x7B (2023)47B13B8 (2)28 %
DeepSeek-V3 (2024)671B37B256 (8), plus 1 shared5.5 %
gpt-oss-20b (2025)20.9B3.6B32 (4)17 %
gpt-oss-120b (2025)116.8B5.1B128 (4)4.4 %
DeepSeek-V4-Flash (2026)284B13B256 (6), plus 1 shared4.6 %
DeepSeek-V4-Pro (2026)1.6T49B384 (6), plus 1 shared3.1 %
Kimi K3 (2026)2.8T104B896 (16)3.7 %

From each model’s paper or model card. Attention, embeddings and shared experts are always active, which is why the active share is higher than the share of experts used.

Total parameters decide

  • How much memory you need: every expert must be loaded
  • The file size on disk
  • How much knowledge the model can hold

Active parameters decide

  • The computation per token: about 2 operations per active weight
  • How many bytes are read per token, and so the speed
  • The electricity and price per token

Quick check

DeepSeek-V3 has 671B parameters, 37B active. Compared with a dense 671B model, roughly how much computation does each token need?

Show the answer

Answer: About one eighteenth Computation follows the active parameters: 37 ÷ 671 ≈ 1/18. Memory, though, still has to hold all 671B.

Which size decides it: total or active parameters?

0 of 6 sorted
  • How much memory the model needs

    Answer: Total parameters

  • How much computation each token costs

    Answer: Active parameters

  • The size of the download

    Answer: Total parameters

  • Tokens per second on a memory-bound device

    Answer: Active parameters

  • How much the model can remember from training

    Answer: Total parameters

  • The price per million tokens on an API

    Answer: Active parameters

Keeping the experts balanced

A router left alone tends to collapse: a few experts get slightly better early on, get picked more, learn more, and get picked even more. Soon most experts sit idle, which wastes their memory, and the busy experts become a traffic jam. This is called routing collapse.

  1. The classic fix: an extra loss. Add a penalty to training whenever the load is uneven, as in Switch Transformer. It works, but the penalty pulls against the real goal of predicting text, and too much of it makes the model worse.
  2. DeepSeek’s fix: a bias, not a loss. Give each expert a bias number that is added to its score only when choosing experts. After each training step, lower the bias of experts that were overloaded and raise it for those that were underused. The load evens out, and the training goal is left untouched. DeepSeek-V3 and V4 use this “auxiliary-loss-free” balancing.

The DeepSeek recipe: fine-grained and shared experts

Early MoE models used a few large experts, such as Mixtral’s 8, with 2 picked per token. DeepSeek’s 2024 paper DeepSeekMoE changed two things, and almost everyone copied them.

  • Fine-grained experts. Cut each expert into smaller ones and pick more of them. The computation stays the same, but there are far more ways to combine experts. With 16 experts and 2 picked, there are 120 possible pairs. Split each into 4 (64 experts, 8 picked) and there are 4,426,165,368 combinations.
  • Shared experts. Some knowledge is needed by every token: grammar, common words. Instead of every routed expert learning it again, one or more shared experts always run. The routed experts are then free to specialise.

Experts on your own computer

MoE models are kind to home hardware in one way and hard in another. They are fast, because each token reads only the active weights. But they are large, because all the experts must be somewhere in memory.

Upper speed limit on an Apple M5 Max (614 GB/s)
Qwen3.8-27B, dense, Q4_K_M: the whole 19 GB file is read for every token

614 ÷ 19 ≈ 32 tokens per second at most.

gpt-oss-120b, MoE, MXFP4: 5.1B active × about 4.3 bits ÷ 8 ≈ 2.8 GB per token

614 ÷ 2.8 ≈ 220 tokens per second at most, for a model four times bigger.

Real speeds are lower than these limits, but the gap is real: the bigger MoE model can write faster. The catch is that its 63 GB file has to fit somewhere. On a PC with a GPU, llama.cpp can split it: attention and shared parts on the GPU, the experts in ordinary RAM, where each token reads only a few.

Run gpt-oss-120b on a 24 GB GPU plus system RAMbash
# by default, llama.cpp decides how much fits on the GPU
$ llama serve -hf ggml-org/gpt-oss-120b-GGUF:MXFP4

# keep every expert in system RAM, everything else on the GPU
$ llama serve -hf ggml-org/gpt-oss-120b-GGUF:MXFP4 --cpu-moe

# keep only the experts of the first 24 layers in RAM
$ llama serve -hf ggml-org/gpt-oss-120b-GGUF:MXFP4 --n-cpu-moe 24
  • :MXFP4 picks the 63.4 GB file, in the 4-bit format gpt-oss was released in.
  • --cpu-moe puts all expert weights in system RAM. The GPU keeps attention, the KV cache and the other weights that every token needs.
  • --n-cpu-moe 24 moves only the first 24 layers’ experts. Lower the number until the GPU is nearly full: more on the GPU means more speed.

A short history

  • 1991: Jacobs, Jordan, Nowlan and Hinton publish “Adaptive Mixtures of Local Experts”: several small networks plus a gate that decides which one to trust.
  • 2017: Google’s Shazeer and colleagues build sparse MoE layers with thousands of experts and up to 137 billion parameters, between LSTM layers.
  • 2020–2021: Google’s GShard (600 billion parameters, translation) and Switch Transformer (one expert per token, a trillion parameters).
  • 2023: Mistral releases Mixtral 8x7B, an open MoE model that matched or beat Llama 2 70B.
  • 2024: DeepSeekMoE, DeepSeek-V2 and V3 make fine-grained, shared experts the standard design.
  • 2026: trillion-parameter open models using only 3 to 4 % of their weights per token: DeepSeek-V4-Pro and Kimi K3.

Remember

  • An MoE layer has many small feed-forward experts and a router that picks the top k for each token.
  • Total parameters decide memory and knowledge; active parameters decide computation, speed and price.
  • Routers tend to collapse onto a few experts. DeepSeek balances them with a per-expert bias instead of an extra loss.
  • Fine-grained experts give far more combinations; shared experts hold what every token needs.
  • Experts do not specialise by subject; their choices follow syntax and patterns.
  • At home, MoE models are fast but large: llama.cpp’s --cpu-moe keeps experts in RAM and the rest on the GPU.

Words to know

Mixture of experts (MoE)
A model whose feed-forward blocks are split into many experts, only a few of which run for each token.
Expert
One of the small feed-forward blocks inside an MoE layer.
Router (gate)
The small network that scores the experts and picks the top few for each token.
Top-k routing
Sending each token to the k experts with the highest scores.
Dense model
A model that uses all its weights for every token.
Active parameters
The weights actually used for one token. Written as “A22B” in names like 235B-A22B.
Shared expert
An expert that every token uses, holding common knowledge.
Load balancing
Keeping all experts roughly equally busy, so none is wasted or overloaded.
Routing collapse
When a router sends almost everything to a few experts and the rest stop learning.
Expert parallelism
Spreading the experts over many GPUs, with tokens sent to wherever their experts live.

Go to the source

This lesson is built on these papers and documents. Paper links open arxiv.org, a separate site.

Check yourself

6 questions. Tap the answer you think is right.

0 of 6 answered

What does the router in an MoE layer do?

Show the answer

Answer: Picks a few experts for each token It scores every expert for the token in front of it and keeps the top k.

A model is called 235B-A22B. What does A22B mean?

Show the answer

Answer: 22 billion parameters are active for each token The A stands for active: 235 billion parameters in total, 22 billion used per token.

Why does an MoE model need lots of memory even though each token uses few weights?

Show the answer

Answer: Different tokens use different experts, so all of them must be loaded Any token may need any expert, so the whole model must be in memory, even though each token reads only a small part.

What is DeepSeek’s auxiliary-loss-free balancing?

Show the answer

Answer: A per-expert bias, raised for underused experts and lowered for overloaded ones The bias only affects which experts are chosen, so the load evens out without an extra loss pulling against the main training goal.

What did Mistral find about Mixtral’s experts?

Show the answer

Answer: Expert choices followed syntax more than subject The distribution of experts was very similar for papers, biology and philosophy; things like indentation in code went to the same experts.

Your GPU has 24 GB and the MoE model file is 63 GB. What does llama.cpp’s --cpu-moe do?

Show the answer

Answer: Keeps the experts in system RAM and the rest on the GPU The parts every token needs stay on the fast GPU, and each token reads only its few experts from RAM.

Lesson complete

Answer every question above to complete this lesson.

Your progress is saved on this device only.

Next lessonPretraining: reading a good part of the internet
Previous lesson All lessons

Choose your language