Scaling Laws

Scaling laws explain why larger language models often improve predictably when parameters, data, and compute grow together.

The Big Question

Language modelling gave us the objective: predict the next token and reduce cross-entropy loss. Now imagine training many language models with the same objective. One has 10 million parameters. Another has 10 billion. Another has hundreds of billions.

Can we predict how much better the larger model will be before we train it?

Scaling laws say that, over broad ranges, the answer is often yes. When model size, data, and compute increase, validation loss tends to fall in a surprisingly regular way. The improvement is not arbitrary. It often follows a power law.

This is one reason modern AI changed so quickly. Researchers learned that if the architecture was sound and the objective was simple, scale itself could be a reliable source of progress.

Core Intuition

Suppose we train several transformer language models and measure validation loss. A toy set of results might look like this:

Model sizeValidation lossInterpretation
10M2.10Small model; learns common local patterns
100M1.80Better grammar, memorization, and short-range structure
1B1.55More knowledge and broader pattern recognition
10B1.38Stronger reasoning and in-context behavior
100B1.27Still improves, but gains are smaller

The loss keeps decreasing, but the gains get smaller. Going from 10 million to 100 million parameters helps a lot. Going from 10 billion to 100 billion still helps, but it costs far more for a smaller reduction in loss.

On ordinary linear axes, this looks like a curve that flattens. On log-log axes, the same relationship often looks close to a straight line. That straight-line behavior is the fingerprint of a power law.

Interactive Demo

Scaling explorer

Power law curve

log parametersloss

The curve slopes downward but flattens. Scaling keeps helping, but each doubling gives a smaller gain.

Compute budget simulator

Predicted loss
2.295

This is a simplified toy law, not a real forecast. It shows the shape: larger models, more data, and more compute reduce loss with diminishing returns.

Budget choice

Parameters
50B
Tokens
1.5T
Budget loss
2.034

Compute-optimal scaling asks how to balance model size and data for a fixed budget, rather than making only the model larger.

What to notice

  • Increasing only parameters can leave the model data-starved.
  • Increasing only data can leave the model capacity-limited.
  • Increasing compute without balance can be wasteful.
  • The point is predictability, not magic.

Move the sliders separately. The important lesson is not the exact number. It is the shape: scaling helps most when parameters, data, and compute are balanced.

Mathematics

A Simple Power Law

A simplified scaling law for model size might be written as:

L(N)=ANα+BL(N)=A N^{-\alpha}+B

Here L(N)L(N) is validation loss, NN is the number of parameters, AA controls the scale, α\alpha controls how quickly loss improves, and BB is the irreducible floor approached by this trend.

The constants matter in research, but the course intuition is simpler: as NN grows, NαN^{-\alpha} shrinks, so loss decreases. Because α\alpha is usually small, the decrease is gradual. Scale works, but it is expensive.

Three Things Scale Together

A language model is not improved by parameters alone. Three resources interact:

ParametersHow many learned weights the model hasMore capacity to store and combine patterns
DataHow many training tokens the model seesMore examples of language, facts, code, and styles
ComputeHow much training work is performedMore total optimization over model and data

If a model is huge but sees too little data, it is undertrained. If the dataset is enormous but the model is too small, the model may not have enough capacity to absorb the patterns. If compute is too limited, training cannot fully use either one.

Compute-Optimal Scaling

Suppose two training runs cost roughly the same:

Run A

100B parameters

20B tokens

Very large model, but not enough training data.

Run B

70B parameters

1.4T tokens

Smaller model, but trained on far more data.

Compute-optimal scaling asks which allocation gives the best loss for a fixed compute budget. The Chinchilla result made this lesson vivid: many earlier large models were too big for the amount of data they saw. For the same budget, a smaller model trained on more tokens can outperform a larger undertrained model.

Why Bigger Models Can Do More

Bigger models have more representational capacity. They can store more patterns, form more specialized internal features, and combine those features in more ways. This does not make them intelligent by magic. It gives the optimization process a larger space in which useful circuits can form.

