AnyLearn
All lessons
AIintermediate

LLM Scaling Laws: From Kaplan to Chinchilla and Beyond

How two landmark papers — Kaplan et al. 2020 and DeepMind's Chinchilla 2022 — rewrote our understanding of compute-optimal training, why the industry now deliberately overtrains models, and how inference costs flip the math entirely.

Not signed in — your progress and quiz score won't be saved.
Lesson progress1 / 12

Why Scaling Laws Matter

Before 2020, scaling up language models felt more like alchemy than engineering. You trained bigger models and hoped for the best. Kaplan et al.'s 2020 paper from OpenAI changed that by showing that loss follows power laws with respect to three quantities: model parameters NN, dataset tokens DD, and compute budget CC.

This turned model development into something approximating a science. If you know your compute budget, the laws tell you roughly where to spend it — how large a model to train and on how many tokens. The 2022 Chinchilla paper from DeepMind then showed OpenAI had the ratio badly wrong, triggering a rethink across the entire field.

Understanding both papers is now essential context for anyone making decisions about training or deploying large models.

Full lesson text

All 12 steps on one page — for reading, reference, and search.

Show

1. Why Scaling Laws Matter

Before 2020, scaling up language models felt more like alchemy than engineering. You trained bigger models and hoped for the best. Kaplan et al.'s 2020 paper from OpenAI changed that by showing that loss follows power laws with respect to three quantities: model parameters NN, dataset tokens DD, and compute budget CC.

This turned model development into something approximating a science. If you know your compute budget, the laws tell you roughly where to spend it — how large a model to train and on how many tokens. The 2022 Chinchilla paper from DeepMind then showed OpenAI had the ratio badly wrong, triggering a rethink across the entire field.

Understanding both papers is now essential context for anyone making decisions about training or deploying large models.

2. The Kaplan et al. Power Laws

The core finding of Kaplan et al. ("Scaling Laws for Neural Language Models", OpenAI, 2020) is that test loss LL scales as a power law in each variable when the others are held fixed:

L(N)(NcN)αN,L(D)(DcD)αDL(N) \approx \left(\frac{N_c}{N}\right)^{\alpha_N}, \quad L(D) \approx \left(\frac{D_c}{D}\right)^{\alpha_D}

where αN0.076\alpha_N \approx 0.076 and αD0.095\alpha_D \approx 0.095 are empirical exponents, and NcN_c, DcD_c are fitted constants. The exponents are small — doubling NN cuts loss by only ~5% — but they are remarkably stable across six orders of magnitude of scale.

The compute-loss relationship combines both: L(C)C0.050L(C) \propto C^{-0.050}. The key policy implication Kaplan drew was that for a fixed compute budget, you should favor larger models trained on fewer tokens — a conclusion Chinchilla would directly contradict.

3. Kaplan vs. Chinchilla: The Allocation Shift

flowchart TD
  A["Fixed Compute Budget C"] --> B["Kaplan 2020 Recommendation"]
  A --> C["Chinchilla 2022 Recommendation"]
  B --> D["Large N, Small D\n(GPT-3: 175B params, 300B tokens)"]
  C --> E["Balanced N and D\n(Chinchilla: 70B params, 1.4T tokens)"]
  D --> F["Result: Undertrained large model"]
  E --> G["Result: Lower loss, same compute"]

4. Chinchilla: Rebalancing Parameters and Tokens

Hoffmann et al. ("Training Compute-Optimal Large Language Models", DeepMind, 2022) ran a much broader sweep of model sizes and data quantities under matched compute budgets and found that Kaplan's advice was off. Their main result: for compute-optimal training, you should scale NN and DD equally.

The rule of thumb that emerged: roughly 20 tokens of training data per parameter. Concretely, a 70B-parameter model should train on ~1.4T tokens — the configuration they named Chinchilla. At the same compute budget as Gopher (280B parameters, 300B tokens), Chinchilla beat it decisively on nearly every benchmark.

Heads up: the "20 tokens per parameter" figure is a useful heuristic, not a law. The exact optimal ratio shifts with the exponents, which themselves depend on architecture and data quality.

The implication was brutal for the industry: GPT-3 (175B params, 300B tokens) was substantially undertrained.

5. The Math Behind Chinchilla Optimality

Hoffmann et al. modeled loss as a function of both NN and DD simultaneously:

L(N,D)=E+ANα+BDβL(N, D) = E + \frac{A}{N^{\alpha}} + \frac{B}{D^{\beta}}

where EE is irreducible loss (entropy of natural language), and AA, BB, α0.34\alpha \approx 0.34, β0.28\beta \approx 0.28 are fitted constants. Compute is constrained by C6NDC \approx 6ND (six FLOPs per token per parameter for a transformer forward + backward pass).

