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. Initial pre‑trainingat 4K, then 8K15.6T8KNTPWhat trains: all
  3. Off this path: domain experts (code, multilingual) 2 stages
  4. Branched from the pre-training run; the point is not named
  5. Code expert1T tokens, mostly code1T16KNTPnot statednot stated: what trains
  6. Multilingual expert90% multilingual tokensnot statednot statedNTPnot statednot stated: tokens, context, what trains
  7. Long‑context pre‑trainingsix stages, 8K to 128K800B128KNTPWhat trains: allcontext to 128K
  8. Annealinglearning rate to 040M128KNTPWhat trains: all
  9. Pre-trained model
  10. × 6 roundsRejection sampling and SFTthen DPO, each roundnot stated128KSFTRS and synthetic datanot statednot stated: tokens, what trains
  11. DPOafter SFT, each roundnot statedshort contextDPO+ NLL 0.2not statednot stated: tokens, what trains
  12. 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

Rejection sampling and SFT

×

For each human-annotation prompt the latest policy writes typically 10 to 30 responses and the reward model keeps the best; the pre-trained model is fine-tuned on these and on synthetic and other data, the loss on the prompt masked.

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.

Rounds
six, each an SFT followed by DPO
Rejection sampling
typically 10 to 30 outputs, the best by the reward model
Learning rate and steps
10⁻⁵, 8.5K to 9K steps
Model averaging
Models from experiments with various data or hyperparameters are averaged at each RM, SFT and DPO stage

Not disclosed Tokens · Batch

What the terms meanReward model · DPO
Reward model
A model learns to give a response a score, from responses people ranked, so that the preferred one scores 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.
All settings6
Rounds
Six rounds, each an SFT followed by DPO. Each round’s data are generated with the best models of the previous round: “Best model for next round” (Figure 7), “sampling synthetic data from the latest models”. The paper says SFT fine-tunes pre-trained checkpoints; that a round starts from the previous round’s model is not stated.
Rejection sampling
K outputs, typically 10 to 30, from the latest chat policy for each prompt; the reward model selects the best
Objective
Cross-entropy on the target tokens, the loss masked on the prompt tokens
Learning rate and steps
10⁻⁵ over 8.5K to 9K steps for the largest models
Context
Mostly short; 0.1% of synthetic long-context data at 16K, 32K, 64K and 128K
Model averaging
Models from experiments with various data or hyperparameters are averaged at each RM, SFT and DPO stage
Sources5