Why did transformers largely replace RNNs for language tasks?
- Exam domain
- Deep learning foundations
- Difficulty
- Medium
- In this mock
- 5 questions on this domainPractise this domain
Why D is the answer
Self-attention relates all words at once and trains in parallel
Self-attention lets every token look at every other token in one step, so transformers capture long-range context and train in parallel on GPUs. RNNs read one step at a time.
Remember: Transformers: self-attention, parallel training.
In detail
- Self-attention links distant words directly.
- Parallel training scales to large data sets.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. They cannot handle long text, so they cost less to runWrong
Transformers handle long context well, up to their context window.
B. They need no training data at allWrong
Transformers need very large amounts of training data.
C. They read one word at a time, so they use far less memory overallWrong
Reading one word at a time describes RNNs.
D. Self-attention relates all words at once and trains in parallelRight
Transformers: self-attention, parallel training.
Use case
An illustrative scenario, not a real incident.
Illustrative: a translation system resolves "it" in a long sentence because attention links the pronoun to the right noun.
See it in different ways
mindmap
root(("Architectures"))
n1["CNN"]
n2["Images"]
n3["RNN and LSTM"]
n4["Sequences"]
n5["Transformer"]
n6["Language"]
n7["Self-attention"]
n8["GAN and diffusion"]
n9["Image generation"]How to read this chart
- The centre is "Architectures".
- "CNN" covers "Images".
- "RNN and LSTM" covers "Sequences".
- "Transformer" covers "Language", "Self-attention".
- "GAN and diffusion" covers "Image generation".
flowchart TD
Q{"Need long context and parallel training?"}
Q -->|"Yes"| A0["Transformer"]
Q -->|"Short sequences on a small device"| A1["RNN or LSTM"]How to read this chart
- At "Need long context and parallel training?": if "Yes", go to "Transformer"; if "Short sequences on a small device", go to "RNN or LSTM".