Initial pre-training
×Next-token prediction on about 15.6T tokens, at a context of 8K after the first 252M tokens.
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
- 15.6T
- Batch and context
- 4M tokens at 4,096, then 8M at 8,192, then 16M
- Learning rate
- peak 8×10⁻⁵, cosine to 8×10⁻⁷
- Data mix
- roughly 50% general, 25% maths and reasoning, 17% code, 8% multilingual
- Compute
- 3.8×10²⁵ FLOPs
Not disclosed Tokens of Llama 3.1 8B and 70B
Why
Long sequences come only at the end, since the compute of self-attention grows quadratically with the sequence length. Llama 3 paper §3.4.2, p. 14
Architecture at this stageThe model as Llama 3.1’s plates draw it at 405B, its context at 8K in this stage.
All settings9
- Objective
- Next-token prediction
- Tokens
- 15.6T. The paper attaches the number to the 8K stage on p. 3 and to the flagship’s pre-training on p. 1, where it also speaks of “a corpus of about 15T multilingual tokens”; whether it includes the ~800B of long context is not clear
- Data mix
- About 50% general knowledge, 25% mathematics and reasoning, 17% code, 8% multilingual; adjusted during training
- Optimizer
- AdamW
- Learning rate
- Peak 8×10⁻⁵, linear warm-up of 8,000 steps, cosine decay to 8×10⁻⁷ over 1,200,000 steps; the peak is 3×10⁻⁴ for 8B and 1.5×10⁻⁴ for 70B
- Batch and context
- 4M tokens of 4,096-token sequences; 8M tokens of 8,192-token sequences after 252M tokens; 16M tokens after 2.87T tokens. The paper writes “8M sequences of 8,192 tokens”; read as tokens from “double these values” and Table 4
- Compute
- 3.8×10²⁵ FLOPs for the flagship’s pre-training
- 8B and 70B
- “Similar recipes” to the 405B’s; the smaller models are trained “for much longer than is compute-optimal”, and the flagship is used “to further improve the quality of those smaller models during post-training”; they gain from code data generated by a larger model, and their safety mixes are tailored to their size
- Trainable
- All
Sources9
- Llama 3 paper, p. 3Objective, Tokens
- Llama 3 paper, p. 1Tokens, Compute, Trainable
- Llama 3 paper, p. 6Data mix
- Llama 3 paper, p. 14Data mix, Optimizer, Learning rate, Batch and context, 8B and 70B, Trainable
- Llama 3 paper, p. 7Learning rate
- Llama 3 paper, p. 10Batch and context
- Llama 3 paper, p. 28B and 70B
- Llama 3 paper, p. 208B and 70B
- Llama 3 paper, p. 438B and 70B