Scaling laws as a power-law fit: a worked example

Abstract

How a loss-versus-parameters curve becomes a straight line on log-log axes, how to fit it, how to put an interval on the fit, and what goes wrong when the irreducible loss is guessed wrong. Worked on synthetic data with known answers.

Scaling laws describe how a model’s loss falls as parameters, data or compute grow. A common form is a power law with an irreducible floor. This paper works one example from start to finish. It generates losses from a law whose constants are known, fits the law back, puts an interval on the result, and then shows what happens when one assumption is wrong. The data is synthetic, so every answer can be checked against the truth. The method is what carries over to real measurements.

The model

Let L be the loss and N the number of parameters:

L(N) = C + A * N^(-alpha)

C is the irreducible loss, the floor that more parameters cannot remove. A and alpha set how fast the loss falls toward that floor. If C is known, subtracting it and taking logs gives a straight line:

log(L - C) = log(A) - alpha * log(N)

One linear regression then recovers alpha and A. The whole method rests on knowing C, which is the part that deserves the most attention.

The synthetic data

The true law has C = 1.7, A = 40 and alpha = 0.30. Seven sizes from 1e6 to 1e9 parameters were evaluated, and Gaussian noise with standard deviation 0.012 was added to each loss.

A worked calculation

Take the 1e8 point. The true law gives 1.7 + 40 * (1e8)^(-0.30). The exponent is -0.30 times 8 in log10, so (1e8)^(-0.30) is 10^(-2.4), about 0.00398. Multiply by 40 to get 0.159, and add the floor: 1.859. The observed loss was 1.854, so the noise at that point was about -0.005. Such values are what the regression has to see through.

The fit

With C fixed at 1.7, the regression gives:

parameters N observed loss fitted loss residual
1e6 2.334 2.333 +0.001
3e6 2.160 2.151 +0.008
1e7 2.014 2.012 +0.003
3e7 1.918 1.923 -0.005
1e8 1.854 1.854 0.000
3e8 1.803 1.810 -0.007
1e9 1.781 1.776 +0.005

The estimates are alpha = 0.307 (true 0.30) and A = 44.0 (true 40), with a root-mean-square error of 0.0049. The exponent is close to the truth. The scale A is about 10 percent high, which is typical: the exponent is easier to pin down than the scale, because the scale trades off against the floor.

An interval, not just a number

A single fit hides how much the data constrains it. Resampling the seven points with replacement, refitting 2,000 times, and taking the middle 95 percent of the results gives:

  • alpha: 0.295 to 0.325, which contains the true 0.30
  • loss extrapolated to 1e10 parameters: 1.733 to 1.740

The point estimate for the extrapolation is 1.737. The true value, 1.740, sits at the top edge of the interval. A reader who saw only the point estimate would not know how much of that tightness depends on the law being right.

A text plot

  2.40 |
  2.35 |o
  2.29 | --
  2.24 |   --
  2.18 |     --o
  2.13 |       --
  2.08 |         ---
  2.02 |            --o
  1.97 |               ----
  1.92 |                   -o---
  1.86 |                        ----o--
  1.81 |                               ---o------
  1.75 |                                         o--------------
  1.70 |
       +--------------------------------------------------------
           1e6          1e7          1e8          1e9        1e10 (parameters, log)
legend: o = observed (synthetic), - = fitted curve

On a log axis the curve looks almost straight at large N and bends toward the floor at small N. Plotting log(L - C) against log(N) makes the straight line explicit, which is the more useful plot for checking the assumption.

What if the floor is wrong?

The floor is the assumption doing the most work. Repeat the same fit with the floor guessed at several values, using the same data:

assumed C fitted alpha fitted A sum of squared residuals extrapolated loss at 1e10
1.20 0.098 4.1 1.0e-2 1.631
1.50 0.161 7.2 5.7e-3 1.676
1.70 0.307 44.0 1.7e-4 1.737
1.78 0.859 182,627 5.5e-1 1.780

Two lessons come out of this table. The residual error is smallest at the true floor, so comparing fits by residuals can recover C when the data is good enough. And a wrong floor gives a plausible-looking exponent with a different extrapolation: guess 1.5 and the exponent halves, and the prediction at 1e10 is 0.06 too low. Guess 1.78, which is above every observed loss, and the fit blows up. A fit whose floor sits above the data is a sign the regression has nothing to say about the floor.

What to report

For a real set of measurements, report the fitted C with its interval, not as a fixed input. Report the residuals next to the fit, so a reader can see whether the curve bends. State the range of parameter counts the data covers, and treat extrapolation beyond it as a claim that needs its own evidence.

Conclusion

A power law with a floor becomes a straight line once the floor is subtracted, so a single regression recovers the exponent. The caution is in the floor. With these synthetic numbers, guessing it 0.2 too low halves the exponent and moves the prediction at 1e10 by 0.06. Fit it with the data, put intervals on everything, and say where the data ends.