A Positional Realizability Theory of Length Generalization in Single-Head Attention
Organizations: Department of Electronic Engineering, Tsinghua University · School of Information and Communication Engineering, Shanghai Jiao Tong University
Abstract
Why does length generalization (LG) depend so sharply on the positional encoding (PE)? Relative schemes extrapolate fixed offsets, absolute schemes fix positions, and neither handles growing offsets. We give a realizability theory for a deliberately controlled abstraction, a single positional-only attention head, that derives this well-documented empirical pattern and says precisely where it holds and breaks. The device is a simulation transfer operator that re-evaluates a selected length--realizing positional kernel on the longer grid, with a scalar read off before any training from alone. Here serves as the computable witness of that taxonomy's derivation, not as a stronger empirical predictor. Our results are a relative-head deep-row characterization for kernels with a strict unique global maximizer (Theorem 2), an absolute/relative duality that derives the pattern (Proposition 4), a learned-absolute underdetermination result, and a static expressivity bound; a sufficiency theorem (Theorem 1) bridges to LG, and the general deterministic case is a precise open conjecture (correcting a tempting but invalid "outside-colspan" argument). Experiments confirm the structure: in the controlled single-head regime exactly separates the taxonomy's generalizing and non-generalizing (PE, task) cells (2625 trained-model measurements; stable at vocab 64/d=128). Together, these results turn the received PE taxonomy into a positional-kernel transfer theorem, and identify the content and depth mechanisms that escape it. The theory concerns the positional channel alone: tasks whose targets depend on token content, including the standard length-generalization suite such as addition and sorting, fall outside Theorem 2.
Figures & tables
| pre-training? | granularity | PE-keyed? | direction | |
|---|---|---|---|---|
| RASP-L ( Zhou et al., 2024a ) | yes | discrete | no | suff. (conj.) |
| C-RASP[Pos] ( Huang et al., 2025 ) | yes | task, binary | by PE-class | suff.+nec. |
| Izzo et al. ( Izzo et al., 2025 ) | train-length bd. | model-level | no | sufficiency |
| spectral PE ( Gu et al., 2025 ) | post-hoc | model-level | spectral | – |
| (ours) | yes | cell, cont. | by feat. map | suff. + rel. nec. + conj. |
| Axis | Levels | Rationale |
|---|---|---|
| PEs | learned-abs, NoPE, ALiBi, sinusoidal, RoPE | the five canonical PE classes |
| Tasks | prev, skip-2/3/5, copy, reverse, first | fixed-relative, growing-offset, fixed-absolute regimes |
| ( pos-2/5, App. E ) | interior absolute positions, off the causal boundary | |
| Lengths | extrapolation beyond ( – ) | |
| Seeds | variance / bootstrap CIs | |
| Models | 1L1H, 2L4H, 4L4H | 1-layer 1-head setting depth/multi-head escape routes |
| PE | task | LG (1L1H) | LG (2L4H) | |
| RoPE | skip5 | 1.00 | ||
| RoPE | prev | 1.00 | ||
| RoPE | copy | 0.00 | ||
| sinusoidal | first | 1.00 | ||
| sinusoidal | skip3 | 0.25 | ||
| learned-abs | first | 1.00 |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| tier | depth | learnable Spearman (95% CI) | sufficiency precision (95% CI) |
|---|---|---|---|
| 1L1H | 1 | 0.90 | 0.925 |
| 2L4H | 2 | 0.31 | 0.94 |
| 4L4H | 4 | 0.28 | 0.97 |
| kernel fit | Spearman | Pearson |
|---|---|---|
| min-norm interpolant (Thm 1 ’s ) | 0.56 | 0.57 |
| cross-entropy, wd (reported ) | 0.91 | 0.95 |
| cross-entropy, wd (max-margin) | 0.92 | 0.94 |
| PE | task | train acc | LG@60 | LG@80 | |
|---|---|---|---|---|---|
| learned-abs | pos2 | 1.00 | 1.00 | 1.00 | 1.00 |
| learned-abs | pos5 | 1.00 | 1.00 | 1.00 | 1.00 |
| sinusoidal | pos2 | 1.00 | 0.98 | 0.98 | 0.97 |
| sinusoidal | pos5 | 1.00 | 1.00 | 1.00 | 0.99 |
| NoPE | pos2 | 0.00 | 0.24 | 0.16 | 0.16 |
| NoPE | pos5 | 0.00 | 0.22 | 0.16 | 0.15 |
| tier | vocab , (main) | vocab , |
|---|---|---|
| 1L1H | 0.90 | 0.92 |
| 2L4H (scale) | 0.36 | 0.45 |
| screen AUC | 1.00 | 1.00 | 1.00 |
|---|---|---|---|
| # generalizing cells | 4/25 | 4/25 | 4/25 |
| rope / prev ( / LG) | 1.00 / 0.93 | 1.00 / 0.87 | 1.00 / 0.87 |
| rope / skip-3 | 1.00 / 1.00 | 1.00 / 1.00 | 1.00 / 0.98 |
| rope / copy (growing) | 0.00 / 0.12 | 0.00 / 0.10 | 0.00 / 0.09 |
| rope / reverse (growing) | 0.00 / 0.16 | 0.03 / 0.14 | 0.00 / 0.12 |
| PE | train acc (2L4H) | LG@60 (2L4H) | positional |
|---|---|---|---|
| ALiBi | 0.96 | 0.84 | 0 |
| RoPE | 1.00 | 0.43 | 0 |
| NoPE | 0.76 | 0.34 | 0 |
| learned-abs | 0.99 | 0.27 | 0 |
| sinusoidal | 0.98 | 0.26 | 0 |
| RoPE freq. scale | train acc | LG@60 | |
|---|---|---|---|
| / | 1.00 | 1.00 | 1.00 |
| 1.00 | 0.94 | 0.93 | |
| 0.00 | 0.88 | 0.88 | |
| 0.00 | 0.23 | 0.18 |
| RoPE setting | prev | skip3 | copy | reverse | first |
|---|---|---|---|---|---|
| ( ) | 1.00 | 1.00 | 0.00 | 0.00 | 0.17 |
| ( ) | 1.00 | 1.00 | 0.00 | 0.03 | 0.20 |
| ( ) | 1.00 | 1.00 | 0.00 | 0.00 | 0.03 |
| base | 1.00 | 1.00 | 0.00 | 0.03 | 0.05 |
| base | 1.00 | 1.00 | 0.00 | 0.03 | 0.03 |
| sinusoidal setting | prev | skip3 | copy | reverse | first |
|---|---|---|---|---|---|
| ( ) | 0.47 | 0.50 | 0.00 | 0.00 | 0.93 |
| ( ) | 0.45 | 0.25 | 0.07 | 0.00 | 1.00 |
| ( ) | 0.00 | 0.00 | 0.00 | 0.00 | 1.00 |
| base | 0.17 | 0.28 | 0.00 | 0.00 | 1.00 |
| base | 0.15 | 0.12 | 0.00 | 0.00 | 1.00 |
Length Generalization
Length generalization studies whether sequence models trained on short inputs can reliably solve the same tasks on longer sequences.
See all 50 papers