Train with noise: and test by averaging it out

Many regularizers share one pattern: while training, add some randomness; at test time, average it away. First the one that adds no noise at all, early stopping; then data augmentation, and a symmetry it can teach; then the pattern, method by method.

1. Early stopping — keep the snapshot that did best on data it never trained on

A curve fit to sixteen noisy points, and its training and validation loss over time Left: sixteen noisy training points, the true curve dashed, the current fit, and the fit from the step with the lowest validation loss. Right: training loss and validation loss against training step on a log scale; the training loss keeps falling while the validation loss falls, bottoms out, and rises again, with the best step marked.
The model is flexible on purpose: 30 bumps (Gaussian radial basis functions) to fit 16 noisy points, trained by plain gradient descent from all-zero weights. Gradient descent learns the smooth, broad shape first, because that is where the gradient is largest; the wiggles that thread every noisy point come much later. So the validation loss, measured on 100 fresh points, falls, bottoms out, and rises, while the training loss falls forever. Early stopping keeps the weights from the bottom of that dip. It adds no noise; it limits how far from the starting point training can wander, which for a linear model like this one acts much like a penalty on the weights (weight decay). Note the log scale: the fit is best after about ten steps and spends the next thirty thousand getting worse.

2. Data augmentation — each training image, seen a different way every time

Each change is one a label should survive: a flipped cat is still a cat. Every time the image comes round in training it is drawn again, so a network sees thousands of variants of each photograph, which is like having thousands more photographs of hippos. The crop is ResNet’s recipe: resize so the short side is a random L between 256 and 480, then take a random 224×224 patch; here the picture is 256 pixels across and scaled the same way. Cutout blanks a random square, which after input normalization is zero, the average color. Mixup is the odd one: it blends two images, and blends their labels by the same weight, drawn from a Beta(α, α) distribution (α = 1 here, which is uniform; smaller α keeps most blends close to one image), so the target for a 40% cat, 60% dog picture is 40% cat, 60% dog. At test time the network sees the plain image (or, for a little extra accuracy, the average of its predictions over a fixed set of crops).

3. Augmentation teaches a symmetry — the same small network, with and without rotations

The true rule is a ring: points between the two dashed circles are blue, the rest orange, and the rule is the same after any rotation. But all 24 training points come from one quarter of the disk. Both networks are identical (2→16→16→1, tanh, Adam) and see the same points. The left one learns a boundary that works in its quarter and is guesswork elsewhere. The right one gets each point rotated by a fresh random angle at every step, the faint dots, so it never sees the same input twice; it is never told the rule is circular, but that is the only boundary consistent with all it was shown. The accuracy is measured over the whole disk. This is what augmentation is for: a symmetry you know the answer has, written into the data instead of into the network, where convolutions write translation.

4. The pattern — noise while training, averaged away at test time

MethodRandomness added while trainingAt test time
DropoutEach unit zeroed with probability pKeep every unit and scale by 1−p, so each unit’s output matches its average while training (or scale up by 1/(1−p) while training, “inverted dropout”, and change nothing at test time)
DropConnectEach weight zeroed at randomUse every weight, scaled the same way
BatchNormEach example normalized with the mean and spread of whichever random minibatch it landed inNormalize with running averages of those statistics, the same for every input
Data augmentationRandom flips, crops, scales and colorsThe plain image, or the average prediction over a fixed set of crops (ResNet: 10 crops at each of 5 scales)
CutoutA random square blanked outThe whole image
MixupTwo images and their labels blended by a random weightReal, unblended images
Stochastic depthWhole residual blocks skipped at randomEvery block, each scaled by its survival probability (why a ResNet can lose a block)
Each line trains many slightly different networks, or one network on many slightly different inputs, and asks the test-time network to behave like their average. The average is taken cheaply, by a rescaling or a fixed statistic, not by running the network thousands of times; for dropout the rescaling is exact for a single linear layer and a good approximation beyond it. Dropout works through the expectation one unit at a time. Early stopping is the exception in the family: no noise, just a limit on how long the noise-free descent may run.