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

Modern decoder recipes compared

See five modern decoder blocks as small diffs against one base block.


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

Go Pro · $8.25/mo
EXPLAINER · 10.C4 · RECIPE BAYLLAMA · 3 OF 6 PARTS CHANGED
01
Stage 1 of 6 · Six parts
Llama changes 3 of the 6 parts, drawn in ochre. Every family keeps RoPE and the residual stream.
Explain it simply

Each column is one recipe for the same block. Each row is one part, in the order data moves. A grey cell copies the base, and an ochre cell is a change. The panel at the right follows one token through the base and the family you pick.

A table of 6 parts by 6 recipes. Llama changes the norm, the attention heads and the MLP.

token rows, normed rows, the KV cachea part the family changes; weightsattention weights, gates, the block outputa part the same as the basemasked keys, idle experts
BaseLlamaMistralQwenGemmaDeepSeekNormlesson 5.14LayerNormRMSNormRMSNormRMSNormRMS pre+ postRMSNormPositionlesson 10.06RoPERoPERoPERoPERoPERoPEAttentionlesson 9.07MHAGQAGQAGQA+ biasGQAMLAWindowlesson 9.08allkeysallkeyswindow3allkeyslocal /globalallkeysMLPlesson 5.07GELUSwiGLUSwiGLUSwiGLUGeGLUSwiGLUExpertslesson 10.10densedensedensedensedenseshared +routedweights144152152160160560work per token144152152160160368KV per token844442the1cat2sat3on4the5mat6BaseLlamax, “mat”−1.150.590.03−0.43s = x + attention−1.590.330.35−0.04y = s + MLP−1.630.091.120.12x, “mat”−1.150.590.03−0.43s = x + attention−0.800.890.08−0.83y = s + MLP−1.190.990.64−0.76RoPE: the same inevery family; q, kturn by angle p − 1at position pgap to the base: 1.41recipes as diffs against the baseBaseLlamaMistralQwenGemmaDeepSeekNormlesson 5.14LayerNormRMSNormRMSNormRMSNormRMS pre+ postRMSNormPositionlesson 10.06RoPERoPERoPERoPERoPERoPEAttentionlesson 9.07MHAGQAGQAGQA+ biasGQAMLAWindowlesson 9.08allkeysallkeyswindow3allkeyslocal /globalallkeysMLPlesson 5.07GELUSwiGLUSwiGLUSwiGLUGeGLUSwiGLUExpertslesson 10.10densedensedensedensedenseshared +routedweights144152152160160560work per token144152152160160368KV per token844442the1cat2sat3on4the5mat6BaseLlamax, “mat”−1.150.590.03−0.43s = x + attention−1.590.330.35−0.04y = s + MLP−1.630.091.120.12x, “mat”−1.150.590.03−0.43s = x + attention−0.800.890.08−0.83y = s + MLP−1.190.990.64−0.76RoPE: the same inevery family; q, kturn by angle p − 1at position pgap to the base: 1.41recipes as diffs against the base
Toy: one decoder block, 6 tokens, width 4, 2 heads; random weights, not trained
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
y=s+MLP(norm(s)),s=x+attn(norm(x))\sy{y}{out}{y} = \sy{s}{data}{s} + \mathrm{MLP}(\mathrm{norm}(\sy{s}{data}{s})),\quad \sy{s}{data}{s} = \sy{x}{data}{x} + \mathrm{attn}(\mathrm{norm}(\sy{x}{data}{x}))
∥y−ybase∥=1.41\lVert y - y_{\text{base}} \rVert = 1.41

Each sublayer reads a normed copy and adds its result to the stream.

Common mix-ups

MYTHEach family is a whole new architecture.

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

Predict, then reveal
3 CHECKS · PRO
Q01Which family keeps the fewest numbers per token in the KV cache?

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 2 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.