Papa Programmer
Lesson 15 of 20

Scaling laws

9 min read

Optional

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.

python
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:

text
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 parameter

The 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.

GopherChinchilla
Parameters280 billion70 billion
Training tokens300 billion1.4 trillion
Tokens per parameterAbout 1About 20
ResultLower scoresHigher scores on most tasks tested
Gopher and Chinchilla used similar compute in different ways

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.
Predictable curvesLoss falls smoothly with parameters, tokens and compute, so teams can plan.
About 20 tokens per parameterChinchilla's rule for the best model at a fixed training budget.
Running costs change the planSmall models trained on more text are cheaper for every request.

Your reading position is saved

0%

0 of 20 complete

Contents

Learning tools