Skip to content
mentoor

Topic 1 of 6 · 5 min read

Power laws of loss and scale

Goal: Read a log-log scaling table or plot and extrapolate the loss of a larger run while stating the caveats.

Test loss of a language model falls as a power law in parameters, data and compute, so on a log-log plot the trend is a straight line you can fit and extend a short way.

Check yourself · 1 of 3

On a log-log plot of loss against parameters, a straight line means what?

Choose one answer

Why it matters

Training a large model costs weeks and a lot of money. Scaling laws let you run small, cheap experiments and predict what a bigger run will reach before you pay for it. Kaplan et al. (2020) fitted loss against model size, dataset size and compute and found clean power laws across many orders of magnitude, with exponents of about 0.076 for parameters, 0.095 for data and 0.050 for compute.

How to read one

A power law has the form loss = a * x^(-b). Take logs of both sides and you get a line: log loss = log a - b * log x. The slope b is the exponent. A small exponent means each tenfold increase buys a small, steady drop.

  1. Fit the line on your small runs, not by eye. Use at least four or five model sizes.
  2. Check that everything else is held fixed: same data, same tokenizer, same learning-rate recipe tuned per size.
  3. Extrapolate only a short distance past your largest point, and give a range, not one number.
  4. Remember the loss has a floor. Real curves bend as they approach the irreducible noise in the text, so a pure straight line over-promises far out.

Before and after

Weak: "Loss went 4.2, 3.6, 3.1 as we scaled 10x each time, so at 100x bigger we will hit 2.0."

Better: the ratios are 0.86 each step, so fitting gives an exponent near 0.066. One more tenfold step predicts about 2.67, and two more about 2.3. A drop to 2.0 would need a trend that is steeper than any seen so far.

import numpy as np

params = np.array([1e7, 1e8, 1e9])
loss = np.array([4.2, 3.6, 3.1])
slope, intercept = np.polyfit(np.log10(params), np.log10(loss), 1)
print(round(slope, 3))                           # about -0.066
print(round(10 ** (intercept + slope * 10), 2))  # prediction at 1e10

What goes wrong

  • Fitting a line to two or three points and trusting its exponent.
  • Extrapolating over several orders of magnitude when the data covers one.
  • Comparing losses across runs that used different tokenizers or data, which makes the numbers incomparable.
  • Treating lower loss as better downstream skill. Loss predicts well on average; individual tasks can jump or stall.

Examples

Fitting three toy runs

Three runs of 10M, 100M and 1B parameters reach losses of 4.2, 3.6 and 3.1. The fitted exponent is about 0.066, and a 10B run is predicted near 2.67. If the 10B run lands at 2.9, the first check is whether data or learning rate was tuned differently, not whether scaling laws are broken.

Same line, wrong tokenizer

A team compares a loss of 2.1 on its own tokenizer with 2.4 on another team's. Losses are per token, and different tokenizers split text into a different number of tokens, so the numbers cannot be compared. Convert to bits per byte first.

Key points

  • Loss follows a power law in parameters, data and compute, which appears as a straight line on a log-log plot.
  • The slope of the log-log line is the exponent, and a small exponent means slow but steady gains per tenfold step.
  • Fit with several model sizes and extrapolate only a short way past the largest one, with a range.
  • Real curves flatten toward an irreducible floor, so far extrapolation from a straight line overpromises.
  • Loss predicts average next-token quality, not any single downstream task.

Common mistakes

  • Extrapolating a fitted line several orders of magnitude beyond the data.
  • Fitting an exponent from two or three points.
  • Comparing per-token losses across different tokenizers or datasets.
  • Assuming a lower loss means every benchmark improves by the same amount.

Check yourself · 2 of 3

Your fits on 10M, 100M and 1B models look clean. Which prediction is the most defensible?

Choose one answer

Check yourself · 3 of 3

Two teams report validation loss of 2.1 and 2.4 and argue about whose model is better. What is the first thing to check?

Choose one answer

Practice items, not counted towards your mastery.

Start here