Scaling laws
9 min read
Loss follows a smooth curve
In 2020, Kaplan and others at OpenAI trained many models of different sizes and measured their loss. The loss fell along a smooth curve as the models grew, as they read more text and as they used more computing power. The curve held over a range of more than a million times in model size. This pattern is called a power law, and the rules that describe it are Scaling lawsMeasured rules that predict how a model's loss falls as you add parameters, training tokens and compute. They are used to plan how big a model should be for a given budget..
The practical value is planning. A team can train several small models cheaply, fit the curve and predict the loss of a large model before spending months of computing on it.
The cost of training
A common estimate puts the computing work of training at about 6 operations for each parameter for each training token. With N parameters and D training tokens, the total is 6 × N × D.
models = {
"GPT-3": (175e9, 300e9),
"Gopher": (280e9, 300e9),
"Chinchilla": (70e9, 1.4e12),
"Llama 3 8B": (8e9, 15e12),
}
for name, (params, tokens) in models.items():
flops = 6 * params * tokens
print(f"{name:11} {flops:.1e} operations, {tokens / params:,.1f} tokens per parameter")It prints:
GPT-3 3.2e+23 operations, 1.7 tokens per parameter
Gopher 5.0e+23 operations, 1.1 tokens per parameter
Chinchilla 5.9e+23 operations, 20.0 tokens per parameter
Llama 3 8B 7.2e+23 operations, 1,875.0 tokens per parameterThe number 3.2e+23 means 3.2 followed by 23 more digits. These are estimates from public parameter and token counts, not measured totals.
Chinchilla: read more, grow less
Early large models grew in size much faster than in training text. In 2022, Hoffmann and others at DeepMind tested that choice. They found that, for a fixed computing budget, parameters and training tokens should grow at about the same rate. Their rule of thumb is about 20 training tokens for each parameter.
They tested the rule with a model named Chinchilla. It had 70 billion parameters, a quarter of the size of DeepMind's earlier Gopher model, and it read 1.4 trillion tokens instead of 300 billion. The two models used a similar computing budget. Chinchilla scored higher than Gopher on most of the tasks they tested.
| Gopher | Chinchilla | |
|---|---|---|
| Parameters | 280 billion | 70 billion |
| Training tokens | 300 billion | 1.4 trillion |
| Tokens per parameter | About 1 | About 20 |
| Result | Lower scores | Higher scores on most tasks tested |
Beyond the training budget
The Chinchilla rule finds the best model for a fixed training budget. It ignores what happens after training. A model that serves millions of requests costs money on every token it writes, and a smaller model is cheaper to run.
For that reason, many recent models train small models on far more text than the rule suggests. Meta trained Llama 3 8B on about 15 trillion tokens, close to 1,900 tokens for each parameter. Meta reported that the model was still improving at the end of training. The extra training costs more once, and every later request is cheaper.
Limits of scaling
- Text supply. High-quality public text is finite. Teams now filter harder, train on the same text more than once and add text written by other models.
- Loss is not ability. Scaling laws predict loss, a smooth number. Skill at a particular task, such as a kind of arithmetic, can improve unevenly as models grow.
- Computing at answer time. Some recent models spend extra computing when they answer, writing out reasoning steps before the final reply. OpenAI's o1 model from 2024 made this approach widely known. It adds a second way to scale, at use time instead of training time.
About how many training tokens fit the Chinchilla rule?
A team plans a 10 billion parameter model and wants the best result for its training budget.
Chinchilla's rule of thumb is about 20 training tokens for each parameter. 20 times 10 billion is 200 billion.
About how much training compute is this?
A model has 1 billion parameters and trains on 100 billion tokens.
The estimate is 6 times parameters times tokens: 6 times 1 billion times 100 billion is 6 times 10 to the power of 20.
Why train a small model far beyond the rule?
Meta trained an 8 billion parameter model on about 15 trillion tokens.
The Chinchilla rule ignores running costs. Extra training costs more once and makes every later request cheaper.
Your reading position is saved
0 of 20 complete
Lesson complete
Scaling laws
Up next