Why did transformers replace RNNs for many NLP tasks?hard

Type
conceptual
Topic
transformers-vs-rnn
Frequency
common
Tags
deep-learning, transformers, rnn, parallelism
Answer

Transformers process all tokens in parallel instead of step by step, and self-attention lets any two tokens interact directly regardless of distance.

Explanation

This removes the sequential training bottleneck of RNNs, makes long-range dependencies much easier to learn, and scales far better with data and compute — which is why BERT, GPT, T5, and LLaMA are all transformer-based.

Follow-upWhat tradeoff do transformers make to get this parallelism?