Scaling Laws & Compute-Optimal Training

The science of scaling: Kaplan scaling laws, Chinchilla optimal ratios, compute-performance prediction, over-training for inference efficiency, and planning large-scale training runs.

Advanced

Table of Contents

  1. Learning Objectives
  2. Notation
  3. Core Intuition
  4. Kaplan Scaling Laws (OpenAI)
  5. Chinchilla Optimal Training
  6. The Compute-Optimal Frontier
  7. Over-Training for Inference
  8. Predicting Performance
  9. Emergent Abilities & Phase Transitions
  10. Planning a Training Run
  11. Common Pitfalls
  12. Summary
  13. Exercises

Learning Objectives

  1. State the power-law scaling relationships for loss vs compute, data, and parameters.
  2. Derive Chinchilla-optimal allocation between model size and data.
  3. Explain why over-training (beyond Chinchilla) is optimal for inference-heavy deployment.
  4. Use scaling laws to predict performance of larger models.
  5. Plan a training run given a fixed compute budget.

Notation

  • NN — number of parameters
  • DD — number of training tokens
  • CC — total compute (FLOPs) ≈6ND\approx 6ND
  • LL — loss (cross-entropy)

Core Intuition

Language model performance follows surprisingly predictable power laws: double the compute → fixed reduction in loss. This means we can predict how a 100B model will perform by training 1B models. The key question: given a fixed compute budget, how should you split it between a larger model vs more data? Chinchilla showed the answer: scale both equally (N∝DN \propto D), contrary to the "make models as large as possible" approach.

Chinchilla Scaling Laws

Compute-optimal frontier (Pareto)Optimal allocation:Model: 2.3B paramsData: 7B tokensLoss: 1.288Compute: 10^21 FLOPs
Compute
21.0
Optimal pointSub-optimal
Explore: Chinchilla scaling laws show compute should be split ~equally between model size and training data. GPT-3 was undertrained; Chinchilla matched it with 4× less compute.

Kaplan Scaling Laws (OpenAI)

Kaplan et al. (2020): Loss follows power laws in NN, DD, and CC:

L(N)=(NcN)αN,αN≈0.076,(1)L(N) = \left(\frac{N_c}{N}\right)^{\alpha_N}, \quad \alpha_N \approx 0.076, \tag{1} L(D)=(DcD)αD,αD≈0.095,(2)L(D) = \left(\frac{D_c}{D}\right)^{\alpha_D}, \quad \alpha_D \approx 0.095, \tag{2} L(C)=(CcC)αC,αC≈0.050.(3)L(C) = \left(\frac{C_c}{C}\right)^{\alpha_C}, \quad \alpha_C \approx 0.050. \tag{3}

Key findings:

  • Performance improves smoothly with scale (no plateaus).
  • Parameters matter more than data (larger model with less data > smaller with more).
  • This led to training VERY large models on relatively little data (GPT-3: 175B params, 300B tokens).

Chinchilla Optimal Training

Hoffmann et al. (2022, DeepMind): Kaplan's conclusion was WRONG. Both parameters and data should scale equally:

Nopt∝C0.5,Dopt∝C0.5.(4)\boxed{N_{\text{opt}} \propto C^{0.5}, \quad D_{\text{opt}} \propto C^{0.5}.} \tag{4}

The Chinchilla rule: Optimal tokens ≈\approx 20x parameters.

Compute budgetOptimal NNOptimal DD
102110^{21} FLOPs400M8B tokens
102210^{22} FLOPs1.4B28B tokens
102310^{23} FLOPs4.7B94B tokens
102410^{24} FLOPs16B320B tokens
102510^{25} FLOPs52B1.04T tokens

Implication: GPT-3 (175B params, 300B tokens) was undertrained. The same compute could have been used for a 70B model trained on 1.4T tokens — achieving BETTER performance.


The Compute-Optimal Frontier

Parametric loss model:

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

where:

  • A/NαA/N^\alpha: reducible loss from limited model capacity.
  • B/DβB/D^\beta: reducible loss from limited data.
  • EE: irreducible loss (noise in data).

Optimal allocation (minimize LL given C=6NDC = 6ND):

∂L∂N∣C=const=0  ⟹  N∗∝Ca,D∗∝Cb,a+b=1.(6)\frac{\partial L}{\partial N}\bigg|_{C=\text{const}} = 0 \implies N^* \propto C^{a}, \quad D^* \propto C^{b}, \quad a + b = 1. \tag{6}

Chinchilla found a≈b≈0.5a \approx b \approx 0.5 (equal scaling).


Over-Training for Inference

