arXiv:2610.07676cs.LGOct 2026

Manuscript Offprint

arXiv:2610.07676

Exact-Solution Volume and Length Generalization in Transformers

Yijia Jessica Zhu, David Chiang

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

ABSTRACT

Research on transformer expressivity shows whether a transformer is capable of solving a given task, but gives little indication of whether the solution, if learned, is generalizable to longer input lengths. We study this question through normalized exact-solution volume (NESV): the fraction of a bounded parameter region that achieves an exact solution on every input of length n. For fixed-width, single-layer transformers with log n-scaled attention, we establish asymptotic bounds on NESV for four tasks: FIRST ( Θ(1)\Theta(1)), MAJORITY ( Θ(1/(nlog⁡n))\Theta(1/(n\log n))), INDEX ( Θ(1/n3)\Theta(1/n^3)), and PARITY (0). These results are consistent with previous empirical results: the faster the exact-solution volume decays with input length, the harder it is to length-generalize on that task. Looking deeper into INDEX, our volume analysis reveals two error sources that grow with n. Consequently, we study a transformer model that would structurally eliminate one of the terms, theoretically improving the NESV bound to Θ(n−1)\Theta(n^{-1}), and empirically achieving 85% accuracy when tested at 10×10\times the training length, compared with the 60% accuracy of the original model. We conclude that volume analysis may be a useful approach to identify concrete sources of length sensitivity and thus provide insights into task-specific model refinements.

1 INTRODUCTION

Theoretical work on the expressivity of transformers (cf. the survey by Strobl et al., 2024) can be seen as a prelude to the study of learnability by transformers, since the existence of a transformer and parameters that solve a given problem is a prerequisite for a transformer to learn to solve the problem. But the existence of a single point in parameter space does not tell us much about whether that point is actually learnable. In this paper, following Kover et al. (2026), we ask a more difficult question: given that a problem is solvable by a transformer with some parameters, how large is the set of successful parameters? While Kover et al. (2026) arrived at somewhat pessimistic conclusions, we look at single-layer transformers with log n-scaling and find that, the volume of the set of successful parameters, as a function of the sequence length n, provides a way to quantify the difficulty of length-generalization in various problems.