Minimizing LL subject to C=6NDC = 6ND gives the optimality condition:

NoptC0.5,DoptC0.5N_{\text{opt}} \propto C^{0.5}, \quad D_{\text{opt}} \propto C^{0.5}

Both scale with C0.5C^{0.5}, hence equal scaling. Kaplan's exponents yielded NoptC0.73N_{\text{opt}} \propto C^{0.73}, which over-weighted parameters. The discrepancy likely came from Kaplan holding learning rate schedules fixed — which artifically made more tokens look less useful.

6. Why the Industry Now Overtrains Deliberately

If Chinchilla defines the compute-optimal point, why do labs train Llama 3.1 8B on 15T tokens — more than 500 tokens per parameter? Because compute-optimal for training loss is not the same as optimal for deployment.

The key insight: inference is not free. Once a model is deployed, it serves billions of requests. A smaller, longer-trained model has lower loss than a larger undertrained model at the same inference compute cost. Users pay per token at inference time, not per FLOP during training.

So the real objective function is:

minimize L subject to fixed inference FLOP budget per query\text{minimize } L \text{ subject to fixed inference FLOP budget per query}

not "fixed training FLOP budget". This flips the recommendation: overtrain a small model so it gets smarter per inference dollar. Llama models, Mistral, Phi — nearly every publicly-released model since 2023 is heavily overtrained relative to Chinchilla.

7. Inference-Time Compute: A New Dimension

The train-longer trend has a parallel on the inference side: spending more compute at inference time rather than baking everything into weights. Techniques include:

  • Chain-of-thought prompting — forces the model to produce intermediate reasoning tokens before answering
  • Best-of-N sampling — generate NN completions, score with a reward model, return the best
  • Tree search / MCTS — explore a tree of partial completions guided by a value function (used in AlphaCode 2)
  • Speculative decoding — use a small draft model to propose tokens, verified in parallel by the large model

OpenAI's o1 and o3 models made inference-time scaling the headline story of 2024. The scaling law for inference compute is empirically log-linear in many reasoning benchmarks — you can keep spending and keep improving, up to a point.

Heads up: inference-time compute doesn't replace training compute. It leverages a well-trained model's latent knowledge; an undertrained model wastes the extra thinking budget.

8. Three Regimes of Compute Allocation

flowchart LR
  A["Total Budget"] --> B["Training Compute"]
  A --> C["Inference Compute"]
  B --> D["Parameter count N"]
  B --> E["Training tokens D"]
  C --> F["Chain-of-thought tokens"]
  C --> G["Best-of-N sampling"]
  C --> H["Tree search"]
  D -- "Chinchilla: scale equally" --> E
  E -- "Post-Chinchilla: overtrain" --> E

9. Empirical Limits and Caveats

Scaling laws are empirical fits — they extrapolate but can break. Several known limitations:

Data quality dominates at high D. Once you've swept the internet, more tokens means lower-quality text. The effective exponent β\beta degrades, so real curves bend away from the power law. Llama 3's 15T token dataset involved aggressive deduplication and quality filtering specifically to stay on the curve.

Architecture matters. The constants AA, BB, α\alpha, β\beta are not universal. Mixture-of-Experts models have different scaling behavior because their effective parameter count differs from their active parameter count. Chinchilla's numbers were fit on dense transformers.

Emergent abilities don't follow smooth curves. Some capabilities (multi-step arithmetic, chain-of-thought reasoning) appear abruptly at certain scales rather than improving smoothly. Whether this is real emergence or a measurement artifact is still debated (Schaeffer et al., 2023 argue it's the latter).

The irreducible loss floor EE is non-trivial. Natural language has genuine entropy; no model can get loss below it.

10. Reading Scaling Laws in Practice

You don't need to refit the curves yourself — but you do need to read them critically. Here's a minimal Python sketch for estimating compute-optimal NN given a FLOP budget CC:

import numpy as np

# Chinchilla-fitted constants (Hoffmann et al. Table A3, IsoFLOP approach)
A, B = 406.4, 410.7
alpha, beta = 0.34, 0.28

def chinchilla_optimal(C_flops: float) -> tuple[float, float]:
    """Return (N_opt, D_opt) for a compute budget in FLOPs."""
    # From the closed-form solution of the constrained minimization
    N_opt = (A * alpha / (B * beta)) ** (1 / (alpha + beta)) * (C_flops / 6) ** (beta / (alpha + beta))
    D_opt = C_flops / (6 * N_opt)
    return N_opt, D_opt

C = 6e23  # ~GPT-3 compute
N, D = chinchilla_optimal(C)
print(f"Optimal params: {N/1e9:.1f}B, optimal tokens: {D/1e9:.0f}B")
# Optimal params: 67.5B, optimal tokens: 1490B

