Onpode
Cover art for Why the attention mechanism solved the sequential bottleneck that RNNs couldn't

Why the attention mechanism solved the sequential bottleneck that RNNs couldn't

November 22, 2026 · 11 min

Jonathan Ingles & Ben Okonkwo

The 2017 transformer paper 'Attention Is All You Need' solved RNNs' sequential bottleneck by replacing recurrence with pure attention, letting every token compare to every other token simultaneously. That parallelism cut training time to roughly 12 hours on 8 GPUs — making transformers cheap enough to try, which is why they won.

The transformer architecture, introduced in June 2017 by Ashish Vaswani and seven co-authors at Google Brain and Google Research in the paper "Attention Is All You Need" (presented at NeurIPS), fundamentally restructured how neural networks process sequential data.

0:0010:30
Get the next episode on Artificial Intelligence →

Follow it free — new episodes land in your feed.

Or make your own — any topic, in minutes

More Onpode episodes on Artificial Intelligence →

About this episode

The 2017 paper 'Attention Is All You Need' is usually described as an invention. It's more precisely a subtraction — the recurrent chain that forced language models to process one token at a time was removed, and the whole thing ran in parallel instead. That single change made the original base model trainable in about twelve hours on eight consumer-grade GPUs, and that cheapness is arguably what won the decade, not any claim about superior intelligence. This episode works through what the transformer actually does mechanically — queries, keys, values, the square-root scaling fix, multi-head attention specializing with no supervision — and where the story gets more complicated. The parallelism is real during training, but generation is sequential again due to causal masking. 'Emergent' abilities look shakier once you smooth the accuracy metric. The encoder-decoder architecture was simplified away, possibly for good reasons, possibly for path dependence, and nobody has run a clean comparison at modern scale. And the same attention mechanism that lets a model link a contract clause on page 12 to a carve-out on page 187 also produces confidently fabricated case citations — one behavior, not two. It's an honest account of what's settled, what's probable, and what remains genuinely open.

Frequently asked

Why couldn't RNNs and LSTMs process sequences in parallel?

RNNs and LSTMs process tokens sequentially — each step must finish before the next begins. Token six cannot start until token five is complete, making it impossible to distribute work across thousands of GPU cores. That strict chain also causes fading memory: information from early tokens must survive every intermediate step to reach later ones.

How does the transformer attention mechanism actually work?

Transformer attention converts each token into three vectors — a query ('what am I looking for'), a key ('what do I offer'), and a value (the content to retrieve). Dot products between queries and keys produce relevance scores, scaled by the square root of key dimension to prevent unstable softmax, then blended into a weighted output in one hop.

Do transformers still generate text sequentially, or is everything parallel?

Transformer training is fully parallel — all positions compute at once. Text generation, however, is still sequential. Decoder-only models like Llama 3 use causal masking, meaning each new token can only attend to preceding tokens, so the model cannot produce token six before token five exists. The parallelism win is primarily a training advantage.

Why is transformer attention O(n²) and is that a real problem?

Transformer self-attention compares every token to every other token, so compute and memory scale quadratically with sequence length — doubling length quadruples cost. FlashAttention (2022) keeps the same quadratic arithmetic but reorganizes memory access to reduce bandwidth overhead significantly, recovering speed without changing the underlying mathematical operation.

Why did hallucination problems come from the same architecture as the long-range reasoning breakthrough?

Transformer attention weights relationships between tokens based on learned patterns, not factual truth. The same mechanism that links a legal definition on page 12 to a clause on page 187 also generates a plausible-sounding but nonexistent case citation. Nothing in the attention computation checks whether a retrieved pattern corresponds to real-world fact.

Grounded in 12 sources
Learning long-range spatial dependencies with horizontal gated-recurrent units ↗ · arxiv.org
Large language models: A comprehensive survey of architectures, applications and challenges ↗ · doi.org
Generative Artificial Intelligence and Large Language Models: Architecture, Capabilities, and Development Prospects ↗ · doi.org
The architecture of language: Understanding the mechanics behind LLMs ↗ · doi.org
Transformer architectures scaling laws and in context learning in foundation models ↗ · doi.org
Mathematical Modeling and Generalization Inference Mechanisms of Large Language Models Under Transformer Architecture ↗ · doi.org
What Is a Transformer Model? | NVIDIA Blogs ↗ · blogs.nvidia.com
Self-Attention Explained: The Mechanism Powering Modern AI | DataCamp ↗ · datacamp.com
How Transformers Work: Transformer Architecture Explained | DataCamp ↗ · datacamp.com
Transformer (deep learning) ↗ · en.wikipedia.org
Transformer (neural network) ↗ · en.wikipedia.org
AI Foundations Part 1: Transformers, Pre-Training and Fine-Tuning, and Scaling ↗ · fabricatedknowledge.com
Read transcript

