Learn AI Math

Self-Attention

What is Self-Attention?

In one sentence: Self-attention lets every word in a sentence look at every other word and decide which ones matter most for understanding it.

When the model reads "The dog chased the ball because it was bouncy," self-attention helps "it" pay strong attention to "ball." Each word gathers useful information from the others, so its meaning gets richer. This happens inside every layer of a Transformer.

What does Self-Attention look like?

In "bank of the river," self-attention links "bank" to "river," so the model knows it is not a money bank.

Why does Self-Attention matter?

Self-attention is the key idea that made Transformers, and today's LLMs, so powerful.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.