mlsanityData to 14 Oct 2026

Extrapolation by Association: Length Generalization Transfer in Transformers

arXiv 2506.09251 ↗First posted 10 Jun 2025cs.CL cs.AIcited by 13

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

  1. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
  2. 2022Emergent Abilities of Large Language Modelscited by 2,512
  3. 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,470
  4. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
  5. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  6. 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
  7. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
  8. 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 313
  9. 2019Compositionality decomposed: how do neural networks generalise?cited by 265
  10. 2022Exploring Length Generalization in Large Language Modelscited by 206
  11. 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 204
  12. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
23 more
  1. 2020From Local Structures to Size Generalization in Graph Neural Networkscited by 124
  2. 2023Teaching Arithmetic to Small Transformerscited by 123
  3. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 117
  4. 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 115
  5. 2024Looped Transformers for Length Generalizationcited by 99
  6. 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
  7. 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
  8. 2023Skill-Mix: a Flexible and Expandable Family of Evaluations for AI modelscited by 64
  9. 2023Positional Description Matters for Transformers Arithmeticcited by 56
  10. 2020The EOS Decision and Length Extrapolationcited by 46
  11. 2023Understanding Addition in Transformerscited by 34
  12. 2019Location Attention for Extrapolation to Longer Sequencescited by 33
  13. 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challengescited by 31
  14. 2024On the Out-Of-Distribution Generalization of Multimodal Large Language Modelscited by 30
  15. 2024Not All LLM Reasoners Are Created Equalcited by 30
  16. 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
  17. 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Taskscited by 22
  18. 2024Can Models Learn Skill Composition from Examples?cited by 17
  19. 2023Improving Length-Generalization in Transformers via Task Hintingcited by 13
  20. 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Taskscited by 11
  21. 2025Task Generalization With AutoRegressive Compositional Structure: Can Learning From D Tasks Generalize to DT Tasks?cited by 11
  22. 2023From Interpolation to Extrapolation: Complete Length Generalization for Arithmetic Transformerscited by 10
  23. 2024On the Power of Convolution Augmented Transformercited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 7; 2026: 6.

13 papers.

Sort:

By area: