← All lessons
0235

Regularization

The overfitting lesson showed the disease: a model that memorises its training data, noise and all, and fails on anything new. Regularization is the family of cures — deliberate handicaps that stop memorisation. The most famous is dropout: during training, randomly switch off a fraction of neurons at every step.

Train with dropout off and watch the curves split: training error keeps improving while test error — the only one that matters — turns upward. That widening generalization gap IS overfitting. Toggle dropout on: with neurons randomly vanishing, the network cannot lean on any single one and must spread knowledge into robust patterns. Cousins in the same family: weight decay (penalise large weights) and early stopping (quit before the curves diverge).

training errortest error (new data)epochs →

generalization gap: 55

Training error keeps falling but test error climbs — the model is memorising noise. Turn dropout on.

Check yourself

Why does making training HARDER — randomly deleting neurons — make the model BETTER on new data?

Go deeper (free): Google ML Crash Course — Regularization

Next: Prompting