Attention

Also called self-attention, attention mechanism

The step inside a transformer that decides which other words in the text matter most for understanding each word.

To read a sentence well, you have to know which earlier words each word depends on. Attention is the transformer's way of doing that. For every token, the model scores how relevant every other token in the input is, and blends their information together in proportion to those scores. It does this many times over, in many layers, each picking up different kinds of links: grammar, meaning, who did what.

Because every token is compared with every other, the work grows quickly as the input gets longer. That's part of why context windows have limits, and why models can handle a fact in the middle of a long document worse than one near the start or end.

For example

In "The trophy didn't fit in the suitcase because it was too big", attention is how the model links "it" to the trophy rather than the suitcase.

WITH PLUS

Put it to use

Where you'll meet attention in ChatGPT, Gemini and Claude, how to use it there, and the mix-up most people make.

Daily Bytes Plus is in the Android app.