Identify the locations where dropout typically sits inside a transformer block
Three canonical dropout sites: attention weights (post-softmax), FFN output, and residual stream. Norm internals and Q/K/V projections do NOT get dropout.
Think of dropout like a coach who randomly benches a few players every practice so the team can't rely on one star to carry every game. In a transformer block, there are three sensible benches: right after the model decides which earlier words to focus on (so it doesn't get hooked on one specific word-to-word connection), on the output of the per-word processing layer (so each word learns sturdier features), and on the shared bus that carries information between blocks (so no single layer becomes load-bearing). Don't bench players inside the rescaling step itself (that ruins the whole point of stabilizing the signal), and don't bench the players that build the focus scores in the first place (that just adds useless noise). In modern frontier LLMs, dropout is often turned off during pretraining because the data is so vast the model is under-fit anyway.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6 min: name the three canonical sites, explain the regularization role of each, justify why norm internals and Q/K/V projections are excluded, and discuss modern pretraining-vs-fine-tuning practice.
Real products, models, and research that use this idea.
- BERT base (2018): dropout 0.1 on attention weights, FFN output, and residual stream: the canonical three.
- Llama 3.1 pretraining: dropout set to 0 across all sites; the model is data bound, not parameter bound.
- Mistral 7B instruction tuning: dropout 0.05 on FFN output and residual stream re-enabled to combat overfitting on small SFT datasets.
- Hugging Face's `LlamaConfig.attention_dropout` defaults to 0.0 but exposes the parameter for fine-tuning use cases.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy is attention dropout applied to post-softmax weights rather than pre-softmax logits?
QWhy does frontier pretraining set dropout to 0 when classic ML wisdom says dropout always helps generalization?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Placing dropout inside the RMSNorm computation. The norm exists to stabilize activation statistics; injecting dropout there defeats its purpose. Same with Q/K/V projections; dropout there destabilizes the attention dot product.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.