Transformer & DL Foundations
IC5IC6

Scaling Laws: Kaplan, Chinchilla, and the Over-Training Era

A single power law tells you how big to build, how long to train, and why every modern lab now over-trains a small model to win on inference.

15 min read · 14 sections
0

1. Quick anchor

A scaling law is an empirical power law that predicts model loss from three numbers — parameters NN, training tokens DD, and the compute C6NDC \approx 6ND that ties them together. The headline fact: for a fixed compute budget, there is one optimal (N,D)(N, D) pair, and Chinchilla showed that pair has NN and DD growing in lockstep — roughly 20 tokens per parameter at the optimum. Kaplan's 2020 laws got the shape right but the allocation wrong; they told labs to build huge, data-starved models (GPT-3: 175B params, 300B tokens), and Chinchilla proved a 70B model on 1.4T tokens beats them on the same compute. The twist that defines 2024-2026: labs now deliberately violate compute-optimality, training small models far past 20 tokens/param, because the budget that matters in production is inference, not training. Everything downstream — which model you pick, how long you train, whether you repeat data — falls out of this one curve.

2. Why interviewers probe this

  • [IC5] — Can you reason quantitatively about a training run instead of cargo-culting "more data good"? Can you compute C6NDC \approx 6ND, explain the 20:1 ratio, and tell me why GPT-3 was undertrained? This separates engineers who tune knobs from those who understand the budget.
  • [IC5] — Do you know the difference between training-optimal and deployment-optimal? An IC5 who says "Llama violates Chinchilla so Meta is wrong" fails; one who explains the inference-amortization argument passes.
  • [IC6] — Can you make a defensible capital-allocation decision under a real constraint (finite unique data, fixed GPU-hours, a latency SLA)? Can you reason about epoch decay, the emergent-abilities debate, and when the smooth power law breaks? This is staff-level: you own the recipe, and a wrong call costs seven figures.
  • [IC6] — Do you know the limits of the laws — that they predict loss, not capability; that they're fit on a specific data distribution; and that extrapolating them off-distribution is where expensive mistakes live?

3. Concept build-up

Beginner explainerNew here? The words first

The words first.

  • Parameter count (NN) — the number of learnable weights in the model; bigger NN = more capacity.
  • Training tokens (DD) — how many tokens of text the model sees during training (counting repeats).
  • Compute (CC) — total floating-point operations to train, measured in FLOPs; for a transformer C6NDC \approx 6ND.
  • Loss — average negative log-probability the model assigns to the correct next token; lower is better.
  • Power law — a relationship like y=axby = a \cdot x^{-b} that becomes a straight line when you plot logy\log y vs logx\log x.
  • Compute-optimal — the (N,D)(N, D) split that gives the lowest loss for a fixed compute budget.
  • Over-training — training a smaller model on far more tokens than compute-optimal, on purpose, to save money later.
  • Emergent ability — a skill that appears suddenly at large scale and is absent in smaller models.

Step by step.

  1. Pick a compute budget CC (e.g. how many GPU-hours you can afford).
  2. That budget can buy a big model on little data, or a small model on lots of data — C6NDC \approx 6ND holds either way.
  3. Plot final loss against many (N,D)(N, D) choices at that budget; you get a U-shaped curve with a clear minimum.
  4. Chinchilla measured that minimum and found NN and DD should grow together — about 20 tokens per parameter.
  5. But the loss curve is flat near the bottom, so you can shrink NN a lot for only a tiny loss increase.
  6. A smaller model is cheaper to serve, so labs pay extra training cost to sit left of the optimum.
  7. Push too far with repeated data and the law breaks — past ~4 epochs, extra passes stop helping.

Remember this: one power law tells you the cheapest way to reach a target loss — and production bends it toward cheap inference.

3.1 The object being fit: loss as a power law

Scaling laws fit a single scalar — cross-entropy loss LL — as a function of scale. The clean, separable form Chinchilla uses is:

ƒ
L(N,D)=E+ANα+BDβL(N, D) = E + \frac{A}{N^{\alpha}} + \frac{B}{D^{\beta}}

Defining every symbol:

  • LL — the per-token cross-entropy loss (nats), what you actually minimize.
  • NN — number of model parameters.
  • DD — number of training tokens.
  • EE — the irreducible loss, the entropy of natural language itself; no model, however large, beats this floor.
  • A,BA, B — fitted scale constants (units chosen so the terms have loss units).
  • α,β\alpha, \beta — the exponents that govern how fast loss falls as you add parameters or data. Chinchilla fits α0.34\alpha \approx 0.34 and β0.28\beta \approx 0.28.