Ben Okonkwo: Jonathan, hi, you ready? I've got a small confession before we start.

Jonathan Ingles: Go on. Those usually end badly for somebody.

Ben Okonkwo: I keep finding that the famous 2017 paper didn't invent the thing it's famous for. It took something away.

Jonathan Ingles: The transformer. Right, that's our subject. Frankly, I want to know how a design that started at 6 layers, width 512, ends up at 126 layers, width 16,384 in Llama 3, and nobody calls it a different thing.

Ben Okonkwo: Hm, okay. Start with the picture. Old models were like one person reading aloud, word by word, memory fading as they go.

Jonathan Ingles: And the new one puts every page of a contract on a big table. Every sentence glances at every other sentence, all at once. No fading.

Ben Okonkwo: Glancing already existed, though. Bahdanau had it on recurrent models in 2014. Ashish Vaswani, Noam Shazeer and the others at Google Brain and Google Research, NeurIPS, June 2017, they just dropped the reading-aloud part.

Jonathan Ingles: Then what did dropping it buy them?

Ben Okonkwo: So what it bought them is speed, and speed turned out to be the whole game. An RNN, an LSTM, has to finish token five before it touches token six. One after another. You can't hand that to a thousand GPU cores, because step six is waiting on step five.

Jonathan Ingles: And the fading memory is a side effect of the same chain.

Ben Okonkwo: Right, same chain. Information from word one has to survive every hop to reach word fifty. Now drop the chain, and every position computes at once during training. That's exactly what GPUs and TPUs are built for. And here's the number I can't get past: the original base model trained in about twelve hours on eight P100s.

Jonathan Ingles: Twelve hours.

Ben Okonkwo: Twelve hours, eight GPUs. A grad student could try that over a weekend.

Jonathan Ingles: Then that's why it won. Not because anyone proved it was smarter. It was cheap to try. And look, here's what gets me: all eight co-authors eventually left Google. Google published the foundation of the whole boom, openly, and the people who wrote it walked out and started or joined other companies. So much for the moat.

Ben Okonkwo: All eight? Hm. I knew about Noam Shazeer, I didn't know it was the full list.

Jonathan Ingles: Every one. Frankly, the incentive is obvious. If the idea is public and the recipe is twelve hours, the only scarce thing is the people and the compute. The people left.

Ben Okonkwo: Okay, but I want to complicate the speed story, because I think I told it too cleanly. Everything I just said, all positions at once, is true for training. And for reading your prompt. It is not true when the model writes back.

Jonathan Ingles: Wait. It still writes one word at a time?

Ben Okonkwo: Decoder-only models, yes. Causal masking means each token can only see what came before, and the next token doesn't exist until the last one is picked. So generation is sequential again. Just, hm, a different kind of sequential than an LSTM's.

Jonathan Ingles: So the thing everyone says changed everything is a training win. Mm. That's a better story than the one I came in with.

Ben Okonkwo: Which means the sequential part left over at generation is cheap, and the all-pairs part is where the work happens. So how does a token actually look at every other token? Mechanically, I mean.

Jonathan Ingles: You tell me. I know the table metaphor. I don't know what's on the table.

Ben Okonkwo: Each token gets turned into three vectors. A query, a key, a value. Query is, hm, 'what am I looking for.' Key is 'what do I offer.' Value is the content you actually pull.

Jonathan Ingles: Who is relevant to me, in other words.

Ben Okonkwo: Right. Dot product of my query with every key gives a score. Then you divide by the square root of the key dimension, because otherwise big vectors make huge scores, and the softmax goes spiky. Nearly all the weight on one token, gradients vanish.

Jonathan Ingles: So the square root is a fix for a numerical problem. Not a deep idea.

Ben Okonkwo: Fair. Plumbing. Softmax turns scores into weights summing to one, and those weights blend the values. Token fifty can pull straight from token one. One hop. No chain to survive.

Jonathan Ingles: One hop. That's the LSTM's fading memory just gone.

Ben Okonkwo: Gone structurally. Whether the model uses that access well is another question. But okay, one reader only finds one kind of relationship, so the paper runs several in parallel. Multi-head attention. Separate projections, and some heads track syntax, a verb to its subject, others something more semantic.

Jonathan Ingles: Several readers, same contract, each hunting something different. And nobody told them what to hunt?

Ben Okonkwo: Nobody. They specialize in training. We can sometimes label a head afterward, though not reliably.

Jonathan Ingles: Look, there's a hole here. If every token looks at every token at once, who says which word came first? 'Dog bites man' is not 'man bites dog.'

