Hugging FaceVictor SanhExplainer
Hugging Face Reads, Feb. 2021 - Long-range Transformers
Summary
Standard transformer models face severe memory and compute bottlenecks due to the quadratic scaling of self-attention with sequence length. To scale beyond short sequence limits, efficient architectures introduce varied mechanisms such as custom sparse attention patterns, compressed recurrence, low-rank projections, and kernel approximations. Longformer integrates local dilated windowed attention with task-specific global tokens, functioning as a drop-in replacement that enables standard pre-trained models to process long inputs without full retraining. Concurrently, Compressive Transformers extend temporal memory by compressing discarded activations, while models like Linformer and Performer reduce computational complexity through projection and kernel estimation. Progress in long-range modeling also reveals that incrementally training models from short to longer sequences accelerates convergence and improves downstream performance.
Context
Standard transformer self-attention incurs a quadratic computational and memory cost with respect to sequence length, creating a major bottleneck when scaling models beyond traditional 512- or 1024-token contexts in natural language processing and other domains like speech or protein modeling.
Approach / What changed
Researchers developed efficient transformer variants utilizing custom attention patterns, memory recurrence, low-rank projections, and kernel approximations. Specifically, architectures like Longformer combine local windowed and task-specific global attention, Compressive Transformers add compressed past activations, Linformer uses low-rank decomposition, and Performer approximates softmax attention kernels directly.
Takeaways
Longformer uses dilated windowed attention and selective global tokens to scale memory linearly, serving as a drop-in replacement for standard self-attention layers in pre-trained models.
Relative positional embeddings generalize effectively to unseen sequence lengths but remain computationally expensive, whereas absolute embeddings are cheaper but rigid.
Staged pre-training that begins with short sequences and incrementally increases context length speeds up training and reduces reliance on spurious correlations.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.