Longformer: The 16,384 Token Pioneer
Introduced in 2020 by researchers at Allen Institute for AI, Longformer was a groundbreaking transformer model that scaled context length to 16,384 tokens, far exceeding the 512-token limits of BERT or the 2048-token limits of early GPT-3.
The top 3
- Longformer's Hybrid Attention: Local Windows + Global Tokens: Longformer achieves its 16,384-token context by combining a fixed-size sliding window attention for local context with a few task-specific global attention tokens, effectively reducing the computational complexity from quadratic to linear.
- Quadratic vs. Linear: Longformer's Complexity Shift: Traditional Transformer models face a quadratic computational complexity with respect to sequence length, limiting them to around 512 tokens. Longformer's sparse attention mechanism, however, reduced this to linear complexity, making it feasible to process sequences of thousands of tokens, like 16,384.
- Longformer's Context Lead: 32x Increase Over BERT: Before Longformer, most Transformer models like BERT were practically limited to 512 tokens. Longformer's ability to handle up to 16,384 tokens represented a significant 32-fold increase in context length, opening doors for processing entire documents and advancing long-range NLP tasks.
Sources
Open the full topic