mlsanityData to 14 Oct 2026

Quantitative Bounds for Length Generalization in Transformers

arXiv 2510.27015 ↗First posted 30 Oct 2025cs.LG stat.MLcited by 8

Not on the map. Why?

Abstract (arXiv)

We study the problem of length generalization (LG) in transformers: the ability of a model trained on shorter sequences to maintain performance when evaluated on much longer, previously unseen inputs. Prior work by Huang et al. (2025) established that transformers eventually achieve length generalization once the training sequence length exceeds some finite threshold, but left open the question of how large it must be. In this work, we provide the first quantitative bounds on the required training length for length generalization to occur. Motivated by previous empirical and theoretical work, we analyze LG in several distinct problem settings: ℓ_∞ error control vs. average error control over an input distribution, infinite-precision softmax attention vs. finite-precision attention (which reduces to an argmax) in the transformer, and one- vs. two-layer transformers. In all scenarios, we prove that LG occurs when the internal behavior of the transformer on longer sequences can be "simulated" by its behavior on shorter sequences seen during training. Our bounds give qualitative estimates for the length of training data required for a transformer to generalize, and we verify these insights empirically. These results sharpen our theoretical understanding of the mechanisms underlying extrapolation in transformers, and formalize the intuition that richer training data is required for generalization on more complex tasks.

Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 33 of its 38 references that are in the map. First posted on arXiv 30 Oct 2025.

Builds on

33 of 38 references.

References · 33

  1. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  2. 2022In-context Learning and Induction Headscited by 964
  3. 2020A Primer in BERTology: What we know about how BERT workscited by 815
  4. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
  5. 2022Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfercited by 288
  6. 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
  7. 2022Exploring Length Generalization in Large Language Modelscited by 206
  8. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
  9. 2021Thinking Like Transformerscited by 184
  10. 2023Birth of a Transformer: A Memory Viewpointcited by 161
  11. 2023Teaching Arithmetic to Small Transformerscited by 123
  12. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
21 more
  1. 2024Looped Transformers for Length Generalizationcited by 99
  2. 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
  3. 2022A Logic for Expressing Log-Precision Transformerscited by 67
  4. 2023Positional Description Matters for Transformers Arithmeticcited by 56
  5. 2024A Formal Framework for Understanding Length Generalization in Transformerscited by 45
  6. 2024Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformerscited by 39
  7. 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challengescited by 31
  8. 2025Understanding and Improving Length Generalization in Recurrent Modelscited by 23
  9. 2024On Provable Length and Compositional Generalizationcited by 22
  10. 2024Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannotcited by 22
  11. 2024Arithmetic Transformers Can Length-Generalize in Both Operand Length and Countcited by 18
  12. 2025Extrapolation by Association: Length Generalization Transfer in Transformerscited by 13
  13. 2025Tropical Attention: Neural Algorithmic Reasoning for Combinatorial Algorithmscited by 12
  14. 2025Knee-Deep in C-RASP: A Transformer Depth Hierarchycited by 12
  15. 2025Graph neural networks extrapolate out-of-distribution for shortest pathscited by 11
  16. 2025Unique Hard Attention: A Tale of Two Sidescited by 10
  17. 2025The Role of Sparsity for Length Generalization in Transformerscited by 8
  18. 2025Non-Asymptotic Length Generalizationcited by 7
  19. 2025On Vanishing Variance in Transformer Length Generalizationcited by 6
  20. 2025Born a Transformer -- Always a Transformer? On the Effect of Pretraining on Architectural Abilitiescited by 6
  21. 2025Scale-invariant Attentioncited by 5

Built on by

Cited by year (2026 to 14 Oct)

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

8 papers.