Annealing
×The learning rate goes linearly to zero over the last 40M tokens, on upsampled data of very high quality; the checkpoints are averaged.
Next-token prediction
In words
At every position the model gives each token of the vocabulary a probability of coming next; the loss is the negative logarithm of the probability it gave the token that does come next, averaged over the sequence.
: the token at position ; : the probability the model, reading the tokens before it, gave that token; : the sequence length.
Next-token prediction as drawn for DeepSeek‑V3.2‑Exp →That plate also draws multi-token prediction, fill-in-the-middle and DeepSeek-V3’s sequence-wise balance loss.
- Tokens
- the final 40M
- Learning rate
- linearly to 0
- Averaging
- Polyak averaging of checkpoints during annealing gives the final pre-trained model
Why
Annealing on small amounts of high-quality code and mathematics data can boost key benchmarks: with the GSM8k and MATH training sets in the annealing mix, a pre-trained 8B model rose by 24.0% and 6.4% on their validation sets, while for the 405B the gain was negligible. The final annealing data excludes benchmark training sets. Llama 3 paper §3.1.3, p. 6
Architecture at this stageThe same model; its checkpoints over the stage are averaged into the pre-trained model.
What the terms meanPolyak averaging
- Polyak averaging
- The weights of the checkpoints saved over the last part of a run are averaged into one model. Llama 3 paper §3.4.3, p. 15
All settings8
- Tokens
- The final 40M, as printed
- Optimizer steps
- About 2 to 3derived40M tokens over Table 4’s 16M tokens per batch is 2.5; the paper does not count the steps.
- Learning rate
- Linearly annealed to 0
- Context
- 128K
- Data
- Sources of very high quality upsampled; no training sets of common benchmarks
- Averaging
- Polyak averaging of checkpoints during annealing gives the final pre-trained model
- Objective
- Next-token prediction
- Trainable
- All
Sources5
- Llama 3 paper, p. 15Tokens, Optimizer steps, Learning rate, Context, Data, Averaging, Objective, Trainable
- Llama 3 paper, p. 10Optimizer steps
- Llama 3 paper, p. 6Data
- Llama 3 paper, p. 3Objective
- Llama 3 paper, p. 1Trainable