Phase 7 · Transformers/
Lesson 7.9advanced2 h 30 min⚡ live demo

Scaling laws and compute-optimal training

Power laws, FLOPs ≈ 6ND, Chinchilla's 20 tokens per parameter, and over-training

Scaling laws turned model building from craft into planning: given a compute budget you can predict the loss, choose the model size and the number of training tokens, and estimate the GPU bill before launching a run. They explain why GPT-3 was built, why Chinchilla showed it was mis-sized, why Llama 3 8B saw 15 trillion tokens, and why the field pivoted toward post-training and test-time compute (8.6 Reasoning models and test-time compute). The 6ND rule here also underlies every cost estimate in 7.10 Efficient inference: KV cache, GQA, FlashAttention, speculative decoding, quantization and 4.12 Compute, hardware and scale basics.

You'll be able to

  • State the Kaplan power laws and what they imply about sample efficiency and extrapolation
  • Derive the FLOPs ≈ 6ND rule and estimate GPU-days for a training run
  • Reproduce the Chinchilla result D ≈ 20N from the fitted loss function and apply it to a budget
  • Explain inference-aware over-training, data constraints and the emergence debate

Key ideas

  1. Loss follows power laws in parameters, data and compute over many orders of magnitude; architecture details matter far less than scale.
  2. Training compute ≈ 6ND FLOPs: 2N for the forward pass and 4N for the backward pass per token.
  3. Chinchilla's fitted law L = E + A/N^α + B/D^β gives compute-optimal D ≈ 20N: grow parameters and tokens together.
Show 4 more key ideas
  1. Gopher (280B, 300B tokens) was under-trained; Chinchilla (70B, 1.4T tokens) beat it at the same compute.
  2. Inference cost scales with N, so heavily used models are over-trained far past Chinchilla (Llama 3 8B: ≈1,900 tokens per parameter).
  3. High-quality data is the binding constraint; ~4 epochs of repetition is nearly free, beyond that returns fall.
  4. Apparent emergence is partly a metric artifact; smooth metrics improve predictably, but discrete thresholds still matter in practice.

Suggested path through this lesson