Fill in the scaled dot-product attention formula.
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
The first blank is the square root of d_k, the per-head key dimension. The second blank is V, the value matrix being weighted by the attention distribution.
Imagine you have a question and a row of labelled boxes. You want to mix the contents of the boxes into one good answer. First, you compare your question card to every label and give each box a score. Big scores can shout over small ones, so you quiet them down by dividing by a fair amount tied to how detailed each label is. The square root part is just the right size of brake so no single label drowns out the rest. Now you have soft weights that say how much each box matters. But weights alone are not the answer. You still need to actually scoop the contents of each box and mix them by those weights. The contents are called V. The two missing pieces are the brake under the slash and the contents at the end.
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.
Identify both blanks immediately, state the formula in full, then spend the rest of the time on why. Derive the variance argument that fixes the scale at the square root of d_k, explain why V is necessary at the end, and connect the formula to its production primitive.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Writing d_k instead of sqrt(d_k), or forgetting V altogether. The square root specifically cancels the standard deviation growth of dot products, and V is what the attention weights are blending.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.