Skip to content
atlas

Overfitting

When a model learns its training examples by heart, including their noise, and then does badly on new cases it has not seen.

Draft - this entry has not been reviewed yet.

Formal

A failure of model training in which a model fits the training data too closely, so it scores well on that data but poorly on new data; found by testing on data held back from training.

In plain English

Like a student who learns last year's exam answers by heart, word for word, and then fails when the questions are slightly changed.

In practice

A pension fund's fraud model finds almost every false claim among the cases it was trained on, but misses most real fraud once live, because it learned details found only in those old cases.

Why it matters

It makes a model look better on paper than in real use, and a model that has learned examples by heart can later repeat private details from its training data.

Technical deep dive

Overfitting is measured by the generalisation gap: the difference between error on the training data and error on data from the same distribution that the model never saw. The classical explanation is the bias-variance decomposition of expected squared error into bias squared, variance and irreducible noise. Simple models have high bias and underfit; very flexible models have high variance, meaning their fit changes a lot with the particular sample, and overfit. The textbook picture is a U-shaped test-error curve as model capacity grows, with the best model at the bottom of the U.

Detection requires honest held-out evaluation: a validation set or k-fold cross-validation for model selection, and an untouched test set for the final number. Learning curves showing training loss still falling while validation loss rises are the typical signature, and early stopping halts training at the validation minimum. A related but distinct problem is overfitting to the validation or test set itself, through repeated tuning against it or by picking the best of many runs; public benchmarks suffer from this at community scale.

Standard countermeasures are more or more diverse data, data augmentation, reducing capacity, and regularisation: L2 penalties (weight decay, ridge) shrink weights, L1 penalties (lasso) drive some to zero, and dropout (Srivastava et al., 2014) randomly disables units during training; the paper keeps each hidden unit with probability 0.5 and each input unit with a higher probability, around 0.8. Ensembles and bagging reduce variance by averaging models. Starting from a pretrained model through transfer learning also helps when task data is small.

Deep learning complicates the classical story. Zhang et al. (2017) showed that standard image networks can reach zero training error on randomly assigned labels, so capacity alone cannot explain why they generalise on real labels. Belkin et al. (2019) described double descent: test error can rise near the interpolation threshold, where the model just fits the training set, and then fall again as models grow much larger. Large overparameterised models can therefore generalise well despite fitting the training data perfectly, which is why parameter count is a poor proxy for overfitting risk.

Overfitting and memorisation are related but not identical. A model can generalise well on average while still memorising rare or duplicated training sequences verbatim. Carlini et al. (2021) extracted verbatim training examples, including names, phone numbers and email addresses, from GPT-2, even some that appeared only once in the training data, and membership inference attacks (Shokri et al., 2017) exploit the confidence difference between seen and unseen records to test whether a record was in the training set. Deduplication and differential privacy during training (DP-SGD) are the main technical mitigations.

What to learn first

Everything this builds on, foundations first.

  1. Training data
  2. →Model training
  3. →Overfitting

Relationships

Don't confuse with
UnderfittingData drift

Sources & further reading

Where this data comes from

This entry was drafted by an AI from the sources above and has not yet been checked by a person. Treat it as a starting point, and check anything important against the sources.

See the review queueSuggest a correction on GitHubThis term as JSON

Check yourself

Loading…

Atlas is in beta.