Common questions this module answers
What does attention do in a transformer?
For every token, attention computes how relevant every other token is, then mixes their information together. It is how 'it' figures out whether it refers to 'the animal' or 'the street' — by attending to the right earlier token.
Why is attention quadratic — O(n²)?
Every token compares itself against every other token, so n tokens require n × n comparisons. Doubling context length quadruples attention compute, which is why long context windows are expensive.
What are queries, keys and values?
Each token emits a query ('what am I looking for?'), a key ('what do I contain?') and a value ('what do I pass along?'). Attention scores are query–key dot products; the output is a score-weighted sum of values.