The two non-constant terms each say: doubling that resource multiplies its loss contribution by a fixed factor (2α2^{-\alpha} or 2β2^{-\beta}). Because α\alpha and β\beta are close, parameters and data reduce loss at similar rates — which is the mathematical seed of the "scale them together" conclusion. The Kaplan 2020 form was a simpler single-variable law L(N)(Nc/N)αNL(N) \approx (N_c / N)^{\alpha_N} that, crucially, used non-embedding parameter counts and a different learning-rate schedule; this is the technical root of why Kaplan and Chinchilla disagree.

3.2 The compute bridge: why C6NDC \approx 6ND

Compute, parameters, and data are not independent — they're chained by the cost of a forward+backward pass. For a dense transformer, one token costs about 2N2N FLOPs in the forward pass (one multiply-add per weight, counted as 2 FLOPs) and roughly 4N4N in the backward pass, totaling 6N\approx 6N FLOPs per token. Over DD tokens:

ƒ
C6NDC \approx 6 N D

This is the load-bearing equation of the whole field. It means: fix CC, and choosing NN forces D=C/(6N)D = C / (6N). You cannot have both big and well-fed for free. Scaling laws are, at heart, a constrained optimization over this one line.

Compute-optimal split — on real numbers

Names in plain words: C = total training FLOPs you can afford. N = model size (params). D = training tokens. The rule C ≈ 6·N·D ties them; Chinchilla says the loss-minimizing split puts about 20 tokens per parameter.

Suppose you have C = 1.2e21 FLOPs (a modest run).

  • The compute constraint: N · D = C / 6 = 1.2e21 / 6 = 2.0e20.
  • The Chinchilla constraint: D = 20 · N.
  • Substitute: N · (20·N) = 2.0e20, so 20·N² = 2.0e20, giving N² = 1.0e19, N ≈ 3.16e93.2B params.
  • Then D = 20 · 3.16e9 ≈ 6.3e10 = 63B tokens.

Check: 6 · 3.2e9 · 6.3e10 ≈ 1.2e21 FLOPs. ✓

What it did: from a single budget number it pinned down both the model size and the dataset size — a 3.2B model on 63B tokens. Build a 30B model on the same budget instead and you'd starve it on 6.7B tokens (≈0.2 tokens/param) and land far up the loss curve.

3.3 Kaplan vs Chinchilla: the same shape, the wrong allocation

Kaplan et al. (2020) concluded that under a fixed compute budget you should spend most of it on parameters: their fit implied NoptC0.73N_{\text{opt}} \propto C^{0.73} and only DoptC0.27D_{\text{opt}} \propto C^{0.27} — model size racing ahead of data. The industry took this literally. GPT-3 (175B params, 300B tokens) is the monument: under 2 tokens/param, wildly data-starved by the standard that came later.

Hoffmann et al. (2022) re-ran the experiment with 400+ models from 70M to 16B params, three independent methods, and a corrected learning-rate schedule (Kaplan's LR decay didn't reach the end of training, biasing his loss estimates). Their finding flipped the allocation: NoptC0.50N_{\text{opt}} \propto C^{0.50} and DoptC0.50D_{\text{opt}} \propto C^{0.50}parameters and tokens scale equiproportionally. The 20-tokens-per-parameter rule is the practical summary (Chinchilla itself: 70B params, 1.4T tokens). The proof was Chinchilla (70B) beating Gopher (280B) — a 4× smaller model — on the same compute, by +7% on MMLU and across the benchmark suite, while being far cheaper to fine-tune and serve. The two reconciling technical points an interviewer wants: (1) Kaplan counted non-embedding parameters, distorting small-model fits; (2) his LR schedule under-trained the tail, making more data look less useful than it is.

3.4 The flat valley: why labs now over-train

Here is the subtlety that the 20:1 headline hides. The loss surface near the compute-optimal point is flat. Move to a model 2-3× smaller than optimal and feed it the extra compute as more tokens, and your training loss rises only slightly. Chinchilla-optimal minimizes loss per unit training FLOP — but it completely ignores inference.

Production economics invert the objective. A model is trained once and served billions of times. Inference cost scales with NN (≈2N2N FLOPs per generated token), so a smaller model is permanently cheaper and lower-latency. The rational move: pick the smallest NN that hits your quality bar, then pour tokens in well past 20:1 to squeeze its loss down. This is exactly why Llama 3 8B trained on 15T tokens (≈1875 tokens/param, ~90× the Chinchilla ratio) and Llama 3.1 trained ~2 epochs on diverse corpora. The training run is "compute-suboptimal" on purpose — you knowingly burn extra GPU-hours up front to amortize a smaller, faster model across a deployment lifetime. The correct frame: Chinchilla optimizes a training budget; deployment optimizes total cost of ownership = training + (inference cost × expected query volume). When query volume is large, the optimum shifts hard toward smaller, over-trained models.

