Self-attention lets every token in a sequence compare itself with every other token. For each pair, the model computes a compatibility score, normalises the scores with a softmax into weights, and returns a weighted average of the value vectors. The result is a contextual representation: the same word gets a different vector depending on its neighbours.
§1 · Self-attention · p.4
Passage 1