Generalization is what separates learning from memorizing. A model is trained on a finite sample of examples, but it is useful only if it does well on inputs it has never seen: next month’s emails, a new patient’s scan, a question nobody asked during training. A model that generalizes has picked up the pattern behind its training data rather than the particulars of it.
How it’s measured
You can’t measure generalization on the data the model learned from, because a model can score perfectly there by rote. Instead you hold data back. The error on a separate test set estimates the generalization error, the expected error on fresh inputs. The difference between training error and test error is the generalization gap.
This only works under an assumption worth stating out loud: training and test examples are drawn independently from the same distribution. When the real world drifts away from the training data, a model can generalize well on paper and still fail in use.
Too simple, too flexible
Two things decide whether a model generalizes: how well it fits the training data, and how small the gap is. A model with too little capacity can’t fit the data at all, which is underfitting. A model with too much capacity for the amount of data can fit the noise too, which is overfitting: training error keeps falling while test error rises. The bias-variance tradeoff is the classical account of this balance, and regularization is the family of tools for nudging a model toward simpler solutions.
The open question
Deep networks complicate the classical story. Zhang and colleagues showed in 2016 that standard image classifiers can perfectly fit training labels that were assigned at random, which by definition can’t generalize. The same networks, trained on real labels, generalize well. So capacity alone doesn’t explain what these models do, and why large networks generalize as well as they do is still an active research question.