Onpode
Cover art for Why attention mechanisms let neural networks solve language at scale

Why attention mechanisms let neural networks solve language at scale

August 5, 2026 · 7 min

Marcus Vale & Ben Okonkwo

The 2017 'Attention Is All You Need' paper by Vaswani et al. at Google Brain replaced sequential RNNs with self-attention, letting every token attend directly to every other token. This eliminated vanishing gradients and unlocked full GPU parallelization — the hardware fit that made GPT, BERT, and Llama trainable at scale.

The transformer architecture was introduced in the 2017 paper "Attention Is All You Need" by Ashish Vaswani and colleagues at Google Brain/Google Research. The paper's authors include Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan Gomez, Łukasz Kaiser, and Illia Polosukhin.

0:006:33
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

In 2017, a team at Google Brain published a paper called 'Attention Is All You Need' and quietly made everything that came before it obsolete. GPT, BERT, Meta's Llama, Claude — the entire stack of large language models that defines the current moment runs on the architecture Vaswani and Shazeer shipped that year. This episode asks a harder question: why did it win, and is that winning permanent? The answer starts with a real failure mode. Recurrent neural networks, the dominant approach before transformers, processed tokens one at a time and had to pass information across every step in a sequence. The result was the vanishing gradient problem — a mathematical shrinkage of the error signal as it traveled backward through hundreds of time steps. The model literally couldn't learn relationships between distant tokens. Self-attention fixed this by letting every token attend to every other token simultaneously, giving gradients a direct path instead of a chain. But that fix has a known cost: quadratic scaling. Longer context means costs that grow fast. The episode gets specific about where that bites — and about why the hybrid architectures now shipping in production, which borrow gated recurrence from the models transformers replaced, suggest the market already suspects the foundation isn't final. An open question, with shipped evidence, examined honestly.

Frequently asked

What is the vanishing gradient problem in RNNs?

The vanishing gradient problem in RNNs is the mathematical shrinkage of the error signal during backpropagation through hundreds of sequential time steps. Each step degrades the signal slightly, so by the time the model tries to learn a connection across long distances — say, token 3 to token 900 — the gradient is effectively zero and the relationship cannot be learned.

How does self-attention fix the vanishing gradient problem?

Self-attention fixes vanishing gradients by letting every token attend directly to every other token simultaneously, creating a direct gradient path rather than a chain of sequential steps. Introduced by Vaswani et al. in 'Attention Is All You Need' (Google Brain, 2017), this geometric change means distant relationships are learned without signal degradation across intermediate tokens.

Why do transformers train faster than RNNs on GPUs?

Transformers process all tokens simultaneously rather than one at a time, which means GPU utilization runs near 100% during training. RNNs had sequential token dependencies that left GPUs idle waiting for the previous step to finish. This parallelizability was the commercial unlock that made scaling laws — more data, more compute, better performance — empirically testable.

What is the quadratic scaling problem in transformers?

Transformer self-attention scales as O(n²): every token must attend to every other token, so compute cost grows quadratically with sequence length. At long context windows — 128,000 tokens or more — inference costs become very large. This O(n²) wall is the core structural limitation that sparse attention variants and hybrid architectures like Mamba attempt to address.

What are Mamba and hybrid transformer architectures?

Mamba and hybrid Transformer-RNN architectures combine gated recurrence — structurally similar to the LSTMs transformers displaced — with attention mechanisms, aiming to reduce the quadratic inference cost of pure transformers at long contexts. As of 2024, these hybrids are in production, not just research papers, signaling that the industry is actively hedging against transformer scaling limits.

Grounded in 11 sources
The Cognitive Divergence: AI Context Windows, Human Attention Decline, and the Delegation Feedback Loop · arxiv.org
Were RNNs All We Needed? · arxiv.org
Scaling Law with Learning Rate Annealing · arxiv.org
The End of Transformers? On Challenging Attention and ... · arxiv.org
Gated Sparse Attention: Combining Computational Efficiency with Training Stability for Long-Context Language Models · arxiv.org
Dilated Neighborhood Attention Transformer · arxiv.org
Neural Scaling Laws Rooted in the Data Distribution · arxiv.org
SST: Multi-Scale Hybrid Mamba-Transformer Experts for ... · arxiv.org
Scaling Laws for Upcycling Mixture-of-Experts Language Models · arxiv.org
Gates Are Not What You Need in RNNs · arxiv.org
The Annotated Transformer · nlp.seas.harvard.edu
Read transcript

Ben Okonkwo: Marcus, hey — before we do anything, I want to try something: I'm going to name a year and a place, and I want your honest first instinct.

Marcus Vale: Sure, go.

Ben Okonkwo: Google Brain, 2017.

Marcus Vale: Vaswani, Shazeer, 'Attention Is All You Need' — that's the whole game right there. Every LLM that matters runs on that architecture.