3.5 Data-constrained scaling: when you run out of text

The clean laws assume unique tokens are infinite. They aren't — high-quality web text is finite, and frontier runs now bump the ceiling. Muennighoff et al. (2023) studied what happens when DD exceeds the unique-token supply DuniqueD_{\text{unique}} and you must repeat data. Findings that matter:

  • Repeating data has diminishing returns: the first repeat of a token is nearly as good as fresh data, but value decays roughly exponentially with epoch count.
  • Past ~4 epochs, additional passes contribute almost nothing and eventually degrade performance (overfitting tax).
  • They fit a modified law where repeated tokens have an effective count smaller than their raw count — a token seen kk times is worth less than kk fresh tokens, by a decaying factor.

The practical rule of thumb from this work: up to about 4 epochs, repeating data is a reasonable substitute for collecting more; beyond that, you're better off adding parameters, accepting a smaller model, or spending on data acquisition/curation. This is why most 2024-2026 production runs cap at 1-2 epochs on their best data and treat data quality as the binding constraint, not token count.

3.6 Emergent abilities: where the smooth law gets contested

Scaling laws predict loss, which falls smoothly. But Wei et al. (2022) catalogued emergent abilities — tasks (multi-step arithmetic, certain reasoning benchmarks) where accuracy is near-random until a scale threshold, then jumps sharply. If real, emergence means you cannot extrapolate capability from small models even when you can extrapolate loss. The live debate: a strong counter-argument holds that many "emergences" are artifacts of discontinuous metrics (exact-match accuracy) — swap to a smooth metric like per-token log-likelihood and the jump dissolves into a gradual curve. The synthesis emerging in 2024-2026 work frames grokking, double descent, and emergence as the same underlying phenomenon: a memorization-vs-generalization circuit competition, where a phase transition (U-shaped scaling on hard subtasks composing with inverted-U on easy ones) produces the apparent threshold. The honest interview position: loss scaling is robust and predictive; capability scaling is partly a measurement question and partly real phase-transition behavior, and you should not bet a roadmap on a single emergence threshold.

4. Minimal implementation

Fit a Chinchilla-style law from run data and solve for the compute-optimal split. This is the back-of-envelope every staff engineer should be able to run before approving a training budget.

import numpy as np
from scipy.optimize import curve_fit
 
# --- 1. Fit L(N, D) = E + A/N^alpha + B/D^beta from observed runs ---
# Each row: (params N, tokens D, measured final loss). Real runs, not toy.
runs = np.array([
    [70e6,   1.4e9,  3.40],
    [160e6,  3.2e9,  3.12],
    [410e6,  8.2e9,  2.88],
    [1.0e9,  20e9,   2.66],
    [2.8e9,  55e9,   2.49],
    [6.9e9,  140e9,  2.36],
])
N, D, L = runs[:, 0], runs[:, 1], runs[:, 2]
 
def loss_law(X, E, A, B, alpha, beta):
    n, d = X
    return E + A * n**(-alpha) + B * d**(-beta)
 
# Fit in a numerically sane range; bounds keep exponents in (0,1).
p0 = [1.7, 400.0, 400.0, 0.34, 0.28]
(E, A, B, alpha, beta), _ = curve_fit(
    loss_law, (N, D), L, p0=p0,
    bounds=([0, 0, 0, 0.05, 0.05], [4, 1e6, 1e6, 1.0, 1.0]),
    maxfev=100000,
)
print(f"E={E:.3f}  A={A:.1f}  B={B:.1f}  alpha={alpha:.3f}  beta={beta:.3f}")
 
# --- 2. Given a compute budget, solve the optimal N, D split ---
def compute_optimal(C, A, B, alpha, beta):
    """Minimize L over N,D subject to C = 6*N*D. Grid search on N."""
    Ns = np.logspace(8, 11, 4000)          # 0.1B .. 100B params
    Ds = C / (6.0 * Ns)                     # compute constraint
    losses = E + A * Ns**(-alpha) + B * Ds**(-beta)
    i = np.argmin(losses)
    return Ns[i], Ds[i], losses[i]
 
