Error falls as a power law in model size, data and compute, then flattens at a floor. For one fixed budget, the best split puts about 20 training tokens behind every parameter.
Pick a budget and drag the model size. A giant model starves for data; a small one runs out of room. Then we build, piece by piece, the power law, the floor, the FLOP count, the best split and an honest forecast.
You need what a logarithm does (it turns multiplying into adding) and a little Python. We build the rest from zero.
Built on Zhai et al., Scaling Vision Transformers (2021); Hoffmann et al., Chinchilla (2022); Cherti et al., Reproducible Scaling Laws for CLIP (2022); and Muennighoff et al., Scaling Data-Constrained Language Models (2023). Re-taught in our own words and devices.
The curve is a fitted law for language models: Besiroglu et al. (2024) re-fit Chinchilla's runs as loss = 1.82 + 482 / N0.348 + 2085 / D0.366. Vision has no public fit this clean, so treat the numbers as the shape, not as a ViT forecast. Data D = budget / (6 × N).
Chapter 0
Guess the error of a big model from three small ones, and see why plain axes hide the answer
Your team has money for one big training run. Before you spend it, you train three small image models: 1 million, 10 million and 100 million parameters. Their test errors are 0.41, 0.30 and 0.22. The big run would have 10 billion parameters. What error will it reach?
The big model is 100 times the size of the largest pilot. You get one shot. So the question is a forecast: from cheap points, predict an expensive one. Try it below before you read on.
Pink dots are the pilots. The dashed line is the 10 B model. Set your guess, press Reveal, then switch the axes.
Illustrative pilots made from error = 0.41 × (N / 1 M)−0.133, the shape real vision runs show. Real pilots also carry noise; Chapter 8 adds it.
On plain axes the three pilots sit in a heap at the left edge. Any curve fits them. On log-log axes they fall on a straight line, and a ruler gives the answer: 0.12. That straight line is a scaling law: a rule that says how error falls as you add a resource.
The failure here is a guess by eye. The symptom is a big run that misses its forecast by a wide margin. To catch it, plot every pilot on log-log axes before you guess. If the points do not line up, you are not ready to forecast. The fix is more pilots, or a law with a floor (Chapter 2).
Chapter 1
Turn a curve that flattens into a line, and read its slope as the price of accuracy
Why did the pilots line up? Because error follows a power law: a constant times the resource raised to a fixed power. Call the amount of the resource N (parameters here; images or compute work the same way). Call the test error E. Call a scale constant A, and call the speed of the fall α, the scaling exponent.
E equals A times N to the minus alpha.
Raise the resource N to the power alpha. Divide the constant A by it. Each time N grows 10×, the error E shrinks by the same factor, 10 to the minus alpha.
With made-up numbers: at N = 1 M the error is 0.40; at N = 100 M it is 0.20. Error halved over two decades, so alpha = log(2) / 2 = 0.301 / 2 = 0.15.
Take the log of both sides. The log of a product is a sum, and the log of a power brings the power down in front:
log E = log A − α · log N
That is a straight line. Its height at the start is log A and its slope is minus alpha. So on log-log axes a power law is a ruler line, and you read alpha as the slope.
Left: plain axes, a curve that flattens. Right: the same law on log-log axes, a line. Drag alpha and watch the slope.
Illustrative law with A = 1. The plain panel shows N from 1 to 1,000; the log panel runs on to 108.
The failure is to fit the line on plain numbers. A straight-line fit to raw N and E gives nonsense, because the big runs dominate. Fit log E against log N instead. The code lab below does exactly that.
Chapter 2
Add a floor to the power law and find where more compute stops paying
In 2021 Zhai, Kolesnikov, Houlsby and Beyer trained Vision Transformers across a wide range of sizes, data and compute. A Vision Transformer (ViT) cuts an image into square patches and treats each patch like a word. Their largest, ViT-G/14, has 1,843 million parameters, trained on the 3-billion-image JFT-3B set, and reached 90.45% top-1 accuracy on ImageNet.
Their plot of error against compute was a line in the middle and flat at the top. A pure power law cannot flatten, so add a constant. Call the error E, the compute C, and the error no amount of compute removes E∞, the irreducible error or floor.
E equals E-infinity plus A times C to the minus alpha.
The error E has two parts. The power-law part A times C to the minus alpha shrinks as compute C grows. The floor E-infinity never moves.
With made-up numbers E-infinity = 0.09, A = 0.5, alpha = 0.15: at C = 1 the error is 0.59; at C = 100 it is 0.341; at C = 10,000 it is 0.216.
Purple is the law with a floor; the dashed purple line has no floor. Yellow is the floor. Slide compute and read the gain from the next 10×.
Illustrative law E = 0.09 + 0.5 × C−0.15, compute in relative units. The bend is the shape of Zhai et al.'s plots; the numbers are not theirs.
The gain from each 10× falls from 0.146 at the start to 0.037 at C = 10,000. Near the floor the curve gives almost nothing. The paper also found that big models are more sample efficient: a larger ViT reaches the same error after seeing fewer images.
The failure is to keep scaling in the flat part. The symptom: each new run costs 10× more and moves accuracy by a fraction of a point. Measure the gain per decade over your last three runs. If it keeps falling, you are near the floor; better labels or a new task pay more than compute.
Chapter 3
Turn a model, an image size and a dataset into a FLOP count and a GPU bill
"Compute" on the x axis is a count of arithmetic. A FLOP is one floating-point add or multiply. To use a scaling law you must count FLOPs for your own run. For an image model, start with how many tokens one image becomes.
Call the image side length in pixels R and the patch side p. A ViT cuts the image into a grid of R / p patches on each side. Call the number of tokens per image T.
T equals R over p, squared.
Divide the side R by the patch side p to get patches per row. Square it. That is T.
ViT-G/14 at 224 px: 224 / 14 = 16 per row, so T = 256. At 336 px, T = 24 × 24 = 576, which is 2.25× the tokens for 1.5× the side.
Now the cost of training. Call the parameter count N, the total training tokens D (images seen times T) and the training FLOPs C. A forward pass does one multiply and one add per parameter per token. The backward pass costs about twice the forward.
C is about six times N times D.
Multiply the parameters N by the tokens D. Multiply by six. That is the FLOP bill C.
ViT-G/14: 6 × 1.843 B × 256 = 2.83 × 1012 FLOPs per image. One pass over 3 B images: C = 8.5 × 1021 FLOPs.
The grid is one image cut into patches. The blue bar is the run's FLOPs on a log scale. Pick a model, then drag the image size and the images seen.
Parameter counts and widths from Zhai et al. (2021). GPU days assume 125 TFLOP/s of useful work per GPU (40% of an A100's 312 peak), an illustrative figure.
Vision-language models pay the same way. A LLaVA-1.5-style model feeds 576 image tokens (a 336 px image, patch 14) into its language model. With 100 text tokens, image tokens are 85% of the training FLOPs.
The failure: 6ND ignores attention. Attention scores cost about T / (6d) on top, where d is the model width. For ViT-B/16 that is 4%; for ViT-L/14 at 336 px it is 9%, and it grows with every pixel. Count it once your images get large.
Chapter 4
Solve the hero's valley: grow model and data together as the budget grows
Back to the hero. The budget C is fixed, and C = 6ND, so a bigger model means fewer tokens. Error now has a part for each resource. Call the floor E, the model-size part A / Nα and the data part B / Dβ. Call the loss L.
L of N and D equals E, plus A over N to the alpha, plus B over D to the beta.
Start at the floor E. Add a penalty that shrinks as the model N grows. Add a second penalty that shrinks as the data D grows. At a fixed budget, growing one penalty's resource grows the other penalty.
Chinchilla, N = 70 B and D = 1.4 T: A / Nα = 0.081 and B / Dβ = 0.075. The two penalties are about equal, so L = 1.82 + 0.081 + 0.075 = 1.97.
Set the slope of L to zero along the budget line and the best model size follows a power of the budget. Call the best size Nopt and its exponent a.
N-opt grows like C to the a, where a equals beta over alpha plus beta.
Add the two exponents alpha and beta. Divide beta by the sum. That fraction a says how fast the best model N-opt grows with the budget C.
a = 0.366 / (0.348 + 0.366) = 0.51. Double the budget: N-opt grows 20.51 = 1.43× and data grows 20.49 = 1.40×.
Each blue diagonal is one budget. Green is the best split; grey dashes are an older rule that grew models faster. Drag the budget.
Green uses the Besiroglu et al. (2024) re-fit of Chinchilla's runs. Grey dashes use Kaplan et al.'s exponent a = 0.73, as listed in Hoffmann et al. Table 2. Gopher: 280 B parameters, 300 B tokens.
At Gopher's budget of 5.76 × 1023 FLOPs the fit puts the best model at 72 B parameters on 1.33 T tokens. Chinchilla used 70 B on 1.4 T, about 20 tokens per parameter, and beat the 280 B Gopher on the same compute. The Chinchilla paper puts it plainly: double the model, double the tokens.
The failure is to put a budget windfall into parameters. The symptom is a big model whose loss still falls fast when training stops. Measure tokens per parameter; far under 20 means a starved model. For vision, Zhai et al. reached the same verdict from the other side: big models need big data.
Chapter 5
Measure data in what it teaches, not in rows downloaded
CLIP learned from 400 million image-caption pairs scraped from the web. LAION scaled the scrape to billions. A scrape repeats itself: the same photo appears thousands of times. So D in the law is not the row count. What is a repeated sample worth?
Muennighoff et al. (2023) measured this for language models. Call the unique tokens U, the number of extra passes over them R (epochs minus one), a fitted constant R*, and the effective data D′: the fresh data the run is worth.
D-prime equals U, plus U times R-star times one minus e to the minus R over R-star.
Count the unique data U once in full. Each repeat adds less than the one before. All repeats together can add at most R-star times U.
4 epochs, so R = 3: D′ = U × (1 + 15.4 × (1 − e−0.195)) = 3.73 U. Four passes are worth 93% of fresh data. 40 passes are worth only 15.2 U.
Warm dashes are samples trained on. The purple curve is what they are worth. Drag the epochs.
Formula and R* = 15.4 from Muennighoff et al. (2023), fitted on language models with 100 M unique pairs as an illustrative set size. Image-text data may differ.
Web duplicates are repeats you did not choose, and they are uneven: one meme can appear 10,000 times while most images appear once. A sample copied 10,000 times is worth at most about 16 fresh samples. So deduplication, removing exact and near copies, costs little accuracy and saves compute. DataComp-1B shows how much the choice of data matters: the same CLIP ViT-L/14 training reached 79.2% zero-shot ImageNet, 3.7 points above OpenAI's CLIP, at equal compute.
The failure is noise. A caption that names the wrong object teaches a false link. The symptom: accuracy stalls as the scrape grows. Score a sample of pairs by hand, or with a CLIP similarity filter, before you scale the set.
Chapter 6
Forecast zero-shot and linear-probe accuracy, and spot a jump made by the metric
You rarely care about pre-training loss. You care how the model does on your task. Two tests measure that without full training. A linear probe freezes the model and trains one linear layer on its features. Zero-shot classification trains nothing: CLIP embeds the image and the text "a photo of a dog" for each class, then picks the closest text.
Cherti et al. (2022) trained OpenCLIP models on LAION up to 2 billion pairs. Zero-shot classification, retrieval, linear probing and fine-tuning all followed power laws in compute. The training data changed the exponents, so a law fitted on one dataset does not carry over to another.
So you can forecast transfer. Say four model scales give zero-shot accuracies of 35%, 52%, 64% and 72% (made-up numbers), one decade of compute apart. The errors are 0.65, 0.48, 0.36 and 0.28. Each decade multiplies error by about 0.75. One more decade gives 0.21 error, so about 79% accuracy.
One model family, one smooth skill. Purple scores each step. Pink scores a 10-step task as all or nothing. Drag the scale.
Illustrative: per-step error = 0.5 × scale−0.25; exact match = per-step accuracy to the 10th power. The idea is from Schaeffer et al. (2023).
Per-step accuracy rises from 50% to 95% in a smooth curve. Exact match over 10 steps stays near zero for a whole decade of scale, then climbs fast. Nothing sudden happened inside the model. The metric multiplies ten chances to fail, so it hides progress and then shows it all at once. Schaeffer et al. (2023) showed that many "emergent" jumps in language models shrink this way under a smooth metric.
The failure is to wait for a jump. The symptom is a team that skips a scale because "the skill has not appeared yet". Measure the same runs with a smooth metric, such as per-step accuracy or the probability of the right answer, and fit that.
Chapter 7
Split error into a part scale can remove and a floor it cannot, then price the rest
Part of every error rate is the answer key's fault. Northcutt et al. (2021) estimated that at least 6% of ImageNet validation labels are wrong. Beyer et al. (2020) re-labelled the set because many images hold several objects or sit between two classes. A perfect model still loses those points.
So the floor E∞ holds label errors, images no one can classify and true overlap between classes. Scale only removes the rest, the reducible error. Call your error now E0, the share of reducible error each 10× of compute removes f, and the error after k decades Ek.
E-k equals E-infinity, plus E-zero minus E-infinity, times one minus f to the k.
Subtract the floor E-infinity from today's error E-zero. Shrink that gap by one minus f for each decade k. Add the floor back.
With made-up numbers E-zero = 0.14, E-infinity = 0.08, f = 0.25: after 1, 2, 3 decades the error is 0.125, 0.114, 0.105. That is 87.5%, 88.6%, 89.5% accuracy.
Yellow is the floor. Purple is the reducible error. Each bar is one more 10× of compute. Drag the floor and the gain per decade.
Illustrative: today's error is fixed at 14%. Real floors come from label audits, not from this slider.
A thousand times the compute bought 3.5 points, and the model is still 2.5 points short of a ceiling it never reaches. Estimate E∞ before you plan a scaling campaign. The reducible gap is your real budget, not the gap to 100%.
The failure: a model that scores above the label ceiling. The symptom is 95% on a benchmark whose labels are 92% right. That model learned the wrong labels. Check it on a re-labelled set such as ImageNet ReaL. Cleaning labels lowers the floor itself, often for less than one more decade of compute.
Chapter 8
Fit noisy pilots, extrapolate to the big run, and see when the forecast stops being one
Now do what a team does before a big run. Real pilots are noisy: the same model with a different seed lands a little higher or lower. Fit a line to log error against log size. Then ask two questions: what does the line say at the target, and how sure is it?
The band around the line is a prediction interval: where a new run would land about 95% of the time if the law holds. It widens with noise, narrows with more pilots and fans out the farther you go past your data.
Pink dots are pilots. Purple is the fit with its band. The grey curve is the truth, hidden from the fit. Drag the target past the data.
Illustrative truth: E = 0.06 + 2 × N−0.15, pilots from 1 M to 1 B parameters with log-normal noise. The band is a least-squares prediction interval in log space, ±2 standard errors.
Three lessons sit in the lab. Near the data the band is tight, so a forecast 3× past your biggest pilot is safe. Far out it fans, and a forecast 1000× past the data is a hope. And the band only covers noise: with the wrong law it can be tight and wrong.
That last case is the dangerous failure. Fit a pure power law to data that bends toward a floor. At 1 T parameters it promises an error near 0.07; the truth is 0.09. The band does not warn you. To catch it, hold out your biggest pilot, fit the rest and check whether the held-out point falls inside the band. If it does not, fit with a floor.
Chapter 9
Keep the numbers, the moves and the code in one place
Error falls as a power law in parameters, data and compute, a straight line on log-log paper. It bends toward a floor set by label noise and ambiguity. Fit the line from cheap pilots, count FLOPs with 6ND, grow model and data together, count data by what it teaches, and stop scaling when the gain per decade dies.
| Term | Meaning | Number to keep |
|---|---|---|
| Power law | E = A · N−α; a line of slope −α on log-log axes | alpha about 0.1 to 0.4 in vision |
| Floor E∞ | Error no compute removes | at least 6% of ImageNet validation labels are wrong |
| ViT-G/14 | Largest model in Zhai et al. (2021) | 1,843 M params, JFT-3B, 90.45% ImageNet |
| ViT-22B | Dehghani et al. (2023), dense ViT at 22 B | 22 B params |
| Tokens per image | T = (R / p)2 | 256 at 224 px / patch 14; 576 at 336 px |
| Training FLOPs | C ≈ 6 · N · D | attention adds about T / (6d) |
| Compute-optimal | Nopt ∝ Ca, a = β / (α + β) | a about 0.5; about 20 tokens per parameter |
| Chinchilla | Hoffmann et al. (2022) | 70 B params, 1.4 T tokens, 5.9 × 1023 FLOPs |
| Repeated data | D′ = U + U R* (1 − e−R/R*) | R* = 15.4; 4 epochs worth 3.73 U |
| DataComp-1B | Filtered data at equal compute | 79.2% zero-shot, +3.7 over OpenAI CLIP ViT-L/14 |
| Situation | Move | Why |
|---|---|---|
| Far from the floor, gain per decade healthy | Scale model and data together | You are on the straight part of the curve |
| Near the floor | Clean labels or change the task | Compute buys almost nothing there |
| Strong frozen model, few labels | Zero-shot to scope, then a linear probe | Few trained weights, little overfitting, cheap |
| Many in-domain labels, last points matter | Full fine-tune | Enough labels to move all the weights |
| Big model too costly to serve | Distill into a small student | Keeps much of the accuracy at a fraction of the serving cost |
pythonimport numpy as np def fit_power_law(N, err, floor=0.0): # N, err: arrays of pilot runs x, y = np.log(N), np.log(err - floor) slope, icpt = np.polyfit(x, y, 1) resid = y - (icpt + slope * x) s = np.sqrt((resid ** 2).sum() / (len(x) - 2)) # scatter in log space def forecast(n): x0 = np.log(n) se = s * np.sqrt(1 + 1/len(x) + (x0 - x.mean())**2 / ((x - x.mean())**2).sum()) mid = icpt + slope * x0 return [floor + np.exp(mid + k * 2 * se) for k in (-1, 0, 1)] # low, mid, high return -slope, forecast # alpha, forecaster def train_flops(n_params, images, side=224, patch=14): tokens = (side // patch) ** 2 # T = (R/p)^2 return 6 * n_params * images * tokens # C = 6 N D def effective_data(unique, epochs, r_star=15.4): R = epochs - 1 return unique + unique * r_star * (1 - np.exp(-R / r_star)) print(train_flops(1.843e9, 3e9)) # 8.5e21 FLOPs: ViT-G/14, one pass over 3 B images print(effective_data(1.0, 4)) # 3.73: four epochs are worth 3.73 unique passes
Sources: Zhai et al., Scaling Vision Transformers; Dehghani et al., ViT-22B; Hoffmann et al., Chinchilla; Besiroglu et al., Chinchilla Scaling: A Replication Attempt; Cherti et al., Reproducible Scaling Laws for CLIP; Muennighoff et al., Data-Constrained Language Models; Gadre et al., DataComp; Northcutt et al., Pervasive Label Errors; Schaeffer et al., Are Emergent Abilities a Mirage?
Now press Present or Teach. Explain from memory: the power law and its slope, the floor, 6ND with patches, the best split and why repeats fade. Then go back to the hero, pick 1023 FLOPs, and find the best model size before the readout tells you.