mlsanityData to 14 Oct 2026

Relative Positions Generalize, Absolute Positions Memorize: An Implicit-Bias Account of Length Generalization in Attention

arXiv 2607.18759 ↗First posted 21 Jul 2026cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Transformers with relative positional encodings often extrapolate to sequences longer than those seen during training, whereas transformers with learned absolute encodings typically do not. This is a robust empirical regularity, and the explanations offered for it so far are chiefly about expressivity, that is, about whether a length-generalizing solution exists. We give an optimization explanation. On a minimal fixed-offset retrieval task that isolates positional selection, the gap is governed by the implicit bias of the trained attention head: among the many solutions that fit short sequences, which one gradient descent actually selects. We prove that rotary encodings make the attention logit a function of relative offset alone, an exact equivariance, so whatever selection rule is learned at training lengths is reproduced verbatim at every longer length. Learned absolute encodings instead leave out-of-range positions unconstrained, and the trained head pins to a fixed absolute position inside the training range. We characterize the learned rotary rule as a low-rank ``carrier'' kernel aligned with the target offset, and we derive the resulting graceful accuracy decay as an attention-dilution law; both predictions are confirmed across seeds and offsets. A linear-attention control shows the mechanism is specific to softmax: without normalization, training selects a min-norm interpolant that does not extrapolate. The phenomenon, the equivariance, and the carrier all transfer to a multi-layer, multi-head transformer trained on a full-sequence length-generalization task. The account connects the implicit bias of attention, implicit bias for extrapolation in recurrent models, and the learning side of the RASP-L conjecture.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 17 of its 20 references that are in the map. First posted on arXiv 21 Jul 2026.

Builds on

17 of 20 references.

References · 17

  1. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
  2. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  3. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
  4. 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 601
  5. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
  6. 2022Neural Networks and the Chomsky Hierarchycited by 217
  7. 2022Exploring Length Generalization in Large Language Modelscited by 206
  8. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
  9. 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
  10. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 117
  11. 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 115
  12. 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
5 more
  1. 2024A Formal Framework for Understanding Length Generalization in Transformerscited by 45
  2. 2024Implicit Bias and Fast Convergence Rates for Self-attentioncited by 31
  3. 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
  4. 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Taskscited by 11
  5. 2022On the Implicit Bias of Gradient Descent for Temporal Extrapolationcited by 7

Built on by

Not cited yet.