A network with enough neurons doesn't have to learn the pattern — it can just memorize every training point. The two look identical on the training set and very different everywhere else, including on real people's data.
A model that learns finds a simple boundary that generalizes to new emails it has never seen. A model that memorizes draws a squiggly boundary that hugs every single training point exactly — including noise and one-off mistakes — and falls apart on anything new. This gap is called the generalization gap, and it's visible as training accuracy pulling far ahead of test accuracy.
Solid dots are training data, hollow-ringed dots are a held-out test set the model never trains on. Push capacity up and train longer until training accuracy hits 100% while test accuracy visibly drops. That gap is overfitting.
You just watched that gap between train and test accuracy open up. Now forget you ever saw the training data — and recover who was in it anyway.
You only get query access to the overfit model from above — no list of its training data. For each of the 6 emails below, check its confidence. An overfit model is suspiciously over-confident on points it has memorized, and unsure on points it hasn't seen. Guess "trained on" vs "never seen" for all 6 and score 5/6 or better.
What just happened: with no list of training data, confidence scores alone were enough to tell you who was in it.
Why it works: an overfit model's output is sharper (closer to 0% or 100%) on points it memorized than on genuinely new points — because it fit the training noise, not just the pattern. Querying confidence (or loss) and comparing to a threshold is the core of membership inference attacks (Shokri et al. 2017). At scale, this is how researchers showed language models can leak whether a specific document was in their training data — a real privacy risk for models trained on personal or sensitive text.
The fix: regularization and early stopping (stop training before the gap opens), differential privacy during training (bounds exactly how much one example can influence the model), and never publish raw confidence scores from a production model without rate limits.