Memorising and Generalising.
Same model, same steps, less data: the training loss keeps improving and the model gets worse.
A model is trained to lower the loss on its training text, but what matters is the loss on text it has never seen. While there is plenty of fresh data the two move together. When the same small dataset is shown again and again — many epochs — the model starts to fit the particular sentences rather than the language: it memorises. The training loss keeps falling; the held-out loss stops falling and then climbs, because the model has become overconfident about continuations that were true of its few documents and not in general.
The workshop shows four recorded runs of exactly the micro architecture, 1.9 million parameters, each trained for the same 6 000 steps of 8 192 tokens on a GPU: on 300 thousand tokens of the course corpus, on 300 thousand with strong weight decay, on 3 million, and on the full 15 million. Pretraining a large model is usually the last situation — less than one pass over the data — which is why it rarely overfits; fine-tuning on small datasets is the first, which is why it does (Vol. XVII).
Below: training loss (light) and held-out loss (dark) against steps for the runs chosen. With 300 thousand tokens the model sees each token over a hundred times.
- Read overfitting from training and held-out curves.
- Relate overfitting to the number of epochs over the data.
- See what weight decay does and does not fix.
- Explain why large pretraining runs rarely overfit.
When the training loss lies
On 300 thousand tokens the model passes over its data about 164 times. Its held-out loss is best early, 7.35 at step 300, and then climbs all the way to 16.3 while the training loss falls to 0.33: it has memorised its few documents almost perfectly and become confidently wrong about everything else. Strong weight decay slows the damage — final held-out loss 10.4 — but does not stop it. Ten times more data, 3 million tokens, gives 5.21; the full 15 million tokens, about 3.2 passes, give 4.21, with training and held-out loss close together (4.08 and 4.21).
The lesson for language models is that data, not regularisation, is the main defence. Large pretraining runs see most of their tokens once, so their training and held-out losses track each other and the danger is elsewhere — verbatim memorisation of duplicated documents (plate VIII.7) and benchmark questions leaking into the data (plate IX.10). Overfitting returns in post-training, where datasets are small and passes are many: a model fine-tuned for too many epochs on a few thousand examples gets worse at everything else (plate XVII.8). Plate X.6 asks how many times data can usefully be repeated when there is not enough of it.
Terms
- Overfitting
- Fitting the training data so closely that loss on new data rises.
- Epoch
- One full pass over the training data.
- Weight decay
- Shrinking every weight a little each step; a regulariser that slows memorisation.
- Early stopping
- Keeping the checkpoint with the best held-out loss instead of the final one.