Scaling Laws for Language Models

Volume III, Chapter 12 — Part I. Power-law scaling of loss with compute, parameters, and data: Chinchilla optimal allocation, Kaplan vs. Hoffmann laws, and theoretical implications for LLM training.

Intermediate

Table of Contents

  1. Learning Objectives
  2. Prerequisites
  3. Notation
  4. Core Intuition
  5. Empirical Scaling Laws
  6. Loss as a Function of Compute
  7. Loss as a Function of Model Size and Data
  8. The Chinchilla Optimal Allocation
  9. Kaplan vs. Chinchilla Recommendations
  10. Breaking Scaling Laws
  11. Worked Examples
  12. Connection to the Broader Curriculum
  13. Common Pitfalls and Misconceptions
  14. Research Perspective
  15. Summary of Takeaways
  16. Exercises

Learning Objectives

After reading this chapter, you should be able to:

  1. State the power-law form of scaling: L(N)NαNL(N) \propto N^{-\alpha_N}, L(D)DαDL(D) \propto D^{-\alpha_D}.
  2. Define training compute C6NDC \approx 6ND FLOPs and the compute-optimal frontier.
  3. Derive Chinchilla's optimal allocation: train smaller models on more tokens.
  4. Contrast Kaplan et al. (2020) vs. Hoffmann et al. (2022) recommendations.
  5. Explain implications for Tokenization and pretraining budget.

Prerequisites


Notation

  • NN — Number of model parameters
  • DD — Training tokens (dataset size)
  • CC — Compute budget (FLOPs)
  • LL — Cross-entropy loss (nats per token)
  • α,β,γ\alpha, \beta, \gamma — Empirical scaling exponents

Core Intuition

LLM performance improves predictably with scale — not linearly, but via power laws. Doubling compute yields predictable (diminishing) loss reduction. Scaling laws quantify these relationships, enabling budget allocation: given a compute budget, how large should the model be and how many tokens should it see?

The Chinchilla result (Hoffmann et al., 2022) overturned prior wisdom: for compute-optimal training, model size and data should scale equally — most models were undertrained.

Series context. Volume III, Chapter 12 (Pretraining).

Neural Scaling Laws

log Compute (FLOPs)log Loss
log C
21.00
ParamsData
Explore: Loss scales as a power law L ∝ C^(-α) with compute. Chinchilla found optimal allocation: scale params and data equally (~20 tokens/param).

Empirical Scaling Laws

Definition 1 (Cross-Entropy Loss). Pretraining minimizes:

L=1Ntokensilogpθ(xix<i).(1)L = -\frac{1}{N_{\text{tokens}}}\sum_i \log p_\theta(x_i \mid x_{<i}). \tag{1}

Definition 2 (Power Law). Empirically, loss scales as:

L(x)=Axα+L,(2)L(x) = A x^{-\alpha} + L_\infty, \tag{2}

where x{N,D,C}x \in \{N, D, C\} (parameters, data tokens, compute), α>0\alpha > 0, LL_\infty is irreducible loss.


Loss as a Function of Compute

Definition 3 (Training Compute). Approximate FLOPs:

C6ND,(3)C \approx 6 N D, \tag{3}

where NN = non-embedding parameters, DD = training tokens. Factor 6 accounts for forward + backward pass.

Theorem 1 (Kaplan et al., 2020). For optimal allocation at fixed CC:

L(C)CαC,αC0.05.(4)L(C) \propto C^{-\alpha_C}, \quad \alpha_C \approx 0.05. \tag{4}

Smooth log-linear improvement over orders of magnitude in compute.


Loss as a Function of Model Size and Data

Separate scaling:

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

with αN0.076\alpha_N \approx 0.076, αD0.095\alpha_D \approx 0.095 (Chinchilla estimates).

Combined (Hoffmann et al.):

L(N,D)=E+ANαN+BDαD,(6)L(N, D) = E + \frac{A}{N^{\alpha_N}} + \frac{B}{D^{\alpha_D}}, \tag{6}

where EE is irreducible entropy of natural language.


The Chinchilla Optimal Allocation

Problem. Minimize L(N,D)L(N, D) subject to C=kNDC = kND (fixed compute).

Theorem 2 (Chinchilla Optimality). At compute-optimal training:

NoptCa,DoptCb,ab0.5.(7)N_{\text{opt}} \propto C^{a}, \quad D_{\text{opt}} \propto C^{b}, \quad a \approx b \approx 0.5. \tag{7}

Corollary 1. Parameters and tokens should scale equally with compute: Dopt20NoptD_{\text{opt}} \approx 20 N_{\text{opt}} (rough rule of thumb).

Proof sketch. Lagrange optimization on (6) with constraint ND=C/kND = C/k. Equal scaling exponents when both terms contribute equally at optimum. \blacksquare


Kaplan vs. Chinchilla Recommendations

  • Kaplan et al. — Scale NN faster than DD — Larger models, less data
  • Chinchilla — Scale NN and DD equally — Smaller models, ~4× more data

Example. GPT-3 (175B params, 300B tokens) was undertrained by Chinchilla standards. Optimal: ~70B params on ~1.4T tokens for same compute.


Breaking Scaling Laws

Proposition 1 (Limits). Scaling laws are empirical — may break due to:

  • Data exhaustion (finite high-quality text)
  • Architecture bottlenecks
  • Inference cost constraints
  • Diminishing returns on downstream tasks vs. pretraining loss

Emergent abilities (Wei et al.) may appear at scale — not captured by smooth loss curves alone.


Worked Examples

Example 1: Compute Budget

C=1024C = 10^{24} FLOPs. Chinchilla: Nopt1011N_{\text{opt}} \approx 10^{11}, Dopt2×1012D_{\text{opt}} \approx 2 \times 10^{12} tokens.

Example 2: Power Law

If L(N)=1000N0.076L(N) = 1000 \cdot N^{-0.076}, doubling NN reduces loss by factor 20.0761.0552^{0.076} \approx 1.055 (5.5%).


Connection to the Broader Curriculum


Common Pitfalls and Misconceptions

Pitfall 1: Confusing pretraining loss with downstream task performance.

Pitfall 2: Using Kaplan scaling in post-Chinchilla era.

Pitfall 3: Ignoring inference cost when scaling NN.

Pitfall 4: C=6NDC = 6ND is approximate (depends on architecture).


Research Perspective

Kaplan et al. (2020). Chinchilla (Hoffmann et al., 2022). Llama 2/3 follow Chinchilla-optimal ratios. Open questions: data quality scaling, mixture-of-experts compute accounting.


Summary of Takeaways

  • ComputeLCαCL \propto C^{-\alpha_C}
  • ParametersLNαNL \propto N^{-\alpha_N}
  • DataLDαDL \propto D^{-\alpha_D}
  • ChinchillaNopt,DoptC0.5N_{\text{opt}}, D_{\text{opt}} \propto C^{0.5}

Next: DPO


Exercises

Exercise 1. Fit power law to given (N,L)(N, L) data points in log-log space.

Exercise 2. Derive Chinchilla optimum from (6) with Lagrange multipliers.

Exercise 3. For C=1023C = 10^{23}, estimate Nopt,DoptN_{\text{opt}}, D_{\text{opt}}.

Exercise 4. Compare GPT-3 training to Chinchilla recommendation.

Exercise 5. Why is αD>αN\alpha_D > \alpha_N significant?

Exercise 6. Relate scaling laws to Bias–Variance.

Exercise 7. MoE: how does effective NN differ from total parameters?

Exercise 8. When do scaling laws predict diminishing returns?