Log inStart free
LESSON 10.C2 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

A MoE layer end to end

Watch 8 tokens pass one MoE layer: routed, capped, mixed, then balanced.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 10.C2 · MOE LAYERSTORED 400 · ACTIVE 208 · DENSE 96
01
Stage 1 of 6 · Four experts
Eight token rows enter the layer. It stores 4 experts of 96 weights; a dense model has one MLP.
Explain it simply

On the left, each row of four cells is one token. Next are four experts, small MLPs of 96 weights each, as in 10.10. A dense layer runs one MLP on every token. The bars at the bottom count the weights: stored, active and dense.

Eight token rows of 4 cells on the left. Next, four expert boxes. Weight bars: dense 96, active 208, stored 400.

token vectors, token copies (thick outline: moved in balancing)experts, weights, slots, biases brouter shares, gates, layer outputdropped copies, lost gate, aux lossempty slot
tokens xexperts, 10.10Expert 196 weightsExpert 296 weightsExpert 396 weightsExpert 496 weightsthecatsatonmatranrugdogdense96 weightsactive208 weightsstored400 weightsstored 4 × 96 + 16 = 400active 2 × 96 + 16 = 208four expertstokens xexperts, 10.10Expert 196 weightsExpert 296 weightsExpert 396 weightsExpert 496 weightsthecatsatonmatranrugdogdense96 weightsactive208 weightsstored400 weightsstored 4 × 96 + 16 = 400active 2 × 96 + 16 = 208four experts
Toy: 10.C2's 8 tokens, 4 experts, top 2; the lean is an extra score on expert 1; random weights, not trained on a task
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Nstored=E⋅96+16,Nactive=k⋅96+16\sy{T}{param}{N_{\text{stored}}} = E \cdot 96 + 16,\quad \sy{A}{param}{N_{\text{active}}} = k \cdot 96 + 16
Nstored=4⋅96+16=400,Nactive=2⋅96+16=208N_{\text{stored}} = 4 \cdot 96 + 16 = 400,\quad N_{\text{active}} = 2 \cdot 96 + 16 = 208

A token uses 2 of the 4 experts.

Common mix-ups

MYTHA bigger capacity factor is the fix for uneven load.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01At capacity factor 0.5, does balancing end the drops?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.