Overfitting
A model that aces its practice questions can still flunk the real exam — that's overfitting: memorising instead of understanding.
A student who memorises last year's exam answers looks brilliant — until the questions change. Models do exactly this, and it's the most important failure to understand: overfitting.
Back in the fitting lessons, the whole goal seemed to be “make the error on your data small.” But that's a trap. You don't actually care how well a model does on data you've already got — you care how it does on data it has never seen. That's the only thing that matters in the real world.
So we play fair: hide some of the data. The tealdots below are the model's study material; the hollowdots are a held-back exam it never trains on. Now turn up the model's complexity and watch the two come apart.
Overfit Playground
Drag the complexity slider all the way up
Push the degree to 10+ and watch the curve thread every training dot perfectly — while the test error explodes.
At degree 1–2 the line is too stiff to follow the curve — both errors stay high (underfitting). Around 3–4 it nails the real pattern. Now crank it to 10+: the curve contorts to pass through every single teal dot, training error dives toward zero — and the test error explodes. Bump the noise up and it gets even more dramatic.
The goal was never to fit the data
The real target is generalisation: doing well on the unseen exam. A model with too much capacity doesn't learn the underlying pattern — it memorises the training points, including the random noise, and that memorised noise is useless (worse than useless) on anything new. The gap between the low training error and the high test error is the overfitting.
Low training error is not the goal — low error on new data is. Make a model complex enough and it will memorise its training set perfectly while failing in the wild. This is why every serious AI is judged on held-out data it was never allowed to study.
The fix isn't always “bigger model.” Often it's the opposite — a simpler model, or more data, or techniques that deliberately stop a model from memorising. Knowing when your model is fooling you is half the skill.
Overfitting is the first way AI quietly misleads you: it looks perfect on the data you tested it with, and falls apart on everything else. The next trap is sneakier still — it's not about the model's complexity, but about the data we feed it. If that data is skewed, the model learns the skew. That's bias, and it's next.
Feel like you get it?
Continue to “Bias In, Bias Out” →