Skip to content

The Llama 3 Herd of Models

main track #8corefrontierpaperrubric 11/122024 · ~60 min

Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri, et al. (Llama Team, Meta)

Status

TL;DR. Llama 3 is a family of dense Transformers (8B, 70B and 405B) trained on 15.6T tokens with a 128K-token vocabulary. Meta kept the architecture simple (GQA, SwiGLU, RoPE) and put its effort into data quality, scale and infrastructure. The 405B model used 3.8×10²⁵ FLOPs, almost 50× Llama 2. Scaling laws chose the model size and predicted benchmark accuracy before training. Context was extended to 128K in six stages. Post-training repeats reward modeling, rejection-sampled SFT and DPO for six rounds, with no PPO.

Why it matters now. Llama 3 is the clearest public record of how a frontier-scale dense model is built end to end. Many open models and RAG systems still build on it. Its tools are now standard: annealing to value data, staged long-context extension, two-step accuracy prediction and checkpoint averaging. Its report also shows the operational side, such as how often a 16K-GPU job fails.

Choose size with a fitted law, predict accuracy before training. IsoFLOP sweeps from 6×10186\times10^{18} to 102210^{22} FLOPs give compute-optimal points. Fitting

N⋆(C)=A Cα,(α,A)=(0.53,0.29),N^\star(C) = A\,C^{\alpha},\qquad (\alpha, A) = (0.53, 0.29),

where N⋆N^\star is the optimal number of training tokens, suggests a 402B model on 16.55T tokens at 3.8×10253.8\times10^{25} FLOPs. Meta trained 405B on 15.6T. Accuracy is then forecast in two steps: compute → NLL of the correct answer (linear) → accuracy (sigmoid).

Then train in phases. Initial pretraining → long-context pretraining (8K → 128K over 6 stages, about 800B tokens) → annealing on high-quality data (the last 40M tokens at learning rate 0, plus Polyak averaging).

