Extrapolation by Association: Length Generalization Transfer in Transformers
Not on the map. Why?
Abstract (arXiv)
Transformer language models have demonstrated impressive generalization capabilities in natural language domains, yet we lack a fine-grained understanding of how such generalization arises. In this paper, we investigate length generalization--the ability to extrapolate from shorter to longer inputs--through the lens of textittask association. We find that length generalization can be textittransferred across related tasks. That is, training a model with a longer and related auxiliary task can lead it to generalize to unseen and longer inputs from some other target task. We demonstrate this length generalization transfer across diverse algorithmic tasks, including arithmetic operations, string transformations, and maze navigation. Our results show that transformer models can inherit generalization capabilities from similar tasks when trained jointly. Moreover, we observe similar transfer effects in pretrained language models, suggesting that pretraining equips models with reusable computational scaffolding that facilitates extrapolation in downstream settings. Finally, we provide initial mechanistic evidence that length generalization transfer correlates with the re-use of the same attention heads between the tasks. Together, our findings deepen our understanding of how transformers generalize to out-of-distribution inputs and highlight the compositional reuse of inductive structure across tasks.
Key facts. Cited by 13 papers in the map (data through 14 Oct 2026). Builds on 35 of its 44 references that are in the map. First posted on arXiv 10 Jun 2025.
Builds on
35 of 44 references.
References · 35
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2022Emergent Abilities of Large Language Modelscited by 2,512
- 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,470
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
- 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 313
- 2019Compositionality decomposed: how do neural networks generalise?cited by 265
- 2022Exploring Length Generalization in Large Language Modelscited by 206
- 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 204
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
23 more
- 2020From Local Structures to Size Generalization in Graph Neural Networkscited by 124
- 2023Teaching Arithmetic to Small Transformerscited by 123
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 117
- 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 115
- 2024Looped Transformers for Length Generalizationcited by 99
- 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
- 2023Skill-Mix: a Flexible and Expandable Family of Evaluations for AI modelscited by 64
- 2023Positional Description Matters for Transformers Arithmeticcited by 56
- 2020The EOS Decision and Length Extrapolationcited by 46
- 2023Understanding Addition in Transformerscited by 34
- 2019Location Attention for Extrapolation to Longer Sequencescited by 33
- 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challengescited by 31
- 2024On the Out-Of-Distribution Generalization of Multimodal Large Language Modelscited by 30
- 2024Not All LLM Reasoners Are Created Equalcited by 30
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
- 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Taskscited by 22
- 2024Can Models Learn Skill Composition from Examples?cited by 17
- 2023Improving Length-Generalization in Transformers via Task Hintingcited by 13
- 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Taskscited by 11
- 2025Task Generalization With AutoRegressive Compositional Structure: Can Learning From D Tasks Generalize to DT Tasks?cited by 11
- 2023From Interpolation to Extrapolation: Complete Length Generalization for Arithmetic Transformerscited by 10
- 2024On the Power of Convolution Augmented Transformercited by 6
Built on by
Citing papers per year: 2025: 7; 2026: 6.
13 papers.
Sort:
By area:
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMscited by 64
- 2025Quantitative Bounds for Length Generalization in Transformerscited by 8
- 2025Why Can't Transformers Learn Multiplication? Reverse-Engineering Reveals Long-Range Dependency Pitfallscited by 7
- 2025Train Once, Answer All: Many Pretraining Experiments for the Cost of Onecited by 6
- 2025Training and Evaluation of Guideline-Based Medical Reasoning in LLMscited by 4
- 2026Stabilizing Extrapolation in Looped Transformers via Learned Stochastic Stoppingcited by 4
- 2026Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidthcited by 3
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedbackcited by 2
- 2026Can Transformers Really Do It All? On the Compatibility of Inductive Biases Across Taskscited by 2
- 2025From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputscited by 1
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Taskscited by 0
- 2026Generalization in LLM Problem Solving: The Case of the Shortest Pathcited by 0
1 more
- 2026Distance generalization in transformers: why bother with positional encoding?10 Sep 2026
- 2026Can Transformers Really Do It All? On the Compatibility of Inductive Biases Across Tasks20 Jul 2026
- 2026Stabilizing Extrapolation in Looped Transformers via Learned Stochastic Stopping29 Jun 2026
- 2026Generalization in LLM Problem Solving: The Case of the Shortest Path16 Apr 2026
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedback25 Mar 2026
- 2026Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidth19 Jan 2026
- 2025From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputs14 Dec 2025
- 2025Training and Evaluation of Guideline-Based Medical Reasoning in LLMs3 Dec 2025
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Tasks2 Dec 2025
- 2025Quantitative Bounds for Length Generalization in Transformers30 Oct 2025
- 2025Why Can't Transformers Learn Multiplication? Reverse-Engineering Reveals Long-Range Dependency Pitfalls30 Sep 2025
- 2025Train Once, Answer All: Many Pretraining Experiments for the Cost of One27 Sep 2025
1 more
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMscited by 64
- 2025Quantitative Bounds for Length Generalization in Transformerscited by 8
- 2025Why Can't Transformers Learn Multiplication? Reverse-Engineering Reveals Long-Range Dependency Pitfallscited by 7
- 2025Train Once, Answer All: Many Pretraining Experiments for the Cost of Onecited by 6
- 2026Stabilizing Extrapolation in Looped Transformers via Learned Stochastic Stoppingcited by 4
- 2026Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidthcited by 3
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedbackcited by 2
- 2026Can Transformers Really Do It All? On the Compatibility of Inductive Biases Across Taskscited by 2
- 2025From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputscited by 1
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Taskscited by 0
- 2026Generalization in LLM Problem Solving: The Case of the Shortest Pathcited by 0
- 2026Distance generalization in transformers: why bother with positional encoding?cited by 0
- 2026Distance generalization in transformers: why bother with positional encoding?10 Sep 2026
- 2026Can Transformers Really Do It All? On the Compatibility of Inductive Biases Across Tasks20 Jul 2026
- 2026Stabilizing Extrapolation in Looped Transformers via Learned Stochastic Stopping29 Jun 2026
- 2026Generalization in LLM Problem Solving: The Case of the Shortest Path16 Apr 2026
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedback25 Mar 2026
- 2026Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidth19 Jan 2026
- 2025From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputs14 Dec 2025
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Tasks2 Dec 2025
- 2025Quantitative Bounds for Length Generalization in Transformers30 Oct 2025
- 2025Why Can't Transformers Learn Multiplication? Reverse-Engineering Reveals Long-Range Dependency Pitfalls30 Sep 2025
- 2025Train Once, Answer All: Many Pretraining Experiments for the Cost of One27 Sep 2025
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMs11 Sep 2025