Delete neurons at random
During training, each unit's output is multiplied by a random zero or one, so a different subnetwork is trained on every batch.
- : the drop probability, the fraction of units switched off.
- : a coin flip for unit , redrawn on every single forward pass.
At , half the units are gone from any given step, and which half changes constantly.
The scaling problem, and where it is solved
Dropping units changes the expected size of the output, and the next layer's weights were tuned for the undropped size.
Left alone, activations would shrink by a factor of at training time and jump back up at inference, which is a different function.
Dividing by during training restores the expectation, and this is called inverted dropout.
It is the version every framework implements, and the reason is efficiency rather than elegance: inference then needs no dropout code at all, which is the path that runs a billion times.
Training and inference
At inference, dropout is simply switched off and the layer is the identity.
Forgetting to switch it off is a classic bug, and it looks like a model that gives a different answer every time you ask it the same question.
One forward pass, in order
- Draw one Bernoulli sample per unit.
- Multiply each activation by its sample, zeroing the dropped ones.
- Divide what survives by .
- Carry on to the next layer.
- At inference, skip all four steps.
Why randomly deleting things helps
A unit cannot rely on any particular other unit being present, because that one might be gone next step.
So the network cannot build long chains of co-adapted units that only work together, and has to spread the representation out redundantly.
It is also close to training an exponentially large ensemble of thinned networks and averaging them at test time.
That is the other standard explanation, and the one that connects dropout to the rest of regularisation.
Modern large models use it sparingly: with enough data the overfitting it fights is no longer the binding constraint, and the noise it adds costs more than it saves.