Ben Okonkwo: Right, that's the catch. Attention is permutation-invariant, shuffle the words and it can't tell. So the original paper added fixed sine and cosine patterns to each embedding. Modern models like Llama 3 use rotary encodings, RoPE, which rotate the vectors by position instead.

Jonathan Ingles: And the bill for all that glancing? Every token, every token. That's n squared. The part that comes later is whether the best design won, or just the one that fit, and that gets uncomfortable.

Ben Okonkwo: It does. And this is my surprise: FlashAttention, 2022. Same exact dense attention, same quadratic arithmetic, just much faster, because it reorganizes memory movement. Part of the quadratic problem was memory bandwidth. So some savings are free, and sparse attention may not be.

Jonathan Ingles: But free versus costly is exactly where I stop trusting the story. Parallelism made the scaling-law era possible, OpenAI and Google both documented it, and Nvidia's GPUs happened to fit. Look, that's a fit story. Nobody raises a billion dollars saying 'maybe a cleverer algorithm.'

Ben Okonkwo: Right, I'll grant the fit part. Performance improves predictably with parameters, data, compute. That's the scaling laws. But the funding story doesn't explain why the curve is smooth.

Jonathan Ingles: Smooth for whom? The people selling the shovels.

Ben Okonkwo: Fair jab. But loss curves have been replicated by independent groups, and that's evidence no investor can fake. The shakier part is 'emergent' abilities. Some of those sudden jumps look like artifacts of thresholded accuracy. Score it with partial credit and the jump smooths out.

Jonathan Ingles: So the strong claim survives, the magic claim doesn't.

Ben Okonkwo: Probably, yes. You pushed me for a probable answer. Scale reliably lowers loss. Whether it buys reasoning is where I'd say the evidence is weaker.

Jonathan Ingles: And the design itself kept changing underneath. The original had an encoder and a decoder.

Ben Okonkwo: It did. Modern LLMs went decoder-only, with causal masking and RoPE. Hm, and here's what I can't tell you: was the encoder rightly abandoned, or just deprioritized because decoder-only was simpler to scale? Nobody ran that comparison cleanly at today's size.

Jonathan Ingles: Deprioritized. I'd bet on it. Path dependence.

Ben Okonkwo: A bet. Not a finding.

Jonathan Ingles: Fine. Then give me the hard case, where fit and truth come apart.

Ben Okonkwo: A paralegal pastes in a 200-page contract. Asks about indemnification. The model links a definition on page 12 to a carve-out on page 187. Exactly the long-range thing attention is for. Then it cites a section number that doesn't exist.

Jonathan Ingles: Mata v. Avianca, 2023. Lawyers sanctioned over fabricated cases.

Ben Okonkwo: And here's the part that unsettles me. Same mechanism, both outputs. Attention weights relationships between tokens. Nothing in it asks whether the thing is true.

Jonathan Ingles: Oh. So the page 187 catch and the fake citation aren't a success and a bug.

Ben Okonkwo: One behavior. A strong pattern-finder. Hallucination and interpretability gaps are separate problems the architecture never addressed.

Jonathan Ingles: Capability isn't accountability. And 'RNNs are obsolete'? That sounds settled.

Ben Okonkwo: Stronger than the evidence. In vision, an hGRU, a recurrent model, has held up on some tasks. Displaced at scale in language, yes. Obsolete, no.

Jonathan Ingles: Won by fit, then. Not by proof.

Ben Okonkwo: Fit, yes. And that's what's left open for me. If the next version keeps attention but computes less of it, can anyone show it keeps what the dense version had? Sparse attention, Mixture-of-Experts, they cut the cost. But they add system complexity. Routing, load balancing, more moving parts.

Jonathan Ingles: And is there an answer? Give me a probable one.

Ben Okonkwo: Honestly, no consensus. Some of the evidence is encouraging. There's math showing attention weights are low-rank and sparse, so in principle a lot of that n squared work is redundant. But what that means for behavior, for the model's actual abilities, we don't fully understand. Hm. A matrix being compressible isn't the same as the model not needing the part you threw away.

Jonathan Ingles: So the redundancy might be waste, or it might be the thing doing the work. Frankly, that's the twelve-hours problem again. The dense version won because someone could cheaply try it. The cheaper versions get tested against a baseline built for the dense one.

Ben Okonkwo: Right. And nobody has run the clean comparison at Llama 3 size.

Jonathan Ingles: Mm. Back at the start I asked how it grows from 6 layers to 126 and nobody calls it something else. I think I have a smaller answer now. Nobody renamed it because nobody could afford to find out whether they should.

Ben Okonkwo: That's uncomfortable, and I can't rule it out. Okay. I'd rather leave it unknown than pretend. Thanks for pushing me to say probably.