advanced attention-transformers 45 min read

Neural Scaling Laws and Compute-Optimal Training

Loss falls as a power of parameters, data, and compute: in two solvable models the exponents are theorems — Zipf's tail for data, a spectrum's tail for size — and a Lagrange multiplier turns the fitted law into the compute-optimal split, whose exponent depends on what you count as a parameter

Overview & Motivation

Train a small transformer on the shared filings with a fixed budget of compute, and choose how to spend it: a narrow model trained on many tokens, or a wide one trained on few. At each budget the losses form a valley. At 101010^{10} FLOPs the valley’s floor sits near 7,1007{,}100 weights. At 2.52.5 times that budget it sits near 10,80010{,}800, and at 6.36.3 times near 22,70022{,}700. On log–log axes the floors rise with the budget, at a slope of 0.460.46 and then 0.800.80, so three noisy points only suggest a line. Kaplan and colleagues (2020) found loss falling as a power law, with some trends spanning more than seven orders of magnitude. Hoffmann and colleagues (2022) measured the valleys on far larger models, and both papers turned the result into rules for sizing real models.

Lines on log–log axes are power laws. The usual form is L≈E+A/NαL \approx E + A/N^\alpha, a line only while the loss stays well above its floor EE, and this topic asks two questions about it. Where do the exponents come from? And how should a budget be split? We develop the answer in order:

  1. Data scaling is Zipf’s tail. A memorizer must err when the next word is one it has not seen. Under the Pitman–Yor generator behind our corpus, that probability is an exact ratio of Gamma functions, which falls as a power of the data.
  2. Model-size scaling is a spectrum’s tail. A linear model whose spectrum and target decay as powers of the coordinate index leaves a tail it cannot represent, a power of its size.
  3. Training time has its own exponent. Gradient flow learns the large-eigenvalue directions first, and what remains decays as a power of time. For Gaussian data we compute SGD’s expected loss exactly.
  4. Compute is 6N6N per token, plus attention. We count it by instrumenting the arrays of a real training step.
  5. The optimal split has a closed form. A Lagrange multiplier on the budget gives the compute-optimal size, and the solvable model predicts its exponent, which the fitting procedures recover.
  6. Kaplan and Chinchilla measured one law in two units. Counting only non-embedding parameters at small scale can turn an exponent near Chinchilla’s 0.50.5 into one near Kaplan’s 0.730.73.

Then the finance case. A firm that trains on its own filings has a fixed amount of text. A few repeated epochs cost almost nothing, and the cap moves the optimum only when the corpus is far smaller than the law asks for.


Data scaling from Zipf: the missing mass

The simplest learner is a lookup table. It predicts a token’s type only if that type has occurred before, and it is wrong whenever the next type is new. That error has a name.

Definition 1 (Memorizer and missing mass).

After nn tokens x1,…,xnx_1, \dots, x_n, the missing mass is the probability that token xn+1x_{n+1} has a type not among x1,…,xnx_1, \dots, x_n. A memorizer is any predictor that can be right only on types it has seen, so its error rate is at least the missing mass.

The shared corpus draws its content words from Pitman–Yor restaurants (the Zipf–Heaps topic, its Definition 4) with discount d=0.6d = 0.6 and strength θ=20\theta = 20. Customer n+1n + 1 opens a new table, which is a new word type, with probability (θ+dKn)/(θ+n)(\theta + d K_n)/(\theta + n), where KnK_n is the number of tables after nn customers.

Theorem 1 (The missing mass under Pitman–Yor).

For a PY(d,θ)\mathrm{PY}(d, \theta) sequence with 0≤d<10 \le d \lt 1 and θ>0\theta \gt 0,

Pr⁡[xn+1 is new]  =  θ+d EKnθ+n  =  Γ(θ+1) Γ(θ+d+n)Γ(θ+d) Γ(θ+n+1)  ∼  Γ(θ+1)Γ(θ+d)  n−(1−d).\Pr[x_{n+1} \text{ is new}] \;=\; \frac{\theta + d\, \mathbb{E} K_n}{\theta + n} \;=\; \frac{\Gamma(\theta + 1)\, \Gamma(\theta + d + n)}{\Gamma(\theta + d)\, \Gamma(\theta + n + 1)} \;\sim\; \frac{\Gamma(\theta + 1)}{\Gamma(\theta + d)}\; n^{-(1 - d)}.
Proof.

Conditioned on the first nn draws, the probability is (θ+dKn)/(θ+n)(\theta + d K_n)/(\theta + n), which is linear in KnK_n; taking expectations gives the first equality. For the second, EKn+1=EKn+(θ+d EKn)/(θ+n)\mathbb{E} K_{n+1} = \mathbb{E} K_n + (\theta + d\, \mathbb{E} K_n)/(\theta + n), so mn=EKn+θ/dm_n = \mathbb{E} K_n + \theta/d satisfies mn+1=mn(θ+n+d)/(θ+n)m_{n+1} = m_n (\theta + n + d)/(\theta + n) with m0=θ/dm_0 = \theta/d. The product telescopes to mn=(θ/d) Γ(θ+n+d) Γ(θ)/(Γ(θ+d) Γ(θ+n))m_n = (\theta/d)\, \Gamma(\theta + n + d)\, \Gamma(\theta) / (\Gamma(\theta + d)\, \Gamma(\theta + n)), which is the Zipf–Heaps topic’s Theorem 3. Then θ+d EKn=d mn\theta + d\, \mathbb{E} K_n = d\, m_n, and dividing by θ+n\theta + n gives the Gamma form. The asymptote is Γ(z+d)/Γ(z+1)∼zd−1\Gamma(z + d)/\Gamma(z + 1) \sim z^{d - 1} as z=θ+n→∞z = \theta + n \to \infty. At d=0d = 0 the same argument gives θ/(θ+n)\theta/(\theta + n).

∎

Over 10001000 simulated restaurants the share of sequences whose draw 10011001 is new is 0.194±0.0130.194 \pm 0.013, against the exact 0.2090.209, and the agreement holds within three standard errors at every checkpoint from n=10n = 10 to 20002000. The corpus’s text mixes seven restaurants with template words that stop growing early. Past ten thousand tokens its rate of new types falls with log–log slope −0.407-0.407, against the theorem’s −(1−d)=−0.4-(1 - d) = -0.4.

The exponent is Zipf’s. A Pitman–Yor measure’s ranked frequencies decay as i−1/di^{-1/d}, so its Zipf exponent is s=1/ds = 1/d. Hutter (2021, §3) shows that a lookup learner on data with Zipf exponent ss errs at a rate proportional to n−(1−1/s)n^{-(1 - 1/s)}, which is n−(1−d)n^{-(1 - d)} here. At d=0d = 0, the one-parameter Chinese restaurant of a Dirichlet process, the rate is θ/(θ+n)\theta/(\theta + n) and the exponent is 11. Hutter’s §6 remarks that the two-parameter process also leads only to exponent 11, in his continuous-feature extension. For the missing mass itself, Theorem 1 gives 1−d1 - d. The n-gram topic estimates the same quantity without a model, by Good and Turing’s n1/nn_1/n (its Theorem 2), and Theorem 1 is its Bayesian counterpart under the generator.

So the heavier the tail of the type distribution, the slower a memorizer learns. The power is the limit of an exact Gamma ratio: at n=100n = 100 the exact value is 7%7\% below the asymptote, and at n=1000n = 1000 it is under 1%1\% below. With d=0.6d = 0.6, a tenfold increase in data cuts the missing mass by about 100.4≈2.510^{0.4} \approx 2.5 (2.492.49 from n=1000n = 1000 to 10,00010{,}000), not 1010.


Model-size scaling: the tail of a spectrum

A memorizer has no size: it remembers everything it sees. For a model of size NN we need a learner that can only represent part of the target. The cleanest one is linear.

Definition 2 (The solvable model).

Features are x∼N(0,Λ)x \sim \mathcal{N}(0, \Lambda) in RM\mathbb{R}^M with Λ=diag(λk)\Lambda = \mathrm{diag}(\lambda_k) and λk=k−a\lambda_k = k^{-a}. The target is y=⟨w∗,x⟩y = \langle w^\ast, x \rangle with λk(wk∗)2=k−b\lambda_k (w^\ast_k)^2 = k^{-b}, for exponents a>1a \gt 1 and b>1b \gt 1. A model of size NN fits f(x)=⟨w,x1:N⟩f(x) = \langle w, x_{1:N} \rangle, and its population loss is

L(w)  =  ∑k≤Nλk(wk−wk∗)2  +  ∑k=N+1Mk−b.L(w) \;=\; \sum_{k \le N} \lambda_k (w_k - w^\ast_k)^2 \;+\; \sum_{k = N+1}^{M} k^{-b}.

We take a=1.5a = 1.5, b=2.5b = 2.5, and M=8192M = 8192.

Coordinate kk is a direction of the input with variance λk\lambda_k, and the target puts k−bk^{-b} of its variance there. The first coordinates are both the loudest and the most important. Language need not be so tidy: a word like the is as loud as any and predicts little. The second sum is what a size-NN model cannot touch however long it trains.

Theorem 2 (The approximation tail).

For 1≤N<M1 \le N \lt M,

∫N+1M+1x−b dx  ≤  ∑k=N+1Mk−b  ≤  ∫NMx−b dx,\int_{N+1}^{M+1} x^{-b}\, dx \;\le\; \sum_{k = N+1}^{M} k^{-b} \;\le\; \int_{N}^{M} x^{-b}\, dx,

so as M→∞M \to \infty the tail lies between (N+1)−(b−1)/(b−1)(N + 1)^{-(b-1)}/(b - 1) and N−(b−1)/(b−1)N^{-(b-1)}/(b - 1).

