Project: Pretrain a Small Model.
A loss target and a compute budget: choose the model’s size and how to spend the steps.
The brief: a character-level decoder (Vol. V) trained from scratch on the first 90% of 60 000 characters of course text, reaching a held-out loss of at most 3.30 nats per character on the last 10%, with training compute of at most 3 × 10¹⁰ FLOPs, counted as 6 × parameters × tokens (plate V.6), where tokens = steps × batch × 32.
The workshop trains the model in the page each time a setting changes, which takes several seconds. The starting design — width 32, 2 layers, 200 steps of batch 8 at learning rate 0.003 — reaches 3.569 with 9.20 × 10⁹ FLOPs. A project plate grades the design against a brief: every check below the workshop must pass, and a passing design is saved in this browser.
Left: training loss and held-out loss as training proceeds, against the brief’s line. Right: FLOPs spent against the budget.
- Train a small model to a loss target.
- Count training FLOPs.
- Trade model size against steps and batch.
- Choose a learning rate.
Where the FLOPs go
The starting design spends only 31% of the budget and stops at 3.569: it is not that the model is too small but that it has seen too little text. FLOPs scale with parameters times tokens, so the same budget buys a wider model for fewer tokens or a narrower one for more; with this little data and compute, the loss is limited by tokens seen, the regime in which Chinchilla’s rule (plate X.3) says to keep the model small.
Batch and learning rate decide how well the steps are used. Larger batches average the gradient over more text and tolerate a larger step; too high a rate makes a small model’s loss jump instead of fall (plate XI.1). The project is the whole of Parts One and Two in miniature: an architecture, a token budget, an optimiser, and a held-out number that is the only judge.
Terms
- Held-out loss
- Cross-entropy on text not used for training.
- Training FLOPs
- About 6 × parameters × tokens.
- Batch size
- Sequences averaged in one gradient step.
- Learning rate
- The size of each optimiser step.
Sources
- Kaplan et al., “Scaling Laws for Neural Language Models”, arXiv:2001.08361, 2020 (C ≈ 6ND).
- Karpathy, nanoGPT, github.com/karpathy/nanoGPT, 2022.