Attention, Explained: The One Idea Behind Every Modern AI Model
Strip away the hype and nearly every frontier model rests on a single mechanism. Here's what attention actually does — and why it changed everything.
- 01Attention lets a model weigh the relevance of every other token when processing each token, replacing fixed-order processing with learned, content-based relationships.
- 02Its breakthrough property is parallelism: unlike earlier sequence models, attention processes a whole sequence at once, which is what made training at scale possible.
- 03The mechanism's cost grows with the square of sequence length — the central engineering tension that much of modern efficiency research is trying to solve.

If you understand one idea in modern AI, make it attention. Almost every large language model, image model, and multimodal system in use today is built on it. The word gets thrown around loosely, but the actual mechanism is precise, elegant, and — once you see it — surprisingly intuitive. Here's what it really does.
The problem attention solves
Language is full of long-range relationships. In the sentence "The trophy didn't fit in the suitcase because it was too big," what does "it" refer to? You know it's the trophy, because of meaning, not position. The relevant word could be anywhere in the sentence — or paragraphs away.
Earlier approaches to sequences processed tokens in order, passing information along step by step. That made it hard to connect distant words: information had to survive a long chain of intermediate steps, and it tended to fade. It was also inherently sequential — you had to process token one before token two — which made it slow to train and hard to scale.
Attention throws out the fixed-order assumption. Instead of passing information down a chain, it lets every token look directly at every other token and decide, based on content, which ones matter.
How it actually works
For each token, the model produces three vectors: a query (what am I looking for?), a key (what do I offer?), and a value (what information do I carry?). To process a given token, the model compares its query against the key of every token in the sequence. Where a query and a key align well, that pairing gets a high score; where they don't, a low one.
Those scores are normalised into weights that sum to one — a distribution of "how much attention should I pay to each other token." The model then takes a weighted blend of all the value vectors according to those weights. The result is a new representation of the token that is informed by exactly the other tokens that are relevant to it, with relevance learned from data rather than hard-coded.
That's the whole core idea. "Self-attention" just means the tokens are attending to others within the same sequence. "Multi-head" attention means doing this several times in parallel with different learned query/key/value projections, so the model can attend to different kinds of relationship at once — one head might track grammatical subject-verb links, another might track topical similarity. Stack many such layers and the model builds up an extraordinarily rich, context-dependent understanding of the input.
Why it changed everything
The conceptual elegance is real, but the reason attention took over is practical: parallelism. Because every token's attention can be computed independently and simultaneously, you can process an entire sequence in one parallel operation rather than crawling through it one step at a time. That maps beautifully onto the parallel hardware used to train large models. The move from sequential processing to parallel attention is, more than any single other factor, what made it economically possible to train models at the scale that produced the current generation of AI.
It also solved the long-range problem directly. There's no chain for information to decay along — any token can attend to any other in a single step, so a pronoun can connect to its referent no matter how far away it sits.
The catch that drives modern research
Attention has one expensive property: to let every token attend to every other token, you compute a score for every pair. For a sequence of length N, that's roughly N-squared comparisons. Double the context length and you roughly quadruple the cost. This quadratic scaling is the central tension in modern model design — it's why context windows were historically limited, and why an enormous amount of research goes into clever approximations, sparse attention patterns, and alternative architectures that try to keep attention's power while taming its cost.
That tension is worth holding onto, because it explains a huge amount of what's happening at the frontier: the race for longer context, the efficiency breakthroughs, the architectural experiments. They're all, in one way or another, wrestling with the same elegant, expensive idea — letting everything look at everything, and paying the price for the privilege.
Ask Relay — he reads every question himself and replies personally by email.