Proof.

x−bx^{-b} is decreasing, so (k+1)−b≤∫kk+1x−b dx≤k−b(k + 1)^{-b} \le \int_k^{k+1} x^{-b}\, dx \le k^{-b} for every kk. Summing the right inequality over k=N+1,…,Mk = N+1, \dots, M gives the lower bound, and summing the left one over k=N,…,M−1k = N, \dots, M - 1 gives the upper.

∎

This is formalCalculus’ integral test (its Theorem 8) with the remainder kept. The harness checks the bracket on 5050 random (b,N,M)(b, N, M), and the tail of our model falls with exponent b−1=1.5b - 1 = 1.5. A size exponent is therefore the exponent of a spectrum’s tail.


Data scaling in the same model: gradient flow and exact SGD

Now train the model from w=0w = 0. Gradient flow on half the population loss, L/2L/2, moves each coordinate on its own: wk(t)−wk∗=−wk∗ e−λktw_k(t) - w^\ast_k = -w^\ast_k\, e^{-\lambda_k t}. We take the half because it is the scale the SGD step below descends; flow on LL itself would run twice as fast. Coordinate kk is learned on the time scale 1/λk=ka1/\lambda_k = k^a, so at time tt the directions with k≲t1/ak \lesssim t^{1/a} are done and the rest have barely moved. A frontier sweeps through the spectrum, and what is left behind it is a tail again.

Theorem 3 (The gradient-flow residual).

With every coordinate kept (N=M=∞N = M = \infty) and s=(b−1)/as = (b - 1)/a,

∑k≥1k−b e−2tk−a  =  Γ(s)a (2t)−s (1+o(1))(t→∞).\sum_{k \ge 1} k^{-b}\, e^{-2t k^{-a}} \;=\; \frac{\Gamma(s)}{a}\, (2t)^{-s}\, \big(1 + o(1)\big) \qquad (t \to \infty).
Proof.

Let φ(x)=x−be−2tx−a\varphi(x) = x^{-b} e^{-2t x^{-a}}. Substituting u=2tx−au = 2t x^{-a} gives

∫0∞φ(x) dx  =  1a (2t)−s∫0∞us−1e−u du  =  Γ(s)a (2t)−s.\int_0^\infty \varphi(x)\, dx \;=\; \frac{1}{a}\, (2t)^{-s} \int_0^\infty u^{s - 1} e^{-u}\, du \;=\; \frac{\Gamma(s)}{a}\, (2t)^{-s}.

φ\varphi rises and then falls, with maximum (b/(2ta))b/ae−b/a(b/(2ta))^{b/a} e^{-b/a} at xa=2ta/bx^a = 2ta/b. By the Zipf–Heaps topic’s lemma on sums of unimodal functions (its Lemma 1), the sum over k≥1k \ge 1 is within twice that maximum of the integral over [0,∞)[0, \infty). The maximum is O(t−b/a)O(t^{-b/a}), which is o(t−s)o(t^{-s}) because b/a>(b−1)/ab/a \gt (b - 1)/a.

∎

At t=10t = 10 the ratio of the sum to the asymptote is already 0.99990.9999, and in our model the asymptote is 1/(3t)1/(3t). One-pass SGD takes one fresh sample per step with step size η\eta. Its expected step is −ηΛ(w−w∗)-\eta \Lambda (w - w^\ast), a gradient step on L/2L/2, so it follows this flow at time t=ηDt = \eta D after DD samples, plus noise. So the data exponent is (b−1)/a(b - 1)/a, and in our model it is 11. For Gaussian features the noise can be computed exactly.

Proposition 1 (One-pass SGD in closed form).

Let e=w−w1:N∗e = w - w^\ast_{1:N} and Sk=E[ek2]S_k = \mathbb{E}[e_k^2], and let τN=∑k>Nk−b\tau_N = \sum_{k \gt N} k^{-b}. One SGD step w←w−η x1:N(⟨w,x1:N⟩−y)w \leftarrow w - \eta\, x_{1:N}(\langle w, x_{1:N} \rangle - y) on a fresh sample gives

Sk  ←  (1−2ηλk+2η2λk2) Sk  +  η2λk(∑j≤NλjSj+τN),S_k \;\leftarrow\; \big(1 - 2\eta\lambda_k + 2\eta^2\lambda_k^2\big)\, S_k \;+\; \eta^2 \lambda_k \Big( \sum_{j \le N} \lambda_j S_j + \tau_N \Big),

and the expected loss after the step is ∑k≤NλkSk+τN\sum_{k \le N} \lambda_k S_k + \tau_N.

Proof.

