Dropout

Machine Learning
Introduced by
Srivastava, N.; Hinton, G.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R.
Year
2014
Type
Stochastic regularization technique for neural networks

What does it do?

Dropout is a stochastic regularisation technique for training neural networks.

At each training step, every neuron is kept with retention probability p and otherwise removed from that step's computation, which discourages units from relying on specific co-adapted partners. Srivastava et al. (2014) gave the comprehensive treatment of the method in the Journal of Machine Learning Research.

The intuition behind the method

A useful way to picture dropout is a team in which any member may be absent on a given day. No one can rely on a single colleague, so each person becomes able to handle more of the work. In a neural network, dropout randomly removes units during training, so no fixed subset can carry the signal alone. Each mini-batch trains a different thinned sub-network, and at test time the full network with scaled weights serves as a heuristic approximation to averaging over these sub-networks.

History

Srivastava, Hinton, Krizhevsky, Sutskever and Salakhutdinov published the comprehensive treatment of dropout in the Journal of Machine Learning Research in 2014. The paper reported experiments across several application areas and discussed dropout in relation to model averaging. Later work, including Yarin Gal's 2016 PhD thesis on uncertainty in deep learning, connected dropout to uncertainty estimation through Monte Carlo Dropout at inference time.

When to use it

Choose dropout when a feedforward, convolutional or recurrent network overfits, or is expected to overfit, and the model is large relative to the available training data. It is most often applied to fully connected layers, with p = 0.5 as a common starting point for hidden layers. Avoid relying on it alone when the dataset is very small or the network is shallow, since simpler regularisers such as L2 weight decay or early stopping may then be a more economical first step. Be cautious when the same layer uses batch normalisation, because the two interact and the gain may be small or negative. For recurrent networks, use a variant that keeps the mask consistent across time steps rather than standard per-step masking.

Limitations and considerations

  • Slower convergence: because each step trains only a thinned sub-network, training usually needs more epochs to reach the same training loss.
  • Benefit depends on context: shallow networks, very small datasets, or networks already regularised by batch normalisation may gain little or be hurt.
  • Interaction with batch normalisation: dropout changes the variance of the inputs that a following batch-normalisation layer sees, and naive combination can degrade performance.
  • Sensitivity to p: a retention probability that is too low can impair convergence, while one that is too high provides little regularisation, so p must be set on validation data.
  • Recurrent networks: a fresh mask at every time step disrupts temporal dependencies, which is why recurrent variants that share the mask across time are needed.
  • Reduced effective capacity: because dropout is a regulariser, it reduces the expressive power of the network, so larger models with more units are often needed to gain its full benefit, which adds computational overhead.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Simple to add: it is a random mask on existing activations, with p as the main hyperparameter, so it can be inserted into an existing layer stack without adding trainable parameters.
  • Implicit ensemble view: training samples many thinned sub-networks that share weights, and the test-time weight scaling approximates averaging their predictions.
  • Discourages co-adaptation: because any unit may be removed at any step, the network cannot depend on particular neighbouring units and is pushed toward redundant representations.
  • Applicable across layer types: the masking step works on dense and convolutional layers, and recurrent networks can use it with a suitable variant.

Applications

  • Regularising fully connected classifier layers in image recognition networks.
  • Reducing overfitting in natural language processing and sequence-to-sequence models.
  • Estimating predictive uncertainty by keeping dropout active at inference time (Monte Carlo Dropout).
  • Fine-tuning new classification heads on pre-trained backbones, with dropout added to the newly initialised layers.
  • Recurrent models for sequence data, which need a dropout mask held constant across timesteps; Keras exposes a separate recurrent_dropout rate for the recurrent units of layers such as GRU and LSTM.

How it works

How it works

1

Before each forward pass, a binary mask is sampled independently for every neuron in the layer. Each mask entry is drawn from a Bernoulli distribution with retention probability p, so a neuron is kept with probability p and dropped with probability 1 − p. The paper's common defaults are p = 0.5 for hidden layers and p = 0.8 for the input layer. Deep learning libraries usually take a drop rate rather than a retention probability. In Keras, for example, the dropout arguments are dropout rates (the dropout argument of a recurrent layer is the rate for its input units). The drop rate is therefore 1 − p: the input-layer default p = 0.8 corresponds to a rate of 0.2, and the hidden-layer default p = 0.5 corresponds to a rate of 0.5. The set of active neurons changes with every mini-batch.

Formula
r_j^{(l)} \sim \text{Bernoulli}(p)
2

The mask is applied element-wise to the layer's activations using the Hadamard (element-wise) product. Neurons whose mask entry is zero are removed from the computation for that forward pass, so they contribute neither to the next layer's activations nor to the gradients that flow back through them.

Formula
\tilde{\mathbf{y}}^{(l)} = \mathbf{r}^{(l)} \odot \mathbf{y}^{(l)}
3

The masked activations pass forward through the remaining active connections, as in a standard fully connected layer. Each mini-batch therefore trains a different thinned sub-network. The paper interprets the overall procedure as approximating averaging over a very large number of such architectures that share weights.

Formula
z_i^{(l+1)} = \mathbf{w}_i^{(l+1)} \tilde{\mathbf{y}}^{(l)} + b_i^{(l+1)}
4

Gradients flow back only through the neurons that were active in the corresponding forward pass, so weights attached to dropped neurons receive no update at that step. Because the mask multiplies the activations, the error propagated back to a layer is multiplied element-wise by the same mask before the derivative of the activation function is applied. For each weight, the gradient is the product of the downstream error and the masked activation of its source neuron, so it is zero whenever that neuron was dropped. Each weight is therefore updated only on the mini-batches in which its source neuron was retained. In recurrent networks the same mask must be used across timesteps so that the error signal is propagated consistently through time. The resulting noise in the optimisation trajectory depends on p and the architecture.

5

At test time all neurons are kept active. Because each neuron now receives more inputs than it did during training, the outgoing weights are scaled by the retention probability p, so the expected activation at test time matches the expected activation seen during training. This weight-scaling rule is a heuristic and a practical approximation to averaging over the sub-networks, not an exact equivalence. The inverted formulation divides activations by p during training instead, so no rescaling is needed at inference time.

Formula
\mathbf{W}_{\text{test}}^{(l)} = p \cdot \mathbf{W}^{(l)}

Common pitfalls

  • Placing dropout before the activation function, on pre-activations, departs from the standard formulation. The standard placement masks the layer's activations after the nonlinearity, as in the mechanics above and in the Keras example where Dropout follows each Dense layer with its activation. The two placements compute different things, so check the choice on validation data.
  • Using standard per-timestep dropout in recurrent layers instead of a mask that is consistent across timesteps.
  • Combining dropout and batch normalisation in the same layer without checking their interaction on validation data.
  • Forgetting to disable dropout at inference time (or failing to apply weight scaling), which makes test predictions noisier and weaker.
  • Treating dropout as a substitute for more training data: it reduces overfitting but cannot replace additional examples.

Frequently asked questions

What retention probability p should I use?

Start from the defaults given in the original paper: p = 0.5 for hidden fully connected layers and p = 0.8 for the input layer. These are retention probabilities. Frameworks such as Keras take a drop rate instead, so set the rate to 1 − p (0.2 for the input layer and 0.5 for hidden layers). These are starting points rather than optimal values for every architecture, so tune p on validation data.

Should I disable dropout when evaluating the model?

Yes. Dropout must be switched off during validation and test inference. Most frameworks (PyTorch, Keras, TensorFlow) handle this when you call model.eval() or set training=False, but confirm that the setting is correct, because leaving dropout active at inference time adds noise to predictions.

Does dropout work with batch normalisation?

Combining both in the same layer can be problematic. Dropout changes the variance of the inputs seen by a following batch-normalisation layer, which can disrupt its statistics. If both are used, compare the placement and the combined performance on validation data rather than assuming either order is safe.

How is inverted dropout different from the original formulation?

In the original formulation the weights are scaled by p at test time. Inverted dropout divides the retained activations by p during training, so the expected activation is preserved during training and no rescaling is needed at test time. Inverted dropout is the common implementation in modern frameworks because it keeps the inference path simple.

Related methods

Sources

  1. Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I., & Salakhutdinov, R. (2014). Dropout: A Simple Way to Prevent Neural Networks from Overfitting. Journal of Machine Learning Research, 15, 1929–1958.

    Open publication reference
  2. Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep Learning (Ch. 7: Regularization for Deep Learning). MIT Press.

    ISBN: 978-0-262-03561-3