LearnQuestion bank

Explain what dropout does during training and inference, why it regularises, and how it interacts with batch normalisation.

ML engineeringTechnicalMedium

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Training: randomly zero units with probability p; inverted dropout scales kept units by 1/(1-p).
  • Inference: dropout off, all units active, no scaling.
  • Regularisation: less co-adaptation, noise injection, implicit ensemble of subnetworks.
  • Placement: rare in conv layers and modern transformer attention; common in MLP heads.
  • BN interaction: train/test variance shift; place dropout after BN or use sparingly.

In full

Dropout randomly sets a fraction p of activations to zero during training; with inverted dropout the surviving units are scaled by 1/(1-p), so the expected activation is unchanged and at inference dropout is simply turned off, with all units active and no rescaling. It regularises by preventing units from co-adapting to each other, injecting noise, and approximating an ensemble over many subnetworks, which makes the learned features more robust rather than memorising one fixed pathway. It is usually used sparingly in conv layers and in modern transformer attention, but more commonly in MLP heads and classifier layers. With batch normalisation the interaction is delicate: BN uses batch statistics in training and running statistics at test time, while dropout changes the activation distribution and variance, so train and inference behaviour can drift apart. In practice I place dropout after BN or keep it light, and I validate rather than assume it helps.

Checked against sources by an independent AI reviewer.

What a strong answer covers

  • Randomly zeroes units with probability p. Inverted dropout scales the kept units by 1/(1−p) so that inference needs no scaling.
  • Interpretations: an implicit ensemble of subnetworks, less co-adaptation, noise injection.
  • Placement and rates: rare in conv layers and modern transformers’ attention; common in MLP heads.
  • Interaction with BN: variance shift between train and test, so dropout is usually placed after BN or used sparingly.

Common mistakes

  • leaving dropout active at inference (forgetting model.eval())
  • scaling twice.