Training

Pinned sources The Llama 3 Herd of Models (arXiv 2407.21783v3), whose results are all for Llama 3.1 · for Llama 3, its model card (meta‑llama/llama3 @ a0940f9) and Meta’s post of April 2024 · no training code is published

  1. Start of training
  2. Llama 3, April 2024, predecessor 2 stages
  3. Whether Llama 3.1 continues these checkpoints: not stated
  4. Llama 3 pre‑training15T+ tokens at 8K15T8KNTPWhat trains: all
  5. Llama 3 post‑trainingSFT, RS, PPO, DPOnot statednot statedSFTPPODPOnot statednot stated: tokens, context, what trains
  6. Llama 3 (April 2024)
  7. Initial pre‑trainingat 4K, then 8K15.6T8KNTPWhat trains: all
  8. Off this path: domain experts (code, multilingual) 2 stages
  9. Branched from the pre-training run; the point is not named
  10. Code expert1T tokens, mostly code1T16KNTPnot statednot stated: what trains
  11. Multilingual expert90% multilingual tokensnot statednot statedNTPnot statednot stated: tokens, context, what trains
  12. Long‑context pre‑trainingsix stages, 8K to 128K800B128KNTPWhat trains: allcontext to 128K
  13. Annealinglearning rate to 040M128KNTPWhat trains: all
  14. Pre-trained model
  15. × 6 roundsRejection sampling and SFTthen DPO, each roundnot stated128KSFTRS and synthetic datanot statednot stated: tokens, what trains
  16. DPOafter SFT, each roundnot statedshort contextDPO+ NLL 0.2not statednot stated: tokens, what trains
  17. Llama 3.1 405B Instruct
  • tokens, log scale
  • NTPdashed: concluded, no source names it
  • not stated by the sources
  • the architecture changes
  • checkpoint
  • checkpoint, weights published
  • a join the sources leave unexplained
  • data from a branch into a stage
  • stages repeated together

Code expert

×

A branch of the pre-training run continues pre-training on 1T tokens of mostly code, extends its context to 16K and is post-trained; it is used to collect code annotations and to rejection-sample code.

Next-token prediction

L=−1T∑i=2T+1log⁡Pi[ti]\mathcal L=-\frac1T\sum_{i=2}^{T+1}\log P_i[t_i]
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.

tit_i: the token at position ii; Pi[ti]P_i[t_i]: the probability the model, reading the tokens before it, gave that token; TT: the sequence length.

The paper continues pre-training on code with “a recipe similar to that of CodeLlama”, whose base models also train infilling; whether this stage does, it does not say.

Tokens
1T
Data
>85% code
Context
16K at the end
Use
Collecting high-quality human annotations for code throughout later rounds of post-training

Not disclosed Learning rate

What the terms meanRejection sampling
Rejection sampling
The model writes several responses to a prompt, a reward model or another check keeps the best, and the kept responses become training data. Llama 3 paper §4.2.2, p. 18
All settings5
Tokens
1T
Data
Mostly (>85%) code
Context
Long-context fine-tuning to 16K tokens over the last several thousand steps, on repo-level code
Post-training
The recipes of §4.1, with SFT and DPO mixes primarily for code
Use
Collecting high-quality human annotations for code throughout later rounds of post-training
Sources1