Llama 3: pretraining phases and the six-round post-training loop Left: three pretraining phases stacked top to bottom. Initial pretraining at 8K context with batch size growing from 4M to 16M tokens; long-context pretraining in six stages from 8K to 128K using about 800B tokens; and an anneal over the final 40M tokens with the learning rate going to zero, high-quality data upsampled, and checkpoint averaging. Right: a loop of four steps repeated six times: train a reward model, rejection-sample 10 to 30 responses per prompt, supervised fine-tuning on the best ones, and DPO, whose model starts the next round. Pretraining (405B, 15.6T tokens) 1. Initial pretraining 8K context · batch 4M → 8M → 16M tokens 2. Long-context pretraining 6 stages, 8K → 128K · about 800B tokens 3. Anneal last 40M tokens · LR → 0 · upsample best data + Polyak checkpoint averaging · AdamW · BF16 Post-training (6 rounds) Reward model human prefs Rejection sample K = 10–30 SFT best responses DPO no PPO next round expert models (e.g. code) supply extra data
Original sketch. Pretraining phases on the left; the six-round post-training loop on the right.
  • Benchmarks (Table 2). 405B: MMLU (5-shot) 87.3, against GPT-4o 89.1 and Claude 3.5 Sonnet 89.9. The 405B model is competitive with the best closed models of mid-2024 on most tasks.
  • Annealing. On the 8B model, annealing on high-quality data raised GSM8k by 24.0% and MATH by 6.4%. At 405B the gains were negligible.
  • Long context. Long-context SFT needs only 0.1% synthetic long-context data. DPO on short data alone did not hurt long-context performance.
  • Reliability (Table 5). 466 interruptions in 54 days, of which 419 were unexpected; about 78% were hardware, with GPU issues the largest category (58.7% of unexpected issues).
  • Annealing as a data-value test (§3.1.3): anneal a 50%-trained 8B model to LR 0 over 40B tokens with 30% weight on the candidate data. OLMo 2’s mid-training and many later reports evaluate data the same way.
  • Staged long-context extension with a large RoPE base, followed by a final high-quality anneal and checkpoint averaging.
  • Downstream forecasting through answer NLL rather than raw accuracy.
  • Rejection-sampled SFT + DPO as a stable, cheap post-training baseline that later pipelines extend with verifiable-reward RL.
  • Dense 405B is expensive to serve compared with MoE models of similar quality.
  • The data mix is described in shares only; the data itself is not released.
  • The printed scaling-law constants are rounded and do not reproduce the 16.55T figure exactly.
  • DPO-only post-training predates the shift to verifiable-reward RL, so reasoning lags later models.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    Llama 3 fits the compute-optimal token count as N*(C) = A·C^α with (α, A) = (0.53, 0.29) and reports that 3.8×10^25 FLOPs implies a 402B model on 16.55T tokens. Plug the rounded constants in yourself. What do you get, why might it differ, and is 402B × 16.55T consistent with C ≈ 6ND?

    What a strong answer covers
    • log10(3.8e25) ≈ 25.58; × 0.53 ≈ 13.56; 10^13.56 ≈ 3.6e13; × 0.29 ≈ 1.05e13, so about 10.5T tokens with the printed constants.
    • The exponent multiplies ln C ≈ 58.9, so a change of 0.005 in α moves N* by about 30%. With α ≈ 0.537 the formula gives about 16T. One possible explanation, not confirmed by the report, is that the printed (0.53, 0.29) are rounded; either way, do not expect to reproduce 16.55T exactly from them.
    • 6 × 402e9 × 16.55e12 ≈ 4.0e25 FLOPs, consistent with the 3.8e25 budget to within the 6ND approximation.
    • Tokens per parameter ≈ 41, about twice the Chinchilla rule of thumb of 20. The paper notes the IsoFLOP curves flatten near the optimum at large compute, so the exact split matters little.
    • Lesson: report fits with enough digits and confidence intervals, because extrapolating over 3–4 orders of magnitude amplifies rounding.
  2. Mechanism

    Llama 3 predicts benchmark accuracy before training with a two-step method: compute → normalized NLL of the correct answer → accuracy. Explain why two steps work better than fitting accuracy against compute directly.

    What a strong answer covers
    • NLL of the correct answer changes smoothly and roughly linearly with log compute, even when accuracy is near chance.
    • Accuracy is a sigmoid-like function of that NLL. It looks flat and then jumps, which is hard to extrapolate from small models.
    • Splitting the two lets small models (up to 1e22 FLOPs) fix the first fit, while the second fit can use Llama 2 models that already reach high accuracy.
    • On ARC Challenge, the forecast over four orders of magnitude only slightly underestimated the 405B result (Fig. 4).
    • This is the same argument as "emergence is a mirage": smooth metrics hide behind discontinuous ones.
  3. What if…

    Annealing on high-quality code and math raised the 8B model's GSM8k by 24.0% and MATH by 6.4%, but gave almost nothing at 405B. Propose an ablation that explains this gap, and say how you would use annealing to value a small new dataset.

    What a strong answer covers
    • Hypotheses: the 405B model already learned these skills in pretraining; or the anneal dataset is too small relative to its capacity; or benchmark contamination differs.
    • Ablation: anneal 8B, 70B and 405B checkpoints on the same data at matched fractions of training, with and without the target data, and track held-out math NLL as well as accuracy.
    • The paper's method for valuing data: take a 50%-trained 8B model, anneal the learning rate to 0 over 40B tokens with 30% weight on the new dataset, and compare with the base anneal.
    • Caveat: if gains vanish at scale, small-model annealing tests may overvalue narrow datasets.
  4. Critique

    Llama 3 chose a dense Transformer rather than MoE "to maximize training stability". With hindsight from DeepSeek-V3 (671B MoE, 37B active, no loss spikes), assess this choice. What did Meta gain and what did it give up?

    What a strong answer covers
    • Gains: a simple, well-understood recipe on a new 16K-GPU cluster, with no router instability or all-to-all communication, and easy inference with standard tooling and FP8 quantization.
    • Costs: every token uses all 405B parameters. DeepSeek-V3 used 37B active parameters and about 2.8M H800 GPU-hours and is competitive on many benchmarks.
    • Training reliability was still hard: 466 interruptions in 54 days (419 unexpected), mostly hardware. Dense training does not remove that problem.
    • A fair verdict: dense made sense given the infrastructure risk at the time, but the efficiency gap made MoE the default for later frontier open models.
  5. Design

    You want to extend a pretrained 8K-context model to 128K for long-document QA and RAG. Using Llama 3's recipe, design the schedule and the checks that tell you each stage is done.

    What a strong answer covers
    • Increase context in stages (Llama 3 used 6 stages from 8K to 128K, about 800B tokens), raising the RoPE base (θ = 500,000) for the target length.
    • Move on only when short-context scores have recovered and needle-in-a-haystack retrieval at the new length is solved.
    • In post-training, mix in a small share of synthetic long-context data (0.1% in Llama 3: QA over chunks, hierarchical summarization, code reasoning).
    • Check with harder long-context tests than single needles, such as RULER, multi-hop, or lost-in-the-middle position sweeps.
    • Anneal at the end (the last 40M tokens at 128K, learning rate to 0) and average checkpoints.
  6. Connect

    Compare Llama 3's post-training loop (reward model, rejection-sampled SFT, DPO, repeated for 6 rounds, no PPO) with the RL-heavy pipelines of DeepSeek-V3 and MAI-Thinking-1. What changed between 2024 and 2026, and why?

    What a strong answer covers
    • Llama 3: each round trains a reward model, samples K = 10–30 responses, keeps the best for SFT, then runs DPO. It avoids PPO for stability and scale.
    • DeepSeek-V3 distills reasoning from R1 into SFT data and then runs GRPO. MAI runs long GRPO climbs from scratch with verifiable rewards.
    • The shift: verifiable rewards (math, code, tests) made online RL reliable and better for reasoning than offline preference methods.
    • Llama 3's rejection-sampling SFT is itself a simple form of RL (best-of-K plus imitation) and survives as a component of later pipelines.

Done with this page?

Status