arXiv:2610.41218cs.LGOct 2026

Manuscript Offprint

arXiv:2610.41218

A Positional Realizability Theory of Length Generalization in Single-Head Attention

Jiasong Han, Yunkai Chai, Jintao Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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 TLT_L that re-evaluates a selected length-L0L_0-realizing positional kernel on the longer grid, with a scalar αL∈[0,1]\alpha_L \in [0,1] read off before any training from (Φ,tn)(\Phi, t_n) alone. Here αL\alpha_L 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 αL\alpha_L 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 αL\alpha_L 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.

1 Introduction

Length generalization (LG), training on short sequences and testing on longer ones, is a sharp probe of whether a transformer has learned an algorithm rather than a length-specific shortcut, and a practical bottleneck for tasks from arithmetic to long-context reasoning (Anil et al., 2022; Jelassi et al., 2023; Zhou et al., 2024b). A large body of empirical work has distilled a clear and consistent picture: LG depends acutely on the positional encoding (PE). Learned-absolute PEs typically fail, relative schemes such as RoPE and ALiBi extrapolate fixed relative offsets, absolute schemes lock fixed absolute positions, and growing-offset tasks such as copy and reverse defeat essentially everything (Kazemnejad et al., 2023; Press et al., 2022; Su et al., 2024; Ruoss et al., 2023; Wang et al., 2024). Existing theory captures pieces of this picture either qualitatively (the RASP-L conjecture, Zhou et al., 2024a; the C-RASP framework, Huang et al., 2025) or through bounds evaluated on the trained model (Izzo et al., 2025). What is missing is an account that derives this picture from the attention mechanism itself: a quantity, computable from the PE

Figure

Training-free: αL\alpha_L is computed from the positional feature map Φ\Phi and the task target tnt_n alone, with no Transformer training, no data samples, and no learned Transformer parameters.

Object certified: the fitted positional kernel (this pipeline, Thm 1). Object measured: the trained Transformer (§6). Gap: selection / content / depth (§7).

Figure 1: Overview of the method. Select (fit) a single positional head's kernel at length L0L_0 realizing the task's target pattern RL0R_{L_0}; transfer the same kernel to a longer grid via TLT_L (re-evaluate ΦLWΦL⊤\Phi_L W \Phi_L^\top, no retraining); old rows keep their argmax by the causal-mask identity (Thm 1); score the new rows [L0,L)[L_0, L) to read off αL∈[0,1]\alpha_L \in [0,1]. The whole pipeline uses only (Φ,tn)(\Phi, t_n), with no Transformer training, no data samples, and no learned Transformer parameters (only a deterministic kernel-selection on the PE basis).

and the task before any training, that says which (PE, task) pairs can length-generalize and why.

The quantity, in one example (Figure 1). Fit a single positional attention head to the prev-token target at training length L0L_0: it attends from each position to the one before it. Now re-evaluate the same kernel on a longer grid and count the fraction of new positions whose attention still peaks on the previous token. For RoPE this fraction is 1 (the relative kernel is length-independent); for a copy task, whose target offset grows with the sequence, it is 0. That fraction is the simulation alignment αL∈[0,1]\alpha_L \in [0,1], the object we study. It is read off from the PE's feature map and the task's target function alone, with no end-to-end Transformer training, no data samples, and no learned Transformer parameters (only a deterministic kernel-selection on the PE basis). It is the computable witness of a simulation transfer operator TLT_L that re-evaluates the selected length-L0L_0-realizing kernel on the length-LL grid (§4). It is model-free and data-free, but selection-rule dependent: the value depends on which realizing kernel the L0L_0-fit selects (§4).

Such a pre-training, data-free quantity is useful in two ways. Practically, it lets one triage (PE, task) choices before spending any compute. Scientifically, which is our focus and the more durable contribution, it converts the empirical PE pattern from a list of observations into a derived consequence of what a single attention head can realize and transfer across lengths, with theorems that say exactly where the pattern holds and proofs of where it must break.

We prove that αL=1\alpha_L = 1 implies exact length generalization (Theorem 1), and we characterize precisely when relative encodings reach it (Theorem 2): the required offset must settle on a single value on all but a vanishing fraction of the “deep” rows of the attention grid, and that value must be attainable as a strict maximizer inside the encoding's own kernel family. So prev/skip-kk generalize while copy and reverse provably cannot (for kernels with a strict unique global maximizer), recovering the received taxonomy as a theorem. Empirically, across 2625 trained-model measurements, αL\alpha_L cleanly separates the (PE, task) pairs that length-generalize from those that do not. We are deliberate about scope: we study a controlled abstraction, the positional channel in isolation, precisely so the theory can be exact. Content and depth escapes are explicitly mapped (§6–7); e.g. an induction task length-generalizes through the content channel exactly where positional αL=0\alpha_L=0. We aim to characterize the positional channel's realizability and to locate where it ceases to be the operative mechanism; explaining all of Transformer LG is outside our scope.