How to read this chapter
Drawing a decoder does not explain how it learns. This chapter follows prediction, error, gradients, updates, evaluation, and generation.
Pretraining learns a next-token distribution from text before task-specific adaptation. Begin with the forward pass, then follow the loss backward to the parameters. Explain why each operation is needed before reading its formula. Later parts show how to resume training, interpret learning curves, compare experiments, and choose a generation policy. The interview exercises test those explanations.
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 again
Finch-24 keeps the modern guide’s architecture fixed. It is an illustrative configuration; optimizer settings and toy losses are not measured results. Real-model comparisons use the original Llama 3 8B release.
| Setting | Symbol | Finch-24 | What it controls |
|---|---|---|---|
| Vocabulary | 32,000 | Possible token IDs | |
| Hidden width | 512 | Features per token | |
| Decoder blocks | 8 | Depth | |
| Query heads | 8 | Attention queries | |
| Key/value heads | 2 | Shared key/value groups | |
| Head width | 64 | Features per head | |
| SwiGLU intermediate width | 1,536 | Feature expansion | |
| Maximum context | 4,096 | Supported training window | |
| Rotary base | 10,000 | RoPE frequencies | |
| Normalization | Pre-norm RMSNorm | Block and final normalization | |
| Norm epsilon | Denominator floor | ||
| Bias parameters | None | Projection convention | |
| Output head | Tied | Shares the input embedding | |
| Unique parameters | 40,509,952 | Learned scalar values |
Batch size is the number of sequences processed together. Sequence length is the number of input positions in each sequence. A microbatch is one group processed in a forward and backward pass; gradient accumulation combines groups before an update. The input and its targets are the same sequence offset by one position.
What is inside
Ten parts follow the supplied topic order. First finish the decoder, then construct its examples, differentiate its loss, run and evaluate training, and generate text. The final part reconciles the complete pipeline and every Finch-24 parameter.
- 01Feature computation, now seen from trainingSections 1 to 2. Training must differentiate feature transformation as well as attention.
- 02Turning a hidden vector into predictionsSections 3 to 6. The final representation must become a prediction.
- 03Giving the decoder something to learnSections 7 to 10. Text supplies its own next-token targets.
- 04Choosing the parameter updateSections 11 to 14. A gradient gives a direction, not a complete update rule.
- 05Keeping learning inside numerical limitsSections 15 to 18. Training needs sensible starting values and usable arithmetic.
- 06Running and resuming the experimentSections 19 to 20. Resuming training requires more than the current weights.
- 07Measuring the predictorSections 21 to 23. Fitting seen text differs from improving on new text.
- 08Comparing experiments fairlySections 24 to 26. A favorable run can reflect luck or budget differences.
- 09Turning predictions into textSections 27 to 32. Generation uses choices the model has not seen in advance.
- 10The complete training-to-generation pipelineSections 33 to 35. The pipeline connects text, learning, evaluation, and generation.
- +Interview prepInterview question bank, graded exercises and worked solutions.