The residual is ⟨e,x1:N⟩−ξ\langle e, x_{1:N} \rangle - \xi, where ξ=∑k>Nwk∗xk\xi = \sum_{k \gt N} w^\ast_k x_k is independent of x1:Nx_{1:N} with mean 00 and variance τN\tau_N. Expanding e←e−η x1:N(⟨e,x1:N⟩−ξ)e \leftarrow e - \eta\, x_{1:N}(\langle e, x_{1:N}\rangle - \xi) and taking expectations, the cross terms in ξ\xi vanish, and Isserlis’ theorem for Gaussian xx gives E[xx⊤Axx⊤]=2ΛAΛ+tr(ΛA) Λ\mathbb{E}[x x^\top A x x^\top] = 2\Lambda A \Lambda + \mathrm{tr}(\Lambda A)\, \Lambda for symmetric AA. With A=E[ee⊤]A = \mathbb{E}[e e^\top], the diagonal of the result depends on AA only through its diagonal SS and through tr(ΛA)=∑jλjSj\mathrm{tr}(\Lambda A) = \sum_j \lambda_j S_j, which is the stated recursion.

∎

The off-diagonal entries of E[ee⊤]\mathbb{E}[e e^\top] are not zero, but the loss never needs them. The recursion costs O(N)O(N) per step, so the expected loss of every size at every step is cheap to compute, with no sampling. Against 400400 Monte Carlo runs it agrees within three standard errors. With η=0.25\eta = 0.25, a step costs NN multiply-adds, so here compute is C=NDC = ND. That step is not small: 1/tr Λ=0.3861/\mathrm{tr}\, \Lambda = 0.386, so η tr Λ=0.65\eta\, \mathrm{tr}\, \Lambda = 0.65. The recursion’s fixed point shows what the noise does. There Sk=ηX/(2(1−ηλk))S_k = \eta X / (2(1 - \eta \lambda_k)), with XX the loss, so X=τN/(1−cN)X = \tau_N / (1 - c_N), where cN=∑k≤Nηλk/(2(1−ηλk))c_N = \sum_{k \le N} \eta \lambda_k / (2(1 - \eta \lambda_k)). The recursion settles there while cN<1c_N \lt 1 and diverges past that, which for the full model means η tr Λ≈1.36\eta\, \mathrm{tr}\, \Lambda \approx 1.36, not 22. At our step the floor is 1.411.41 times the tail at N=8N = 8 and 1.581.58 times at N=1024N = 1024. So the noise rescales the size term and barely moves its exponent. Paquette and colleagues (2024) and Bordelon, Atanasov, and Pehlevan (2024) map the phases where it does more. We cite that analysis rather than prove it, and the harness’s recovered exponents are the evidence that we are in the simple phase.


Counting compute

The budget of a real model is counted in floating-point operations. A product of an m×km \times k and a k×nk \times n matrix costs 2mkn2mkn FLOPs, one multiply and one add per term. Per token, a weight matrix is used once in the forward pass and twice in the backward pass: once to send the gradient back to its input, and once to form its own gradient.

Proposition 2 (The FLOPs of a training step).

Take the toy decoder of this topic: LL pre-LN blocks of width dd (the transformer-block topic, its Definition 1) with causal attention over a context of nn tokens, and a tied V×dV \times d embedding that is also the unembedding. Let N=12Ld2+VdN = 12 L d^2 + V d count the weights that enter matrix products. One training step on BB windows costs exactly

Bn (6N+12Lnd)B n \,\big( 6N + 12 L n d \big)

matrix-multiply FLOPs.

Proof.

Each block’s weights are 12d212 d^2: the query, key, value, and output maps (4d24 d^2) and the MLP’s d×4dd \times 4d and 4d×d4d \times d maps (8d28 d^2). The tied unembedding adds one d×Vd \times V product per token. Each weight costs 22 FLOPs per token forward and 44 backward, which is 6N6N. The scores QK⊤QK^\top and the weighted sum AVAV cost 2nd2nd each per token per layer forward, and the backward pass takes four products of the same size: 4nd+8nd=12nd4nd + 8nd = 12nd per layer. The embedding lookup and its gradient are a gather and a scatter, not products.

∎

We check this by counting, not by reading the code. The harness wraps every parameter in an array type that adds 2k2k FLOPs for each output entry of each matrix product it takes part in, then runs one real forward and backward pass. At all seven widths the count equals Bn(6N+12Lnd)Bn(6N + 12Lnd) to the integer. NN leaves out the biases and the position table, which take part in no matrix product: at d=12d = 12 it is 9,6009{,}600 of 10,15210{,}152 parameters. The attention term is not small at toy scale. Its ratio to 6N6N is exactly 2Ln/(V+12Ld)2Ln/(V + 12Ld), here 128/(512+24d)128/(512 + 24d), so it falls as the model widens: 19.5%19.5\% at d=6d = 6 and 7.7%7.7\% at d=48d = 48. Of all the compute, those are 16.3%16.3\% and 7.1%7.1\%.

