Dropout & Its Bayesian Interpretation
Rigorous derivation of dropout as a regularizer: the forward pass with random masks, inverted dropout scaling, the connection to model averaging over exponentially many subnetworks, and the MC Dropout interpretation as approximate Bayesian inference.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- Dropout: Formulation
- Inverted Dropout
- Dropout as Ensemble Averaging
- Effect on Co-adaptation
- MC Dropout: Bayesian Interpretation
- Dropout in Different Architectures
- Common Pitfalls
- Summary
- Exercises
Learning Objectives
- Define dropout mathematically as multiplication by a random binary mask.
- Derive the expected output and show it equals the deterministic scaled output.
- Explain dropout as an implicit ensemble of subnetworks.
- Derive the MC Dropout uncertainty estimate.
- Understand when and where to apply dropout (and when not to).
Notation
- — dropout probability (probability of zeroing a unit)
- — binary mask vector
- — hidden activations
- — dropped activations
Core Intuition
During training, dropout randomly "turns off" each neuron with probability . This forces the network to not rely on any single neuron — every neuron must be useful independently. At test time, all neurons are active but scaled, effectively averaging over all possible subnetworks. This acts as a powerful regularizer that reduces co-adaptation between neurons.
Dropout Regularization
Dropout: Formulation
Training: For each forward pass, sample a mask with :
The output of the next layer: .
Test time (naive): Use the full network but scale: .
So at test time: multiply weights by .
Inverted Dropout
In practice, scale during training instead (avoids modifying test-time code):
Now — the expected output matches the deterministic network. At test time, no modification is needed.
Dropout as Ensemble Averaging
A network with units and dropout creates possible subnetworks (one for each binary mask). Each forward pass trains one subnetwork. The test-time output (with scaling) approximates the geometric average of all subnetworks' predictions.
Theorem (Baldi & Sadowski, 2013). For linear networks, the dropout-averaged output exactly equals the scaled deterministic output. For nonlinear networks, it is an approximation.
Ensemble perspective:
This is intractable to compute directly but is approximated by the scaled deterministic forward pass.
Effect on Co-adaptation
Without dropout, neurons can "co-adapt" — one neuron compensates for another's mistakes. This creates fragile representations. With dropout:
- Each neuron must be independently useful (since its partners may be absent).
- Features become more robust and transferable.
- Effective model capacity is reduced (regularization).
Analogy: Training a team where random members are absent each day forces everyone to be versatile.
MC Dropout: Bayesian Interpretation
Theorem (Gal & Ghahramani, 2016). Dropout at test time approximates inference in a deep Gaussian process — a form of approximate Bayesian inference.
MC Dropout prediction: Run forward passes at test time with dropout active:
Uncertainty estimate:
where is a model precision term related to weight decay.
Interpretation: The variance across dropout samples captures epistemic uncertainty — high variance indicates the model is unsure because different subnetworks disagree.
Dropout in Different Architectures
- Fully connected layers: Standard dropout with .
- Convolutional layers: Spatial dropout — drop entire feature maps rather than individual pixels. Standard dropout on individual pixels is too aggressive (adjacent pixels are correlated).
- Recurrent layers: Apply to non-recurrent connections only (not hidden-to-hidden). Variational dropout: same mask across time steps.
- Transformers: Applied to attention weights and after FFN layers. Typical .
Common Pitfalls
Pitfall 1. Using dropout with batch normalization. BN estimates batch statistics; dropout changes the distribution. At test time, the BN running statistics are inconsistent with the non-dropped network. Use one or the other.
Pitfall 2. Applying dropout before the final layer without inverted scaling. The logits will be systematically lower at test time.
Pitfall 3. Setting too high. means most of the network is dropped — underfitting. For large models, – is typical.
Summary
- Dropout randomly zeros activations during training: .
- Acts as an implicit ensemble of subnetworks.
- Prevents co-adaptation — neurons must be independently useful.
- MC Dropout at test time provides uncertainty estimates (approximate Bayesian inference).
- Apply dropout rates of 0.1–0.5 depending on model size and task.
Exercises
Exercise 1. Show that inverted dropout (equation 2) has .
Exercise 2. For a linear network with dropout, compute and show it provides an implicit L2 penalty on .
Exercise 3. Prove that the number of possible subnetworks with droppable units is .
Exercise 4. Implement MC Dropout conceptually: for a classification problem, explain how to obtain predictive entropy from stochastic forward passes.
Exercise 5. Derive the equivalent weight decay strength corresponding to dropout rate for a single linear layer (Gal & Ghahramani, 2016).