What are scaling laws in machine learning?
Scaling laws are empirical formulas that predict a model's loss from its size, its training data and the compute spent on it. For language models the loss falls as a power law in each of these, so a plot on log-log axes is close to a straight line across many orders of magnitude. A law fitted on small, cheap runs can then forecast the loss of a run 1,000 times larger.
Labs use scaling laws to plan training runs before spending the compute. They decide how many parameters a model should have for a given GPU budget, how many tokens to collect, and whether a new architecture or data mix is worth scaling up. The 2022 Chinchilla paper used them to show that most large models of the time were too big for their data, which changed how open models such as Llama were trained.
Key ideas
- Language-model loss falls as a power law in parameters, data and compute, which appears as a straight line on log-log axes.
- Training a dense transformer costs about 6 FLOPs per parameter per token, so C ≈ 6ND.
- The Chinchilla fit splits loss into an irreducible part, a term for model size and a term for data.
- For a fixed compute budget, the best model grows roughly as the square root of compute, near 20 tokens per parameter.
- Models meant for heavy serving are trained far past that point, because a smaller model is cheaper on every generated token.
- Scaling laws predict loss, not specific abilities, and they assume fresh data of a fixed quality.
Common questions
How are scaling laws used to plan a training run?
A team trains a series of small models with the same recipe, fits a power law to their final losses, and extrapolates to the planned budget. The GPT-4 technical report describes predicting the final loss from models trained with 1,000 to 10,000 times less compute. The same fits help choose model size, token count and learning rate before the expensive run starts.
What is irreducible loss?
It is the part of the loss that no model size or amount of data removes, the E term in the Chinchilla formula. It reflects the randomness of text itself: many next tokens are not predictable from the context. Its value depends on the dataset and tokenizer, so an E of 1.69 nats per token applies only to the data it was fitted on.
Do scaling laws apply outside language models?
Yes. Similar power laws have been measured for image, video, speech and multimodal models, and for reinforcement learning. The exponents and constants differ by domain and architecture, so a law has to be refitted for each setting rather than copied from a language model.
Do scaling laws cover inference compute?
The classic laws cover training compute only. Newer work studies two other trade-offs: training smaller models longer to save inference cost, and spending more compute at answer time, through longer reasoning or many sampled answers, to raise accuracy on a fixed model. Both follow their own empirical curves.
Related explainers
- Learning Curves — Diagnosing underfitting and overfitting from training size
- Language Modeling — Predict the next token — the objective that powers GPT, BERT, and modern NLP
- Mixture of Experts — Routing each token to a few experts in a much larger model
- Quantization — Shrinking model weights to 8 and 4 bits
- KV Cache — Why LLM generation caches keys and values, and what it costs
- Sampling: Temperature, Top-k & Top-p — How a language model picks its next token
- Distributed Training — Splitting training across many GPUs
References
- Kaplan et al. (2020), "Scaling Laws for Neural Language Models"
- Hoffmann et al. (2022), "Training Compute-Optimal Large Language Models"
- Besiroglu et al. (2024), "Chinchilla Scaling: A replication attempt"
- Muennighoff et al. (2023), "Scaling Data-Constrained Language Models"
- Schaeffer et al. (2023), "Are Emergent Abilities of Large Language Models a Mirage?"
Last updated