Kaplan and colleagues’ Table 1 and Eq. 2.2 write the forward cost as 2N+2nlayer nctx d2N + 2 n_{\text{layer}}\, n_{\text{ctx}}\, d. That is one context-sized term per layer, where the scores and the weighted sum cost that much each, and NN is the non-embedding count, which leaves out the unembedding’s 2Vd2Vd. At small widths the unembedding is most of the compute. Porian and colleagues (2024) list this last-layer cost as the first of three corrections that move Kaplan’s exponent toward Chinchilla’s.


Compute-optimal allocation

Fix a budget CC and a loss law L(N,D)L(N, D). A model too small for the budget saturates at its own tail, and a model too large sees too few tokens to learn anything. Between them is a valley, and its floor is the compute-optimal size.

Theorem 4 (The compute-optimal split).

Let L(N,D)=E+AN−α+BD−βL(N, D) = E + A N^{-\alpha} + B D^{-\beta} with A,B,α,β>0A, B, \alpha, \beta \gt 0. On the budget 6ND=C6ND = C the unique minimizer is

N∗=G(C6)β/(α+β),D∗=G−1(C6)α/(α+β),G=(αAβB)1/(α+β),N^\ast = G \Big(\frac{C}{6}\Big)^{\beta/(\alpha + \beta)}, \qquad D^\ast = G^{-1} \Big(\frac{C}{6}\Big)^{\alpha/(\alpha + \beta)}, \qquad G = \Big(\frac{\alpha A}{\beta B}\Big)^{1/(\alpha + \beta)},

the frontier is L∗(C)=E+KC−αβ/(α+β)L^\ast(C) = E + K C^{-\alpha\beta/(\alpha+\beta)} for a constant KK, and the budget’s Lagrange multiplier is ν=−dL∗/dC=αβα+β (L∗−E)/C\nu = -dL^\ast/dC = \frac{\alpha\beta}{\alpha + \beta}\, (L^\ast - E)/C.

Proof.

Put D=C/(6N)D = C/(6N) and u=log⁡Nu = \log N. Then f(u)=E+Ae−αu+B(C/6)−βeβuf(u) = E + A e^{-\alpha u} + B (C/6)^{-\beta} e^{\beta u} is a sum of a constant and two strictly convex exponentials, so it has at most one critical point. f′(u)=0f'(u) = 0 reads αAN−α=βBD−β\alpha A N^{-\alpha} = \beta B D^{-\beta}. At the optimum, the two reducible terms stand in the ratio β:α\beta : \alpha. Substituting D=C/(6N)D = C/(6N) and solving gives N∗N^\ast and D∗D^\ast. Then AN∗−αA N^{\ast -\alpha} and BD∗−βB D^{\ast -\beta} are both constant multiples of (C/6)−αβ/(α+β)(C/6)^{-\alpha\beta/(\alpha+\beta)}, which gives the frontier, and differentiating it gives ν\nu. By the envelope theorem ν\nu is the multiplier of the constraint.

∎

The exponent a=β/(α+β)a = \beta/(\alpha + \beta) splits each extra order of magnitude of compute between size and data. With a=0.5a = 0.5 they grow together, and the number of tokens per parameter is constant. Read through formalML’s Lagrangian-duality topic, ν\nu is the sensitivity theorem’s shadow price (its Theorem 7): the loss one more FLOP buys at the optimum. The harness checks the closed form against a numeric minimum and ν\nu against a numeric derivative on 3030 random laws.

For the solvable model, Theorems 2 and 3 suggest α=b−1\alpha = b - 1 and β=(b−1)/a\beta = (b - 1)/a, and Theorem 4 then predicts

a∗  =  βα+β  =  11+a,a^\ast \;=\; \frac{\beta}{\alpha + \beta} \;=\; \frac{1}{1 + a},

whatever bb is. This is a prediction, not a corollary, because the model’s loss is not exactly additive. With a=1.5a = 1.5 it says N∗∝C0.4N^\ast \propto C^{0.4}: the spectrum’s decay alone decides how compute should be split. (Here C=NDC = ND, since a step costs NN, and the constant factor does not change the exponent.)

Hoffmann and colleagues estimated aa three ways. Approach 1 takes, at each budget, the size whose training curve is lowest. Approach 2 fits a parabola in log⁡N\log N to each budget’s valley and takes its vertex. Approach 3 fits the five parameters of the law to every run at once, minimizing a Huber loss of the log-residuals with δ=10−3\delta = 10^{-3} by L-BFGS from a grid of starting points. That is a robust M-estimator, the subject of formalStatistics’ method-of-moments topic (its Theorem 11). On the solvable model’s exact loss over 1515 sizes and 4949 data sizes, the three approaches give a=0.403a = 0.403, 0.4080.408, and 0.4050.405, against 0.40.4. Approach 3’s exponents are α^=1.523\hat\alpha = 1.523 and β^=1.035\hat\beta = 1.035, against 1.51.5 and 11.

