Scaling Laws I: The Basics

Fix the compute, and the loss depends on how you split it between parameters and tokens. At Gopher's budget, a fitted scaling law puts the best split at 72 billion parameters on 1.3 trillion tokens. Kaplan's 2020 rule builds 485 billion parameters instead, and loses 0.038 nats.

Pick a rule, then drag the model size along the fixed budget. Watch the predicted loss trace a valley. Then we build every piece from zero: power laws, fitting, the joint loss, isoFLOP curves, the optimal split, and the correction from Kaplan to Chinchilla.

You need C = 6ND from Lecture 2 and logarithms. We build the rest from zero.

Lecture 9 of Stanford CS336, Language Modeling from Scratch (Spring 2025, Percy Liang and Tatsunori Hashimoto). Previous: Lecture 8, Parallelism II. Next: Lecture 10, Inference.

Split Gopher's budget

485B

Budget 5.76 × 1023 FLOPs, Gopher's (Hoffmann et al., 2022); tokens D = C / (6N). The loss comes from L = E + A/Nα + B/Dβ, using Besiroglu et al.'s 2024 refit of the Chinchilla runs (E 1.8172, A 482.01, B 2085.43, α 0.3478, β 0.3658), in nats per token. Kaplan's size: its 4.68B optimum at 1021 FLOPs (as quoted by Hoffmann et al., Appendix D.4) grown as C0.73.

Chapter 0

The Budget Problem

Price a month of 10,000 GPUs in FLOPs, and see that the budget fixes the product of parameters and tokens, not either one

A friend gives you 10,000 H100s for a month and asks for the best open language model you can build. That is the lecture's opening question. The data and the training code are ready. One decision is left: which model to train.

First, price the gift. An H100 peaks at 989.5 trillion bf16 FLOPs per second. Say your code reaches 40% of that, an illustrative figure. A month is 2,592,000 seconds. The budget is 10,000 × 989.5 × 1012 × 0.4 × 2,592,000 = 1.03 × 1025 FLOPs. It is fixed.

Lecture 2 tied that budget to the model. Call the number of parameters N and the number of training tokens D. Each token costs 2 FLOPs per parameter in the forward pass and 4 in the backward pass. So the training compute C is:

Say it aloud

C equals six times N times D.

C
C the training compute, in FLOPs.
6
six FLOPs per parameter per token: 2 forward, 4 backward.
N
N the number of parameters.
D
D the number of training tokens.
In plain words

Multiply the parameters N by the tokens D, then by 6. Turned around, a fixed C gives D = C / (6N): every parameter you add takes tokens away.

With numbers

GPT-3: N = 175 × 109, D = 300 × 109. C = 6 × 175 × 109 × 300 × 109 = 3.15 × 1023 FLOPs. The GPT-3 paper reports 3.14 × 1023.

Slide along one budget

Parameters across, tokens up, both on log axes. The yellow line is every model one budget can buy. Pick a budget, then drag the model size along it.

70B

Dots: published parameter and token counts (GPT-3, Gopher, Chinchilla, LLaMA 65B, Llama 2 70B, Llama 3 70B). The 10,000-GPU budget assumes the GPUs run at 40% of peak, our illustrative choice. 6ND ignores attention's extra work, which grows with context length.

GPT-3 trained 1.7 tokens per parameter, Chinchilla 20 and Llama 3 70B 214. On your budget, the same line holds a 7B model on 244 trillion tokens and a 700B model on 2.4 trillion. All of them cost the same. Which one learns the most?

Guessing is expensive: one try uses the whole month. Scaling laws answer the question with small runs. Measure how the loss falls as N and D grow, fit a simple law, then pick the split the law likes best.

Symptom: the run needs twice the GPU-days you planned.

Measure: check the budget formula. Counting 2ND covers only the forward pass.

Fix: plan with 6ND. The backward pass costs twice the forward, because each weight needs two matmuls on the way back.

