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. Long‑context pre‑trainingsix stages, 8K to 128K800B128KNTPWhat trains: allcontext to 128K
  9. Annealinglearning rate to 040M128KNTPWhat trains: all
  10. Pre-trained model
  11. Off this path: Reward model 1 stage
  12. Reward modelin each roundnot statednot statedRMLlama 2’s, no marginnot statednot stated: tokens, context, what trains
  13. Reward model
  14. × 6 roundsRejection sampling and SFTthen DPO, each roundnot stated128KSFTRS and synthetic datanot statednot stated: tokens, what trains
  15. DPOafter SFT, each roundnot statedshort contextDPO+ NLL 0.2not statednot stated: tokens, what trains
  16. 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

Llama 3 post-training

×

Stage · Llama 3 (April 2024)

Llama 3’s post-training combined supervised fine-tuning, rejection sampling, PPO and DPO.

Supervised fine-tuning

LSFT=−∑t∈ylog⁡P(yt∣x,y<t)\mathcal L_{\mathrm{SFT}}=-\sum_{t\in y}\log P(y_t\mid x,y_{<t})
In words

The model is trained on examples of the answers wanted, prompts with their responses, by the cross-entropy of next-token prediction on the responses.

xx: the prompt; yy: the response; the prompt’s tokens are left out of the loss.

  • Reinforcement learning. The model writes responses, a reward scores them, and the model is moved toward the responses that score higher.
  • DPO. From pairs of a preferred and a rejected response, the model is trained to raise the preferred one’s probability, measured against a frozen reference model, more than the rejected one’s, with no separate reward model.
Data
over 10M human-annotated examples

Not disclosed Rounds · Settings

What the terms meanRejection sampling · PPO
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
PPO
Proximal policy optimization: reinforcement learning whose baseline for a response is a learned value model, with each update clipped near the policy that wrote the samples. GRPO keeps the clip and takes the group’s mean reward as the baseline.
All settings2
Method
“A combination of supervised fine-tuning (SFT), rejection sampling, proximal policy optimization (PPO), and direct preference optimization (DPO)”
Data
Publicly available instruction datasets and over 10M human-annotated examples
Sources2