Updated Aug 20, 2026

Attention

The mechanism that lets a model weigh which other parts of the input matter when interpreting each word.

Share

What it means

Meaning depends on context. In "the bank raised rates," *bank* means one thing; in "the bank was muddy," another. Attention is how a model resolves that: when processing each token, it computes how relevant every other token is and blends them accordingly.

Crucially the weighting is learned, not specified. Nobody tells the model that pronouns should attend to the nouns they refer to — it discovers such patterns because they help predict text.

The cost is the catch. Comparing every position against every other means work that grows roughly with the square of the sequence length. Doubling the context roughly quadruples that cost, which is the fundamental reason long contexts are expensive and why much architecture research targets cheaper attention variants.

Why it matters

Attention explains both why models understand context so well and why context has a price. It also underlies the "lost in the middle" effect — attention is finite and unevenly distributed, so material buried mid-context genuinely gets less of it.

In practice

Structure prompts so the important material is prominent rather than buried. Long contexts are not free, and not every token in one gets equal consideration.

Related terms