Simple Algorithm
Artificial Intelligence · Deep Layer · 28 min

Scaling Laws

Power laws in loss and compute-optimal training.

Across more than seven orders of magnitude of compute, the test loss of language models has fallen along straight lines on log–log axes. This lesson states those laws precisely, explains why the two landmark fits disagreed, derives power laws from simple models of data, and redoes the compute-optimal calculation once inference and finite data enter the bill.

What you’ll learn

  • State Kaplan et al.'s and Hoffmann et al.'s scaling laws with their estimation methods, and explain why their compute-optimal prescriptions differed.
  • Derive power-law learning curves from a Zipf-distributed "quanta" model, including αD=αN/(1+αN)\alpha_D=\alpha_N/(1+\alpha_N), and from the dimension of the data manifold.
  • Derive the inference-aware compute optimum, and describe how repeated data and hyperparameter transfer change scaling practice.
  • Assess what scaling laws do not predict: downstream abilities, and behavior beyond the measured range.

Two landmark fits

The prescriptions differ sharply: Nopt∝C0.73N_{\mathrm{opt}}\propto C^{0.73} against about C0.5C^{0.5}. Later work traced the gap to method. Pearce and Song (2024) attributed much of it to counting only non-embedding parameters in small models, where embeddings are a large share of the total. Porian et al. (2024) reproduced Kaplan's exponent and then removed it step by step by counting the final layer's compute, adjusting the warmup duration and retuning the optimizer at each scale. Kaplan et al. also used one learning-rate schedule length for all runs, which penalizes short runs, as Hoffmann et al. pointed out. Finally, a re-analysis of Hoffmann et al.'s data found that approach (3) disagreed with approaches (1) and (2) and reported implausibly narrow confidence intervals; refitted, it agreed with them (Besiroglu et al., 2024).

Why power laws? Two models

DerivationProof
  1. L(n)−L∞=δ∑k>npk=δ (1+o(1))α ζ(α+1) n−α ∝ N−αL(n)-L_\infty=\delta\sum_{k>n}p_k=\frac{\delta\,(1+o(1))}{\alpha\,\zeta(\alpha+1)}\,n^{-\alpha}\ \propto\ N^{-\alpha}

    (a) The excess loss is the mass of the unlearned tail. Compare the sum with an integral, ∑k>nk−(α+1)=1αn−α (1+o(1))\sum_{k>n}k^{-(\alpha+1)}=\tfrac1\alpha n^{-\alpha}\,(1+o(1)):

  2. k∗(D)=(Dτ ζ(α+1))1/(α+1)k^*(D)=\Big(\frac{D}{\tau\,\zeta(\alpha+1)}\Big)^{1/(\alpha+1)}

    (b) Skill kk appears about DpkDp_k times in DD tokens, so it is learned when Dpk≥τDp_k\ge\tau, which holds for every kk up to

  3. L(D)−L∞ ∝ k∗(D)−α ∝ D−α/(α+1),αD=αN1+αNL(D)-L_\infty\ \propto\ k^*(D)^{-\alpha}\ \propto\ D^{-\alpha/(\alpha+1)},\qquad\alpha_D=\frac{\alpha_N}{1+\alpha_N}

    Substitute n=k∗(D)n=k^*(D) into (a):

  4. Each skill appears abruptly at a definite scale, yet the average loss falls smoothly, because the Zipf tail holds skills at every scale. Smooth averages built from sharp parts are one way to reconcile smooth scaling laws with reports of emergence.

Predict before you look

Taking the Chinchilla fit's α≈0.34\alpha\approx0.34 as αN\alpha_N, what data exponent does the quanta model predict?

Show the answer

0.25

0.34/1.34≈0.2540.34/1.34\approx0.254, close to the fitted β≈0.28\beta\approx0.28. The same formula with Kaplan's αN=0.076\alpha_N=0.076 predicts 0.0710.071, below their 0.0950.095: suggestive, not decisive.