Other spectra test the prediction. Approach 1 gives 0.4030.403 at (a,b)=(1.5,2)(a, b) = (1.5, 2) and 0.3820.382 at (1.5,3.5)(1.5, 3.5), against 0.40.4; 0.4400.440 at (1.25,2.5)(1.25, 2.5), against 0.4440.444; 0.3400.340 at (2,3)(2, 3), against 0.3330.333; and 0.2500.250 at (3,4)(3, 4), against 0.250.25, once the data grid runs to 2202^{20}. On our usual grid that last spectrum gives 0.3740.374, because its optima run off the end. All of them land within 0.020.02.

The law recovers the exponents, but it is not the model’s loss surface. Its root-mean-square log error over the grid is 0.1280.128, and its worst point, at N=8N = 8 and D=64D = 64, is off by a factor of e0.400≈1.49e^{0.400} \approx 1.49. The fit overstates the loss there, 0.0730.073 against 0.0490.049, for two reasons. About 55%55\% of the gap is the data term: a size-NN model’s data term sums only the NN coordinates it keeps, so a small model finishes learning sooner than the additive form allows. The rest is the fitted size term, 0.03770.0377 against a true tail of 0.02680.0268. It sits on SGD’s floor at this size, 0.03780.0378, which the run has not reached at D=64D = 64. A law that recovers its exponents can still misdescribe the region it was not built for.

The published fits. Hoffmann and colleagues print E=1.69E = 1.69, A=406.4A = 406.4, B=410.7B = 410.7, α=0.34\alpha = 0.34, and β=0.28\beta = 0.28 (their Eq. 10), so a=0.452a = 0.452. Besiroglu and colleagues (2024) recovered the unrounded values from the paper’s source, with α=0.3392\alpha = 0.3392 and β=0.2849\beta = 0.2849, giving a=0.4565a = 0.4565. At Gopher’s budget of 5.76×10235.76 \times 10^{23} FLOPs, the printed values give N∗=32.2N^\ast = 32.2B parameters. The unrounded ones give 40.340.3B, which rounds to the paper’s 4040B for Approach 3. Besiroglu and colleagues then refit the law to data reconstructed from the paper’s figures and found a=0.513a = 0.513. That puts N∗N^\ast at 72.272.2B and about 1818 tokens per parameter, beside Approaches 1 and 2 (67B and 63B) and Chinchilla’s own ratio of 2020.


Toy transformers on the filings

The theorems above live in models we chose. To ask whether text behaves the same way, we train transformers. The decoders have two pre-LN blocks of width dd, a learned position table, and a tied embedding over the 511511 commonest types of the training text plus [UNK]. They read windows of 3232 tokens from 35003500 synthetic filings, about 736736 thousand tokens, of which the last 65,53665{,}536 are held out. Adam’s peak rate is 1.28/d1.28/d, a one-over-width rule fixed on a small sweep, with 10%10\% warmup and a linear decay that ends at each run’s own horizon. Hoffmann and colleagues stress that the schedule must match the horizon, and Kaplan and colleagues’ did not. Each of three budgets, C=6ND∈{1010,2.5×1010,6.3×1010}C = 6ND \in \{10^{10}, 2.5 \times 10^{10}, 6.3 \times 10^{10}\}, trains five widths between 66 and 4848.

Every budget’s losses form a valley with its minimum inside the grid. The parabola vertices sit at N∗≈7,130N^\ast \approx 7{,}130, 10,83010{,}830, and 22,72022{,}720 weights, so Approach 2 gives a=0.630a = 0.630. Approach 3 on all fifteen runs gives a=0.694a = 0.694, with α^=0.403\hat\alpha = 0.403, β^=0.914\hat\beta = 0.914, and an irreducible E^=0.772\hat E = 0.772 nats.

One seed says little. We reran all fifteen with four more seeds. Each valley stays interior, but a point’s standard deviation runs from 0.0170.017 to 0.1050.105 nats, with median 0.0310.031. That is small against the valleys’ depths but not against the differences between neighboring widths near a floor. (Retraining the middle run at d=12d = 12 with two seeds gives only 0.0100.010, which understates it.) The published Approach 3 exponent is the highest of the five, which run from 0.470.47 to 0.690.69, and E^\hat E runs from 0.770.77 to 1.251.25. Approach 2 is steadier, from 0.530.53 to 0.630.63, and on the five-seed mean losses it gives 0.580.58, with slopes of 0.490.49 and 0.670.67 between budgets.

Three budgets spanning a factor of 6.36.3 cannot pin down an exponent. In total parameters ours is about 0.580.58, against Chinchilla’s 0.50.5. In non-embedding parameters, Kaplan’s count, it is about 0.660.66, against Kaplan’s 0.730.73. The honest reading is that the grid cannot separate the two.

A · Power laws — Zipf’s tail for data, a spectrum’s tail for size
64
exact SGD loss, all 15 sizes; size N = 64 highlighted1001,00010,0001 × 10⁻⁴1 × 10⁻³1 × 10⁻²1 × 10⁻¹samples D (one SGD step each)loss
exact expected loss (Proposition 1)fitted E + A/N^α + B/D^β (Approach 3)
exact loss at D = 65,536
0.00196
fitted α (Theorem 2: b − 1 = 1.5)
1.523
fitted β (Theorem 3: (b − 1)/a = 1)
1.035