The drive for looking beyond expressivity is also visible in experiments on simple sequence tasks. Chiang & Cholak (2022) construct exact transformers for FIRST (whether the first symbol is a 1) and PARITY (whether the number of 1's is odd), but report that standard training fails on PARITY, and that FIRST does not necessarily extrapolate to longer inputs without log n-scaling. Hahn & Rofin (2024) report that fitted PARITY solutions become much sharper as input length grows than fitted solutions for FIRST and MAJORITY (whether there are more 1's than 0's). Thus, tasks that are all expressible can behave differently under training and length extrapolation.

Such findings motivate examining the geometry of the parameter sets that implement a task. In related work on loss landscapes, Chiang et al. (2023) argue that the geometry and volume of low-loss regions can explain part of neural-network generalization without relying entirely on the implicit bias of gradient descent. We study a related exact-solution quantity at each finite input length. For a fixed task and architecture, we restrict the trainable parameters to a bounded region and measure the fraction that correctly solves the task on every input of length n. We call this quantity the normalized exact-solution volume (NESV). Its dependence on n describes how the full set of exact solutions changes as the

Table 1: NESV bounds and mean accuracy at 10×10 \times the maximum training length for the four tasks. The models Agen\mathcal{A}_{\mathrm{gen}}, Asin\mathcal{A}_{\mathrm{sin}}, and Apos\mathcal{A}_{\mathrm{pos}} are described in Section 2.2, while Anorm\mathcal{A}_{\mathrm{norm}} is described in Section 4.2.

TaskModel
Positional (Apos\mathcal{A}_{\text{pos}})General (Agen\mathcal{A}_{\text{gen}})Sinusoidal (Asin\mathcal{A}_{\text{sin}})Normalized (Anorm\mathcal{A}_{\text{norm}})
NESVAcc. (%)NESVAcc. (%)NESVAcc. (%)NESVAcc. (%)
FIRSTΘ(1)\Theta(1)100.0051.12055.06Θ(1)\Theta(1)100.0
MAJORITY—92.7Θ((nlog⁡n)−1)\Theta((n\log n)^{-1})82.6Θ((n3log⁡n)−1)\Theta((n^3\log n)^{-1})87.5—92.7
INDEXΘ(n−3)\Theta(n^{-3})59.6051.9050.2Θ(n−1)\Theta(n^{-1})85.1
PARITY0—0—0—0—

computation is required to handle longer inputs. With uniform sampling over the bounded parameter region, this is the probability of sampling an exact solution. Comparing this baseline with empirical training results can help distinguish the effects of initialization and optimization from the nature of the task and the selected transformer model in terms of learnability.

We consider four binary classification tasks on binary strings. FIRST returns the first input symbol, whereas INDEX returns the symbol at a position specified by one of the input tokens. MAJORITY returns whether more than half of input symbols are 1's, whereas PARITY returns whether the number of 1's is odd. We refer to the first pair as positional tasks, and the second pair as counting tasks.

We conduct our analyses on the simplest models suited to solve the corresponding problems. In all cases, we only consider single-layer transformers. For the positional tasks, we use a model with positional encoding (j,j2)(j, j^2) where the Query and Key maps only depend on token positions and the Value map only depends on the tokens themselves (following the form of the construction of Bhattamishra et al. (2024)). For the counting tasks, the positions of the tokens are irrelevant, so we primarily use a model without positional encoding. We also examined a model with sinusoidal positional encoding (sin⁡(j),cos⁡(j))(\sin(j), \cos(j)).

See Table 1 for a summary of the asymptotic bounds obtained with respect to input length nn. Under the positional model Apos\mathcal{A}_{\mathrm{pos}}, the NESV for INDEX is Θ(n−3)\Theta(n^{-3}), while FIRST has constant NESV. The sinusoidal model Asin\mathcal{A}_{\mathrm{sin}} has volume 0 for both. Under the position-free model Agen\mathcal{A}_{\mathrm{gen}}, the NESV for MAJORITY is Θ(1/(nlog⁡n))\Theta(1/(n\log n)). Under the sinusoidal model Asin\mathcal{A}_{\mathrm{sin}}, the NESV for MAJORITY is instead Θ(1/(n3log⁡n))\Theta(1/(n^3\log n)). PARITY has a zero NESV whenever n>h+1n > h + 1 for both models, hh being the width of the transformer. This is a direct consequence of the standard one-dimensional capacity of shallow ReLU networks (Arora et al., 2018) in the finite-length setting, and is consistent with the broader result that no one-layer, one-head transformer computes PARITY across all lengths (Kozachinskiy et al., 2026b).

We train those tasks under the same protocol. The empirical results are in line with our NESV analysis: the task-model pair whose NESV shrinks faster as nn grows shows worse length generalization. The only counterexample was that, under the general sinusoidal model, MAJORITY trains as well as under the position-free model Agen\mathcal{A}_{\mathrm{gen}}, although the former's volume shrinks faster with nn.

Among the tasks we examine, INDEX demonstrates particularly bad length generalization (60% average accuracy at ten times training length) despite being expressible (Kozachinskiy et al., 2026a). Our NESV analysis reveals the underlying mechanisms. Exact retrieval of a designated position kk requires that position to receive enough attention, so its attention score must remain within a constant of the maximum attention score. Expressing the difference in attention scores between neighboring positions as a function of kk reveals two key error components, one proportional to k2k^2 and another proportional to kk, which are the sources of failing length generalization.

Guided by this analysis, we modify the model so that the error term proportional to k2k^2 no longer grows with input length. This is called the normalized positional model. The NESV improves from Θ(n−3)\Theta(n^{-3}) to Θ(n−1)\Theta(n^{-1}). In our experiments, the modified model also generalizes substantially better on INDEX, achieving an average accuracy of 85%85\% percent at ten times the training length.

Taken together, the results show that expressivity alone can conceal qualitatively different parameter-space behavior. Volume analysis, on the other hand, may offer another useful tool to further identify the computational constraints responsible for learning behaviors and offer insight for task-specific model refinements.