C = 1.2e21  # FLOPs
N_opt, D_opt, L_opt = compute_optimal(C, A, B, alpha, beta)
print(f"C={C:.1e} FLOPs -> N*={N_opt/1e9:.2f}B  D*={D_opt/1e9:.1f}B  "
      f"tokens/param={D_opt/N_opt:.1f}  loss={L_opt:.3f}")

What each block does. Block 1 fits the five constants of the separable law by nonlinear least squares; the bounds keep the exponents physically meaningful and the irreducible loss EE non-negative. Block 2 enforces the compute bridge C=6NDC = 6ND by parameterizing the whole feasible set with a single variable NN (since DD is then determined), evaluating loss along that line, and taking the minimum — exactly the constrained optimization of §3.2. The printed tokens/param should land near 20 when your fit recovers αβ\alpha \approx \beta; if it doesn't, your fit (or your run data) is telling you the exponents diverge, which is itself a finding. The same compute_optimal function, swept over a range of CC, traces the compute-optimal frontier you'd put in a planning doc.

5. Production tradeoffs

Regime NN vs optimal Tokens/param Training cost Inference cost When to choose
Kaplan-style (legacy) much larger ~2 high (wasted on params) high (huge NN) never, in hindsight
Chinchilla-optimal optimal ~20 minimized per FLOP moderate research/ablation; one-shot eval
Over-trained (modern default) 2-10× smaller 100-2000 higher up-front low, fast high-volume serving, edge, latency SLA
Data-constrained smaller repeats, ≤4 epochs bounded by data low scarce high-quality corpus

Cost. Training is a one-time C6NDC \approx 6ND; inference is recurring 2N\approx 2N FLOPs per output token times every query forever. The crossover math: extra training tokens to over-train cost 6NΔD6N \cdot \Delta D once; the inference savings from a smaller NN accrue per query. Above a volume threshold (often millions of queries — easily reached for any deployed product) the over-trained small model wins on total cost of ownership.

Latency / quality. Smaller NN means lower per-token latency and higher throughput (more requests per GPU), the dominant serving lever. Over-training buys back the quality you'd lose from shrinking NN — up to a point of diminishing returns set by the B/DβB/D^{\beta} term flattening.

Failure modes. (1) Extrapolating off-distribution — laws are fit on a fixed data mix; change the corpus (more code, more multilingual) and the constants move. (2) Data exhaustion — pushing tokens/param high enough that you exceed unique data and silently start repeating, paying the >4-epoch overfitting tax. (3) Confusing loss with capability — a lower loss does not guarantee an emergent skill cleared its threshold; eval on the actual task. (4) Stale 6ND6ND — MoE and quantized training break the dense FLOP accounting; for MoE use active parameters per token, not total.

What changes at scale. At frontier compute the binding constraint stops being FLOPs and becomes unique high-quality tokens and memory bandwidth (see /inference). Allocation decisions shift from "how big a model" to "how do I get more good data" (synthetic data, curation, multi-epoch with quality filtering). MoE changes the curve: it decouples total parameters (capacity) from active parameters (per-token cost), letting you grow capacity while holding inference FLOPs roughly fixed — a different point on the cost/quality frontier than dense scaling laws describe.

6. How it's asked