Post-Chinchilla insight (LLaMA, 2023): Chinchilla minimizes loss for fixed TRAINING compute. But at deployment, inference cost scales with NN (not DD). A smaller model trained on MORE data has:

  • Same training compute.
  • Same or better loss.
  • MUCH cheaper inference.

LLaMA strategy: Train a 7B model on 1T tokens (143x Chinchilla ratio instead of 20x).

Over-training multiplier MM:

D=M×DChinchilla=M×20N.(7)D = M \times D_{\text{Chinchilla}} = M \times 20N. \tag{7}

For M=7M = 7 (LLaMA-7B at 1T tokens): Uses 7x more training compute than Chinchilla-optimal, but inference is 7x cheaper than the Chinchilla-optimal 50B model.

When to over-train: When inference cost dominates (serving millions of users) vs training cost (one-time).


Predicting Performance

Using scaling laws for planning:

  1. Train small models (100M-1B) at different scales.
  2. Fit power law: L=a⋅N−b+cL = a \cdot N^{-b} + c.
  3. Extrapolate to target scale.

Reliability: Predictions are accurate to within 5% for 10x extrapolation. Less reliable for 100x+ extrapolation (emergent abilities may not be captured).

Downstream task prediction: Harder. Some tasks show smooth scaling; others show sudden "emergence" at specific scales.


Emergent Abilities & Phase Transitions

Wei et al. (2022): Some capabilities appear suddenly at scale:

  • Chain-of-thought reasoning: emerges around 100B.
  • Multi-step arithmetic: emerges around 10B.
  • Code generation: emerges around 1B.

Debate: Are emergent abilities real (phase transitions) or artifacts of evaluation metrics (smooth underlying improvement, discontinuous metric)?

Schaeffer et al. (2023): Many "emergent" abilities disappear when using continuous metrics instead of threshold-based ones. The underlying capability scales smoothly; it just crosses evaluation thresholds at certain scales.


Planning a Training Run

Given budget CC (in FLOPs):

  1. Decide target: Chinchilla-optimal (minimize loss) vs over-trained (minimize inference cost).
  2. Compute NN and DD: N=C/(6D)N = C / (6D) given chosen DD.
  3. Estimate loss: L=A/Nα+B/Dβ+EL = A/N^\alpha + B/D^\beta + E from small-scale experiments.
  4. Validate: Train a 1/10 scale model first; verify scaling prediction.
  5. Budget hardware: Total GPU-hours = C/(GPU FLOPS×MFU)C / (\text{GPU FLOPS} \times \text{MFU}).

Example: Budget = 102410^{24} FLOPs. Chinchilla: 16B model, 320B tokens. Over-trained (M=4M=4): 7B model, 560B tokens. On 1024 H100s at 50% MFU: 1024/(1015×0.5×1024)≈2310^{24} / (10^{15} \times 0.5 \times 1024) \approx 23 days.


Common Pitfalls

Pitfall 1. Blindly following Chinchilla ratios without considering deployment. For a model serving millions of requests, the 7x inference cost savings from over-training easily pays for the extra training compute.

Pitfall 2. Extrapolating scaling laws beyond data quality limits. Scaling laws assume constant data quality. At 10T+ tokens, data quality degrades (more duplicates, noise) — actual performance falls below power-law prediction.

Pitfall 3. Ignoring the constant EE (irreducible loss). No amount of scaling reduces loss below EE (entropy of natural language). Estimated E≈1.7E \approx 1.7 nats for English text.


Summary

  • Power-law scaling: Loss decreases predictably with compute, parameters, and data.
  • Chinchilla rule: Optimal tokens ≈\approx 20x parameters for minimum training loss.
  • Over-training: Train smaller models longer for cheaper inference (LLaMA approach).
  • Prediction: Small-scale experiments reliably predict large-scale performance.
  • Emergence: Some capabilities appear at specific scales (debate on mechanism).
  • Scaling laws are the most important tool for planning billion-dollar training runs.

Exercises

Exercise 1. Given a budget of 102310^{23} FLOPs: compute the Chinchilla-optimal model size and training tokens.

Exercise 2. LLaMA-2 70B was trained on 2T tokens. Is this over-trained or under-trained by Chinchilla standards? By how much?

Exercise 3. Fit a power law L=a⋅N−b+cL = a \cdot N^{-b} + c to these data points: (100M, 3.5), (1B, 2.8), (10B, 2.3). Predict loss at 100B.

Exercise 4. Compare total cost (training + 1-year inference) for: (a) Chinchilla-optimal 50B model serving 1M requests/day, vs (b) over-trained 7B model at same quality.

Exercise 5. Design an experiment to test whether chain-of-thought reasoning is truly emergent (discontinuous) or appears emergent due to evaluation metrics.