The data-manifold model (Sharma & Kaplan, 2022) explains exponents by geometry. If inputs lie on a manifold of intrinsic dimension dd and the network acts like a piecewise-linear interpolator with NN pieces, each piece covers a cell of diameter s∝N−1/ds\propto N^{-1/d}. A smooth target deviates from its linear interpolant by O(s2)\order{s^2} (Taylor's theorem), so squared error, or cross-entropy near its optimum, scales as s4s^4:

L(N)−L∞ ∝ s4 ∝ N−4/d⟹αN≈4dL(N)-L_\infty\ \propto\ s^4\ \propto\ N^{-4/d}\qquad\Longrightarrow\qquad\alpha_N\approx\frac4d
Small exponents mean high intrinsic dimension: αN=0.076\alpha_N=0.076 corresponds to d≈50d\approx50. Sharma and Kaplan found rough agreement between measured exponents and intrinsic-dimension estimates of trained networks' representations. Bahri et al. (2024) separate this resolution-limited regime from a variance-limited one, where one resource is effectively unlimited and the loss approaches its limit as 1/N1/N or 1/D1/D.

Allocating compute in the real world

DerivationThe inference-aware optimum
  1. min⁡N,D 6ND+2NDinfsubject toE+ANα+BDβ=ℓ\min_{N,D}\ 6ND+2ND_{\text{inf}}\quad\text{subject to}\quad E+\frac{A}{N^{\alpha}}+\frac{B}{D^{\beta}}=\ell

    Train NN parameters on DD tokens, then generate DinfD_{\text{inf}} tokens at about 2N2N FLOPs each. To reach a target loss ℓ\ell at minimum lifetime cost, solve

  2. 6D+2Dinf6N=αAN−α−1βBD−β−1⟺αA N−αβB D−β=1+Dinf3D\frac{6D+2D_{\text{inf}}}{6N}=\frac{\alpha AN^{-\alpha-1}}{\beta BD^{-\beta-1}}\quad\Longleftrightarrow\quad\frac{\alpha A\,N^{-\alpha}}{\beta B\,D^{-\beta}}=1+\frac{D_{\text{inf}}}{3D}

    At the optimum the cost gradient is parallel to the loss gradient (Lagrange). Multiply through by N/DN/D:

  3. Dinf≫D⟹N<NChinchilla(ℓ),D>DChinchilla(ℓ)D_{\text{inf}}\gg D\quad\Longrightarrow\quad N<N_{\text{Chinchilla}}(\ell),\qquad D>D_{\text{Chinchilla}}(\ell)

    With Dinf=0D_{\text{inf}}=0 this is the Chinchilla balance αAN−α=βBD−β\alpha AN^{-\alpha}=\beta BD^{-\beta} of The Scaling Era & the Bitter Lesson. Inference lets the model term exceed the data term by the factor 1+Dinf/(3D)1+D_{\text{inf}}/(3D): a smaller model, trained on more tokens, reaching the same loss. Sardana et al. (2024) concluded that models expecting large inference demand should be trained smaller and longer than Chinchilla-optimal.

Check your understanding

A model will generate Dinf=30DD_{\text{inf}}=30D tokens over its lifetime. At the lifetime-optimal point, by what factor does the model term αAN−α\alpha AN^{-\alpha} exceed the data term βBD−β\beta BD^{-\beta}?

  1. 11, the Chinchilla balance
  2. 1111
  3. 3131
  4. 33
Show the answer

B. 1111

1+Dinf/(3D)=1+30/3=111+D_{\text{inf}}/(3D)=1+30/3=11. A heavy inference load pushes toward a smaller model trained on more data.

  • Finite data. Compute-optimal training of ever larger models needs ever more unique text. Muennighoff et al. (2023) fit scaling laws with repeated data: up to about four epochs, repeated tokens are nearly as valuable as fresh ones, and beyond that the value of further repetition decays toward zero. Mixing in code can stretch the supply; whether synthetic text can substitute for human text at scale is open.
  • Hyperparameters across scale. A scaling law compares well-tuned runs, but tuning a large model directly is unaffordable. Under the maximal-update parametrization (μ\muP), optimal learning rates and initialization scales stay roughly constant as width grows, so they can be tuned on a small proxy and transferred (Yang et al., 2022). Porian et al.'s reconciliation shows the stakes: badly tuned small models bias the fitted exponents.

What scaling laws do not tell you

Scaling laws are fits, not theorems. Three caveats matter in practice:

  • Extrapolation. Fits over a few orders of magnitude are routinely extrapolated by one or two more. Some curves bend: broken power laws, with smoothly changing exponents, fit many tasks better than a single power law (Caballero et al., 2023). The irreducible term EE is read off the curvature of the fit and is poorly constrained.
  • Loss versus abilities. Downstream accuracy is a nonlinear function of loss and can look flat, then steep. How much of that is real is the emergence debate (In-Context Learning & Emergence).
  • What is held fixed. Each law holds for one architecture family, data distribution, tokenizer and recipe. Better data filtering or training methods shift the whole curve, which is why algorithmic progress can be measured as compute saved at equal loss.

Key takeaways

  • Kaplan et al. (2020) found L(N)∝N−0.076L(N)\propto N^{-0.076}, L(D)∝D−0.095L(D)\propto D^{-0.095} and Nopt∝C0.73N_{\mathrm{opt}}\propto C^{0.73}; Hoffmann et al. (2022), by three methods, found Nopt,Dopt∝C≈0.5N_{\mathrm{opt}},D_{\mathrm{opt}}\propto C^{\approx0.5}. The gap is largely methodological.
  • Zipf-distributed skills give L(N)−L∞∝N−αL(N)-L_\infty\propto N^{-\alpha} and L(D)−L∞∝D−α/(α+1)L(D)-L_\infty\propto D^{-\alpha/(\alpha+1)}, abrupt parts under a smooth average; a data manifold of dimension dd gives αN≈4/d\alpha_N\approx4/d.
  • With inference counted, the optimum satisfies αAN−α/(βBD−β)=1+Dinf/(3D)\alpha AN^{-\alpha}/(\beta BD^{-\beta})=1+D_{\text{inf}}/(3D): smaller models trained longer. Repetition is nearly free up to about four epochs, and μ\muP transfers hyperparameters across width.
  • Scaling laws are empirical fits for a fixed recipe; extrapolation, the irreducible term and the mapping from loss to abilities are their weak points.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why did Kaplan et al. (2020) recommend Nopt∝C0.73N_{\mathrm{opt}}\propto C^{0.73} when Hoffmann et al. (2022) found about C0.5C^{0.5}?

  1. Kaplan et al. trained on code rather than natural text
  2. Mainly method: counting only non-embedding parameters at small scale, last-layer compute, warmup and per-scale optimizer tuning, and fixed schedule lengths
  3. Hoffmann et al. used a different tokenizer, which changes every exponent
  4. Transformers changed between 2020 and 2022, so each result holds for its own architecture
Show the answer

B. Mainly method: counting only non-embedding parameters at small scale, last-layer compute, warmup and per-scale optimizer tuning, and fixed schedule lengths

Pearce & Song (2024) and Porian et al. (2024) recovered Kaplan's exponent and removed it by correcting these choices; Kaplan's single schedule length also penalized short runs.

Question 2

In the quanta model, why does the average loss fall smoothly even though each skill is learned abruptly?

  1. Because skills are in fact learned gradually
  2. Because cross-entropy is a smooth function
  3. Because the excess loss is the mass of the unlearned Zipf tail, ∝n−α\propto n^{-\alpha}, and the tail holds skills at every scale
  4. Because larger models forget the skills of smaller ones
Show the answer

C. Because the excess loss is the mass of the unlearned Zipf tail, ∝n−α\propto n^{-\alpha}, and the tail holds skills at every scale

Each increase in scale adds a few skills, each removing its small share pkp_k of the loss; the remaining tail of a power law is itself a power law.

Question 3

In the data-manifold model, what does a measured exponent αN≈0.08\alpha_N\approx0.08 suggest?

  1. An intrinsic dimension around 5050, since αN≈4/d\alpha_N\approx4/d
  2. An intrinsic dimension around 0.30.3
  3. That the data lie on a line
  4. That the model is in the variance-limited regime
Show the answer

A. An intrinsic dimension around 5050, since αN≈4/d\alpha_N\approx4/d

Piecewise-linear interpolation over NN cells of diameter N−1/dN^{-1/d} gives squared error ∝N−4/d\propto N^{-4/d}, so d≈4/0.08=50d\approx4/0.08=50.

Question 4

A training run runs out of fresh text and must repeat its corpus. What did Muennighoff et al. (2023) find?

  1. Any repetition ruins the run
  2. Repeated data is always as good as fresh data
  3. Repetition beats fresh data, because the model memorizes better
  4. Up to about four epochs costs little; beyond that, further repetition is worth less and less, approaching nothing
Show the answer

D. Up to about four epochs costs little; beyond that, further repetition is worth less and less, approaching nothing

Their fitted law discounts repeated tokens with a value that decays exponentially in the number of repetitions: a few epochs are nearly free, many are nearly worthless.

Further reading

  • J. Kaplan et al., "Scaling laws for neural language models," arXiv:2001.08361 (2020).
  • J. Hoffmann et al., "Training compute-optimal large language models," NeurIPS (2022).
  • E. J. Michaud, Z. Liu, U. Girit & M. Tegmark, "The quantization model of neural scaling," NeurIPS (2023).
  • N. Muennighoff et al., "Scaling data-constrained language models," NeurIPS (2023).
  • Y. Bahri, E. Dyer, J. Kaplan, J. Lee & U. Sharma, "Explaining neural scaling laws," PNAS (2024).