← Amazon Interview Insights

Amazon·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Amazon ML engineer interview, technical phone screen focused on deep learning fundamentals. The dropout question sounds basic until they start asking about the math behind it.

Questions Asked (1)

Q1

Implement dropout in code, and explain the difference between how it behaves during training versus inference, including why you divide activations by the keep-probability during training (inverted dropout). Follow-up: what happens if you leave dropout on at test time?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

I wrote the code fine but fumbled the explanation of the scaling factor.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by writing a clear, vectorized implementation of inverted dropout, then explain the training vs. inference behavior and the rationale for scaling during training. Address the follow-up by describing the consequences of leaving dropout on at test time, emphasizing increased variance and degraded performance.

Pro tip: Mention that inverted dropout ensures the expected value of activations remains unchanged between training and inference, so no scaling is needed at test time—this shows you understand the mathematical justification and practical deployment benefits.

1. Implement inverted dropout

Write a function that during training generates a binary mask with probability keep_prob, multiplies the input by the mask, and divides by keep_prob. During inference, simply return the input unchanged.

2. Explain training vs. inference behavior

During training, dropout randomly zeroes neurons to prevent co-adaptation and force robustness. At inference, no neurons are dropped; the full network is used deterministically.

3. Justify scaling by keep_prob

Dividing by keep_prob during training ensures that the expected sum of activations remains the same as without dropout, so the network's output scale is consistent between training and inference.

4. Address the follow-up

If dropout is left on at test time, predictions become stochastic and the expected output is scaled down by keep_prob, leading to inconsistent and typically worse performance. It also increases variance and breaks deterministic inference.

Key Points to Mention

  • Inverted dropout scales activations during training, not inference, avoiding test-time scaling.
  • Dropout acts as a regularizer by preventing co-adaptation of neurons.
  • At inference, the full network is used without dropout, and no scaling is needed due to inverted dropout.
  • The expected value of activations is preserved by dividing by keep_prob during training.
  • Leaving dropout on at test time introduces randomness and scales outputs by keep_prob, harming performance.
  • Implementation should be vectorized for efficiency, using a mask of the same shape as the input.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.