LLM Scaling Laws: Kaplan, Chinchilla Compute-Optimal & Over-Training
How smooth power-law scaling laws predict LLM loss before spending $10M+ on GPUs, why Chinchilla's 20-tokens-per-parameter rule overturned GPT-3, and why LLaMA 3 deliberately 'over-trains' for 2,000 tokens/parameter!
LLM Scaling Laws (Kaplan & Chinchilla) mathematically relate pretraining loss to model parameters N, training tokens D, and compute FLOPs C ≈ 6ND.
Before spending millions on a GPU cluster, scaling laws tell you the optimal balance between model size and dataset size—and why smaller over-trained models (like Llama-3 8B) win at inference.
No AI lab spends $50M training a frontier LLM blind — Scaling Laws let you run small 100M–1B pilot experiments and predict the exact validation loss of a 70B+ model before launching the cluster!
Memorizing C ≈ 6 · N · D and GPU MFU (Model FLOPs Utilization, ~35%–50%) lets you estimate training cost, cluster size, and wall-clock days on the back of an envelope.
Understanding inference-optimal over-training explains why LLaMA 3 8B (trained on 15 Trillion tokens — 94× past Chinchilla!) crushes older 70B models while costing 8× less to serve!
Classic AI strategy & research interview question: 'Why did Chinchilla say an 8B model should only train on 160B tokens, yet Meta trained LLaMA 3 8B on 15 TRILLION tokens?'
Approximately how many floating-point operations (FLOPs) does it take to pre-train a dense Transformer with N parameters on D tokens?
- Compute pre-training FLOPs from model size N and training tokens D using the canonical rule C ≈ 6 · N · D
- Contrast Kaplan et al. (2020) parameter-heavy scaling with DeepMind's Chinchilla (2022) compute-optimal 20:1 tokens-per-parameter rule
- Interpret the Chinchilla parametric loss equation L(N, D) = E + A/N^α + B/D^β and the irreducible entropy floor E
- Explain why modern inference-heavy models (LLaMA 3 8B on 15T tokens!) deliberately over-train far past Chinchilla-optimal
Think of training an LLM like studying for an exam with a fixed budget of 100 hours (Compute ). You can either build a giant brain () that only skims 10% of the textbook () — that was GPT-3 (under-trained!) — OR you can pick the exact balance where brain size and pages read scale equally (, Chinchilla-optimal!). Better yet: if millions of users will query your brain every day afterward, it pays to train a smaller, faster brain on 100× more books (Inference-Optimal Over-Training, like LLaMA 3)!
1. The 6·N·D Compute Budget & Power-Law Loss
On a log-log plot, LLM cross-entropy loss falls along a remarkably straight line across 7+ orders of magnitude of compute — until it approaches the irreducible entropy floor of natural language.
The Parametric Scaling Law
with empirical Chinchilla exponents , and irreducible entropy nats (natural language always has genuine unpredictability!).
- Core Consequence: If you increase while leaving small, the term stalls your loss; if you increase while leaving tiny, the term stalls your loss. Both must grow together!
C ≈ 6·N·D and L(N, D) = E + A/N^α + B/D^β
1 multiply + 1 add = 2 FLOPs per parameter per token.
2. Kaplan (2020) vs. Chinchilla (2022) IsoFLOP Frontier
Use the Chinchilla Compute Calculator mini-lab below to see how shifting a fixed FLOP budget from an under-trained 280B model to a 70B Chinchilla-optimal model slashes loss for FREE!
Why Chinchilla Overturned GPT-3 & Gopher
- Kaplan et al. (OpenAI, 2020) held learning-rate schedules fixed and concluded should grow much faster than (). This led to massive, under-trained models like GPT-3 (175B on 300B tokens — 1.7 tok/param) and Gopher (280B on 300B tokens).
- Chinchilla (DeepMind, 2022) properly tuned the cosine learning-rate decay to each token horizon and proved and should scale equally () at ~20 tokens per parameter:
- Chinchilla 70B trained on 1.4T tokens used the exact same training compute as 280B Gopher, yet crushed it on every benchmark AND was 4× cheaper to serve!
Chinchilla 6ND Compute & Over-Training Calculator
3. Inference-Optimal Over-Training & Test-Time Compute Scaling
Chinchilla optimizes training cost only — assuming you throw the model away after training! In the real world, a popular model serves trillions of inference tokens.
Why Modern LLMs Deliberately Over-Train (LLaMA 3, Gemma 2, Qwen)
If your 8B model will be downloaded millions of times or serve billions of API calls, inference cost dwarfs training cost.
- LLaMA 3 8B was trained on 15 Trillion tokens (~1,875 tokens/parameter — nearly 100× past Chinchilla-optimal!), and its loss was still steadily improving at 15T tokens!
- The New Frontier — Test-Time Compute Scaling (o1 / R1 / Thinking Models): As high-quality pre-training internet text runs scarce (the "Data Wall"), frontier labs added a 3rd scaling axis: spending extra compute at inference time via Reinforcement Learning & Chain-of-Thought verification (covered in Module 5.5!).
Worked Example: Checking Chinchilla Ratio & Training FLOPs
Compare GPT-3 (175B, 300B tokens), Chinchilla (70B, 1.4T tokens), and LLaMA 3 8B (8B, 15T tokens).
Ratio tok/param (heavily under-trained). Compute FLOPs.
Why did Meta train LLaMA 3 8B on 15 Trillion tokens (~1,875 tokens/param) instead of stopping at the Chinchilla-optimal 160B tokens?
You have a fixed training compute budget of FLOPs. Using Chinchilla's and , what are the compute-optimal model size and token count ?
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
Not at all! 20 tokens/param is only the minimum training compute point for a given loss. Keeping fixed and continuing to train to 200 or 2,000 tokens/param continues to smoothly reduce loss — it just takes more training FLOPs per unit of loss drop.
Chinchilla Compute-Optimal Scaling Frontier Studio
Slide your training compute budget from 10²¹ to 10²⁵ FLOPs to compute the exact Chinchilla-optimal Model Size N and Dataset Size D.
Pre-Training Pilot Extrapolation
Labs train 5–10 small models (100M–3B) across IsoFLOP curves to verify architecture tweaks (e.g., GQA, MLA, Muon optimizer) before committing to a $10M+ frontier run.
Small Language Models (SLMs) for Edge & Low-Latency APIs
Gemma 2 2B/9B, Phi-4, and LLaMA 3 8B leverage heavy over-training + synthetic data + distillation to run locally on laptops and phones.
# Chinchilla Compute-Optimal Scaling Calculator: C ≈ 6 * N * D, optimal D ≈ 20 * N
def chinchilla_plan(flops_budget: float) -> dict:
# Solve 6 * N * (20 * N) = C => N = sqrt(C / 120)
n_params = (flops_budget / 120.0) ** 0.5
d_tokens = 20.0 * n_params
return {
"compute_flops": flops_budget,
"optimal_params_B": round(n_params / 1e9, 2),
"optimal_tokens_B": round(d_tokens / 1e9, 1),
}
for label, C in [("7B-class budget", 6e21), ("70B-class budget", 5.8e23)]:
print(label, "->", chinchilla_plan(C))
C ≈ 6·N·D (or forgetting to multiply by MFU when converting FLOPs to GPU-hours).2·N·D forward + 4·N·D backward = 6·N·D, and real clusters achieve ~35%–50% MFU (Model FLOPs Utilization), never 100% peak spec!