Module 1 · Inside the transformer · Lesson 2
Attention, step by step
How each token gathers information from the others through queries, keys and values, and why the formula looks the way it does.
By the end of this lesson you can
- Derive scaled dot-product attention and explain the role of Q, K, V and the √d scaling
- Compute a small attention example by hand, including the causal mask
- Explain why transformers use multiple heads and what heads have been observed to learn
- Place attention inside a transformer block and the residual stream