Scaling Laws for Neural Language Models
OpenAI's 2020 paper trained Transformers of 768 to 1.5 billion parameters on WebText2 and found that loss falls as a power law in parameters, data and compute, almost regardless of shape. At a fixed budget, grow the model first (size ∝ compute^0.73). A breakdown that checks the numbers.
On this page
- Why this paper matters
- What the experiments were
- Finding 1: scale decides, shape barely matters
- Finding 2: three power laws
- Finding 3: data requirements and overfitting
- Finding 4: training steps and the critical batch size
- Finding 5: where to spend a fixed compute budget
- The contradiction the paper points out
- What came after: which conclusions were corrected
- Reading the numbers with care
- What to take away
- Further reading
- FAQ
Why this paper matters
Kaplan et al. (OpenAI, January 2020) asked a question that had almost no quantitative answer before GPT-3: how does the test loss of a language model change with scale, and how should a fixed compute budget be split between parameters and data? They trained Transformers on WebText2 with 768 to 1.5 billion non-embedding parameters and 22 million to 23 billion training tokens, and reached three main conclusions:
- Test loss falls as a power law in the parameter count , the dataset size and the optimally allocated compute . Within the paper’s range (8 orders of magnitude of compute, 6 of parameters, a little over 2 of data) the data show no sign of bending away from a straight line.
- At a fixed parameter count, shape (depth, width, number of attention heads) has only a small effect on loss.
- At a fixed compute budget, the extra compute should go mainly into a bigger model: the optimal size grows as , while the data only needs to grow slowly, as .
A later replication (Porian et al., 2024) writes that this law was influential in choosing the size of GPT-3 and several later models. Two years after the paper, Chinchilla changed the conclusion to parameters and data growing about in step, and still later work traced the disagreement to specific experimental details. So the paper is both a method and a case that later work has checked item by item. This breakdown verifies the numbers in the paper and marks which of them turned out to be unreliable. The derivations and Chinchilla’s full result are on the wiki page Scaling Laws, and they are not repeated here.
The table collects every quantitative result of the paper; the sections below explain them one by one. counts non-embedding parameters (no vocabulary or position embeddings), and loss is in nats per token.
| Result | Formula and fitted values | Conditions |
|---|---|---|
| Loss falls with parameters | , , | Enough data, trained to convergence |
| Loss falls with data | , , tokens | Large model, early stopping |
| Loss falls with compute | , , PF-days | Enough data, best model size, batch far below critical |
| Data needed to avoid overfitting | Within 0.02 of the converged loss | |
| Critical batch size | , tokens, | Depends only on the loss, not on model size |
| Optimal allocation | , , , | Compute measured as |
What the experiments were
| Item | Setup |
|---|---|
| Data | WebText2: web pages linked from Reddit (through October 2018, at least 3 karma), 20.3 million documents, 96 GB of text, tokens (BPE, vocabulary of 50,257). tokens are held out for testing, and generalization is also measured on Books Corpus, Common Crawl, English Wikipedia and a set of public internet books |
| Models | Decoder-only Transformers, context of 1,024 tokens; 768 to 1.5 billion non-embedding parameters, with shapes from to and |
| Conventions | , without vocabulary or position embeddings; training compute ( is the batch size in tokens, the number of steps); 1 PF-day FLOPs |
| Optimization | Adam, steps, 512 sequences × 1,024 tokens tokens per batch; 3,000 steps of linear warmup, then cosine decay to zero; models above 1 billion parameters use Adafactor because of memory |
| Metric | Cross-entropy averaged over a 1,024-token context |
Training compute counts only per token for the non-embedding parameters. It leaves out the matrix multiplication of the output layer (the unembedding) and the attention term that depends on the context length, which the paper says is small when . As we will see, leaving out the output layer, the fixed batch size and the fixed-length warmup are what later replications found when they went looking for the disagreement with Chinchilla.
Finding 1: scale decides, shape barely matters
The most surprising result is that model shape hardly matters. With the non-embedding parameter count fixed, changing the feed-forward ratio , the aspect ratio or the head dimension one at a time moves the loss by only a few percent (Figure 5, run with models of 25 and 50 million parameters). The aspect ratio can vary by a factor of 40 with little effect, and a model with reaches a loss within 3% of the shape used by GPT-2. With , the shapes the paper mentions have similar parameter counts but differ in depth by more than a factor of thirty:
# The three shapes (n_layer, d_model) the paper mentions, with
# N ~ 12 * n_layer * d_model^2
for n_layer, d_model in [(6, 4288), (48, 1600), (207, 768)]:
n = 12 * n_layer * d_model ** 2
print(f"({n_layer}, {d_model}): N = {n / 1e9:.2f}B")
Output:
(6, 4288): N = 1.32B
(48, 1600): N = 1.47B
(207, 768): N = 1.47B
Three more observations matter just as much:
- Count only non-embedding parameters and the trend is clean. If the vocabulary and position embeddings are included in , models of different depth scatter onto several curves. With only non-embedding parameters, everything except models with fewer than 2 layers or extreme aspect ratios lands on one curve (Figure 6). The paper concludes that the embedding matrix could be made smaller without hurting performance.
- Transformers use long context better than LSTMs. An LSTM matches a Transformer on the first tokens of the context, but its loss stops improving after about 100 tokens, while the Transformer keeps improving across the whole 1,024 tokens (Figure 7).
- Out-of-distribution loss follows in-distribution loss. A model trained only on WebText2 also follows a power law in on Books Corpus, Common Crawl and English Wikipedia, with almost the same slope and only a small, slowly growing offset. Generalization depends almost entirely on the in-distribution validation loss, not on how long the model trained or whether it converged (Figure 8).
Finding 2: three power laws
The paper measured the loss under three different bottlenecks, which gives three power laws. Each holds only under its own conditions:
- : trained close to convergence on enough data, the loss depends only on the non-embedding parameter count. The data is all of WebText2, and no overfitting was seen except possibly for the very largest models.
- : one large model with is trained on fixed subsets of WebText2 of different sizes and stopped as soon as the test loss no longer improves (early stopping).
- : for a given compute , take the best result over all model sizes. The paper first builds an empirical curve at a fixed batch size (Figure 1), then corrects it to with the critical batch size introduced below, and says that predictions should use the trend.
The paper also stresses that the values of , and depend on the vocabulary and tokenization and have no fundamental meaning. What matters is the exponents. They are small, so returns diminish but stay steady. A few numbers from the paper’s fits:
# The paper's fits: L(N) = (Nc/N)^aN, L(D) = (Dc/D)^aD, in nats/token (WebText2)
aN, Nc = 0.076, 8.8e13
aD, Dc = 0.095, 5.4e13
print("loss factor, params x2 / x10:", f"{2 ** -aN:.3f} / {10 ** -aN:.3f}")
print("loss factor, data x2 / x10:", f"{2 ** -aD:.3f} / {10 ** -aD:.3f}")
for n in (1e7, 1e8, 1e9): # loss set by model size when data is not limiting
print(f"N = {n:.0e}: L(N) = {(Nc / n) ** aN:.2f}")
Output:
loss factor, params x2 / x10: 0.949 / 0.839
loss factor, data x2 / x10: 0.936 / 0.804
N = 1e+07: L(N) = 3.37
N = 1e+08: L(N) = 2.83
N = 1e+09: L(N) = 2.38
Doubling the parameters multiplies the loss by , a drop of only about 5%, and a factor of 10 gives 0.839. The data exponent is a little larger (0.095), so doubling the data multiplies the loss by about 0.936. The last three lines show at a few sizes: parameters correspond to about 2.38 nats per token. That absolute value only makes sense with the paper’s WebText2 and tokenizer; with another vocabulary the constants must be refit.
, and each describe a case in which one factor is the bottleneck: the first assumes unlimited data, the second an unlimited model, the third that both the model size and the batch size are optimal. Real training is limited by several factors at once, and describing it takes in the next section and later.
Finding 3: data requirements and overfitting
To put parameters and data in one equation, the paper proposes
Three principles select this form. (1) Changing the vocabulary or tokenization only rescales the loss by a constant, so and must be able to absorb it. (2) For the loss must reduce to , and for to . (3) The loss should be analytic at , that is, expandable in integer powers of . The paper admits that the third principle has the weakest theoretical support and rests mainly on how well the fit works. Fitting four parameters gives , , and (Table 2). is 0.103 rather than 0.095 because here the whole surface is fitted at once. The runs with the dataset cut by a factor of 1,024 (about tokens) are not fitted well; the paper notes that an epoch is then only 40 parameter updates, so overfitting starts extremely early and this may be a different regime.
The degree of overfitting depends only on the combination (Figure 9, right). The paper turns “trained to within 0.02 of the converged loss (about the variation between random seeds) without overfitting” into a lower bound on the data:
Here , using the joint fit . Data only has to grow sub-linearly with model size:
# Data needed to avoid overfitting: D >= 5e3 * N**0.74
for n in (1e8, 1e9, 1e10):
d = 5e3 * n ** 0.74
print(f"N = {n:.0e}: D >= {d:.1e} tokens ({d / n:.1f} per parameter)")
print(f"8x the parameters -> {8 ** 0.74:.2f}x the data")
Output:
N = 1e+08: D >= 4.2e+09 tokens (41.6 per parameter)
N = 1e+09: D >= 2.3e+10 tokens (22.9 per parameter)
N = 1e+10: D >= 1.3e+11 tokens (12.6 per parameter)
8x the parameters -> 4.66x the data
An 8-fold larger model needs only about 4.7 times as much data. From this the paper infers that models below parameters can be trained with minimal overfitting on the 22-billion-token WebText2, while the largest models will see mild overfitting.
This is “the data needed to avoid overfitting”, not “the compute-optimal ratio”, and the paper says explicitly that the two usually differ. It also did not optimize regularization (for example the dropout probability) while varying and . Note that the tokens per parameter implied by this bound fall as the model grows (41.6, 22.9, 12.6), whereas Chinchilla’s “about 20 tokens per parameter” is a ratio that stays roughly constant across scales. The two answer different questions, and the similar numbers near mean nothing.
Finding 4: training steps and the critical batch size
The third variable is training time. For a fixed model size and unlimited data, the learning curve after an initial transient can be fitted jointly in and the number of steps:
The fitted values are , , and (Table 3). The first term is the loss floor set by model size, and the second falls with the number of steps. needs some explanation.
Most of the paper’s runs use a fixed batch size ( tokens), but for a given target loss a batch that is too large wastes compute (it takes few steps), and one that is too small wastes steps (it saves compute). The paper borrows the critical batch size theory of McCandlish et al. (2018): training to a given loss takes steps and processes samples, and these satisfy , where is the fewest steps needed with a very large batch and the fewest samples needed with a very small batch. Their ratio is the critical batch size, . At both the number of steps and the number of samples are twice their minimum, a roughly optimal compromise between time and compute. Given , steps and compute at any batch size can be converted to the standardized and :
The paper measures the critical batch size to depend only on the loss reached, not on model size: with tokens and . The lower the loss, the larger the critical batch, which roughly doubles for every 13% drop in loss (Figure 10).
aB, Bstar = 0.21, 2e8 # B_crit(L) = B* / L**(1/aB), in tokens
for loss in (4.5, 3.5, 3.0, 2.5):
print(f"L = {loss}: Bcrit = {Bstar / loss ** (1 / aB):.2e} tokens")
print(f"batch 2^19 tokens is critical at L = {(Bstar / 2 ** 19) ** aB:.2f}")
print(f"13% lower loss -> Bcrit x{0.87 ** (-1 / aB):.2f}")
Output:
L = 4.5: Bcrit = 1.55e+05 tokens
L = 3.5: Bcrit = 5.13e+05 tokens
L = 3.0: Bcrit = 1.07e+06 tokens
L = 2.5: Bcrit = 2.55e+06 tokens
batch 2^19 tokens is critical at L = 3.48
13% lower loss -> Bcrit x1.94
The last two lines follow from the paper’s fit: the default batch of tokens is the critical batch size at a loss of about 3.5 nats. Early in training, above 3.5, this batch is larger than critical and wastes compute; below 3.5 it is smaller than critical, which saves compute but takes more steps. That is why the paper converts to and instead of using the actual steps and compute.
Finding 5: where to spend a fixed compute budget
Substituting into and minimizing over gives how the optimal configuration grows with compute (Section 6.2 and Appendix B):
with . The theory predicts about 0.054 and . The direct measurements are , , and (Figures 13 and 14), and the paper says the two agree to within a few percent. The step exponent is so small that, in the paper’s words, it may even be consistent with zero. Converting the exponents into multiplicative factors:
# Optimal allocation vs compute: N~C^0.73, B~C^0.24, S~C^0.03, D = B*S ~ C^0.27
for name, e in (("N", 0.73), ("B", 0.24), ("S", 0.03), ("D", 0.27)):
print(f"{name}: x{10 ** e:.2f} per 10x compute, "
f"x{10 ** (9 * e):.3g} per 1e9x")
Output:
N: x5.37 per 10x compute, x3.72e+06 per 1e9x
B: x1.74 per 10x compute, x145 per 1e9x
S: x1.07 per 10x compute, x1.86 per 1e9x
D: x1.86 per 10x compute, x269 per 1e9x
Every 10× of compute should make the optimal model about 5.4 times larger and the data only about 1.9 times larger, and most of the extra data goes into a bigger batch, so the number of serial steps barely changes. Figure 3 of the paper illustrates a billion-fold increase in compute: the model grows by more than a million, the batch by about 100 and the serial steps by less than 10, matching the output above. A few readings:
- Extra compute goes mainly into the model. This is the most actionable point of the paper: rather than doubling the data, make the model several times larger and let the data grow slowly.
- Large models are more sample-efficient. To reach the same loss, a larger model needs to process fewer tokens (Figure 2, left), and compute-efficient training stops far short of convergence (Figure 2, right).
- The optimum is not sharp. A model between 0.6 and 2.2 times the optimal size needs only about 20% more compute (Figure 12), so a small deviation from the optimal size costs little. The paper adds that, because of hardware constraints, researchers typically train smaller models for longer than is compute-optimal.
- Steps grow extremely slowly. Since , the paper suggests that work on speeding up early training is worthwhile, because compute-efficient training needs very few optimization steps.
The contradiction the paper points out
In Section 6.3 the paper extrapolates and concludes that its own power laws must fail somewhere. The argument has three steps:
- To avoid overfitting, the data must grow with the model: (Equation 6.6).
- But compute-efficient training uses data that grows slowly. Training at the critical batch size and seeing each token once, the amount of data is tokens (Equation 6.7), growing much more slowly than step 1 requires.
- So at large enough compute, even a single pass without repeating data runs into the data bottleneck. With , the loss would then fall with compute only as , while predicts , and the two curves must cross.
The crossing is at PF-days, parameters, tokens and nats per token (Equation 6.8). The paper stresses that these values are very uncertain and could be off by an order of magnitude in either direction, depending on the fitted exponents. It offers two readings. The most obvious is that the laws must break down before this point. The other is explicitly labeled a conjecture: the crossing may have a deeper meaning, with a rough estimate of the entropy per token of natural language, and the trend leveling off near it. The crossing was computed with Kaplan et al.’s own allocation exponents, which were later corrected (next section), so its values should no longer be taken as an estimate. It is better used as an example of why an extrapolation needs a boundary.
What came after: which conclusions were corrected
The most important correction concerns the allocation exponent. Hoffmann et al. (2022, Chinchilla) refit it with more than 400 models, and their three methods give exponents in of 0.50, 0.49 and 0.46, against 0.73 for Kaplan et al. They also ran a direct comparison: at FLOPs the Kaplan fit gives 4.68 billion parameters and Chinchilla’s method 2.86 billion; they trained models of 4.74 and 2.80 billion parameters, and the smaller one ended with the lower loss. The first number can be reproduced from the paper’s formula:
import math
PF_DAY = 1e15 * 24 * 3600 # FLOPs in one PF-day
for c in (1e21, 6 * 175e9 * 300e9): # 1e21: Chinchilla's test; GPT-3 by 6ND
n_kaplan = 1.3e9 * (c / PF_DAY / 2) ** 0.73 # C = 2 * Cmin at B_crit
n_chin = math.sqrt(c / 120) # D = 20N and C = 6ND
print(f"C = {c:.2e}: Kaplan N = {n_kaplan:.2e}, "
f"20 tokens/param N = {n_chin:.2e}")
Output:
C = 1.00e+21: Kaplan N = 4.68e+09, 20 tokens/param N = 2.89e+09
C = 3.15e+23: Kaplan N = 3.12e+11, 20 tokens/param N = 5.12e+10
The in the first line is exactly the Kaplan prediction quoted in the appendix of the Chinchilla paper, and the “20 tokens per parameter” rule gives 2.89 billion, close to Chinchilla’s own fitted 2.86 billion. The second line takes GPT-3 (175 billion parameters, 300 billion tokens) and estimates its training compute as FLOPs, or 3,646 PF-days. The Kaplan fit then gives about 310 billion parameters and the 20-tokens-per-parameter rule about 51 billion. The second line extrapolates the paper’s fit by more than three orders of magnitude (the paper’s compute curves stop at about 1 PF-day). It only shows how far the two exponents drift apart, and it is not a judgment on GPT-3.
The Chinchilla paper gives two reasons. Kaplan et al. used the same token count (the end of the cosine schedule, about 130 billion tokens) and the same learning-rate schedule for all models, which overestimates the loss of models trained on fewer tokens and so underestimates the benefit of small models on little data. And most of Kaplan’s experimental models were much smaller (many under 100 million parameters), while most of Chinchilla’s had more than 500 million, with the FLOPs-loss frontier showing slight curvature at larger scales.
Porian et al. (2024) went further with more than 900 training runs (Llama-style models on RefinedWeb, repeated on OpenWebText2). They traced the disagreement to three concrete factors and found that the learning-rate decay conjectured in the Chinchilla paper is not essential. The table is their Figure 1, where is the fitted exponent in and the last column is the optimal parameter count at Chinchilla’s compute budget of FLOPs:
| Setting | Optimal size | |
|---|---|---|
| (a) Reproduce Kaplan et al.’s setup | 0.835 | about 3T |
| (b) Count the FLOPs of the output layer (the decoding head) | 0.706 | about 787B |
| (c) On top of (b), make the warmup length in tokens comparable to the model size | 0.602 | about 292B |
| (d) On top of (c), use a cosine learning-rate decay matched to the token budget | 0.571 | about 183B |
| (e) On top of (c), set the learning rate, batch size and AdamW separately for each size, with a constant learning rate | 0.497 | about 77B |
The three factors are:
- Compute of the output layer. Kaplan et al.’s compute convention leaves out the output layer (perhaps because it shares weights with the embedding). Porian et al. show that the resulting underestimate of the per-token compute grows from roughly 10% for large models to roughly 90% for small ones.
- Warmup length. Kaplan et al.’s fixed 3,000 warmup steps (about 1.57 billion tokens) are too long for small models: their optimal token count is below or close to the warmup tokens, so they are “forced” to use more tokens than optimal. That inflates the optimal token count at small compute and with it the exponent.
- Retuning the optimizer with scale. The fixed batch size of tokens leaves small models only a few hundred steps. With the learning rate, batch size and set per size, the exponent returns to about 0.5, matching Chinchilla.
From (c) to (d) the exponent drops by only about 0.03, so learning-rate decay matters little; (e) uses no decay at all and still reaches 0.497, so a constant learning rate with per-size tuning is enough to reproduce Chinchilla’s allocation. These numbers come from Porian et al.’s own setup and are not a re-analysis of Kaplan’s original data. They show which factor moves the exponent by how much.
One more point is worth remembering. Both Chinchilla and Porian et al. observe that the curve of optimal loss against compute bends slightly, closer to a saturating power law than to Kaplan’s pure power law. Chinchilla’s parametric loss adds an irreducible-loss term that Kaplan’s form does not have.
Reading the numbers with care
- The constants have no fundamental meaning. , and depend on the tokenizer and the dataset, as the paper says itself. With another vocabulary the absolute loss values are not comparable.
- The paper has small internal inconsistencies. Section 1.2 gives PF-days while the fit label in Figure 13 reads . The theoretical 0.054 and 0.71 differ slightly from the measured 0.050 and 0.73. The data exponent is 0.26 in Equation 6.7 and when composed as . These come from fitting and rounding and do not change the conclusions, but when quoting, say which equation you used.
- The coverage is limited. The compute curve stops at about 1 PF-day, the largest model has 1.5 billion parameters and the largest dataset 23 billion tokens. For today’s models every use of the formulas is an extrapolation.
- One dataset and one architecture family. The results come from WebText2 and decoder-only Transformers. They say nothing about mixture-of-experts models, long context or more elaborate data mixtures.
- It studies pretraining loss. The paper does not evaluate downstream ability, and what a given drop in loss means for capabilities needs separate evidence.
What to take away
- The method matters more than the constants. Measure a smooth trend at small scale, then plan with the fitted formula. That is what the paper leaves behind, while the specific 0.73 has been corrected.
- Know your bottleneck. Parameters, data, compute, batch size and steps each follow a different law when they are the limiting factor. Work out which regime you are in before applying a formula.
- Conclusions depend on experimental details. Seemingly minor choices such as warmup length, batch size, learning rate and the compute convention can move the allocation exponent from 0.5 to 0.83. Check each of them when you design your own scaling-law experiments.
- Extrapolation needs a boundary. The authors themselves point out where the extrapolation contradicts itself. Using a fitted formula far outside the range of the experiments calls for a safety margin and continued checking.
Further reading
- Kaplan et al., Scaling Laws for Neural Language Models (2020): the source of every number here.
- Hoffmann et al., Training Compute-Optimal Large Language Models (2022, Chinchilla): refits the optimal allocation.
- Porian et al., Resolving Discrepancies in Compute-Optimal Scaling of Language Models (NeurIPS 2024): traces the disagreement between the two studies.
- McCandlish et al., An Empirical Model of Large-Batch Training (2018): the critical batch size.
- Wiki: Scaling Laws (Chinchilla’s formulas and an interactive calculator), The Compute and Memory Ledger of Training (where comes from), The LLM Training Pipeline.
FAQ
- What is the main finding of the Scaling Laws paper?
- Training Transformers with 768 to 1.5 billion non-embedding parameters on WebText2, the authors found that test loss falls as a power law in the parameter count N, the dataset size D and the optimally allocated compute C_min, with exponents of about 0.076, 0.095 and 0.050, and that for a fixed N the shape (depth, width) barely matters. At a fixed compute budget most of the extra compute should go into a bigger model (the optimal size grows roughly as compute to the power 0.73), while the data needs to grow only slowly (about the power 0.27).
- How much does the loss drop when the parameter count doubles?
- With the paper's fit L(N) ∝ N^-0.076, doubling the parameters multiplies the loss by 2^-0.076 ≈ 0.949, a drop of only about 5%, and a tenfold increase gives about 0.839. For data the exponent is 0.095, so doubling multiplies the loss by about 0.936. These are fits on WebText2 when no other factor is the bottleneck, and they should not be carried over to other data or architectures as they are.
- Why does the paper count only non-embedding parameters?
- Without the vocabulary and position embeddings, models of different depth fall on one trend line; with them the trend is scattered (Figure 6 of the paper). N is estimated as 12·n_layer·d_model². Porian et al. (2024) later pointed out that the same convention also left the output layer out of the paper's compute estimate, which matters most for small models and is one reason its conclusion differs from Chinchilla's.
- Why do Kaplan et al. and Chinchilla disagree?
- Their fitted exponents for the optimal model size are about 0.73 and 0.5. The Chinchilla paper blames in part the fixed token count and learning-rate schedule that Kaplan et al. used for all models. Porian et al. (2024) traced the gap to three factors in their replication: compute that leaves out the output layer, a fixed-length learning-rate warmup that is too long for small models, and optimizer hyperparameters that were not retuned with scale. With those fixed they match Chinchilla, and learning-rate decay turned out to matter little.
- What is the critical batch size?
- Up to the critical batch size, a larger batch costs almost no compute efficiency and cuts the number of steps proportionally; beyond it, returns diminish. The paper measures B_crit(L) ≈ 2×10⁸ / L^(1/0.21) tokens, which depends only on the loss reached and not on model size, and doubles for roughly every 13% drop in loss. Training at the critical batch size takes twice the minimum number of steps and twice the minimum number of samples.
- Can these power laws predict the loss of my own model directly?
- Not directly. The fitted constants depend on the tokenizer and the dataset, and the paper itself says they have no fundamental meaning. The experiments reach only about 1 PF-day of compute and 1.5 billion parameters, and they study pretraining loss, not downstream ability. In practice you refit the laws with small models on your own data and architecture, then extrapolate with a safety margin.