Scaling laws & Chinchilla

In one sentence

Loss falls predictably as a power law in parameters, data and compute. Chinchilla's compute-optimal mix is ~20 tokens per parameter, but labs overtrain small models because inference, not training, dominates lifetime cost.

Analogy: A bigger brain and more books both help a student, with diminishing returns. Chinchilla is the best brain-versus-books split for a fixed tuition budget; overtraining drills a smaller student far longer because they're cheaper to employ for years.

Same compute, three answers: the right split depends on whether you count only training or also every token you will serve.

How it works

  • Fit small runs, then extrapolate the loss curve before paying for the big one.
  • Training costs C ≈ 6·N·D FLOPs; serving costs ~2·N FLOPs per generated token.
  • Llama 3 8B was overtrained on ~15T tokens, ~1,875 per parameter, and was still improving.
  • Returns diminish: with Kaplan's exponent, 10× more compute cuts loss by only ~11%.
  • Test-time compute is a second curve: reasoning models spend more thinking tokens per query, paid at inference.

Check yourself

Answer to mark it learned; your answers aren't scored.

Your pilot pretraining runs (100M to 1B parameters) fit a clean power law, and the extrapolated loss for a 13B run looks great. A PM wants to promise leadership that the 13B will score 85% on your legal-QA benchmark. What's your stance?

Go deeper

Full explanation

Scaling laws are empirical fits showing that a language model's loss falls as a smooth power law as you scale parameters (N), training tokens (D) and compute (C), across many orders of magnitude. That makes training predictable: fit small runs, then extrapolate before paying for the big one.

Training compute is roughly C ≈ 6·N·D FLOPs (2ND forward, 4ND backward). For a fixed C, how do you split it?

  • Kaplan et al. (2020): mostly into parameters. GPT-3 (175B params, 300B tokens, ~1.7 tokens/param) followed that.
  • Chinchilla (Hoffmann et al., 2022) corrected it: grow N and D equally, about 20 tokens per parameter. Chinchilla 70B on 1.4T tokens beat the 4× larger Gopher (280B) at the same compute.

But Chinchilla minimizes training compute only. Every served token costs ~2N FLOPs, so for a model used billions of times a smaller, overtrained model wins: Llama 3 8B saw ~15T tokens, ~1,875 per parameter, and was still improving.

Two caveats to say out loud: power laws mean diminishing returns (each fixed loss gain costs a multiple of compute), and lower loss doesn't map linearly to your task. The newest axis is test-time compute: Reasoning models & test-time compute spend more tokens thinking per query, a second scaling curve paid at inference.

Code Back-of-envelope: training FLOPs and the Chinchilla split
pythonBack-of-envelope: training FLOPs and the Chinchilla split
def train_flops(n_params, n_tokens):
    return 6 * n_params * n_tokens  # ~2ND forward + ~4ND backward

def chinchilla_optimal(compute, tokens_per_param=20):
    # C = 6 * N * (20 * N)  ->  N = sqrt(C / 120)
    n = (compute / (6 * tokens_per_param)) ** 0.5
    return n, tokens_per_param * n

RUNS = {  # (parameters, training tokens) as published
    "GPT-3 175B": (175e9, 300e9),
    "Chinchilla 70B": (70e9, 1.4e12),
    "Llama 3 8B": (8e9, 15e12),
    "Llama 3.1 405B": (405e9, 15.6e12),
}

for name, (n, d) in RUNS.items():
    c = train_flops(n, d)
    n_opt, d_opt = chinchilla_optimal(c)
    print(f"{name}: {c:.1e} FLOPs, {d / n:,.0f} tok/param -> "
          f"Chinchilla: {n_opt / 1e9:.0f}B on {d_opt / 1e12:.1f}T")