[IC4] What is the relationship between compute, parameters, and tokens, and what's the Chinchilla rule? For a dense transformer, training compute is approximately C6NDC \approx 6ND FLOPs, where NN is parameters and DD is tokens. Chinchilla showed that for a fixed CC, loss is minimized when parameters and tokens scale equiproportionally — roughly 20 training tokens per parameter (70B params on 1.4T tokens). The earlier Kaplan laws over-weighted parameters, which is why GPT-3 at 175B params on only 300B tokens was badly undertrained.
[IC5] Chinchilla says ~20 tokens per parameter is compute-optimal. Llama 3 8B was trained on 15T tokens — roughly 1875 tokens/param. Is Meta wrong, or is the law wrong? Neither — they're optimizing different objectives. Chinchilla minimizes training loss per unit of training FLOPs and ignores deployment. Meta is optimizing total cost of ownership: a model is trained once but served billions of times, and inference cost scales with NN (≈2N2N FLOPs/token). Because the loss valley is flat near the optimum, you can shrink NN a lot for a small loss penalty, then over-train on extra tokens to claw the quality back — yielding a permanently cheaper, faster model. So Llama 3 deliberately sits far left of compute-optimal; it's "wasteful" on training FLOPs and optimal on serving economics.
[IC5] Derive why 1/sqrt(d_k) attention scaling is unrelated to scaling laws, then explain what the Chinchilla law fits and why it's a log-log line. The 1/dk1/\sqrt{d_k} factor is a numerical fix inside one attention layer — it keeps QKQK^\top dot products from saturating softmax, a per-forward-pass concern with nothing to do with training budgets. Scaling laws instead fit final cross-entropy loss LL as a function of NN and DD across whole training runs. The form L=E+A/Nα+B/DβL = E + A/N^{\alpha} + B/D^{\beta} is a power law: subtract the irreducible floor EE and take logs, and each term becomes linear — log(LEother term)=logAαlogN\log(L - E - \text{other term}) = \log A - \alpha \log N — so the reducible loss is a straight line versus logN\log N with slope α-\alpha. That linearity on a log-log plot is what makes the law extrapolative and useful for planning.
[IC6] Fixed compute CC, but your unique high-quality corpus DuniqueD_{\text{unique}} is smaller than the Chinchilla-optimal DD for CC. Allocate compute across model size, epochs, and data acquisition. First check the gap: compute-optimal wants DC/(620)20D^* \approx \sqrt{C/(6 \cdot 20)} \cdot \sqrt{20} — if Dunique<DD_{\text{unique}} < D^* I'm data-bound, not compute-bound. From Muennighoff et al., repeating data helps with exponentially decaying returns and turns harmful past ~4 epochs, so I'd cap at ~4 epochs of DuniqueD_{\text{unique}}, treating repeated tokens as worth fewer effective tokens than their raw count. Any leftover compute goes into a smaller model than naive Chinchilla (since effective data is below DD^*) rather than more epochs. In parallel I'd invest in the highest-ROI lever — data acquisition, curation, and synthetic generation — because at this scale the binding constraint is unique tokens, and a dollar of clean data beats a dollar of repeat compute.
[IC6] How much would you trust a scaling-law extrapolation when deciding to commit to a 10× larger run? Loss extrapolations are reliable within the fitted regime and on the same data distribution — that's the strongest evidence we have and worth trusting for the loss target. But I'd hedge three ways: (1) loss is not capability — I'd identify which downstream tasks I actually need and check whether they show smooth or emergent (threshold) behavior, since the latter can't be extrapolated; (2) refit constants if the data mix changes (more code/multilingual moves AA, BB, and the exponents); (3) validate the 6ND6ND accounting against the actual architecture (MoE, long-context attention, and quantized training all break the dense approximation). I'd commit to the loss prediction, run a small intermediate-scale checkpoint to de-risk capability, and keep a kill criterion.

7. Pitfalls & flashcards

  • Quoting "20 tokens/param" as a law of nature. It's the compute-optimal ratio for one objective. Production over-trains 5-100× past it on purpose; quote the ratio and the inference-amortization caveat.
  • Forgetting the constant 6. C6NDC \approx 6ND (forward 2N2N + backward 4N4N). People drop the factor and miscalculate budgets by 3×.
  • Comparing Kaplan and Chinchilla numbers directly. Kaplan used non-embedding parameters and an under-decayed LR schedule; the exponents aren't apples-to-apples. The disagreement is methodological, not metaphysical.
  • Assuming infinite data. Past ~4 epochs of repeated data, returns collapse and overfitting begins; effective token count is below raw count when you repeat.
  • Treating loss as capability. Loss falls smoothly; some capabilities appear at thresholds (debated as real phase transitions vs metric artifacts). Eval the task, don't infer it from loss.
  • Applying dense laws to MoE. Use active parameters per token for inference cost and the FLOP bridge; total parameters describe capacity, not per-token compute.

Flashcard. Chinchilla picks the cheapest training point (\approx20 tokens/param via C6NDC\approx 6ND); production deliberately over-trains a smaller model because inference is paid per query, forever — total cost of ownership, not training FLOPs, sets the real optimum.

8. Further reading

  • Hoffmann et al., 2022 — Training Compute-Optimal Large Language Models (Chinchilla): the equiproportional result, the 20:1 ratio, and the Gopher comparison. arxiv.org/abs/2203.15556 · NeurIPS PDF
  • Kaplan et al., 2020 — Scaling Laws for Neural Language Models: the original power laws and the parameter-heavy allocation that Chinchilla corrected. arxiv.org/abs/2001.08361
  • Muennighoff et al., 2023 — Scaling Data-Constrained Language Models: the data-repetition law and the ~4-epoch cliff. arxiv.org/abs/2305.16264
  • Wei et al., 2022 — Emergent Abilities of Large Language Models: the emergence catalogue and the threshold debate. arxiv.org/abs/2206.07682

Next: /inference — where the 2N2N-per-token serving cost that drives over-training actually gets paid, and how to make it cheaper.

Primary sources
← More in Transformer & DL Foundations