Ben Okonkwo: Right — GPT series, BERT, Meta Llama, the whole stack. Now here's what I actually want to get into, because I think the instinct you just had — 'that's the whole game' — is load-bearing in a way that might not survive scrutiny. The paper replaced RNNs and LSTMs, which processed tokens strictly one at a time and had genuinely crippling vanishing gradient issues. Transformers fixed that. But the mechanism that fixed it, self-attention, scales as O of n-squared. Every token attends to every other token. And Vaswani and Shazeer... I mean, they could see that. It's in the math.

Marcus Vale: Okay, so — if it's such a known ceiling, why does literally every major lab still ship on transformer foundations in 2024? That's the thing I don't buy as a clean story.

Ben Okonkwo: Right — but the reason they still ship on transformers is actually the answer to why RNNs died. Okay, picture a film editor working a twelve-hour cut. She needs to remember that the actor who appears in frame three is the same one who reappears in frame nine hundred. An RNN has to pass that fact through every single frame in between. Each step, the signal degrades a little — that's the vanishing gradient problem, not a metaphor, an actual mathematical shrinkage of the error signal as you backpropagate through hundreds of time steps. By the time you're trying to correct the model on that connection, the gradient is basically zero. The model literally cannot learn the relationship.

Marcus Vale: Oh — so the old architecture was a game of telephone. The message just... degrades with distance.

Ben Okonkwo: Exactly that. And self-attention cuts the telephone line entirely — the ending just looks directly back at frame three. Every token attends to every other token simultaneously, so the gradient has a direct path, not a chain of a thousand steps. That's the geometric fix Vaswani and the Google Brain team actually shipped in 2017.

Marcus Vale: But parallel processing destroys word order. You can't just read all tokens at once and pretend sequence doesn't exist.

Ben Okonkwo: Right, and that's — okay, this is actually the clever patch. Positional encodings get added directly to each token's embedding before anything else happens. The model knows where in the sequence every token sits, even though it's processing all of them at once. And then — now this is the part I find genuinely interesting — they don't run just one attention operation. Multi-head attention runs several in parallel, each one learning to track a different kind of relationship. One head might lock onto syntax, another onto coreference. They concatenate the outputs.

Marcus Vale: So multiple lenses on the same sequence at the same time. What's the grounding — is there empirical work showing the heads actually specialize, or is that just the theoretical framing?

Ben Okonkwo: There's interpretability work suggesting it, yeah — I'd call it suggestive rather than settled. But here's what's not in question: this architecture is why GPT, BERT, Llama — all of it — got built at scale at all. The parallelizability is what made GPUs actually useful for training. That's the part we haven't touched yet, and honestly it's where the quadratic cost starts biting back in ways that make the whole foundation look a lot less permanent.

Marcus Vale: The GPU angle is actually what made the whole thing fundable. Think about it — a machine learning engineer, Thursday night, she queues a training run on a 128,000-token document. Transformer kicks in, all tokens hit the hardware simultaneously, GPU utilization spikes to basically 100 percent. That's it. That's the commercial unlock. RNNs couldn't do that — sequential dependency meant the GPU sat idle waiting for the previous token to finish. You were paying for hardware you couldn't use.

Ben Okonkwo: And that's why scaling laws became testable at all.

Marcus Vale: Exactly — once you can peg the GPU at full utilization, you can actually run the experiment. More parameters, more data, more compute, performance goes up predictably. That's what made GPT, BERT, Llama, Claude possible. Not the math alone. The hardware fit.

Ben Okonkwo: Okay but that same engineer — she's watching inference cost now, right? Longer context window, costs explode. That's the O-n-squared wall.

Marcus Vale: Yeah. And here's where I'll actually hedge — because the question is whether that's structural or just an engineering constraint someone optimizes away. Mamba and the hybrid RNN variants suggest it's structural. You can't attend to every token against every other token at a million tokens without burning real power on every forward pass. That's not accidental.

Ben Okonkwo: So what experiment would have to fail for you to update that? Like — if sparse attention variants close the gap at 128k context, does that change the claim?

Marcus Vale: Frankly — yes. If sparse or gated attention gets within, say, five percent performance on long-context benchmarks without structural modification to the core transformer block, I update. But we're not there. The research says we're patching, not fixing.

Ben Okonkwo: What actually settled for me is that Mamba-Transformer hybrids are in production now. Not a paper. Shipped. And they use gated recurrence, which is structurally close to what transformers replaced in 2015. That's not a theoretical challenge to the architecture. That's the market already hedging.

Marcus Vale: Yeah — and I think that's the honest landing. Transformer got there first. Crossed the threshold first. Parallelizability, GPU fit, scaling laws — all of it. But 'first past the threshold' and 'optimal for the next threshold' are different claims, and the hybrid architectures are basically the market's way of saying it knows the difference.

Ben Okonkwo: And we genuinely can't say which way it lands. I'm comfortable with that.

Marcus Vale: Frankly, an open question with shipped evidence is better than a closed one with vibes. Good talk.