How does a dropout layer behave differently in training mode versus evaluation mode?

Quick Overview

Asks how a dropout layer behaves in training mode compared with evaluation mode, and how deep learning frameworks switch between the two. Tests understanding of random masking, activation scaling, deterministic inference and common mode-switching mistakes.

How does a dropout layer behave differently in training mode versus evaluation mode?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

How does a dropout layer behave differently in training mode versus evaluation mode? Explain what the layer computes in each mode and how a framework such as PyTorch or Keras switches between them. ```hint Compare expected values Compare the expected output of one unit during training with its output at inference. Something has to make the two agree, and it only needs to happen in one of the two modes. ``` ### What a Strong Answer Covers - What dropout does to activations during training, including how often the random mask is drawn. - How the scale of activations is kept consistent between training and inference. - What the layer computes in evaluation mode and why outputs become deterministic. - How the mode is switched in a common framework, and what goes wrong when it is not. ### Follow-up Questions - Why is the evaluation-mode network only an approximation to averaging the predictions of all the thinned networks? - How does Monte Carlo dropout use training-mode behavior at inference, and what does it cost? - What changes if a codebase uses the older non-inverted form of dropout? - A model with dropout placed before batch normalization looks fine during training but does worse after `model.eval()`. What could cause that?

Overview: Asks how a dropout layer behaves in training mode compared with evaluation mode, and how deep learning frameworks switch between the two. Tests understanding of random masking, activation scaling, deterministic inference and common mode-switching mistakes.

Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

How does a dropout layer behave differently in training mode versus evaluation mode?

Explain what the layer computes in each mode and how a framework such as PyTorch or Keras switches between them.

What a Strong Answer Covers Guidance

  • What dropout does to activations during training, including how often the random mask is drawn.
  • How the scale of activations is kept consistent between training and inference.
  • What the layer computes in evaluation mode and why outputs become deterministic.
  • How the mode is switched in a common framework, and what goes wrong when it is not.

Follow-up Questions Guidance

  • Why is the evaluation-mode network only an approximation to averaging the predictions of all the thinned networks?
  • How does Monte Carlo dropout use training-mode behavior at inference, and what does it cost?
  • What changes if a codebase uses the older non-inverted form of dropout?
  • A model with dropout placed before batch normalization looks fine during training but does worse after model.eval() . What could cause that?