The road

  1. Power laws: why scaling curves are straight lines on log-log axes.
  2. Why power laws: error that falls as a power of the data.
  3. Fit and extrapolate: predict a big run from small ones, and the floor that breaks a line.
  4. Design by scaling: compare optimizers, shapes and batch sizes with small runs.
  5. Joint loss: L(N, D) as a floor plus a capacity term plus a data term.
  6. IsoFLOPs: the valley along one budget (the hero's curve), measured.
  7. The allocation: derive the best N and D for any budget.
  8. Kaplan vs Chinchilla: why 0.73 became 0.5, and 20 tokens per parameter.
  9. Showcase: an allocator for any budget.
  10. Field guide: the numbers, the code, and what scaling laws cannot tell you.
With C = 6ND fixed at 5.76 × 1023 FLOPs, how many tokens does a 70B model get?

Chapter 1

Straight Lines on Log-Log Axes

Plot Kaplan's loss curves on both kinds of axes, and read the exponent as the slope of a straight line

Kaplan et al. (2020) trained Transformers from 768 to 1.5 billion parameters on the same text. On ordinary axes, the loss curve drops fast and then flattens. It looks as if scale stops helping. On log axes, the same curve is a straight line.

A straight line on log-log axes is a power law: one quantity is a fixed power of another. Kaplan's fit for loss against parameters, when data is plentiful, names a constant Nc and an exponent αN:

Say it aloud

L of N equals N-c over N, to the power alpha-N.

L(N)
L of N the test loss, in nats per token, of a model with N parameters trained on enough data.
Nc
N-c a fitted scale: 8.8 × 1013. It depends on the tokenizer and data, so it has no deep meaning.
N
N the parameters, not counting the embedding matrices.
αN
alpha-N the exponent: 0.076. On log-log axes it is the slope, with a minus sign.
In plain words

Divide the scale N-c by the model size N, and raise that to the power alpha-N. Each doubling of N multiplies the loss by 2 to the power minus alpha-N.

With numbers

N = 109: L = (8.8 × 104)0.076 = 2.38 nats. Double to 2 × 109: L = 2.25, which is 0.949 × 2.38. Every doubling cuts the loss by 5.1%.

Take the logarithm of both sides: log L = αN log Nc − αN log N. That is a line in log N with slope −αN. Data has the same shape: L(D) = (5.4 × 1013 / D)0.095. So does compute spent at its best split: L = (3.1 × 108 / C)0.050, with C in petaFLOP-days.

Bend the axes

One of Kaplan's three laws, drawn over the range he measured. Switch the axes, then drag the point and read the loss.

1B

Kaplan et al. (2020), equations 1.1 to 1.3, fitted on WebText2. Each law needs the other limits out of the way. The parameter law needs plenty of data; the token law needs a large model.

The exponents are small. A doubling of compute buys only 3.4% (2−0.050 = 0.966). But they compound: 1,000 times the parameters gives 1000−0.076 = 0.59 of the loss. And the line is straight, so two small runs fix it.

Symptom: your loss curve flattens, and you conclude that more scale will not help.

Measure: replot it with both axes on a log scale. A straight line means steady returns for each doubling.

Fix: plan with the slope on log-log axes, never with the shape on linear ones.

Loss follows L = (Nc / N)0.076. You double N. What happens to the loss?

Chapter 2

Why Error Falls as a Power of Data

Estimate a mean from n samples, measure a slope of minus one, then see why neural networks show far shallower slopes

Why a power law at all? The lecture starts with the simplest estimator there is. Draw n numbers from a bell curve with an unknown mean and a spread σ (the standard deviation). Estimate the mean by their average, μ̂. How far off is it?

Say it aloud

The expected value of mu-hat minus mu, squared, equals sigma squared over n.

E[ ]
the expected value of the average over many repeats of the whole experiment.
μ̂
mu-hat our estimate: the average of the n samples.
μ
mu the true mean we want.
σ2
sigma squared the variance of one sample.
n
n the number of samples.
In plain words

Square the gap between the estimate mu-hat and the truth mu, and average it over many repeats. It equals one sample's variance sigma squared, shared out over n samples.

With numbers

With made-up numbers: σ = 2 and n = 100 give 4 / 100 = 0.04. Four times the data, n = 400, gives 0.01: a quarter of the error.

Take logs: log error = −log n + 2 log σ. That is a straight line with slope −1. Any error that falls as 1/nα is a scaling law with slope −α. Most classical estimators give slope −1.

Measure the slope of an estimator

Dots: the squared error of a sample mean, averaged over 300 repeats, at each n. Press Draw to run the experiment, then pick a dimension for the reference line.

The dots are a live simulation with σ = 1. Reference lines are the n−1/d rate from the lecture's informal argument, drawn through the n = 2 point; their height is illustrative.

Neural scaling laws are much shallower. Hestness et al. (2017) measured slopes of −0.066 for word language models and −0.094 for character models, and between −0.07 and −0.35 across other tasks. Why so slow?

The lecture's answer is a flexible, nonparametric learner, one that assumes no fixed shape for the function. Cut the input space into boxes and average inside each. More data buys smaller boxes, but in d dimensions you need many more boxes to shrink each side. The error falls like n−1/d. If language behaves like d ≈ 10.5, the slope is −0.095. The lecture adds a warning: estimates of intrinsic dimension are shaky, so this story is a hint, not a proof.

Symptom: you collected ten times the data and the loss fell by only 20%.

Measure: fit the slope on your own runs. At slope −0.095, ten times the data gives 10−0.095 = 0.80 of the loss.

Fix: budget data with the measured exponent, not with the 1/n intuition from statistics.

Why does a neural language model's data slope (about −0.07 to −0.095) sit far from the −1 of a sample mean?

Chapter 3

Fit Small Runs, Predict the Big One

Fit a line to seven cheap runs, extrapolate it ten thousand times further, and find the floor that a straight line ignores

The promise of scaling laws is cheap prediction. Train seven small runs from 1018 to 1021 FLOPs. Fit a law. Read off the loss of a 1025-FLOP run before you pay for it.

The simplest fit is a straight line through the logs. Take log C and log L for each run and fit by least squares:

log L = log A − α log C   (fit the slope −α and the intercept log A)

The toy below uses a known truth, so you can check the prediction. The truth is the loss at the best split for each budget, from the refit Chinchilla law of the hero. It has a floor: the loss can never drop below E = 1.82 nats, no matter how much compute you spend.

Fit seven runs, predict the eighth

Pink dots: small runs with measurement noise. Yellow: the true loss of the big run. Choose a fit, change the noise, and see where the prediction lands.

0.005

Toy truth: L*(C) = 1.8172 + 2708.5 × C−0.1783, the best-split loss of Besiroglu et al.'s refit. Noise is Gaussian on L, in nats. The floor fit scans E and fits the rest as a line.

With no noise, the straight line misses by 0.61 nats: it predicts 1.30, the truth is 1.91. On log axes the true curve bends toward its floor, and a line cannot bend. The fit with a floor, L = E + A C−α, lands within 0.001.

Noise makes the floor fit wobble. We ran 200 sets of seven runs at 0.01 nats of noise. The floor fit's typical miss was 0.022 nats; one set in ten missed by more than 0.058. Both fits matched the small runs equally well. Only the extrapolation tells them apart.

Symptom: the big run lands 0.3 nats worse than your line promised.

Measure: look at the residuals of the largest small runs. If they curve upward, the data is reaching its floor.

Fix: fit a floor term, and hold out your largest small run to test the extrapolation before you trust it.

Why does a straight line on log-log axes overpredict the gains at 1025 FLOPs in this toy?

Chapter 4

Design Choices from Small Runs

Settle optimizer, architecture, depth and batch size by comparing scaling lines instead of training two giant models

Is a Transformer better than an LSTM? The brute-force answer trains an LSTM the size of GPT-3, for tens of millions of dollars. The lecture's answer is a procedure:

  1. Train a few small models of each kind.
  2. Fit a scaling law for each.
  3. Compare the laws at the target scale and pick the winner.

Hestness et al. (2017) did this for optimizers on character language models. SGD's fitted line is 5.37 m−0.094 and Adam's is 5.25 m−0.095, where m is the number of training characters. The slopes are almost the same. Adam shifts the line down by about 4% across the range.

Pick an optimizer from small runs

Yellow: SGD, the baseline. Pink: Adam. Each dot is a small run with noise. Drag the largest run size and the noise, then read the predicted gap at 1.07 billion characters.

2.1M chars
1.0%

True lines from Hestness et al. (2017), Figure 3 (character LMs, depth-10 recurrent highway networks). Runs start at 219 characters; noise multiplies each loss. We simulate the runs.

Range matters more than count. We simulated 300 experiments at 1% noise. With runs only up to 2.1 million characters, the predicted gap had the wrong sign one time in three. Up to 33.6 million characters, it never did.

Kaplan et al. answered three more questions this way. LSTMs match Transformers on tokens early in the context, but fall behind later in it, so Transformers win at scale. Depth matters little once you count parameters without the embeddings: only models with fewer than two layers, or with extreme width-to-depth ratios, leave the common line. And the best batch size grows as the loss falls. The critical batch size is the point past which a bigger batch stops saving steps:

Say it aloud

B-crit of L equals B-star over L to the power one over alpha-B.

Bcrit(L)
B-crit of L the critical batch size, in tokens, when the loss is L.
B*
B-star a fitted scale: 2 × 108 tokens.
L
L the current loss, in nats per token.
αB
alpha-B a fitted exponent: 0.21, so one over alpha-B is 4.8.
In plain words

Raise the loss L to the power 4.8 and divide B-star by it. A lower loss gives a larger critical batch.

With numbers

Kaplan's fit (equation 1.4): at L = 3.0 nats, Bcrit = 2 × 108 / 3.04.8 = 1.07 million tokens. At L = 2.5, 2.55 million. It doubles for every 13% drop in loss.

The learning rate is the exception: its best value shifts with model width. Lecture 11 covers muP, which fixes that.

Symptom: the design that won at small scale loses at large scale.

Measure: compare the slopes, not the points. A steeper line can start worse and still cross.

Fix: span at least two orders of magnitude with your small runs before you extrapolate.

What is the scaling-law procedure for choosing between two designs?

Chapter 5

One Formula for Parameters and Tokens

Split the loss into a floor, a capacity term and a data term, and see each one move as you change N and D

Chapter 1 had one law for parameters with plenty of data, and one for data with a large model. A budget forces both to be finite at once. We need the loss as a function of N and D together.

Hoffmann et al. (2022), the Chinchilla paper, use three parts. A floor E: the loss of a perfect model of this text. A capacity term: what a finite model of N parameters loses. A data term: what a model trained on only D tokens loses. Each term is a power law, with constants A and B and exponents α and β:

Say it aloud

L of N and D equals E, plus A over N to the alpha, plus B over D to the beta.

L(N, D)
L of N and D the final loss, in nats per token.
E
E the floor: the loss no model and no data can beat. 1.8172 in the refit.
A
A the scale of the capacity term: 482.01.
N
N the parameters.
α
alpha how fast more parameters help: 0.3478.
B
B the scale of the data term: 2085.43.
D
D the training tokens.
β
beta how fast more tokens help: 0.3658.
In plain words

Start at the floor E. Add the capacity term, A divided by N to the alpha. Add the data term, B divided by D to the beta. More N shrinks the first term; more D shrinks the second.

With numbers

Chinchilla, N = 70 × 109 and D = 1.4 × 1012, with the refit constants: 1.817 + 0.081 + 0.075 = 1.974 nats. The two terms are almost equal. That is no accident, as Chapter 7 shows.

Take the loss apart

The map shades predicted loss over parameters and tokens: stronger pink is lower. The bar splits your point's loss into floor, capacity and data. Drag N and D, then switch the constants.

70B
1.4T

Published constants (Hoffmann et al., Appendix D.2): E 1.69, A 406.4, B 410.7, α 0.34, β 0.28. Refit (Besiroglu et al., 2024, from the paper's own plotted runs): E 1.8172, A 482.01, B 2085.43, α 0.3478, β 0.3658. The yellow line is Gopher's budget.

Two fits of the same runs disagree. The published constants give 1.937 for Chinchilla, with a floor of 1.69 and a data term of 0.163. The refit gives a floor of 1.82. The total barely moves, but its parts do, and Chapter 7 shows how that changes the best split. Kaplan used a different form, but the idea is the same: one term for each limit.

Symptom: doubling the model barely helps.

Measure: compare the two terms. If B / Dβ is much larger than A / Nα, data is the limit.

Fix: move compute from parameters to tokens.

In L(N, D) = E + A/Nα + B/Dβ, what does the term B/Dβ measure?

Chapter 6

IsoFLOP Curves: The Valley, Measured

Train many model sizes on each of nine budgets, find each valley's bottom, and fit how the bottom moves with compute

Hold the compute C fixed and change the model size N. Every run gets D = C / (6N) tokens. That set of runs is an isoFLOP curve: equal FLOPs everywhere. A small model lacks capacity. A large one lacks tokens. In between is a valley, and its bottom is the best model for that budget, N*.

This is Approach 2 of the Chinchilla paper. Hoffmann et al. used nine budgets, from 6 × 1018 to 3 × 1021 FLOPs, with up to 16 billion parameters. They matched each run's learning-rate schedule to its own token count. For each budget they fit a parabola to loss against log N:

L ≈ c0 + c1 log N + c2 (log N)2   →   log N* = −c1 / (2 c2)

The parabola's lowest point is the estimate of N*. Then they fit a line through the nine points of log N* against log C. Its slope is the exponent a in N* ∝ Ca. They found a = 0.49, and b = 0.51 for tokens.

Run the isoFLOP experiment

Left: each budget's runs, loss against model size, with its parabola. Right: each valley's bottom against compute, and the line through them. Press Run, then add noise and run again.

0.010

The paper's nine budgets. Each budget trains 9 sizes from N*/8 to 8 N*; losses come from the refit law plus Gaussian noise. We simulate the runs; they are not the paper's data.

With no noise, the simulation finds a = 0.513, the refit law's true exponent, and puts N* at Gopher's budget at 71.6B. At 0.01 nats of noise, 500 repeats gave a = 0.512 ± 0.005 and an N* between 65B and 78B nine times in ten. At 0.03 nats the range widens to 54B to 95B. Valleys are flat at the bottom, so noise moves the vertex a lot.

Symptom: one budget's fitted bottom lands far off the line of the others.

Measure: check that its vertex lies inside the range of sizes you trained. A vertex outside the grid is a guess.

Fix: train sizes on both sides of the bottom, at least 4 times smaller and 4 times larger.

Along one isoFLOP curve, why does loss rise again for very large models?

Chapter 7

Derive the Best Split

Set the slope of the loss along the budget to zero, and the two terms must balance; solve that for the best N

With the joint law in hand, the isoFLOP valley has a formula. Put D = C / (6N) into L(N, D):

L(N) = E + A N−α + B (6N / C)β

The capacity term falls as N grows; the data term rises. At the bottom of the valley the slope with respect to N is zero. Differentiate, and multiply through by N:

−α A N−α + β B (6N / C)β = 0   →   α × (A / Nα) = β × (B / Dβ)

That is the balance rule: at the best split, alpha times the capacity term equals beta times the data term. Solve it for N. Call the combined constant G and the exponent a:

Say it aloud

N-opt equals G times C over six, to the power a, where a equals beta over alpha plus beta.

Nopt
N-opt the model size at the bottom of the valley for budget C.
G
G the combined constant (αA / (βB)) to the power 1 / (α + β). It is 0.1196 for the refit.
C
C the budget in FLOPs; C / 6 is N times D.
a
a the exponent: beta over alpha plus beta. It is 0.5126 for the refit. Tokens grow as C to the power 1 − a.
In plain words

Divide the budget C by 6 to get the product N times D. Raise it to the power a and multiply by G: that is N-opt. The tokens are what is left, D-opt = C / (6 N-opt).

With numbers

Gopher's budget, C = 5.76 × 1023, so C / 6 = 9.6 × 1022. Nopt = 0.1196 × (9.6 × 1022)0.5126 = 72.2 billion. Dopt = 1.33 trillion tokens: 18.4 per parameter. Chinchilla itself was 70B on 1.4T.

Balance the two terms

Purple: alpha times the capacity term. Teal: beta times the data term. Both along Gopher's budget. Where they cross is the best split. Drag N, then switch the constants.

280B

Budget 5.76 × 1023 FLOPs. Constants as in Chapter 5. The page computes the crossing from the formula above; it does not read it off the curves.

The published constants say something odd. Their a is 0.452, and at Gopher's budget they give Nopt = 32 billion on 3.0 trillion tokens: 93 tokens per parameter. That contradicts the paper's own Approaches 1 and 2, and the 70B Chinchilla it trained. Besiroglu et al. (2024) rebuilt the data from the paper's figure and found two causes. The paper rounded its constants, and its fitting optimizer stopped early. Their refit gives the 18 tokens per parameter above.

Symptom: the formula's best size differs from your isoFLOP bottoms by a factor of two.

Measure: compare the exponent a from the joint fit with the slope from the isoFLOP fit.

Fix: refit until they agree, with tighter optimizer tolerances and unrounded constants.

At the compute-optimal split, how do the two loss terms compare?

Chapter 8

Kaplan vs Chinchilla

Grow two rules from the same starting budget, see one build 485B models on too few tokens, and find what each rule got right

Kaplan et al. (2020) found that the best model grows as C0.73. Tokens grow only as C0.27. Models like GPT-3 and Gopher grew large on about 300 billion tokens. Chinchilla found 0.50 for both. Why?

Hoffmann et al. point to the learning rate. Kaplan trained every model with one cosine schedule, sized for 130 billion tokens, and read losses from partway through. A run cut short on a long schedule has not finished its decay, so its loss reads too high. Short training looked worse than it is, which pushed the rule toward big models. Many of Kaplan's runs were also under 100 million parameters.

Call the tokens per parameter r. At the best split:

Say it aloud

r equals D-opt over N-opt, which equals C over six, over N-opt squared.

r
r tokens per parameter at the best split.
Dopt
D-opt the best token count for budget C.
Nopt
N-opt the best model size, which grows as C to the power a.
C
C the budget in FLOPs.
In plain words

Divide the budget's N-times-D, C over 6, by N-opt squared. N-opt squared grows as C to the power 2a, so r grows as C to the power 1 − 2a. If a is one half, r never changes.

With numbers

Kaplan, a = 0.73: r scales as C−0.46 and shrinks with every budget. Chinchilla, a = 0.50: r stays near 20. The refit, a = 0.5126: r drifts from 21.6 at 1021 FLOPs to 17.1 at 1025.

Grow both rules from one point

Both rules start from their own advice at 1021 FLOPs. Yellow is Kaplan, pink is Chinchilla, dots are real models. Drag the budget and compare the tokens each parameter gets.

5.76 × 10²³

Starting sizes from Hoffmann et al., Appendix D.4: 4.68B (Kaplan) and 2.86B (their Approach 1) at 1021 FLOPs. Exponents 0.73 and 0.50 from their Table 2. Kaplan counted parameters without embeddings, so its line is approximate. Model dots use 6ND.

Hoffmann et al. tested both at 1021 FLOPs: a 4.74B model, as Kaplan advised, against 2.80B. The smaller one won. Grow both rules to Gopher's budget, and Kaplan's builds 485B on 198B tokens; Chinchilla's builds 69B on 1.4T. DeepMind trained that 70B model, and it beat 280B Gopher on most benchmarks.

ModelParametersTokensTokens per parameter
GPT-3175B300B1.7
Gopher280B300B1.1
Chinchilla70B1.4T20
LLaMA 65B65B1.4T21.5
Llama 2 70B70B2T28.6
Llama 3 70B70B15T214

Why train Llama 3 70B on 214 tokens per parameter? A deployed model pays 2N FLOPs for every token it serves, and Chinchilla ignores that. At Llama 3 70B's budget, 6.3 × 1024 FLOPs, the refit's best split is 246B on 4.3T. The 70B model loses 0.010 nats and runs 3.5 times cheaper.

Symptom: a 280B model trained on 300B tokens loses to a model a quarter its size.

Measure: tokens per parameter. Gopher had 1.1; the valley's bottom sits near 20.

Fix: shrink the model and train it longer on the same budget.

Why did Kaplan's rule favour larger models than Chinchilla's?

Chapter 9

Showcase: Allocate Any Budget

Choose a budget and a model size, and read the best split, the predicted loss, the price of missing it and the cost to serve

Everything so far, in one tool. Pick a budget from 1019 to 1026 FLOPs. The allocator draws that budget's isoFLOP valley from the joint law. It marks the bottom with Chapter 7's formula and puts your model on the curve. Move your model away from the bottom and read what it costs.

Allocate a budget

Top: the valley for your budget, with the best size in green and yours in warm. Bottom: your split as tokens and parameters. Drag the budget, then move off the bottom.

5.76 × 10²³
1×

Loss from the joint law; best split from Nopt = G (C/6)a. Serving cost is 2N FLOPs per generated token, ignoring attention. Predictions for the Chinchilla data and tokenizer, not for any other model.

Things to try. At Gopher's budget, go 4 times smaller than the best: the loss rises 0.020 nats. Go 4 times larger: it rises 0.020 nats too. Ten times either way costs about 0.056. With the refit constants the valley is nearly symmetric in log N, because α and β are close. Smaller is not safer for loss, but it is 4 times cheaper to serve.

Check yourself. Before you drag, predict the best split at 1023 FLOPs. Chapter 7's formula gives 29.5B parameters on 566B tokens, 19 per parameter. Then switch to the published constants and watch the bottom jump to a model less than half the size.

Chapter 10

Field Guide

Keep the formulas, the allocator in code, and the list of things a scaling law will not tell you

A budget fixes N × D = C / 6. Loss falls as a power law in each, down to a floor. Fit the joint law on small runs, or measure isoFLOP valleys. Then balance the two terms, α × A/Nα = β × B/Dβ. For the Chinchilla data, that means roughly equal growth of N and D, near 20 tokens per parameter.

QuantityFormulaValueSource
Training computeC = 6NDGPT-3: 3.15 × 1023Lecture 2; GPT-3 paper
Parameter law(Nc/N)αNαN = 0.076; 0.949 per doublingKaplan et al., 2020
Data law(Dc/D)αDαD = 0.095Kaplan et al., 2020
Critical batchB* / L1/αB1.07M tokens at L = 3.0Kaplan et al., 2020
Joint lossE + A/Nα + B/Dβ1.974 nats at 70B, 1.4TBesiroglu et al., 2024 refit
Best sizeG (C/6)a, a = β/(α+β)72.2B at 5.76 × 1023Hoffmann et al., 2022, eq. 4
Exponent aNopt ∝ Ca0.50, 0.49, 0.46 (three approaches); Kaplan 0.73Hoffmann et al., Table 2
Tokens per parameter(C/6) / Nopt220 to 22 (Approach 1); 18.4 refitHoffmann et al., Table 3

The allocator in code. We ran it; the comments are its output.

python
REFIT     = dict(E=1.8172, A=482.01, B=2085.43, al=0.3478, be=0.3658)  # Besiroglu et al. 2024
PUBLISHED = dict(E=1.69,   A=406.4,  B=410.7,   al=0.34,   be=0.28)    # Hoffmann et al. 2022

def loss(p, N, D):
    return p['E'] + p['A'] / N**p['al'] + p['B'] / D**p['be']

def allocate(p, C):                       # minimize loss subject to 6ND = C
    a = p['be'] / (p['al'] + p['be'])
    G = (p['al'] * p['A'] / (p['be'] * p['B'])) ** (1 / (p['al'] + p['be']))
    N = G * (C / 6) ** a
    return N, C / (6 * N)

N, D = allocate(REFIT, 5.76e23)
print(N / 1e9, D / 1e12, D / N)             # 72.2  1.33  18.4
print(loss(REFIT, 70e9, 1.4e12))          # 1.974
N, D = allocate(PUBLISHED, 5.76e23)
print(N / 1e9, D / 1e12, D / N)             # 32.2  2.98  92.6  (inconsistent with Chinchilla)
print(allocate(REFIT, 1.03e25))            # (3.16e11, 5.41e12): your 10,000 H100s

What scaling laws do not tell you:

Keep going

Read next

The habit. Before you pick a model size, write the budget as N × D. Then ask which term of the loss is larger, and move compute toward the other one.
A team has twice the compute of its last compute-optimal run. Under Chinchilla's rule, how should it change N and D?

Now teach it: press Present or Teach. Derive the balance rule from L(N, D) and C = 6ND, and explain why Kaplan's 0.73 became 0.5. Then go back to the instrument and predict, before you drag, how much worse Gopher's 280B split is than the best.

Scaling Laws I: The Basics · Stanford CS336, Lecture 9
Previous: Parallelism II · Next: Inference · Course site · Back to Gleams