When you read the sentence "The cat sat on the mat because it was tired," you immediately know that "it" refers to the cat—not the mat. This seemingly simple act of disambiguation has been a major challenge for artificial intelligence. The breakthrough came with self-attention, the core mechanism behind modern large language models like ChatGPT, Claude, and Gemini.
Self-attention works by allowing every word in a sentence to simultaneously compare itself to every other word. Each word computes a 'connection strength' to others, building a web of relationships. For example, the word "it" scans the sentence and finds the strongest connection to "cat," resolving the pronoun correctly. This entire process happens in parallel, enabling the model to grasp context without forgetting earlier parts of the text.
Before self-attention, language models processed words one by one, often losing track of long-range dependencies. Self-attention, introduced in the Transformer architecture, lets every word 'see' every other word instantly—turning attention inward rather than outward. That small shift transformed AI's ability to understand language, paving the way for today's conversational agents.
This explanation is part of an ongoing series that breaks down AI concepts in under 60 seconds, including earlier topics like positional encoding, mixture of experts, KV cache, softmax, and more.