Against D, each size’s curve falls with slope near −1 until it reaches the tail its N coordinates cannot touch, then flattens; bigger models flatten later and lower. The fitted law tracks the large models closely and overstates the small ones: a size-N model’s data term sums only its N kept coordinates.

B · Splitting a budget — IsoFLOP valleys, Theorem 4, and Kaplan’s units
2.62 × 10⁵
every size that fits budget C = 2.62 × 10⁵, trained on D = C/N samples101001,0002 × 10⁻³5 × 10⁻³1 × 10⁻²2 × 10⁻²vertexmodel size Nloss
loss at each size on this budgetlowest size (Approach 1)parabola vertex (Approach 2)
lowest size (Approach 1)
128
parabola vertex (Approach 2)
119.9
Theorem 4: N* ∝ C^a, a = 1/(1 + a_λ)
0.400
a from Approaches 1 / 2 / 3
0.403 / 0.408 / 0.405

Left of the floor the model is too small and sits on its tail; right of it the model is too big for its data. Every factor of 16 in compute moves the floor right by about 16^0.4 ≈ 3.

C · A finite corpus — repeated epochs and the capped optimum
d = 12, 434,176 tokens read, from the whole stream and then from fewer unique tokens2.03.04.05.00.65 epochs (670,082 unique)2.2872.2872.3014 epochs (108,544 unique)2.3062.3122.32616 epochs (27,136 unique)2.3712.4492.47164 epochs (6,784 unique)2.7773.4173.236256 epochs (1,696 unique)4.8324.9616.499held-out loss (nats); bars start at 2.0, clipped at 5.2
repeated, three-seed meanwhole stream, D′ tokens readtoy fit at Muennighoff’s effective data D′ (R* = 15.4)

Four epochs cost 0.019 nats, and sixty-four cost half a nat. The top row draws random windows from the whole stream, 0.65 passes of it. At 16 and 64 epochs the repeated run beats a run that reads D′ tokens of the whole stream, so here a repeated token is worth more than D′ says, though that run also takes fewer steps.

126.2B
compute-optimal size at the compute BloombergGPT’s run spent, 1.73 × 10²³ FLOPs, under a data cap1 × 10¹¹1 × 10¹²5 × 10¹⁰1 × 10¹¹unconstrained 39.0B709B availableD* wantedunique tokens Uoptimal parameters N*
optimal parameters N*
46.2B
epochs over the corpus
4.94
predicted loss (Besiroglu et al.’s fit)
2.0162
unconstrained loss
2.0121

Above the unconstrained D* the cap does not bind. Just below it, a few repeated epochs are nearly free. Far below it, more passes stop paying, and the compute goes into a bigger model.


Kaplan against Chinchilla

Kaplan and colleagues found N∗∝C0.73N^\ast \propto C^{0.73} (their Eq. 6.1), and Hoffmann and colleagues found C0.5C^{0.5}. The two papers differ in schedules, data, and scale, but one difference is a matter of definition. Kaplan counted only non-embedding parameters NneN_{\text{ne}}, and compute as 6NneD6 N_{\text{ne}} D.

