Skip to content
Road to Intelligence

Concept · Chapter 3: Machine Learning

Distribution Shift

Must knowUnderstand10 minDifficulty

Distribution shift is when the data a model meets in use differs from the data it was trained on, so its measured performance no longer applies.

The problem

Held-out testing assumes the future looks like the past — the same distribution of inputs and the same input–label relationship.

The solution

Monitor inputs and outcomes in production, evaluate on data from the deployment setting, retrain as the world changes, and test robustness to plausible shifts.

The consequence

A model's accuracy is a property of a model and a distribution together — which is why 'works on the benchmark' and 'works in the world' can differ sharply.

Three kinds

KindWhat changesExample
Covariate shiftthe inputs P(x)P(x)a skin-lesion model trained on one hospital's cameras, deployed with another's
Label (prior) shifthow common each class is, P(y)P(y)fraud rises during a holiday season
Concept driftthe relationship P(y∣x)P(y \mid x)what counts as spam changes as spammers adapt

Why it matters for you

Models can fail badly on inputs unlike their training data while still producing confident outputs Established. In engineering terms: monitor the distributions of your features and predictions like you would monitor any data pipeline, and treat a sudden change as an alert.

For LLMs the question becomes: which of today's questions look like the training data, and which don't? Chapter 16 returns to robustness and calibration.

What to remember

  • Covariate shift: inputs change (new customers, new camera).
  • Label/prior shift: class frequencies change (fraud rate doubles).
  • Concept drift: the input→label relationship itself changes.
  • Monitor production data; a test-set score assumes no shift.