Scale-invariant attention
Ben Anson, Xi Wang, Laurence Aitchison
Abstract
One persistent challenge in LLM research is the development of attention mechanisms that are able to generalise from training on shorter contexts to inference on longer contexts. We propose two conditions that we expect all effective long context attention mechanisms to have: scale-invariant total attention, and scale-invariant attention sparsity. Under a Gaussian assumption, we show that a simple position-dependent transformation of the attention logits is sufficient for these conditions to hold. Experimentally we find that the resulting scale-invariant attention scheme gives considerable benefits in terms of validation loss when zero-shot generalising from training on short contexts to validation on longer contexts, and is effective at long-context retrieval.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
2 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- YaRN: Efficient Context Window Extension of Large Language Models cites The Impact of Positional Encoding on Length Generalization in Transformers
- The Impact of Positional Encoding on Length Generalization in Transformers cites Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
- AdaRoPE: Not All Attention Heads Should Rotate and Scale Equally cites Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
- AdaRoPE: Not All Attention Heads Should Rotate and Scale Equally cites YaRN: Efficient Context Window Extension of Large Language Models
- LLM Maybe LongLM: SelfExtend LLM Context Window Without Tuning cites Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
- LLM Maybe LongLM: SelfExtend LLM Context Window Without Tuning cites YaRN: Efficient Context Window Extension of Large Language Models
Cited by top-tier papers2
Builds on19
- Train Short, Test Long: Attention with Linear Biases Enables Input Length ExtrapolationOfir Press, Noah A. Smith, Mike LewisICLR 2022 · 1,168 citations
- YaRN: Efficient Context Window Extension of Large Language ModelsBowen Peng, Jeffrey Quesnelle, Honglu Fan, Enrico ShippoleICLR 2024 · 508 citations
- The Impact of Positional Encoding on Length Generalization in TransformersAmirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das et al.NeurIPS 2023 · 444 citations
- LLM Maybe LongLM: SelfExtend LLM Context Window Without TuningHongye Jin, Xiaotian Han, Jingfeng Yang, Zhimeng Jiang et al.ICML 2024 · 167 citations
- Small-scale proxies for large-scale Transformer training instabilitiesMitchell Wortsman, Peter J. Liu, Lechao Xiao, Katie E. Everett et al.ICLR 2024 · 162 citations
Related papers
- LazyAttention: Efficient Retrieval-Augmented Generation with Deferred Positional EncodingHaocheng Xia, Mihir Pamnani, Hanxi Fang, Supawit Chockchowwat et al.ICML 2026
- Bayesian Attention Mechanism: A Probabilistic Framework for Positional Encoding and Context Length ExtrapolationArthur S. Bianchessi, Yasmin C. Aguirre, Rodrigo C. Barros, Lucas S. KupssinsküICLR 2026 · 6 citations
- Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language ModelsBo Gao, Michael Spratling, Letizia GionfridaICML 2026 · 1 citation
- ReAttention: Training-Free Infinite Context with Finite Attention ScopeXiaoran Liu, Ruixiao Li, Zhigeng Liu, Qipeng Guo et al.ICLR 2025
- DAM: Dynamic Attention Mask for Long-Context Large Language Model Inference AccelerationHanzhi Zhang, Heng Fan, Kewei Sha, Yan Huang et al.ACL Findings 2025 · 1 citation
