Attention, Explained Like a Group Chat
One idea from a 2017 translation paper sits inside every model you use. What attention is, in plain words, why it made scaling laws possible, and how GPT-2 grew into reasoning models and Kimi K3.
The idea inside every AI model you use came from a paper about translating English into German.
In June 2017, eight researchers at Google posted Attention Is All You Need. It beat the best translation systems of the day, and the big version trained in 3.5 days on one machine with eight graphics cards. Nothing in it is about chatbots. Yet ChatGPT, Claude, Gemini, DeepSeek and Kimi all run on the idea at its centre. The T in GPT stands for Transformer, the name the paper gave its model.
The authors are worth a look too. A footnote says the order of their names is random, because all eight contributed equally. Nine years later, none of them works at Google. Seven started companies, and two are now at OpenAI. Here is where each one went.
This is the explanation I would give a friend who knows a bit of code, or a student who has never opened a research paper. By the end you will know what attention does, why it let AI labs turn money into intelligence on a predictable curve, and how one 2017 design grew into GPT-2, then reasoning models, then Kimi K3. The first four sections need no maths. If you have ever built a backend, one of them will feel familiar.
The Telephone Line
Before 2017, the best language models read the way you listen to someone talk: one word at a time, in order. After each word they updated a single running note about everything heard so far, then passed that note on to the next word.
Think of the children’s game of telephone. A message is whispered down a line, one person at a time. I will call this the Telephone Line. It has two problems, and both matter for the rest of this essay.
The first is forgetting. The note has a fixed size, so every new word squeezes out a little of the old ones. In 2014, the paper that first added attention to translation called this fixed-size note “a bottleneck”. Read the sentence below: by the time the model reaches “are”, it has to remember that “keys”, five words back, was plural.
The second is speed. Word six cannot be processed until word five is done. The 2017 paper says it plainly: this “inherently sequential nature precludes parallelization”. Hold on to that one. It turns out to be the whole story.
Before 2017
The Telephone Line
2017, attention
The Group Chat
The Group Chat
Attention throws the line away. Put every word of the sentence into one Group Chat. Every word can read every other word’s message directly, in a single step, no matter how far apart they sit.
But a word does not read everyone equally. For each word, the model decides how much to listen to each of the others, as a share of its focus that adds up to 100%. That share is the “attention”. A word then updates its own meaning with a blend of what it heard, weighted by those shares.
Google’s 2017 write-up showed this with a sentence I still find the clearest test. In “The animal didn’t cross the street because it was too tired”, “it” is the animal. Change “tired” to “wide” and “it” becomes the street. French gives the two nouns different genders, so a translator has to get this right. Try it:
Try it
Who is “it”?
looks at
58%
animal
looks at
9%
street
the rest
33%
everything else
That is the whole idea. Every word looks around the Group Chat, decides who matters, and rewrites its own meaning from what it heard. A model does this in layers, dozens of times over, so by the top layer each word carries its entire context with it.
One small honesty: models read tokens, which are words or pieces of words. “Unbelievable” might be three tokens. I will keep saying “words” because the picture is the same.
The Fuzzy Lookup
If you have written backend code, you already know most of attention. You just know the strict version.
A dictionary lookup like prices["tea"] compares your key with every stored key. One matches exactly, you get its value, and the rest are ignored. Attention does the same lookup, but every key matches a little. It scores each key against what you asked for, turns the scores into shares that add up to 100%, and hands back a blend of all the values. I call this the Fuzzy Lookup.
This is where the three famous letters come from. Each word makes three things from itself. A query: what am I looking for? A key: the label on my drawer, what do I have? A value: what I hand over if someone picks me. “It” sends out a query that roughly means “something that can be tired”, the key on “animal” matches it well, and most of the animal’s value flows into the new meaning of “it”.
What you already know
A normal lookup
What attention does
The Fuzzy Lookup
Every word makes three things from itself
Query, key and value
Nobody writes these queries and keys by hand. Each word turns into its query, key and value by passing through three tables of numbers, and the model learns those tables during training. The Fuzzy Lookup is the fixed part. What gets looked up is learned.
The Picture in the Paper
The paper has two diagrams that every course on this topic copies. Here they are as printed. Read them from the bottom up.
Figure 1 confuses almost everyone the first time, because it shows two towers. That is because the 2017 model was a translator. The left tower, the encoder, reads the English sentence. The right tower, the decoder, writes the German one word at a time, glancing across at the encoder as it goes. GPT and every chat model since kept only the writer. Flip the switch to see what was dropped.
Figure 1, the original
The Transformer
Encoder: GPT drops itReads the encoder: droppedFigure 2, left
One head

