Scaling laws: loss vs parameters, data, compute
State that loss falls as a power law in N, D and C toward an irreducible floor. Use a fitted law to predict a larger model's loss from small runs.
Builds on: Reading pretraining loss curves, FLOPs per token: 2N forward, 6N training
What the animation says
Predict before you pay
Training a frontier model costs millions of dollars in compute. The compute is roughly six times the parameters times the training tokens, in floating point operations. Before you pay, you want to know what loss the model will reach. And whether ten times more parameters, data or compute is worth buying. Good news: loss is predictable. Fit a simple curve on cheap small runs, then extend it to the big one.
Floor plus a shrinking gap
Loss has two parts. First, a floor: the entropy of text itself. Even a perfect model can't know which word a writer picks next. Above the floor sits the reducible loss. It is the only part that scale can shrink. Every ten times more parameters multiplies that gap by about the same factor, say zero point six, at every scale. Data and compute work the same way, each with its own factor. So if you keep scaling forever, where does the loss go?
A straight line in log-log
It creeps toward the floor and never touches it. As a formula: loss is about the floor, E, plus a constant A divided by N to the power alpha. Alpha is small. Real fits give roughly zero point zero five to zero point three five. Subtract the floor and take logs of both axes. The gap becomes a straight line that slopes down by alpha. Data and compute follow the same shape, as long as the other factors aren't the bottleneck.
Two small runs, one big guess
Let's predict a ten-billion-parameter model from two small runs. The fitted floor is one point seven. Ten million parameters reaches loss three point seven. A hundred million reaches two point seven. Subtract the floor, and the gaps are two, then one. So each ten times in parameters halves the gap. That means alpha is about zero point three. Ten billion is a hundred times bigger than a hundred million. What loss do you predict?
Keep the floor
A hundred times is two decades, so the gap halves twice: one, then a half, then a quarter. Add the floor back: one point seven plus a quarter is about one point nine five. Now the trap: drop the floor and fit the raw loss instead. Then each decade multiplies the whole loss by about zero point seven three. Two decades from two point seven gives about one point four four. That is below the floor, which is impossible. So always subtract the floor before you multiply.
Fitting the floor
In real fits, the floor isn't given. You estimate it too. This script tries many candidate floors. For each one, this line subtracts the floor and takes logs, and this line fits a straight line. The floor that makes the points straightest wins: here one point seven, with alpha zero point three. Then extrapolate a few orders of magnitude, and watch for the factor you didn't scale becoming the bottleneck. Your turn: drag the floor until the points line up.
Each 10× buys a fixed fraction
The power-law form
Predicting a 10B model from two small runs
Fitting the floor and exponent
import numpy as np
N = np.array([1e7, 3e7, 1e8, 3e8, 1e9])
loss = 1.7 + 2.0 * (N / 1e7) ** -0.3 # synthetic "measured" losses
def fit(E): # straight line in log-log after removing floor E
y = np.log(loss - E)
s, c = np.polyfit(np.log(N), y, 1)
err = np.sum((s * np.log(N) + c - y) ** 2)
return err, s, c, E
err, s, c, E = min(fit(E) for E in np.linspace(0, 1.9, 191))
print(f"E={E:.2f} alpha={-s:.3f} pred@1e10={E + np.exp(c) * 1e10**s:.3f}")
Remember
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.
Bytewise
All courses