Learning Curves & Sample Size
How error falls with more data, and the shapes curves really take.
How much will the next ten thousand labeled examples buy you? The answer is the learning curve: expected error as a function of sample size. Theory pins down its shape in clean cases, for regular parametric models and for smooth nonparametric ones. Practice finds power laws with stubbornly small exponents. And both find curves that go up when more data arrive.
What you’ll learn
- Define expected learning curves, and prove that the expected training error of empirical risk minimization never decreases with , while its test error need not be monotone.
- Derive the parametric rates and , and the nonparametric rate from a bias–variance balance.
- Explain sample-wise double descent and what is known about monotone learners.
- Fit and extrapolate power-law learning curves to decide whether to collect more data, and recognize when extrapolation fails.
Learning curves, precisely
Fix a distribution and a learning algorithm . The expected learning curve is , and the training curve is . In practice you estimate by training on random subsets of several sizes, repeating each size a few times, and averaging validation errors. (The loss-versus-iterations plot of a single training run is a different object, sometimes also called a learning curve; this lesson is about sample size.)
For empirical risk minimization over a class with best-in-class predictor , training error is optimistic, , and one half of the picture is always well behaved:
Write the empirical risk on points as the average of the empirical risks that leave one point out, since each point appears in exactly of the subsets:
The minimum of an average is at least the average of the minima:
Each is the minimal empirical risk on an i.i.d. sample of size , so it has expectation . Taking expectations proves the claim.
No such argument exists for the test curve , and the last two steps of this lesson show it can rise. Viering, Mey & Loog (2019) posed monotonicity as an open problem, with simple examples in which ERM's expected risk does and does not decrease with each added example.
Parametric rates: one over n
For correctly specified, regular parametric models the excess risk falls like (number of parameters)/:
- Least squares with coefficients and Gaussian inputs: for , exactly (from the mean of an inverse Wishart matrix, derived in Overfitting & the Bias–Variance Trade-off).
- Maximum likelihood with parameters under log loss: the expected excess risk is the KL divergence from the true distribution to the fitted one, approximately .
For a model containing the truth , expand the excess log loss to second order around . The first-order term vanishes at the true parameter, and the Hessian there is the Fisher information :
The MLE is asymptotically normal, , so is asymptotically , with mean :
A correctly specified logistic regression with parameters is fit to examples. Approximately what expected excess log loss (in nats per example) does the rule predict?
Show the answer
0.005
nats. Doubling the data halves it: the parametric learning curve is a power law with exponent . The approximation is asymptotic; with few examples per parameter, or with separable data where the MLE does not exist, it fails.
Classification theory gives the same flavor with combinatorial complexity in place of parameter counts: for a class of VC dimension , sample complexity scales like in the realizable case and like in the agnostic case (Learning Theory: How Many Examples Are Enough?). These bounds hold uniformly over distributions. If the constants may depend on the (fixed) distribution, Bousquet, Hanneke, Moran, van Handel & Yehudayoff (2021) proved a trichotomy in the realizable case: the best achievable learning curves of any class decay either exponentially, linearly, or arbitrarily slowly, and which case holds is characterized by combinatorial parameters of the class. Uniform PAC bounds describe only the upper envelope of these curves.
Nonparametric rates and dimension
Without a parametric model, rates depend on smoothness and dimension. For regression functions on with bounded derivatives, Stone (1982) proved that the optimal (minimax) rate for the squared error is . The exponent comes from balancing bias against variance.
A local averaging estimator (kernel smoothing, or local polynomials for ) with bandwidth averages the labels in a window of volume , which holds about points. Smoothness bounds the bias by ; averaging independent noises gives the variance:
Minimize the sum over : the derivative vanishes when . Plug the optimal bandwidth back in:
| Smoothness | Dimension | Exponent | Data needed to halve the error |
|---|---|---|---|
| 2 | 1 | 0.80 | |
| 2 | 2 | 0.67 | |
| 2 | 10 | 0.29 | |
| parametric | any | 1 |
Curves that go up
Take minimum-norm least squares (the interpolating solution when ) with isotropic Gaussian features, and noise variance . The exact expected excess risk is for and for : the bias is the part of outside the -dimensional row space of , and the variance comes from the inverse-Wishart mean, as in the parent lesson. (Hastie, Montanari, Rosset & Tibshirani, 2022, analyze the limit of this and much more general models.) Read it as a learning curve:
| 10 | 50 | 90 | 95 | 105 | 110 | 150 | 300 | |
|---|---|---|---|---|---|---|---|---|
| excess risk | 0.93 | 0.76 | 2.6 | 6.0 | 6.3 | 2.8 | 0.51 | 0.13 |
This is sample-wise double descent (Nakkiran, 2019: "more data can hurt"). Near the smallest singular value of approaches zero and the pseudo-inverse amplifies the noise; the peak is variance. Optimally tuned ridge removes it in this model, which is why the effect is rarely seen in carefully regularized practice; Double Descent in the modern-generalization lessons covers the model-wise version.
Can a learner always be made monotone? Bousquet, Daniely, Kaplan, Mansour, Moran & Stemmer (2022) showed that for multiclass classification every learning algorithm can be transformed, with black-box access, into a monotone one with similar performance, and that every PAC-learnable class has a monotone PAC learner, resolving the question for that setting.
In the model above (, minimum-norm least squares), you grow the training set from to . What happens to the expected excess risk?
- It falls from about 0.76 to about 0.42, as more data always helps
- It rises from about 0.76 to about 2.6, because the variance term explodes as approaches
- It is unchanged, because is fixed
- It falls to zero, because the model still interpolates
Show the answer
B. It rises from about 0.76 to about 2.6, because the variance term explodes as approaches
The bias term falls from to , but the variance term rises from to . Interpolating noise with a nearly singular design is what hurts; past the curve descends again.
Power laws at scale, and when to collect more data
Hestness et al. (2017) measured learning curves for deep networks in machine translation, language modeling, image classification and speech recognition. Generalization error followed power laws in every domain, with exponents usually between and , much shallower than the or of classical theory. Better architectures and optimizers shifted the curve down without changing its exponent. They described three regions: a small-data region near best-guess error, the power-law region, and (expected, though not reached in their experiments) an irreducible-error region.
Kaplan et al. (2020) fitted language-model loss as with , alongside power laws in model size and compute, and Hoffmann et al. (2022) found that compute-optimal training should scale parameters and training tokens in equal proportion. These are empirical regularities over the ranges studied, not theorems; why the exponents take the values they do is an open question.
A validation error behaves like over the range you care about (the floor is negligible). By what factor must the training set grow to halve the error?
Show the answer
10 ×
Solve : . At an exponent of the factor would be , which is why small exponents make data so expensive at scale.
import numpy as np
from scipy.optimize import curve_fit
def power_law(n, a, b, c):
"""Learning-curve model: an irreducible floor a plus a power-law term."""
return a + b * n ** (-c)
def samples_needed(sizes, errors, target):
"""Fit (size, mean validation error) pairs, then solve a + b n^(-c) = target."""
(a, b, c), _ = curve_fit(power_law, sizes, errors,
p0=[min(errors) / 2, 1.0, 0.5], maxfev=20000)
if target <= a:
return np.inf # the fitted floor is above the target
return (b / (target - a)) ** (1 / c)Measure the error at several sizes by repeated subsampling, re-tuning hyperparameters at each size (a model tuned for the full data is not the right model for a small subset). Refit on bootstrap resamples of the points to get an interval for the answer: the floor and exponent are often poorly identified, and extrapolating far beyond the largest measured size is risky.
| What the curve shows | Decision |
|---|---|
| validation error still falling steeply; large train–validation gap | more data is likely to pay; extrapolate the fit to price it |
| both curves flat and close together | more data of the same kind will not help; change the model or the features |
| a bump or a plateau followed by a drop | beware of extrapolation: the curve has changed regime (double descent, a phase transition, a change in data quality) |
| small-data region near chance | too few points to fit a power law; collect more before extrapolating |
Key takeaways
- The expected learning curve belongs to a learner and a distribution. ERM's expected training error never decreases in ; its test error need not decrease.
- Regular parametric models: excess risk (parameters), e.g. for least squares and for maximum likelihood. Smooth nonparametric regression: , the curse of dimensionality.
- Learning curves can rise: minimum-norm least squares peaks at (sample-wise double descent). Monotone learners exist in principle for classification.
- Deep-learning curves follow power laws with small exponents ( to in Hestness et al.); fitting on subsamples prices more data, but extrapolation needs uncertainty estimates and fails at regime changes.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
For empirical risk minimization over a fixed class, what is guaranteed about the expected training error as grows?
- It never decreases
- It never increases
- It equals the expected test error for large , and is otherwise arbitrary
- Nothing, because ERM can be non-monotone
Show the answer
A. It never decreases
The empirical risk on points is the average of leave-one-out empirical risks, and the minimum of an average is at least the average of the minima, so . It is the test curve that can be non-monotone.
A regression function has two bounded derivatives in dimensions. Compared with a parametric model (rate ), how much more data does an optimal nonparametric method need to halve its squared error?
- The same: 2× in both cases
- About 2.4× instead of 2×
- About 11× instead of 2×
- About 100× instead of 2×
Show the answer
C. About 11× instead of 2×
The minimax exponent is , so halving needs times more data. The parametric rate needs only twice as much.
With isotropic Gaussian features and minimum-norm least squares, where does the sample-wise learning curve peak?
- At
- At , where the design matrix is nearly singular
- At
- It has no peak: the curve is monotone in
Show the answer
B. At , where the design matrix is nearly singular
Both variance formulas, and , diverge as : the smallest singular value of approaches zero and the pseudo-inverse amplifies the noise.
According to Hestness et al. (2017), what did better architectures and optimizers do to deep-learning learning curves in a given domain?
- They steepened the power-law exponent
- They removed the power-law region entirely
- They shifted the curve down without changing its exponent
- They made the curve non-monotone
Show the answer
C. They shifted the curve down without changing its exponent
Models for a single domain showed the same steepness; improvements moved the intercept. So better models help by a constant factor at every size, while the exponent sets how expensive further error reductions are.
Further reading
- T. Viering & M. Loog, "The shape of learning curves: a review," IEEE Transactions on Pattern Analysis and Machine Intelligence 45(6), 7799–7819 (2023).
- C. J. Stone, "Optimal global rates of convergence for nonparametric regression," Annals of Statistics 10(4), 1040–1053 (1982).
- J. Hestness, S. Narang, N. Ardalani, G. Diamos, H. Jun, H. Kianinejad, M. M. A. Patwary, Y. Yang & Y. Zhou, "Deep learning scaling is predictable, empirically," arXiv:1712.00409 (2017).
- J. Kaplan, S. McCandlish, T. Henighan, T. B. Brown, B. Chess, R. Child, S. Gray, A. Radford, J. Wu & D. Amodei, "Scaling laws for neural language models," arXiv:2001.08361 (2020).
- O. Bousquet, S. Hanneke, S. Moran, R. van Handel & A. Yehudayoff, "A theory of universal learning," Proceedings of the 53rd ACM Symposium on Theory of Computing (STOC), 532–541 (2021).