Figure 2, right
Many heads

What is left is surprisingly small: one block, repeated. Here it is again, redrawn and set moving.
The left one is a single layer. First the Group Chat: every word reads the others. Then a feed-forward step, where each word thinks on its own about what it just heard. Andrej Karpathy describes the pair as communication followed by computation. Between them, “add & normalise” keeps the original signal and the update side by side, so nothing is lost on the way up. The paper stacked six of these layers. Modern models stack dozens.
The word “masked” matters. A model like GPT writes one word at a time, so during training each word may only read the words before it. Hiding the future is what turns a reader into a writer: the only thing left to learn is the next word.
Figure 1, redrawn
One Transformer layer
Figure 2, redrawn
Inside one attention head
Multi-head attention
Run eight heads at once, then join them
The right diagram is one attention head, step by step: score every pair, scale the scores down, hide the future, turn scores into shares, blend the values. It is the Fuzzy Lookup again, drawn as a pipeline. The original model ran 8 of these heads side by side, so one head can track who did what while another tracks which adjective belongs to which noun.
Why It Scaled
Here is the part most explanations skip, and I think it is the most important one.
A graphics card is thousands of small calculators that want to work at the same time. The Telephone Line cannot use them well. Word six waits for word five, so most of the chip sits idle. The Group Chat hands every word to the chip at once. Every score in the grid can be computed at the same moment.
Same sentence, same chip
The race that decided everything
2017 base model
12hours
On one machine with 8 graphics cards. The big version took 3.5 days.
The result
28.4
BLEU on English to German, more than 2 points above every earlier system, ensembles included.
Karpathy, 2022
“A general-purpose differentiable computer.”
His three reasons: it can express a lot, it trains well, and it runs in parallel.
That is why the 2017 paper could report 28.4 BLEU on English to German, more than 2 points above every earlier result, after 3.5 days of training. The base model, at 65 million parameters, trained in about 12 hours. In 2022 Karpathy called the Transformer “a general-purpose differentiable computer”, and the last of his three reasons was exactly this: it runs in parallel.
Attention did not make models smarter in one jump. It made them trainable at a scale nobody could reach before, because it turned language into the shape of work that chips are built for. Everything after 2017 follows from that.
The Three Dials
Once training was parallel, labs could ask a simple question: what happens if we just make it bigger?
OpenAI tried. GPT-1 in 2018 was a Transformer trained to guess the next word in a few thousand books. It had 117 million parameters. GPT-2, in February 2019, had 1.5 billion and wrote such convincing text that OpenAI released it in stages. GPT-3, in 2020, had 175 billion and could do new tasks just from a few examples in the prompt.
In January 2020, Jared Kaplan and colleagues at OpenAI published Scaling Laws for Neural Language Models. They turned three dials: the size of the model, the amount of text, and the computing power spent on training. I call them the Three Dials. Turn any one up, and the model’s error falls along a straight line on a log chart, with some trends holding over more than seven orders of magnitude. The shape of the model, how deep or wide, barely mattered.
Dial one
Bigger model
Dial two
More data
Dial three
More compute
Then they turned all three
Each bar drawn to scale
GPT-3 is 1,500 times the size of GPT-1, two years later. The design barely changed in between. They turned the dials.
A straight line is a prediction. For the first time, a lab could say how good a model would be before spending the money to train it. That turned AI from research into something closer to engineering, and it is how labs could justify each larger training run before paying for it.
The same paper also tested the Telephone Line. The older recurrent models stopped improving after fewer than 100 tokens of context, while the Transformer kept getting better across the whole context. That is the link I wanted to make in this essay. Scaling laws needed a design that could use the chips and use long context. The Group Chat was the first that could do both.
The dials had to be balanced, though. In 2022, DeepMind’s Chinchilla showed most big models were starved of data. Their 70-billion-parameter model, trained on 1.4 trillion tokens, beat the 280-billion-parameter Gopher with the same compute. Rich Sutton had written the moral in 2019, in The Bitter Lesson: methods that make use of computation win, “and by a large margin”. Ilya Sutskever had said a version of it in 2015: train a large enough network on enough data and “you will almost necessarily succeed”.
The Group Chat Bill
Nothing is free. If every word reads every other word, the work grows with the square of the length. Ten words means 100 scores. A thousand words means a million. Double the chat and the bill goes up four times. I call this the Group Chat Bill.
Why long chats are expensive
Double the words, four times the work
A 1M-token chat
1012
A trillion match scores, in every layer, for every head. This is the bill every new design tries to cut.
There is a second cost, and backend developers will recognise it. When a model writes, it adds one word at a time, and each new word must read every word before it. Recomputing every old key and value each time would be wasteful, so the model keeps them in memory. This is called the KV cache, and it is literally a cache. It grows with every word, and it has to sit in the chip’s fastest memory. Together with the Group Chat Bill, it is why long context is expensive.
Cutting the Bill
Almost every change to attention since 2017 is a way of paying less of the Group Chat Bill. Once you see the KV cache as a cache, the list reads like a set of caching strategies. Share the cache between heads. Compress it. Read only recent entries. Fetch only the entries that matter. Or replace it with a running summary of fixed size.
Sebastian Raschka keeps the best reference I have found for this: an LLM Architecture Gallery with diagrams of more than a hundred models, and a visual guide to attention variants. Here is my version, one tile per idea.
Multi-head · 2017
Many readers at once
The original paper ran 8 heads side by side. Each learns to look for something different.
Grouped-query · 2019, 2023
Share the cache
Heads share their keys and values in groups. Llama 2 and 3 use it, with quality close to the original.
Sliding window · 2023
Read only the recent past
Stack enough layers and the window reaches further back. Gemma 3 mixes 5 windowed layers to 1 full one.
Sparse · 2025
Pick the few that matter
DeepSeek V3.2 adds a cheap “lightning indexer” and cut its API prices by more than half.
Latent · 2024
Zip the cache
DeepSeek-V2 stored a compressed version and shrank the cache by 93.3%. Kimi K2 uses it too.
Linear · Kimi Delta, 2025
Keep a running summary
No cache that grows: a fixed-size memory is updated word by word. Cheap, but it forgets details.
Hybrid · 2025, 2026
Mix cheap and full
Kimi Linear: up to 75% less cache and up to 6× faster at a million tokens. Kimi K3 is built this way.
FlashAttention · 2022
Same maths, less walking
Exact attention, computed in blocks so the chip stops fetching from slow memory. 3× faster GPT-2 training.
The other half · Mixture of Experts
Ask only two experts
Each layer is a Group Chat followed by a thinking step. MoE splits the thinking step into experts. Kimi K2 has 1 trillion parameters but uses 32 billion per word.
Notice what linear attention does. It keeps one fixed-size summary and updates it word by word. That is the Telephone Line again, back in a smarter form. The difference is that these new versions can still be trained in parallel, and they are mixed with a few full Group Chat layers that can still look anywhere. I find it funny that the idea attention replaced came back once someone made it fit the chips.
From GPT-2 to Kimi K3
Put the dates side by side and three directions appear. Models got bigger. Attention got cheaper. And from 2024, models were given time to think. Every line below still has the 2017 Group Chat at its centre.
From one paper
The family tree
Raschka has a careful comparison of GPT-2 against modern models, and the surprise in it is how little changed. Positions are now encoded by rotating queries and keys. A few small parts were swapped for simpler or better ones. The feed-forward step was split into experts. The core is the same: query, key, value, softmax, blend.
Seven years apart
What changed after GPT-2
The newest models take these changes furthest. DeepSeek’s V4 uses compressed and sparse attention that, its report says, needs 10% of V3.2’s cache at a million tokens. Kimi K3 goes further still, and it is worth its own section.
How Kimi K3 Is Different
Moonshot AI released Kimi K3 in July 2026. It is the clearest picture I know of where the Group Chat has ended up. Sebastian Raschka’s architecture notes call it “essentially a scaled-up production version” of Moonshot’s earlier Kimi Linear model: the same design, taken from 48 billion parameters to 2.8 trillion.
Start with the layers. GPT-2 ran the full Group Chat in every layer. K3 runs it in 24 of its 93. The other 69 use Kimi Delta Attention, which keeps a running summary of fixed size instead of a cache that grows with every word. The technical report lays them out in blocks of three summary layers and one full layer, with one more full layer at the very top.
Layer by layer
GPT-2 against Kimi K3
GPT-2 XL, 2019 48 layers, all full attention
Kimi K3, 2026 69 running-summary, 24 full
Four changes make it work, and none of them throws attention away. Two of them cut the Group Chat Bill. One is new to me: K3 uses the Group Chat on its own layers. Normally each layer simply adds up everything below it. In K3, a layer uses attention to decide which earlier blocks to listen to, which the report calls Attention Residuals.
1 · Kimi Delta Attention
Most layers keep a running summary
Each word fades the memory a little and rewrites part of it. The memory never grows, however long the chat.
2 · No position numbers
Order comes from forgetting
The full layers get no position information at all. The summary layers forget older words faster, and that is enough to tell order. Raschka calls it the first frontier-level model to do this.
3 · Attention Residuals
A Group Chat between layers
Normally a layer adds up everything below it equally. In K3, each layer chooses which earlier blocks to listen to, with the same softmax as attention. About 4% more training cost, by Raschka’s count.
4 · Experts
16of 896
experts used for each word
Plus 2 shared experts in every layer. That is how a 2.8 trillion parameter model uses about 104 billion per word.
The part I find most striking is the missing position numbers. Every model since 2017 has had to be told where each word sits, because attention on its own cannot see order. K3’s full layers are told nothing. Its summary layers forget older words faster than recent ones, and that fading is enough to carry the order. Raschka calls it the first frontier-level model to work this way.
2.8Tparameters
104B used per word
1Mtokens
context, with no position encoding
27KiB
cache per token, vs 68.6 for K2 (Raschka’s estimate)
2.5×
better scaling efficiency than K2, per the report
So the Group Chat did not go away. It became the expensive step a model calls every fourth layer, and always at the end. Moonshot is still adjusting the mix: by Raschka’s account, the K3.1 Pro weights released in November keep the 69 summary layers and switch the 24 full ones to DeepSeek-style sparse attention.
The Fourth Dial
By 2024 the Three Dials were getting expensive to turn. Then OpenAI found another one. Its o1 model writes a long chain of reasoning before it answers, and OpenAI reported that performance “smoothly improves” with more of this thinking time, as well as with more training. I call it the Fourth Dial: compute spent while answering, not while learning.
2024: a new dial
Three dials, then a fourth
AIME 2024, a hard maths exam
Same question, more thinking
DeepSeek-R1-Zero, 2025
15.6→71.0%
Same exam, trained by rewarding right answers. Its answers grew longer by themselves.
OpenAI did not say what o1 is built on. DeepSeek did. DeepSeek-R1, in January 2025, was built on the same base as their V3 model. They trained it by rewarding right answers, with no worked examples to copy, and its answers grew longer by themselves. The paper even has a section called the “aha moment”, where the model stops, writes “wait”, and rethinks its approach.
This is why I think attention is the most important part of the architecture. A reasoning model is the same Group Chat, run for longer. Every word of its thinking is a new member of the chat, and every later word can read it. The Group Chat Bill and the KV cache are why long thinking costs what it does.
Is Attention Still All You Need?
The strongest case against my point deserves a fair hearing.
First, attention is not where most of a model’s knowledge sits. Most parameters live in the feed-forward step. In Kimi K2, the model has 1 trillion parameters, mostly in its experts. Second, data and training matter as much as design. Chinchilla won with the same design and better balance. R1 won with the same design and a new way of training. Third, the newest models are moving away from full attention. In K3 three of every four layers are not full attention at all. Raschka goes further and writes that models using full attention in every layer have “effectively disappeared” in the second half of 2026. That is his read of the field, and I have not checked it model by model.
I agree with all three. And I still think the claim holds, for a historical reason. Scaling laws are patterns that people observed, not laws of nature, and they were observed on Transformers. Attention was the first design that let all Three Dials turn at once. Everything since, including the hybrids that use less of it, is a way of keeping those dials turning more cheaply.
Under the Hood
This section is for readers who want the mechanics. Skip it and you lose nothing from the argument.
For the backend reader
The Fuzzy Lookup, in code
// Q, K, V: one row per word
function attention(Q, K, V) {
const d = K[0].length;
return Q.map((q) => {
// 1. score every key
const s = K.map((k) =>
dot(q, k) / Math.sqrt(d));
// 2. scores → shares (sum 1)
const w = softmax(s);
// 3. blend the values
return blend(V, w);
});
}The formula in the paper
softmax(QKT / √d) V
QKᵀ is step 1, every query against every key. Softmax is step 2. Multiplying by V is step 3.
Q, K and V are not three inputs. They are three learned projections of the same word vector: Q = xW_Q, K = xW_K, V = xW_V. Each head has its own three matrices, which is how different heads learn to ask different questions.
Why divide by √d? A dot product of two long vectors gets large just because the vectors are long. Large scores push softmax towards giving one word nearly 100%, and training stalls. Dividing by the square root of the vector length keeps the scores in a calm range.
The mask sets every score for a future word to minus infinity before softmax, so its share becomes exactly zero. That is why training is parallel and generation is not. In training every position is predicted at once. In generation the next word does not exist yet.
Attention has no sense of order. Shuffle the words and the scores do not change. Order has to be added. GPT-2 added a learned vector for each position. Most models now use RoPE, which rotates each query and key by an angle that depends on its position, so the score between two words depends on how far apart they are.
The weights are not explanations. Attention maps are tempting to read like a mind, and the “it” example above is clean because I chose a clean example. Real heads are messier, and many do things nobody has named.
If you want to see it run, the Transformer Explainer runs a real GPT-2 in your browser, Brendan Bycroft’s LLM visualisation shows every multiplication in 3D, and Karpathy’s Let’s build GPT writes one from scratch in two hours.
What I Am Watching
One number: the ratio of cheap layers to full Group Chat layers. Kimi Linear and Qwen3-Next settled on 3 to 1. If the next generation pushes that to 7 to 1 without getting worse at finding a fact buried deep in a long document, then the future is mostly running summaries with an occasional full look. If it cannot, full attention stays the part you cannot remove.
A paper about translating English into German gave every word the right to read every other word. That one change made language fit on the chips, and the chips did the rest.
Next time a model answers you, every word of that answer came out of a group chat. Which word was it listening to?
Sources and Further Reading
- Vaswani et al., Attention Is All You Need (2017). The results, the 8-GPU training times, N = 6 layers, 8 heads, 65M and 213M parameters.
- The authors: affiliations and the random-order footnote from the paper PDF. Vaswani: Essential AI, Nvidia (reported). Shazeer: back to Google, to OpenAI. Parmar: Anthropic. Uszkoreit: Inceptive. Jones: Sakana AI. Gomez: Cohere and Aleph Alpha. Kaiser: OpenAI. Polosukhin: NEAR.
- Google Research, Transformer: A Novel Neural Network Architecture for Language Understanding (2017). The animal and street example.
- Bahdanau, Cho and Bengio, Neural Machine Translation by Jointly Learning to Align and Translate (2014). The first attention, and the bottleneck.
- OpenAI: GPT-1 (2018), GPT-2 and its paper (2019), GPT-3 (2020), Learning to Reason with LLMs (2024).
- Kaplan et al., Scaling Laws for Neural Language Models (2020). Hoffmann et al., Chinchilla (2022).
- Sutton, The Bitter Lesson (2019). Sutskever, O’Reilly interview (2015). Karpathy, on the Transformer (2022).
- Cheaper attention: Multi-Query, Grouped-Query, Llama 2, Mistral 7B, Gemma 3, FlashAttention, DeepSeek-V2 (MLA), DeepSeek V3.2 sparse attention, Kimi Linear, Qwen3-Next (vendor figures).
- Experts and big models: Switch Transformer, DeepSeek-V3, Kimi K2, Kimi K3 technical report (HTML) and blog, launch coverage in Fortune, DeepSeek-V4.
- Reasoning: DeepSeek-R1 (2025).
- Sebastian Raschka: LLM Architecture Gallery, From GPT-2 to gpt-oss, A Visual Guide to Attention Variants, From Full to Hybrid Attention, Kimi K3 architecture notes and its gallery card.
- Other explainers worth your time: Jay Alammar’s Illustrated Transformer, 3Blue1Brown’s attention lesson, the Transformer Explainer, Bycroft’s LLM visualisation, Karpathy’s Let’s build GPT.