How does self attention actually work, and why did it change everything?
Here is the single idea that basically all of modern AI rests on, and most people who use these tools every day have no idea it exists.
In 2017 a paper landed with maybe the boldest title in the history of computer science: "Attention Is All You Need." Not a modest claim. Turned out to be true.
The idea, called self attention, works like this. Instead of a model reading a sentence one word at a time in order, it looks at every word against every other word all at once. For every word it effectively asks: out of everything else in this sentence, how much should I care about you right now?
Wait, how does a pile of math know that "it" in a sentence means "the animal" and not "the street"?
Every word gets turned into three small lists of numbers, called a query, a key, and a value. Think of it like a library. The query is what a word is searching for. The key is what a word advertises about itself. The value is what it actually hands over once a match is found. To work out how much "it" should care about "animal," the model compares "it's" query against "animal's" key. Do that comparison against literally every word in the sentence, turn the scores into percentages that add up to a hundred, and "it" becomes a blend of every other word, weighted by relevance. Mostly animal. Barely anything from "the" or "because."
And here is the part that made this a much bigger deal than just being clever. Comparing every word against every other word is not a chain of steps that has to happen in order. It is one big block of matrix multiplication, done all at once. Which meant something people had wanted for years suddenly became possible: throwing enormous amounts of computing power at language and having the extra power actually help.
A model could finally remember the second word by the time it reached the fiftieth. Not roughly. Directly.