MLCrack

    DEEP LEARNING · INTERVIEW QUESTION

    What is dropout and how does it prevent overfitting?

    🟢 beginner · Training & Optimization

    Hint: Think about randomly turning off neurons during training.

    Answer

    Dropout randomly sets a fraction p (typically 0.1–0.5) of neuron activations to zero during each training forward pass. Surviving activations are scaled by 1/(1-p) to maintain expected values. How it prevents overfitting:

    Interview reasoning

    1. Prevents co-adaptation: neurons can't rely on specific other neurons, forcing redundant representations.

    2. Ensemble effect: each forward pass trains a different 'sub-network' — predictions average over exponentially many sub-networks.

    3. Adds noise: acts as regularization, similar to adding noise to weights.

    At inference: disable inverted dropout without further scaling, since surviving activations were already scaled during training. The alternative non-inverted convention instead scales at inference; do not combine both conventions.

    Variants: DropConnect (drops weights), Spatial Dropout (drops entire channels in CNNs), DropPath (drops entire layers in residual networks). MC Dropout: using dropout at inference for uncertainty estimation.

    Inverted dropout independently suppresses activations during training and scales survivors by 1/(1-p), preserving their expectation. It regularizes through stochastic subnetwork training, but its impact depends on placement and rate. Evaluation normally disables dropout; deliberate stochastic uncertainty methods require separate validation.

    Worked example. At p=0.2, surviving activations scale by 1.25. A retained activation originally equal to 4 becomes 5, while a dropped activation becomes zero. Averaged over masks its expectation remains 4, but its variance changes.

    Validation

    Compare held-out loss and task quality across rates and seeds, including interactions with normalization and minority classes. Verify repeated evaluation calls are deterministic when ordinary dropout is disabled.

    Common pitfalls

    Dropout cannot compensate for leakage or poor labels. Keeping it accidentally active during serving introduces randomness without proving useful uncertainty estimates.