How to read this chapter
The older decoder works, but its components leave room for better scale control, feature selection, and memory use. This chapter explains the changes behind the modern recipe.
Each part asks what an upgrade replaces, why it helps, and which conventions a correct implementation must match. Start with the attention and decoder-block guide. Use the drawings to explain the change before consulting its formula or code.
Each part ends with an “In one breath” recap. The interview page has questions, graded exercises, and worked solutions; try the reasoning before reading the answer.
Meet Finch-24
Finch-24 rebuilds Finch-19 with the 2024 recipe. Width, depth, vocabulary, and query-head count stay fixed, so the comparison focuses on architecture. Llama 3 8B supplies the larger-model reference.
| Setting | Finch-19 (2019 recipe) | Finch-24 (2024 recipe) | Changed in |
|---|---|---|---|
Vocabulary V |
32,000 | 32,000 | |
Width d_model |
512 | 512 | |
Layers N |
8 | 8 | |
Query heads H |
8 | 8 | |
Key/value heads H_kv |
8 | 2 | Part IV |
Head size d_head |
64 | 64 | |
| Positions | learned table, 1,024 rows | RoPE, base 10,000, no table | Part I |
Context T_max |
1,024 | 4,096 | Part I |
| Normalization | LayerNorm, pre-norm | RMSNorm, pre-norm, ε = 1e-5 | Part II |
| MLP | GELU, 2,048 wide | SwiGLU, 1,536 wide | Part III |
| Attention kernel | written by hand | SDPA / FlashAttention | Parts V, VI |
| Biases | everywhere | none | Part VII |
| Output head | tied to embeddings | tied to embeddings | |
| Parameters | 42,128,384 | 40,509,952 | Part VII |
An upgrade need not make a model larger. Shared KV heads reduce retained history; RMSNorm simplifies scale control; SwiGLU adds input-dependent feature selection. Whether the combined recipe improves quality still requires training and evaluation.
What is inside
Seven parts, one upgrade each, then the assembled block. The map shows the modern block with every changed part marked; each part lights up its own piece.
- 01RoPE, ProperlySections 1 to 6. Rotary positions must match the saved model.
- 02RMSNorm: Rescale, Skip the Re-CentringSections 7 to 11. Deep stacks need reliable scale control.
- 03SwiGLU: A Gated MLPSections 12 to 16. An MLP can learn content and its gate separately.
- 04Grouped-Query AttentionSections 17 to 21. Generation repeatedly reads stored attention history.
- 05SDPA: One Call, Several KernelsSections 22 to 26. An attention API can select different implementations.
- 06FlashAttention: Exact Attention That Respects MemorySections 27 to 32. Attention can spend more time moving intermediates than computing them.
- 07The Modern Decoder Block, AssembledSections 33 to 38. The upgrades leave the decoder's basic structure intact.
- +Interview prepInterview question bank, graded exercises and worked solutions.