Proposition 3 (The same optimum in Kaplan's units).

Suppose N∗∝CaN^\ast \propto C^a in total parameters along a family of models, and let ρ=dlog⁡Nne/dlog⁡N\rho = d \log N_{\text{ne}} / d \log N along the family. Then the non-embedding optimum, measured against Cne=6Nne∗D∗C_{\text{ne}} = 6 N_{\text{ne}}^\ast D^\ast, has local exponent

dlog⁡Nne∗dlog⁡Cne  =  ρaρa+1−a.\frac{d \log N_{\text{ne}}^\ast}{d \log C_{\text{ne}}} \;=\; \frac{\rho a}{\rho a + 1 - a}.

If the embedding grows as Nne1/3N_{\text{ne}}^{1/3}, then ρ\rho rises from 11 toward 33 as the embedding’s share grows, and the exponent rises toward 3a/(1+2a)3a/(1 + 2a).

Proof.

Along the optimum, dlog⁡N∗=a dlog⁡Cd \log N^\ast = a\, d\log C and dlog⁡D∗=(1−a) dlog⁡Cd \log D^\ast = (1 - a)\, d \log C, since N∗D∗∝CN^\ast D^\ast \propto C. So dlog⁡Nne∗=ρa dlog⁡Cd \log N_{\text{ne}}^\ast = \rho a\, d \log C, and dlog⁡Cne=dlog⁡Nne∗+dlog⁡D∗=(ρa+1−a) dlog⁡Cd \log C_{\text{ne}} = d \log N_{\text{ne}}^\ast + d \log D^\ast = (\rho a + 1 - a)\, d \log C. Divide. For N=Nne+cNne1/3N = N_{\text{ne}} + c N_{\text{ne}}^{1/3} and x=cNne−2/3x = c N_{\text{ne}}^{-2/3}, ρ=(1+x)/(1+x/3)\rho = (1 + x)/(1 + x/3), which increases from 11 at x=0x = 0 to 33 as x→∞x \to \infty, and the exponent is increasing in ρ\rho.

∎

A model family of fixed shape has dmodel∝Nne1/3d_{\text{model}} \propto N_{\text{ne}}^{1/3}, so its embedding, (V+nctx) dmodel(V + n_{\text{ctx}})\, d_{\text{model}}, grows as Nne1/3N_{\text{ne}}^{1/3}. Take GPT-2’s vocabulary of 50,25750{,}257 and context of 10241024, Kaplan’s setting, with dmodel=64 nlayerd_{\text{model}} = 64\, n_{\text{layer}}, and size the models by Besiroglu and colleagues’ fit (a=0.513a = 0.513). Below 101810^{18} FLOPs, where the embedding is between 40%40\% and 99%99\% of the model, the non-embedding exponent is 0.7050.705. By 102310^{23} FLOPs the embedding share has fallen below 1%1\%, and the exponent is back to 0.5140.514. The local exponent agrees with Proposition 3 to 2×10−32 \times 10^{-3} at every budget, and the limit is 3a/(1+2a)=0.7593a/(1 + 2a) = 0.759. This is a calculation about units, not a measurement. It extrapolates Besiroglu and colleagues’ fit far below its range, since Hoffmann and colleagues’ IsoFLOP runs start at 6×10186 \times 10^{18} FLOPs, and its smallest rows are not real models: at 101510^{15} FLOPs the family has 0.710.71 of a layer. Still, this is Pearce and Song’s (2024) reconciliation, with the closed form behind it: most of Kaplan’s experiments ran where embeddings dominated, so Kaplan’s 0.730.73 and Chinchilla’s 0.50.5 can be the same law. Proposition 3 says nothing about which count is the right one. On our toy grid the same reading moves Approach 2’s exponent from 0.580.58 to 0.660.66 on the five-seed mean losses, and from 0.6300.630 to 0.7060.706 on the published seed.



Where this goes next

The losses on this page are cross-entropies, so everything in the perplexity topic about what a nat buys applies to the frontier: a loss gain of 0.10.1 nats cuts perplexity by a factor of e−0.1e^{-0.1}, about 9.5%9.5\%, whatever the scale. The decoding topics take a trained model as given and ask how to generate from it. The fine-tuning topic asks how few new parameters adapt a pretrained one, which is a scaling question in a regime this page does not touch.

Three things are outside our scope. Emergent abilities on downstream tasks are not losses and need not follow a power law. Compute spent at inference, by sampling longer or more, has its own trade-offs. And the variance-limited regimes of Bahri and colleagues (2024), where a model is large enough to interpolate, belong with formalML’s double-descent topic, whose risk curves have the peak that our monotone laws leave out.


Honest caveats


Implementation

The companion notebook (notebookPath) imports scaling_laws.py, which owns every number on this page. That module imports the transformer-block topic’s module for the pre-LN block, attention, LayerNorm, and their backward passes. Through it, it also gets the neural-language-models topic’s Adam constants and the shared finance corpus. It imports the contextual-embeddings topic’s module for the faster MLP backward pass, and the perplexity topic’s module, which brings the Zipf–Heaps topic’s Pitman–Yor sampler and closed form. It computes the solvable model’s SGD losses exactly, trains 102102 decoders from scratch in NumPy with hand-written gradients, and runs a harness of 2424 assertion-based tests in about two and a half minutes on a laptop CPU. The tests cover:

  • Theorem 1 against 10001000 simulated restaurants, its Dirichlet case, its asymptote at three (d,θ)(d, \theta), and the corpus’s own learning curve.
  • Theorem 2’s bracket on 5050 random instances, and Theorem 3’s bracket against the exact incomplete-gamma integral on 2020.
  • Theorem 3’s clock against small-step SGD, and Proposition 1 against 400400 Monte Carlo SGD runs.
  • Proposition 1’s fixed point and its divergence past η tr Λ≈1.36\eta\, \mathrm{tr}\, \Lambda \approx 1.36.
  • Theorem 4 against a numeric minimum on 3030 random laws, with its multiplier against a numeric derivative.
  • The three approaches’ recovery of the predicted exponent, Approach 1 on five more spectra, and the law’s misfit split into its two causes.
  • Proposition 2 by instrumented counting at seven widths, and the decoder’s gradient against central differences.
  • The published fits’ exponents and optima, Proposition 3 against finite differences, the toy grid’s valleys at all five seeds, the seed spread, the repetition runs with their no-fit control, and the capped optimum.

The laboratory reads its data from a JSON file that one of those tests requires to equal the module’s viz_payload() exactly, so the figure cannot drift from the code.

References & Further Reading