Skip to content
← AI Folks Labs

The model that looks best has learned nothing

Every beginner builds a model, sees it score 99%, and celebrates. Then it meets real data and falls apart. Here is exactly what went wrong, in a chart you can push around yourself.

6 min · Beginner · Playable

First, the idea

Learning the rule, or learning the answers

A student who understands the topic can answer questions they have never seen. A student who memorised last year's paper scores brilliantly on last year's paper and nothing else. Both look identical if the only test you run is last year's paper — and that is the mistake.

Training data

The examples the model is allowed to study. It will get very good at these.

Test data

Examples it has never seen, held back deliberately. This is the only score that means anything.

The gap between them

Small gap: it learned the rule. Large gap: it memorised the answers.

Stage 01

Turn the dial and break it

Below are twelve points from a hidden rule, with a bit of noise on top. Start at degree 1 — a straight line, clearly too simple. Push it to 3 or 4, and it looks about right. Now push it to 12 and watch the curve twist itself through every single point.

12 training pointsGeneralising
Training points New data The model The hidden rule
0.31Error on training data
Error on new data

Similar error on both sets. This is the model you would actually ship.

Real least squares, fitted in your browser — the curve is genuinely the best polynomial of that degree through those points. Only the hidden rule is invented, so that “new data” means something.

In plain words

At degree 12 the error on the training points is nearly zero. That looks like success and is the opposite. Press “Show new data from the same source” — the same rule, the same noise level, points it has never seen — and watch the second number explode while the first stays perfect.

Stage 02

Then reveal the rule

Press “Reveal the hidden rule” to see the gold dashed line the data actually came from. Notice which model is closest to it: not the one that threaded every point, but the modest one that ignored most of them. The wiggles at high degree were the model faithfully learning the noise — and noise, by definition, does not repeat.

Try it with your own data

Press “Draw your own data” and tap five points in a rough line. Then push the degree up. With few points, even a modest model starts memorising — which is why small datasets are so dangerous.

Try it with more points

Press “Fresh training set” a few times at a high degree. The wilder the curve moves between runs, the less any of it was real. A stable model is one that barely notices which sample it got.

What follows from this

What this explains

Why you always hold data back

If you tune a model against the same data you tested it on, you have quietly memorised through the back door. Split the data before you touch it, and do not look at the test set until the end.

Why simpler often wins

Given two models with similar test error, the simpler one is more likely to survive contact with reality. Complexity has to earn its place by improving the score on data the model has never seen.

Why more data helps more than a better model

The same flexible model that memorises twelve points generalises fine on twelve thousand. Most “our model does not work” problems are data problems wearing a costume.

Why leakage is so destructive

If a column quietly contains the answer, the model reaches 99% and you learn nothing until it ships. Leakage is memorisation you cannot see in the chart — which is why finding it is a discipline, not a check.

Next

This is module two, week one

Validation splits, cross-validation, leakage hunting and the discipline of not fooling yourself — before any of the interesting algorithms.