# GPT-3 175B: 3.2e+23 FLOPs, 2 tok/param -> Chinchilla: 51B on 1.0T
# Chinchilla 70B: 5.9e+23 FLOPs, 20 tok/param -> Chinchilla: 70B on 1.4T
# Llama 3 8B: 7.2e+23 FLOPs, 1,875 tok/param -> Chinchilla: 77B on 1.5T
# Llama 3.1 405B: 3.8e+25 FLOPs, 39 tok/param -> Chinchilla: 562B on 11.2T

# Inference cost per generated token is ~2N FLOPs: 16 GFLOPs (8B) vs 154 (77B)
Real example

You have ~7×10^23 FLOPs (6 × 8B × 15T). Chinchilla-optimal spends it on a ~77B model trained on ~1.5T tokens; Meta spent it on Llama 3 8B over 15T tokens. The 77B model would likely reach lower loss, but every generated token costs ~154 GFLOPs instead of ~16, and it needs ~154 GB of bf16 weights instead of 16 GB, so several GPUs instead of one. The gap is ~138 GFLOPs per token: past ~5T served tokens, the inference savings alone exceed the entire training budget. That's the argument of Sardana et al.: once you count expected inference, the optimal model is smaller and trained longer.

Trade-offs +3 · −3

+ You gain

  • Predict a big run's loss from small pilot runs before committing millions of dollars.
  • Give a defensible split between parameters and data instead of guesswork.
  • Explain the market: why small overtrained open models rival much larger older ones.

− You pay

  • Empirical fits: exponents shift with data quality, architecture and tokenizer.
  • They predict loss, not specific capabilities; jumps on downstream tasks are hard to forecast.
  • They assume fresh data keeps coming; high-quality text is finite and repeated epochs lose value.

Use it when

Budgeting a training or continued-pretraining run; explaining why a small open model rivals a big old one; arguing compute vs data vs inference trade-offs in model selection and capacity planning.

Avoid it when

Don't use loss curves to promise a specific capability or benchmark score, and don't apply 20 tokens per parameter to a model you'll serve at scale: that rule ignores inference cost.

Numbers to know 5
  • Training ≈ 6·N·D FLOPs; inference ≈ 2·N FLOPs per token.
  • Chinchilla-optimal: ~20 tokens per parameter (70B on 1.4T tokens).
  • GPT-3: ~1.7 tokens/param; Llama 3 8B: ~1,875 tokens/param (15T tokens).
  • Llama 3.1 405B: ~3.8×10^25 FLOPs on 15.6T tokens.
  • Kaplan's loss-vs-compute exponent is ~0.05: 10× more compute cuts loss by only ~11%.
Common pitfalls 4
  • Quoting "20 tokens per parameter" as the right way to train any model; it's optimal for training compute only.
  • Reading lower pretraining loss as "better at my task" without a downstream eval.
  • Using total parameters in 6ND for an MoE; compute scales with active parameters.
  • Ignoring the data limit: beyond ~4 epochs, repeated tokens add much less than fresh ones (Muennighoff et al., 2023).
Interview questions 2

Answer out loud first, then reveal.

Chinchilla says ~20 tokens per parameter. Why did Meta train an 8B model on 15T tokens?Show answer

Because Chinchilla optimizes the wrong objective for a product. It minimizes loss for a fixed training budget, but training happens once while inference cost scales with parameters on every token served. An 8B model costs ~16 GFLOPs per token versus ~154 for the 77B model the same compute would train Chinchilla-style. Overtraining spends extra training compute per unit of quality and pays it back in serving cost, latency and fitting on one GPU. Meta also reported the 8B was still improving at 15T tokens.

Is scaling hitting a wall?Show answer

I separate the axes. Pretraining still follows power laws, but returns diminish: each step needs ~10× compute, and high-quality data is getting scarce. So gains shifted to post-training and test-time compute: reasoning models trained with RL on verifiable tasks, which spend more tokens per query, made big jumps on math and code. For architecture decisions that means quality per dollar now depends on how much thinking we buy per request, so I treat reasoning effort as a cost knob and route it per task.