The 60-second answer
Project token representations into queries, keys, and values, then compute scaled dot-product scores QKᵀ/√d. Apply masking when needed, softmax the scores, and use them to take a weighted sum of V.
Build the answer in this order
Project token representations into queries, keys, and values, then compute scaled dot-product scores QKᵀ/√d.
Apply masking when needed, softmax the scores, and use them to take a weighted sum of V.
Multi-head attention performs this in parallel subspaces so different heads can model different relationships.
Track tensor shapes, masking semantics, numerical stability, and O(n²) sequence-length cost.
A useful interview mental model
This is the shape of a strong answer—not a script to memorize.
Senior-level signal
- Discuss memory bandwidth and attention/KV-cache costs, not only FLOPs, when reasoning about real latency.
- Tie architectural choices to the task, context length, training objective, and deployment constraints.
What the interviewer is really testing
Likely follow-up questions
Common weak-answer patterns
- Reciting a definition without mechanism or assumptions.
- Claiming one technique is always better without a data regime.
- Stopping before failure modes, validation, or deployment implications.