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.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Dropout placement inside a transformer block is one of those details that seems trivial until you try to put it in the wrong place. The 2017 paper specified three canonical sites (attention weights, FFN output, residual stream) and almost no published architecture has deviated. The placements are not arbitrary; they reflect a careful choice about which activation surfaces are well conditioned for stochastic regularization and which would be destabilized by it.
This question tests whether you've thought carefully about where in the computation graph dropout makes sense. The senior answer connects the three correct placements to the regularization theory and explains why two superficially plausible alternatives (norm internals, Q/K/V projections) are universally avoided.
The three canonical sites
Attention dropout sits on the post-softmax attention weights, before the weighted sum over V. The softmax produces a distribution over tokens for each query; dropout zeros random entries in that distribution and the result is renormalized (or not; implementations vary, but the standard is to drop without renormalization, accepting the lossy sum). The regularization effect is to perturb which tokens get attended to on each forward pass, preventing the model from over-relying on any single token to token edge.
FFN output dropout sits on the output of the position-wise feed-forward network, before the residual add. This is standard MLP dropout: zero random dimensions of the FFN output vector, forcing the model to maintain redundant feature representations.
Residual / post-sublayer dropout sits on the sublayer output before it is added to the residual stream. This regularizes how much each sublayer contributes to the running residual. It's the strongest dropout location because it perturbs the residual stream itself, which every later sublayer reads from.
In BERT, T5, and the original 2017 transformer, these three sites all use the same dropout rate (typically 0.1). Modern recipes sometimes vary the rate per site or disable some sites entirely.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
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.
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?
Pre-softmax dropout would zero some logits; after softmax, the remaining nonzero logits would absorb almost all the probability mass via the exp normalization, defeating the regularization. Post-softmax dropout zeros some attention edges while keeping the rest correctly normalized (after renormalization).
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases 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.
60 second bullets to scan on the way to the call.
The three canonical dropout sites in a transformer block
Why post-softmax weights are the right attention dropout target, not Q/K/V projections
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.