Attention Alignment and Flexible Positional Embeddings Improve Transformer Length Extrapolation
Not on the map. Why?
Abstract (arXiv)
An ideal length-extrapolatable Transformer language model can handle sequences longer than the training length without any fine-tuning. Such long-context utilization capability relies heavily on a flexible positional embedding design. Upon investigating the flexibility of existing large pre-trained Transformer language models, we find that the T5 family deserves a closer look, as its positional embeddings capture rich and flexible attention patterns. However, T5 suffers from the dispersed attention issue: the longer the input sequence, the flatter the attention distribution. To alleviate the issue, we propose two attention alignment strategies via temperature scaling. Our findings show improvement on the long-context utilization capability of T5 on language modeling, retrieval, multi-document question answering, and code completion tasks without any fine-tuning. This suggests that a flexible positional embedding design and attention alignment can go a long way toward Transformer length extrapolation.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Builds on 27 of its 37 references that are in the map. First posted on arXiv 1 Nov 2023.
Builds on
27 of 37 references.
References · 27
- 2017Attention Is All You Needcited by 59,932
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
15 more
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
- 2021Improving language models by retrieving from trillions of tokenscited by 1,278
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2021GLM: General Language Model Pretraining with Autoregressive Blank Infillingcited by 1,026
- 2022GLM-130B: An Open Bilingual Pre-trained Modelcited by 837
- 2023The RefinedWeb Dataset for Falcon LLM: Outperforming Curated Corpora with Web Data, and Web Data Onlycited by 755
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2023Landmark Attention: Random-Access Infinite Context Length for Transformerscited by 206
- 2021Self-attention Does Not Need O(n2) Memorycited by 152
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 110
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
- 2022Dissecting Transformer Length Extrapolation via the Lens of Receptive Field Analysiscited by 39
Built on by
Citing papers per year: 2023: 1; 2024: 3; 2025: 3; 2026: 2.
9 papers.
- 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encodingcited by 32
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddingscited by 23
- 2024Selective Attention: Enhancing Transformer through Principled Context Controlcited by 16
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
- 2025Calibrated Language Models and How to Find Them with Label Smoothingcited by 7
- 2025Mask-GCG: Are All Tokens in Adversarial Suffixes Necessary for Jailbreak Attacks?cited by 6
- 2026An Evaluation of Context Length Extrapolation in Long Code via Positional Embeddings and Efficient Attentioncited by 0
- 2026Good Token Hunting: A Hitchhiker's Guide to Token Selection for Visual Geometry Transformerscited by 0
- 2026Good Token Hunting: A Hitchhiker's Guide to Token Selection for Visual Geometry Transformers22 May 2026
- 2026An Evaluation of Context Length Extrapolation in Long Code via Positional Embeddings and Efficient Attention25 Feb 2026
- 2025Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddings13 Dec 2025
- 2025Mask-GCG: Are All Tokens in Adversarial Suffixes Necessary for Jailbreak Attacks?8 Sep 2025
- 2025Calibrated Language Models and How to Find Them with Label Smoothing1 Aug 2025
- 2024Selective Attention: Enhancing Transformer through Principled Context Control19 Nov 2024
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolation7 Oct 2024
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolation23 May 2024
- 2023Length Extrapolation of Transformers: A Survey from the Perspective of Positional Encoding28 Dec 2023
Similar, not cited
Close in wording, no citation either way
- 2025Sliding Window Attention Training for Efficient Large Language Models
- 2024A Training-free Sub-quadratic Cost Transformer Model Serving Framework With Hierarchically Pruned Attention
- 2025A Survey on Transformer Context Extension: Approaches and Evaluation
- 2025Is Random Attention Sufficient for Sequence Modeling? Disentangling Trainable Components in the Transformer
- 2022Efficient Long Sequence Modeling via State Space Augmented Transformer
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMs
- 2026ZetaGPT: A Reference Implementation of Positional--Encoding--Free State--Space--Attention Language Models
- 2024AttnLRP: Attention-Aware Layer-Wise Relevance Propagation for Transformers