Part 2 of "AI-grunderna"
Read the full series →Attention: the history behind the breakthrough, and why it also explains hallucinations
Attention: the history behind the breakthrough, and why it also explains hallucinations
The previous article in this series ended on a weakness of n-gram models: they forgot everything beyond a small window of preceding words, and could never capture context further back in a sentence. That's exactly the problem attention solved, and the solution is also a big part of the explanation for why modern language models sometimes hallucinate, meaning they sound fully certain about claims that aren't true.
The history: from a translation problem to the entire architecture
Attention wasn't born as a general idea about how language models should work. It was born as a solution to a specific, fairly technical problem in machine translation.
In 2014, Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio described a problem with the translation models of the time (published at ICLR 2015). They were built on an architecture that squeezed an entire source sentence into a single, fixed vector before translating it, regardless of whether the sentence was five words or fifty. The longer the sentence, the more information got lost in that squeeze, and translation quality dropped noticeably for long sentences. Their solution was to let the model, for each word it was about to produce in the translation, choose for itself which parts of the source sentence were relevant at that moment, instead of being forced to compress everything in advance. They called that mechanism attention, and it quickly became influential far beyond machine translation.
The real breakthrough came in 2017, when Ashish Vaswani and coauthors at Google published the paper "Attention Is All You Need." The title was literal: they showed that the sequential, word-by-word processing earlier architectures required could be removed entirely, and a whole model could be built around attention alone. That made two things possible at once. Training could be massively parallelized, since the model no longer had to process text in strict order, which made it practically possible to train on far larger datasets in reasonable time. And the model could weigh in context regardless of how far back it sat in the text, instead of only seeing the last few words the way n-gram models did. That architecture is called the transformer, and it's the foundation of essentially every modern language model.
Worth noting: Yoshua Bengio, one of three authors behind the 2014 attention paper, is also one of three authors of Deep Learning, together with Ian Goodfellow and Aaron Courville. The book served for a long time as the canonical reference work across the entire field of deep learning, and makes it possible to follow the same researcher's thinking from the original idea of attention to the broader theory behind neural networks in general.
What attention actually does
The intuition is simpler than the math behind it. Imagine the sentence "He sat by the bank to wait for the loan." The word "bank" is ambiguous on its own, it could be a riverbank or a financial institution. What decides the meaning is the word "loan" later in the sentence. A reader (human or artificial) has to be able to connect "bank" with "loan" to understand the sentence correctly, even though the words aren't next to each other.
That's exactly what attention does, just for every single word in relation to every other word at once. Each token in a sentence effectively "asks" which other tokens are relevant for interpreting it, gets a kind of relevance score against every other token in the context, and builds its interpretation as a weighted combination of whatever turned out to be most relevant. "Bank" weighs "loan" heavily, regardless of the distance between the words in the sentence. That ability, to freely connect relevant parts no matter where in the text they sit, is exactly what n-gram models' small fixed window could never give.
The connection to hallucinations
Here's the less comfortable part. Attention makes a model better at weighing in the right context. It does nothing to determine whether what the model ends up saying is actually true. The mechanism is optimized to produce the most statistically plausible next word given the context, not to distinguish a verified fact from a well-phrased statement that just happens to sound right.
A research paper from OpenAI and Georgia Tech, published in 2025, gave that connection a much sharper explanation than "the model sometimes guesses wrong." The authors show that hallucinations aren't a mysterious glitch in the system, but a natural statistical result of how models are trained and evaluated. If a model can't distinguish a false statement from a true one based on its training data, errors arise with mathematical necessity, much like a student guessing on a multiple choice exam instead of leaving the answer blank. The point the paper emphasizes is that current evaluation methods reinforce that behavior: a model that guesses confidently is rewarded more often on standard accuracy tests than a model that honestly says "I'm not sure," since only the former can happen to be right.
Attention is the mechanism that makes such a guess convincing. It can blend several locally plausible, fluent patterns into an answer that sounds confident and coherent, without anywhere in the process checking whether any of it is actually true. The more a false statement resembles the structure of true statements the model has seen during training, the more strongly it gets weighted in, and the more certain it sounds. Fluency and truth are simply two different things, decided by different mechanisms, and attention only solves the first one.
What the two articles give you together
Tokens and n-grams gave you the foundation for what AI actually costs in daily operation, and where the idea of predicting the next word comes from historically. Attention gives you the foundation for why modern models became so much better at understanding context, and why that very improvement has a downside: sounding certain and being right are not the same thing, and neither article in this series changes that. Knowing this isn't a reason to stop using the tools. It's a reason to know exactly which kind of answer to double check, and which kind you can trust.
New articles straight to your inbox
Get updates when new articles are published about AI, strategy, and entrepreneurship.
TERBIS