Which structural property of attention is the single biggest reason transformers scaled where RNNs did not?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
The one hop gradient path between any two tokens. Parallelism is a consequence, even with infinite parallel RNN hardware, the gradient signal would still degrade across distance.
Think of writing a paragraph while glancing at notes spread across your desk. You can look at any note directly, no matter how far away on the desk it is: one quick glance and back to writing. That's attention. An RNN is like passing a whispered message down a line of people: by the time it reaches the end, half the words are gone. Same task, but the desk of notes setup keeps every detail one quick glance away.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Contrast O(d) RNN path with O(1) attention path, explain that the Jacobian product along the RNN chain causes vanishing/exploding gradients, and clarify that parallelism falls out of having no sequential dependency.
| Property | RNN/LSTM | Attention |
|---|---|---|
| Path length between tokens at distance d | O(d) | O(1) |
| Gradient stability at distance 1000+ | Degrades (vanishes/explodes) | Stable |
| Forward pass parallelism in sequence dim | Sequential | Parallel matmul |
| Compute cost per layer | O(n · d²) | O(n² · d) |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Picking the parallelism option (C). It's true but it's the consequence of the one hop property, not the underlying reason.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.