Each row of the post-softmax attention weight matrix corresponds to which side of the QK product?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Each row corresponds to one query token; entries along the row are that token's weights over all key tokens; row sums to 1 because softmax normalizes per row.
Picture a table where each row belongs to one person who is asking a question. That row lists how much attention this person pays to every other person in the room. The numbers in the row are slices of a pie that has to add up to a whole pie, because the person is dividing 100 percent of their attention across the room. Different rows belong to different askers, each splitting their own pie independently.
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.
4m: matrix shape from QK^T, softmax along the key axis, row-sum-to-1 invariant, mask interaction, decode-time degenerate case, and operational consequences for visualization and FlashAttention.
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.
Swapping rows and columns. Rows index queries (who is asking) and columns index keys (who is being asked about). Flipping this breaks every subsequent operation.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.