TranslationA larger model has seen many bilingual and multilingual patterns.
Code generationA larger model can absorb syntax, APIs, idioms, and long-range structure.
In-context learningA larger model becomes better at inferring the task from examples in the prompt.
Multi-step reasoningA larger model can represent more intermediate dependencies, though this remains imperfect.

Emergent Abilities

Some abilities appear to become useful only after a model reaches a certain scale. A small model may fail at a task completely, while a larger model starts to solve it after seeing only a few examples in the prompt.

France -> Paris
Japan -> Tokyo
Brazil -> ?

A sufficiently capable model can infer that the task is country-to-capital mapping and continue with Brasilia. This is in-context learning: the model changes its behavior from the prompt without changing its weights.

The word emergent should be used carefully. Some apparent jumps become smoother when researchers use better metrics or give partial credit. The safe claim is that scale can unlock qualitatively more useful behavior, even when the training objective stays next-token prediction.

Limits Of Scaling

Scaling is powerful, but it is not infinite. Larger models require more data, more compute, more memory, more engineering, and more energy. They can also be slower and more expensive to serve. Scaling laws help plan training runs, but they do not remove product constraints or guarantee trustworthy behavior.

Implementation

A classroom version of scaling laws is simple: train several tiny language models, keep the dataset and training procedure comparable, then plot validation loss against parameter count.

import matplotlib.pyplot as plt

configs = [
    {"d_model": 64, "layers": 2},
    {"d_model": 128, "layers": 4},
    {"d_model": 256, "layers": 6},
]

results = []

for config in configs:
    model = TinyLanguageModel(
        vocab_size=tokenizer.vocab_size,
        d_model=config["d_model"],
        n_layers=config["layers"],
    )

    train(model, train_loader, steps=5000)
    val_loss = evaluate(model, validation_loader)
    params = sum(p.numel() for p in model.parameters())
    results.append((params, val_loss))

params = [row[0] for row in results]
losses = [row[1] for row in results]

plt.loglog(params, losses, "o-")
plt.xlabel("parameters")
plt.ylabel("validation loss")
plt.title("Tiny scaling experiment")
plt.show()

Real scaling-law research trains many more models, varies dataset size and compute, and fits power-law curves carefully. But the small experiment teaches the mental model: loss often improves smoothly enough that future training runs can be planned.

Interview Discussion

What is a scaling law?

A scaling law is an empirical relationship showing how model performance changes predictably as resources such as parameters, data, and compute increase.

Why are log-log plots common?

Power-law relationships become approximately straight lines on log-log plots, which makes the trend easier to identify and extrapolate.

What was the main lesson of compute-optimal scaling?

For a fixed compute budget, the best model is not necessarily the largest one. The model size and number of training tokens should be balanced.

Does lower language-model loss guarantee a better assistant?

No. Lower loss usually means a better next-token predictor. Helpful assistant behavior also depends on fine-tuning, preference optimization, prompting, tools, and product design.

Active Recall

1. What are the three main resources in LLM scaling?

2. Why does a power law imply diminishing returns?

3. What does it mean for a model to be undertrained?

4. Why might a smaller model trained on more tokens beat a larger model trained on fewer tokens?

5. What is in-context learning, and why is it connected to scale?

6. Why does lower validation loss not automatically solve alignment or product quality?

Common Mistakes

  • Thinking scaling laws mean bigger is always best. Bigger only helps when data, compute, and training quality are adequate.
  • Confusing lower loss with perfect behavior. Loss measures next-token prediction, not honesty, safety, latency, cost, or usefulness.
  • Treating emergence as mystical. Emergent abilities are empirical observations about behavior at scale, not a separate training objective.
  • Ignoring data quality. More tokens help only if those tokens contain useful signal.

Connection To Pretraining

Scaling laws tell us why training larger language models is not just a leap of faith. They give us a way to reason about parameter count, dataset size, and compute before spending the money.

The next lesson asks what the actual training run looks like. Once we choose a scale, how do we collect data, tokenize it, run the transformer, compute loss, update weights, and repeat that process over enormous numbers of tokens?