GPT-3's actual config was 175B params / 300B tokens — wildly off the Chinchilla optimum for that budget.

11. The Modern "Train Longer" Playbook

What does overtraining look like in practice? Compare these public models at roughly similar inference cost (7–8B active parameters):

ModelParamsTraining tokensTokens/param
GPT-3 (for ref, 175B)175B300B1.7x
Chinchilla optimal (70B)70B1.4T20x
Llama 2 7B7B2T286x
Llama 3.1 8B8B15T1,875x
Phi-3 Mini 3.8B3.8B3.3T868x

The trend is unmistakable. Phi-3 Mini is the extreme case — Microsoft trained a tiny model on heavily curated "textbook quality" data, targeting users who need to run models on-device where inference cost is the binding constraint.

The lesson: Chinchilla optimality is a training-time concept. Real deployment decisions require you to plug in your actual inference-to-training cost ratio and solve accordingly.

12. What Comes After Scaling Laws

Scaling laws describe loss on next-token prediction. Downstream task performance is messier — sometimes a 2x compute increase yields near-zero benchmark improvement, then another 2x causes a jump. Several open questions shape active research:

Data scaling walls. High-quality internet text may be genuinely finite. Synthetic data (generated by stronger models) is now a primary lever; its scaling behavior is still being characterized.

Multimodal scaling. Do the same power laws hold when you add image, audio, or code tokens? Early evidence (Flamingo, GPT-4V, Gemini) suggests yes, with separate constants per modality.

Scaling inference, not training. The o-series models suggest that for reasoning tasks, inference compute may be more elastic than training compute — you can keep improving by thinking longer, even with a frozen model.

Post-training amplification. RLHF and DPO can extract substantially more capability from a given pretrained checkpoint. Whether this shifts the optimal pretraining point is an open empirical question.

The meta-lesson: treat scaling laws as a compass, not a map.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. According to Kaplan et al. (2020), when holding compute budget fixed, which resource should you prioritize?
    • More training tokens over larger model size
    • Larger model size over more training tokens
    • Equal split between parameters and tokens
    • Increasing batch size above all else
  2. What is the Chinchilla compute-optimal rule of thumb for data relative to parameters?
    • 1 token per parameter
    • 5 tokens per parameter
    • 20 tokens per parameter
    • 100 tokens per parameter
  3. Why do modern models like Llama 3.1 8B train on far more tokens than Chinchilla optimality suggests?
    • Chinchilla's math has been proven incorrect
    • Inference cost per query favors smaller, longer-trained models over large undertrained ones
    • Larger datasets always reduce overfitting regardless of model size
    • Regulatory requirements mandate minimum dataset sizes
  4. In the Chinchilla loss formula $L(N,D) = E + A/N^\alpha + B/D^\beta$, what does $E$ represent?
    • The optimizer's learning rate decay factor
    • The irreducible entropy of natural language
    • The embedding dimension of the model
    • The evaluation loss on a held-out test set
  5. Which finding did Schaeffer et al. (2023) challenge regarding LLM scaling?
    • The power-law relationship between compute and loss
    • That emergent abilities appear abruptly rather than smoothly with scale
    • The Chinchilla 20-tokens-per-parameter ratio
    • That inference-time compute improves reasoning

Related lessons

AI
advanced

Loop engineering: verification, orchestration, and anti-patterns

Make loops trustworthy. Adversarial verification panels, sub-agent orchestration, loop-until-dry for unbounded discovery, loop-until-budget for paid depth, multi-modal sweeps with diverse prompts, eval-driven cap selection, and the five anti-patterns — silent caps, infinite plans, drift, premature termination, thrashing — that ship to prod more than they should.

9 steps·~14 min
AI
intermediate

Loop engineering in production: state, errors, and budgets

Once an agent loop runs past a few iterations the failure surface shifts: state bloats, tool calls fail in three distinct ways, retries multiply if you stack them wrong, and unbounded budgets rack up four-figure bills overnight. The state, errors, and budgets you need to make the loop survive contact with reality.

8 steps·~12 min
AI
beginner

Loop engineering basics: the agent control loop

How LLM agents actually run: the iterative prompt-action-observation loop, the ReAct shape, the smallest tool-calling loop in twelve lines, why you always stack three termination layers, what the model sees on iteration N, and when a single prompt is the better answer.

8 steps·~12 min
AI
intermediate

LLM Observability with OpenTelemetry: GenAI Semantic Conventions

Master the OTel GenAI semantic conventions — gen_ai.* attributes, span structure for prompts/completions/tools, sampling strategies, and cost attribution — and understand why standardizing across LangSmith, Phoenix, Datadog, and Grafana matters for production AI systems.

13 steps·~20 min·audio