Why did transformers replace RNNs for many NLP tasks?hard
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?