← Back to Deep Learning Mind Map
🧠 Deep LearningID: dropout

Dropout

🎯Core Definition
Dropout randomly zeroes neurons with probability pp during training to prevent co-adaptation. The standard implementation is Inverted Dropout: sample a Bernoulli mask m∼Bernoulli(1−p)m \sim \text{Bernoulli}(1-p) and scale y=11−pm⊙xy = \frac{1}{1-p} m \odot x so that E[y]=E[x]\mathbb{E}[y] = \mathbb{E}[x]; at inference no scaling is applied and the full network is used.
💡Use Cases
the main regularizer for fully-connected and attention layers (attention output and FFN in Transformers), typically p=0.1p = 0.1–0.30.3 for LLM pretraining/finetuning; interviews ask about the train/inference formula difference, why inference must disable it, and its order with BN.
⚡Key Problems Solved
it performs implicit ensembling over 2n2^n subnetworks, substantially reducing overfitting (original paper: test error reduced by roughly 4–5%). Inverted dropout moves the scaling into training so inference is cost-free — this is PyTorch's default (torch.nn.Dropout acts only in train mode). When combined with BN, apply dropout BEFORE normalization: BN's re-normalization would absorb dropout's scaling and noise, weakening the regularization.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Dropout.
Use Cases
In production engineering, what are the primary use cases for Dropout and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write the inverted-dropout training formula y=11−pm⊙xy = \frac{1}{1-p} m \odot x (m∼Bernoulli(1−p)m \sim \text{Bernoulli}(1-p)) and explain why inference needs no scaling to preserve the expectation.
2
What is the mathematical relationship between naive dropout (scaling at test) and inverted dropout (scaling at train)? Why does every framework implement the inverted version?
3
Why does dropout regularize: its link to ensemble learning and co-adaptation — and which layers is it usually applied to?
4
What happens if dropout is not disabled at inference (model.eval())? What problems arise from train/inference inconsistency?
5
What order should be used when combining dropout with BatchNorm, and why is dropout usually applied before BN?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Dropout"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardNorm Methods ComparisonNext Card →Label Smoothing

🔗 More Deep Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/DL/card/dropout
中文速览与面试要点

Dropout (Dropout)

定义: Dropout 以概率 p 随机置零神经元, 防止共适应 (co-adaptation)。标准实现是 Inverted Dropout: 训练时生成伯努利掩码 m Bernoulli(1-p) 并缩放 y = 11-p m x, 使 E[y] = E[x]; 推理时不做任何缩放, 直接使用全量网络。 使用场景: 全连接层与注意力层的正则化主力 (Transformer 的 attention 输出与 FFN), LLM 预训练/微调中 dropout 通常取 0.1~0.3; 面试常问: 训练/推理公式差异、为什么推理必须关闭、与 BN 的顺序。 解决的问题: 相当于对 2^n 个子网络做隐式集成, 显著缓解过拟合 (原论文: 测试错误率下降约 4~5%)。Inverted 版本把缩放移到训练端, 推理端零额外计算, 是 PyTorch 默认实现 (torch.nn.Dropout 仅在前向为训练模式时生效)。与 BN 并用时注意顺序: 一般先 Dropout 再 BN, 否则 BN 的重新归一化会吸收掉 Dropout 的缩放与扰动, 削弱正则效果。

核心要点

  • 写出 Inverted Dropout 训练公式 y = 11-p m x (m Bernoulli(1-p)) 并解释为什么推理时不缩放能保持期望一致?
  • 朴素 Dropout (推理时缩放) 与 Inverted Dropout (训练时缩放) 的数学关系? 为什么工程上都用 Inverted 版本?
  • Dropout 为什么能正则化: 与集成学习、共适应 (co-adaptation) 的关系? 一般在哪些层用?
  • 模型推理 (model.eval()) 时忘记关闭 Dropout 会怎样? 训练/推理行为不一致会导致什么问题?
  • Dropout 与 BatchNorm 并用的顺序? 为什么一般先 Dropout 再 BN?