Read the sentence and stop at cold. To know what cold is doing there, you glance at other words: drinks, mostly, since that is what is cold. Attention is a mechanism that does this glancing with numbers. For each token it decides how much of every other token to take in, and the answer is a set of weights that add up to one.
Each token computes two small arrows from its embedding. Its key says what it is: the nouns point one way, the verbs another, the temperature words a third. Its query says what it is looking for. "cold" is an adjective hunting for a noun, so its query points where the noun keys point. In a real model the arrows are longer and learned; the idea is the same.
Take the query of cold and dot it with the key of every token, including itself. Arrows that point the same way score high; opposite ways score negative. Ten tokens, ten numbers. The nouns come out on top because that is what a temperature adjective looks for.
Raw scores can be any size. Run them through softmax, the same move that turned the next-token chart into probabilities, and they become positive shares that sum to one. Drinks takes the most, café and day some, the glue words almost nothing. These are the attention weights, and they are the arcs from the first scene.
The weights decide how much; the values decide what. Each token also has a value vector, a few dials of content. The output for cold is the weighted average of everyone's values: mostly drinks, a little café and day. Cold walks away carrying "noun-ish, thing-like" information it did not have before. That is the whole point: tokens updating themselves from context.
Every token does this at the same time, each with its own query. Slide through them. The verbs look for their nouns, the nouns look for their adjectives, the glue words look at nothing in particular. One mechanism, run ten times in parallel.
All ten rows together make the attention matrix: row i is what token i takes from each column. This is one *attention head*. A transformer layer runs many heads side by side, each with its own key and query matrices, so one head can track adjective-to-noun while another tracks verb-to-subject. Notice one thing the matrix does not know: which token comes first. That is next.
Shuffle the sentence.
The score is a dot product of cold's query with drinks' key, and neither arrow knows where its token sits in the sentence. Shuffling changes nothing. Attention on its own is blind to order, which is a real problem: "the dog bit the man" and "the man bit the dog" would look identical. Positional encoding fixes that.