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. [11 ] , 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. [11 ] arrived at somewhat pessimistic conclusions, we look at single-layer transformers with log n n n -scaling and find that, the volume of the set of successful parameters, as a function of the sequence length n n 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 [6 ] 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 n n -scaling. Hahn & Rofin [8 ] 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. [7 ] 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 n n . We call this quantity the normalized exact-solution volume (NESV) . Its dependence on n n n describes how the full set of exact solutions changes as the 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 , j 2 ) (j, j^2) ( 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. [4 ] ). 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)) ( sin ( j ) , cos ( j )) .
See Table 1 for a summary of the asymptotic bounds obtained with respect to input length n n n . Under the positional model A p o s \mathcal{A}_{\mathrm{pos}} A pos , the NESV for INDEX is Θ ( n − 3 ) \Theta(n^{-3}) Θ ( n − 3 ) , while FIRST has constant NESV. The sinusoidal model A s i n \mathcal{A}_{\mathrm{sin}} A sin has volume 0 for both. Under the position-free model A g e n \mathcal{A}_{\mathrm{gen}} A gen , the NESV for MAJORITY is Θ ( 1 / ( n log n ) ) \Theta(1/(n \log n)) Θ ( 1/ ( n log n )) . Under the sinusoidal model A s i n \mathcal{A}_{\mathrm{sin}} A sin , the NESV for MAJORITY is instead Θ ( 1 / ( n 3 log n ) ) \Theta(1/(n^3 \log n)) Θ ( 1/ ( n 3 log n )) . PARITY has a zero NESV whenever n > h + 1 n > h + 1 n > h + 1 for both models, h h h being the width of the transformer. This is a direct consequence of the standard one-dimensional capacity of shallow ReLU networks (Arora et al. [1 ] ) 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., [14 ] ).
Table 1. NESV bounds and mean accuracy at 10× the maximum training length for the four tasks. The models A g e n \mathcal{A}_{\mathrm{gen}} A gen , A s i n \mathcal{A}_{\mathrm{sin}} A sin , and A p o s \mathcal{A}_{\mathrm{pos}} A pos are described in § 2.2 , while A n o r m \mathcal{A}_{\mathrm{norm}} A norm is described in § 4.2 .
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 n n n 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 A g e n \mathcal{A}_{\mathrm{gen}} A gen , although the former’s volume shrinks faster with n n n .
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 k k k 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 k k k reveals two key error components, one proportional to k 2 k^2 k 2 and another proportional to k k k , which are the sources of failing length generalization.
Guided by this analysis, we modify the model so that the error term proportional to k 2 k^2 k 2 no longer grows with input length. This is called the normalized positional model. The NESV improves from Θ ( n − 3 ) \Theta(n^{-3}) Θ ( n − 3 ) to Θ ( n − 1 ) \Theta(n^{-1}) Θ ( n − 1 ) . In our experiments, the modified model also generalizes substantially better on INDEX, achieving an average accuracy of 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.
Setup
In this section, we describe the tasks to be analyzed and the transformers to be used in the analysis.
Tasks and exact-solution volume
For n ≥ 1 n \ge1 n ≥ 1 , write [ n ] = { 1 , … , n } [n] = \{1,\ldots,n\} [ n ] = { 1 , … , n } and let w = ( w 1 , … , w n ) ∈ { 0 , 1 } n w = (w_1,\ldots,w_n) \in\{0,1\}^n w = ( w 1 , … , w n ) ∈ { 0 , 1 } n . We study
F I R S T n ( w ) = w 1 I N D E X n ( w , k ) = w k , k ∈ [ n ] , M A J O R I T Y n ( w ) = 1 { ∑ j = 1 n w j ≥ n + 1 2 } for odd n , P A R I T Y n ( w ) = ( ∑ j = 1 n w j ) m o d 2. \begin{aligned}
\mathrm{FIRST}_n(w) &= w_1 \\
\mathrm{INDEX}_n(w,k) &= w_k,\quad k \in[n], \\
\mathrm{MAJORITY}_n(w) &= 1\left\{\sum_{j=1}^{n} w_j \ge\frac{n+1}{2}\right\}\quad\text{for odd }n, \\
\mathrm{PARITY}_n(w) &= \left(\sum_{j=1}^{n}w_j\right)\bmod2.
\end{aligned} FIRST n ( w ) INDEX n ( w , k ) MAJORITY n ( w ) PARITY n ( w ) = w 1 = w k , k ∈ [ n ] , = 1 { j = 1 ∑ n w j ≥ 2 n + 1 } for odd n , = ( j = 1 ∑ n w j ) mod 2.
For INDEX, the n n n tokens w 1 , … , w n w_1,\ldots,w_n w 1 , … , w n , which we call data tokens , are followed by a single token, which we call the index token , encoding k k k . We refer to this as right-hand sequence INDEXing. For the other tasks, there is an index token for consistency’s sake, but it is fixed.
Definition 1 (Normalized exact-solution volume, NESV). For a task T T T and transformer model A \mathcal{A} A , let S n T , A S_n^{T,\mathcal{A}} S n T , A be the parameters for which the output is strictly correct on every length-n n n input, and on every index k k k . For a fixed parameter bound B > 0 B>0 B > 0 , define
V B T , A ( n ) = λ D A ( S n T , A ∩ [ − B , B ] D A ) ( 2 B ) D A . (1) V_B^{T,\mathcal{A}}(n)=\frac{\lambda_{D_{\mathcal{A}}}\left(S_n^{T,\mathcal{A}}\cap[-B,B]^{D_{\mathcal{A}}}\right)}{(2B)^{D_{\mathcal{A}}}}. \tag*{(1)} V B T , A ( n ) = ( 2 B ) D A λ D A ( S n T , A ∩ [ − B , B ] D A ) . (1) Equivalently, (1) is the probability of obtaining a correct solution when each scalar parameter is sampled independently and uniformly from [ − B , B ] [-B,B] [ − B , B ] . Unless stated otherwise, B B B and the hidden width of the FFNN, h h h , are fixed as n n n grows. Throughout, log \log log denotes the natural logarithm; ∥ ⋅ ∥ 2 \lVert\cdot\rVert_2 ∥ ⋅ ∥ 2 and ∥ ⋅ ∥ ∞ \lVert\cdot\rVert_\infty ∥ ⋅ ∥ ∞ denote the Euclidean and maximum-coordinate norms. Throughout, c , C > 0 c,C>0 c , C > 0 and the constants implicit in the subscripted asymptotic notation such as Θ B , h \Theta_{B,h} Θ B , h may depend on B B B and h h h , but never on n n n ; c , C c,C c , C may change from line to line.
Transformer Models
We consider only single-layer transformers. Let x j x_j x j denote the j j j -th data token and let z z z denote the index token. The query, key, and value maps have the form Q ( x ) = W Q x + b Q Q(x)=W_Qx+b_Q Q ( x ) = W Q x + b Q , K ( x ) = W K x + b K K(x)=W_Kx+b_K K ( x ) = W K x + b K , V ( x ) = W V x + b V V(x)=W_Vx+b_V V ( x ) = W V x + b V . Writing q = Q ( z ) q=Q(z) q = Q ( z ) , k j = K ( x j ) k_j=K(x_j) k j = K ( x j ) , v j = V ( x j ) v_j=V(x_j) v j = V ( x j ) , the attention output is
α j = exp ( ( log n ) q T k j ) ∑ i = 1 n exp ( ( log n ) q T k i ) , A = ∑ j = 1 n α j u j . (2) \alpha_j=\frac{\exp((\log n)q^{\mathsf T}k_j)}{\sum_{i=1}^{n}\exp((\log n)q^{\mathsf T}k_i)},\qquad A=\sum_{j=1}^{n}\alpha_j u_j. \tag*{(2)} α j = ∑ i = 1 n exp (( log n ) q T k i ) exp (( log n ) q T k j ) , A = j = 1 ∑ n α j u j . (2)
The log n \log n log n factor was proposed by Chiang & Cholak [6 ] and Nakanishi [16 ] and has been used in practice in Qwen (Bai et al., [2 ] ). Chen et al. [5 ] provide additional theoretical justification for this choice. In this paper, this choice is natural since we study positional tasks such as INDEX, where attention must continue to select a particular position as the number of competing positions grows with the input length. We omit the 1 / d 1/\sqrt{d} 1/ d factor in conventional log n \log n log n scaling because d d d is constant in n n n and does not affect the asymptotic bounds in n n n .
The self-attention is followed by a feed-forward network (FFNN) classifier with hidden width h h h :
y = W 2 ReLU ( W 1 A + b 1 ) + b 2 ∈ R 2 , (3) y=W_2\operatorname{ReLU}(W_1A+b_1)+b_2\in\mathbb{R}^2, \tag*{(3)} y = W 2 ReLU ( W 1 A + b 1 ) + b 2 ∈ R 2 , (3)
where W 1 ∈ R h × 2 W_1\in\mathbb{R}^{h\times2} W 1 ∈ R h × 2 , b 1 ∈ R h b_1\in\mathbb{R}^h b 1 ∈ R h , W 2 ∈ R 2 × h W_2\in\mathbb{R}^{2\times h} W 2 ∈ R 2 × h , b 2 ∈ R 2 b_2\in\mathbb{R}^2 b 2 ∈ R 2 .
The two coordinates of y y y are indexed by the labels { 0 , 1 } \{0,1\} { 0 , 1 } , and the predicted label is y ^ = argmax c ∈ { 0 , 1 } ( y ) c \hat{y} = \operatorname*{argmax}_{c \in\{0,1\}}(y)_c y ^ = argmax c ∈ { 0 , 1 } ( y ) c . When the input needs to be explicit, we write A ( w , k ) A(w,k) A ( w , k ) and y ( w , k ) y(w,k) y ( w , k ) .
We do not use residual connections or layer normalization. Adding them could alter the size and geometry of the exact-solution set; we leave this extension for future work.
In this paper, we consider four models. We describe three of them here; the fourth, A n o r m \mathcal{A}_{\mathrm{norm}} A norm , we leave for § 4.2 .
In the general model A g e n ( h ) \mathcal{A}_{\mathrm{gen}}(h) A gen ( h ) , the data tokens are x j = e w j ∈ R 2 x_j=e_{w_j}\in\mathbb{R}^2 x j = e w j ∈ R 2 , and the index token is z = 0 2 z=0_2 z = 0 2 . The maps Q , K , V : R 2 → R 2 Q,K,V:\mathbb{R}^2\to\mathbb{R}^2 Q , K , V : R 2 → R 2 are unrestricted affine maps, so q = Q ( 0 2 ) q=Q(0_2) q = Q ( 0 2 ) , k j = K ( e w j ) k_j=K(e_{w_j}) k j = K ( e w j ) , and v j = V ( e w j ) v_j=V(e_{w_j}) v j = V ( e w j ) . So A g e n ( h ) \mathcal{A}_{\mathrm{gen}}(h) A gen ( h ) has D c o u n t = 5 h + 20 D_{\mathrm{count}}=5h+20 D count = 5 h + 20 trainable scalar parameters.
We also examined a model, A s i n ( h ) \mathcal{A}_{\mathrm{sin}}(h) A sin ( h ) , with a sinusoidal positional encoding ( sin ( j ) , cos ( j ) ) (\sin(j),\cos(j)) ( sin ( j ) , cos ( j )) .
For the positional tasks, we use the positional model A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) . The data token at position j j j and the index token encoding k k k are
x j p o s = [ e w j j j 2 ] ∈ R 4 , z k p o s = [ 0 2 k 0 ] ∈ R 4 x_j^{\mathrm{pos}} =
\begin{bmatrix}
e_{w_j}\\
j\\
j^2
\end{bmatrix}
\in\mathbb{R}^4,
\qquad
z_k^{\mathrm{pos}} =
\begin{bmatrix}
0_2\\
k\\
0
\end{bmatrix}
\in\mathbb{R}^4 x j pos = e w j j j 2 ∈ R 4 , z k pos = 0 2 k 0 ∈ R 4
(where 0 2 0_2 0 2 is the two-dimensional zero vector). For FIRST, the index is fixed at k = 1 k=1 k = 1 . For INDEX, the index k ∈ [ n ] k\in[n] k ∈ [ n ] is supplied as part of the input. Because j j j and j 2 j^2 j 2 grow without bound in the input length, allowing them to propagate through the network would like lead to instability; positional-encoding choices are known to strongly affect length extrapolation [10 ] . Accordingly, we constrain the model to have the form of the index-lookup construction of Bhattamishra et al. [4 ] :
W Q p o s = [ 0 2 × 2 a 0 2 ] , b Q p o s = b , W_Q^{\mathrm{pos}}=[0_{2\times2}\ \ a\ \ 0_2], \qquad b_Q^{\mathrm{pos}}=b, W Q pos = [ 0 2 × 2 a 0 2 ] , b Q pos = b ,
W K p o s = [ 0 2 × 2 r s ] , b K p o s = c K , W_K^{\mathrm{pos}}=[0_{2\times2}\ \ r\ \ s], \qquad b_K^{\mathrm{pos}}=c_K, W K pos = [ 0 2 × 2 r s ] , b K pos = c K ,
W V p o s = [ C V 0 2 × 2 ] , b V p o s = b V . W_V^{\mathrm{pos}}=[C_V\ \ 0_{2\times2}], \qquad b_V^{\mathrm{pos}}=b_V. W V pos = [ C V 0 2 × 2 ] , b V pos = b V .
where a , b , r , s , c K , b V ∈ R 2 a,b,r,s,c_K,b_V\in\mathbb{R}^2 a , b , r , s , c K , b V ∈ R 2 , C V ∈ R 2 × 2 C_V\in\mathbb{R}^{2\times2} C V ∈ R 2 × 2 (and 0 2 × 2 0_{2\times2} 0 2 × 2 is the 2 × 2 2\times2 2 × 2 zero matrix). This model has D p o s = 5 h + 18 D_{\mathrm{pos}}=5h+18 D pos = 5 h + 18 trainable scalar parameters.
NESV bounds and length generalization
We first establish the volume bounds for the four tasks and then compare such results with those of length-generalization experiments.
Main result
Theorem 1 (NESV bounds). Fix B > 0 B>0 B > 0 and h ≥ 2 h\ge2 h ≥ 2 . As n → ∞ n\to\infty n → ∞ ,
V B F I R S T , A p o s ( h ) ( n ) = Θ B , h ( 1 ) (4) V_B^{\mathrm{FIRST},\mathcal{A}_{\mathrm{pos}}(h)}(n)=\Theta_{B,h}(1) \tag*{(4)} V B FIRST , A pos ( h ) ( n ) = Θ B , h ( 1 ) (4) V B I N D E X , A p o s ( h ) ( n ) = Θ B , h ( n − 3 ) (5) V_B^{\mathrm{INDEX},\mathcal{A}_{\mathrm{pos}}(h)}(n)=\Theta_{B,h}(n^{-3}) \tag*{(5)} V B INDEX , A pos ( h ) ( n ) = Θ B , h ( n − 3 ) (5) V B M A J O R I T Y , A g e n ( h ) ( n ) = Θ B , h ( ( n log n ) − 1 ) n odd (6) V_B^{\mathrm{MAJORITY},\mathcal{A}_{\mathrm{gen}}(h)}(n)=\Theta_{B,h}\left((n\log n)^{-1}\right) \qquad n\ \text{odd} \tag*{(6)} V B MAJORITY , A gen ( h ) ( n ) = Θ B , h ( ( n log n ) − 1 ) n odd (6) V B P A R I T Y , A g e n ( h ) ( n ) = 0 n > h + 1. (7) V_B^{\mathrm{PARITY},\mathcal{A}_{\mathrm{gen}}(h)}(n)=0 \qquad n>h+1. \tag*{(7)} V B PARITY , A gen ( h ) ( n ) = 0 n > h + 1. (7)
Proof sketch. For FIRST, one can choose parameters such that the attention score decreases quadratically away from position one. A fixed neighborhood of these parameters preserves that decrease, and the resulting concentration of attention lets the classifier return the first symbol for all sufficiently large lengths. The neighborhood does not shrink with n n n , thus ensuring a constant NESV bound.
However, the same argument cannot be used for INDEX, because the attention score must peak at j = k j=k j = k for every possible k k k , and small errors that are harmless at one position can be amplified at another. We examine the two relevant error sources in § 4 .
In the position-free model A g e n \mathcal{A}_{\mathrm{gen}} A gen , a word is represented only by its number of 1’s. For MAJORITY, the output changes only once, between counts ( n − 1 ) / 2 (n-1)/2 ( n − 1 ) /2 and ( n + 1 ) / 2 (n+1)/2 ( n + 1 ) /2 . These counts differ by just one, so the interval that separates them narrows as n n n increases. Consequently, placing the decision boundary between them requires increasingly precise parameter choice.
For PARITY, by contrast, every increment in the count must flip the output. A fixed number of hidden ReLU units cannot provide arbitrarily many flips in output. The upper bound of zero, meaning that PARITY is not solvable by the class of transformers considered here, is consistent with previous theoretical results [14 ] and experiments [6 , 8 ] .
The complete proofs of the four bounds, including the technical details omitted from the INDEX proof sketch in § 4.1 , are given in Appendix § 8 .
For detailed results related to the sinusoidal model A s i n \mathcal{A}_{\mathrm{sin}} A sin , see Appendix § 10 .
Experiment
To compare these bounds with empirical results, we train the FIRST, INDEX, and MAJORITY models with hidden width h = 8 h = 8 h = 8 . We use 20 random seeds per task and draw a fresh batch at each update, sampling its length uniformly from 1 , … , N 1,\ldots,N 1 , … , N ; for MAJORITY, we use only odd lengths. The main results use N = 51 N = 51 N = 51 . Checkpoints are selected using validation data at length N N N , without inspecting longer inputs, and tested on random examples at lengths up to 511. Additional experiments on N = 11 , 21 , 31 , 41 N = 11, 21, 31, 41 N = 11 , 21 , 31 , 41 , which give similar results, are in Appendix § 11 .
Table 1 shows that FIRST remains accurate at the longest test length (under A p o s \mathcal{A}_{\mathrm{pos}} A pos ), MAJORITY retains substantial accuracy (under A g e n \mathcal{A}_{\mathrm{gen}} A gen ), and INDEX falls much closer to chance (under A p o s \mathcal{A}_{\mathrm{pos}} A pos ). These observations agree with the ranking of the three volume bounds.
We found the results of INDEX particularly interesting. Despite the task being expressible and learnable on lengths up to 51, it showed poor length generalization, much worse than that of MAJORITY. We take a closer look at this task in the next section.
The INDEX task
We first revisit the volume argument from the previous section, to identify the parameter combinations responsible for the n n n -dependent decay. We then modify the model to control one of these combinations structurally and compare the resulting theoretical and empirical behavior.
Length-sensitive components of the attention score
Recall that, in the positional model A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) , q = a k + b q = ak + b q = ak + b , k j = r j + s j 2 + c K k_j = rj + sj^2 + c_K k j = r j + s j 2 + c K , u j = C V e w j + b V u_j = C_V e_{w_j} + b_V u j = C V e w j + b V . The attention score is
g j = q ⊤ k j = ( a k + b ) ⊤ ( r j + s j 2 + c K ) . (8) g_j = q^\top k_j = (ak + b)^\top(rj + sj^2 + c_K). \tag*{(8)} g j = q ⊤ k j = ( ak + b ) ⊤ ( r j + s j 2 + c K ) . (8)
We compare the scores at position k k k and position k + Δ k + \Delta k + Δ . The expansion will produce the following quantities used repeatedly in later proofs, so we introduce some notations for future convenience.
χ = a ⊤ s ℓ = 2 b ⊤ s + a ⊤ r δ = b ⊤ s ϕ = b ⊤ r . (9) \chi= a^\top s \qquad\ell= 2b^\top s + a^\top r \qquad\delta= b^\top s \qquad\phi= b^\top r. \tag*{(9)} χ = a ⊤ s ℓ = 2 b ⊤ s + a ⊤ r δ = b ⊤ s ϕ = b ⊤ r . (9)
Now consider position k + Δ ∈ [ n ] k + \Delta\in[n] k + Δ ∈ [ n ] . The score gap of this position is
g k + Δ − g k = Δ ( 2 χ k 2 + ℓ k + ϕ ) + Δ 2 ( χ k + δ ) . (10) g_{k+\Delta} - g_k = \Delta(2\chi k^2 + \ell k + \phi) + \Delta^2(\chi k + \delta). \tag*{(10)} g k + Δ − g k = Δ ( 2 χ k 2 + ℓ k + ϕ ) + Δ 2 ( χ k + δ ) . (10)
We want this gap to be negative. The coefficient C q u a d ( k ) C_{\mathrm{quad}}(k) C quad ( k ) controls the curvature of the score around the indexed position, while C l i n ( k ) C_{\mathrm{lin}}(k) C lin ( k ) measures its first-order drift and therefore whether the score remains centered at j = k j = k j = k ; we want it to be zero. Because χ \chi χ and ℓ \ell ℓ are multiplied by k k k and k 2 k^2 k 2 , small errors in these parameter combinations can be amplified at large k k k (i.e., at large n n n ).
Sketch of lower bound
See Section A.2.1 for the full proof of the lower bound.
Let η = min { B / 16 , 1 / 16 } \eta=\min\{B/16,1/16\} η = min { B /16 , 1/16 } and consider the solution (which we call the center ):
a 0 = ( 2 η , 0 ) , b 0 = ( 0 , − η ) , r 0 = ( η , 0 ) , s 0 = ( 0 , η ) . (11) a^0=(2\eta,0),\qquad b^0=(0,-\eta),\qquad r^0=(\eta,0),\qquad s^0=(0,\eta). \tag*{(11)} a 0 = ( 2 η , 0 ) , b 0 = ( 0 , − η ) , r 0 = ( η , 0 ) , s 0 = ( 0 , η ) . (11)
We want to find a region around the center that still solves the problem. The volume of this region will serve as our lower bound. At this center, χ = ℓ = ϕ = 0 \chi=\ell=\phi=0 χ = ℓ = ϕ = 0 , δ = − η 2 \delta=-\eta^2 δ = − η 2 , and the score gap is
g k + Δ − g k = − η 2 Δ 2 . (12) g_{k+\Delta}-g_k=-\eta^2\Delta^2. \tag*{(12)} g k + Δ − g k = − η 2 Δ 2 . (12)
In a sufficiently small neighborhood of the center, we may restrict
∣ χ ∣ ≤ c n − 2 , ∣ ℓ ∣ ≤ c n − 1 , (13) |\chi|\le cn^{-2},\qquad|\ell|\le cn^{-1}, \tag*{(13)} ∣ χ ∣ ≤ c n − 2 , ∣ ℓ ∣ ≤ c n − 1 , (13)
while allowing a a a , b b b , r 2 r_2 r 2 , and s 2 s_2 s 2 (the second coordinates of r r r and s s s , resp.) to vary over fixed-width intervals independent of n n n . Every parameter choice in this region then satisfies g k + Δ − g k ≤ − η 2 4 Δ 2 g_{k+\Delta}-g_k\le-\frac{\eta^2}{4}\Delta^2 g k + Δ − g k ≤ − 4 η 2 Δ 2 for every k ∈ [ n ] k\in[n] k ∈ [ n ] and every nonzero Δ \Delta Δ such that k + Δ ∈ [ n ] k+\Delta\in[n] k + Δ ∈ [ n ] . Under the log n \log n log n attention scale, the total attention outside the indexed position then tends to zero as n → ∞ n\to\infty n → ∞ uniformly in k k k . Hence, for all sufficiently large n n n , the indexed position receives at least a fixed fraction of the total attention, uniformly over all inputs and indexes. We may then restrict ( C V , b V ) (C_V,b_V) ( C V , b V ) and ( W 1 , b 1 , W 2 , b 2 ) (W_1,b_1,W_2,b_2) ( W 1 , b 1 , W 2 , b 2 ) to fixed-size neighborhoods, independent of n n n , such that, for some constant c 0 > 0 c_0>0 c 0 > 0 independent of n n n , y w k ( w , k ) − y 1 − w k ( w , k ) ≥ c 0 y_{w_k}(w,k)-y_{1-w_k}(w,k)\ge c_0 y w k ( w , k ) − y 1 − w k ( w , k ) ≥ c 0 for every input ( w , k ) (w,k) ( w , k ) . To produce a exact solution, only the width of the interval χ \chi χ and ℓ \ell ℓ need to depend on n n n . Therefore the constructed set of exact solutions has normalized volume
Ω ( n − 2 ) ⋅ Ω ( n − 1 ) = Ω ( n − 3 ) . (14) \Omega(n^{-2})\cdot\Omega(n^{-1})=\Omega(n^{-3}). \tag*{(14)} Ω ( n − 2 ) ⋅ Ω ( n − 1 ) = Ω ( n − 3 ) . (14)
Sketch of upper bound
See Section A.2.2 for the full proof of the upper bound.
For each indexed position k k k , compare a constant word with a word that differs from it only at position k k k . These two inputs must be assigned different labels. We consider two cases. Let m = y w k ( w , k ) − y 1 − w k ( w , k ) m=y_{w_k}(w,k)-y_{1-w_k}(w,k) m = y w k ( w , k ) − y 1 − w k ( w , k ) . In any correct solution, we will have m > 0 m>0 m > 0 , but if m ≤ n − 5 m\le n^{-5} m ≤ n − 5 , we call the solution small-margin ; otherwise, we call it large-margin .
Take any one of the inequalities y w k ( w , k ) > y 1 − w k ( w , k ) y_{w_k}(w,k)>y_{1-w_k}(w,k) y w k ( w , k ) > y 1 − w k ( w , k ) ; there are 4 n 4n 4 n such inequalities in total. Fix arbitrary values of a a a , b b b , r r r , s s s , c K c_K c K , C V C_V C V , b V b_V b V , W 1 W_1 W 1 , b 1 b_1 b 1 , W 2 W_2 W 2 , and b 2 , 1 − w k b_{2,1-w_k} b 2 , 1 − w k . As b 2 , w k b_{2,w_k} b 2 , w k varies, the margin of the inequality varies with slope one. To satisfy 0 < y w k ( w , k ) − y 1 − w k ( w , k ) ≤ n − 5 0<y_{w_k}(w,k)-y_{1-w_k}(w,k)\le n^{-5} 0 < y w k ( w , k ) − y 1 − w k ( w , k ) ≤ n − 5 , b 2 , w k b_{2,w_k} b 2 , w k needs to lie in an interval of length n − 5 n^{-5} n − 5 . Thus the set of small-margin solutions has normalized volume at most 4 n ⋅ n − 5 / ( 2 B ) = O ( n − 4 ) 4n\cdot n^{-5}/(2B)=O(n^{-4}) 4 n ⋅ n − 5 / ( 2 B ) = O ( n − 4 ) .
For every large-margin solution, changing only the symbol at position k k k from τ \tau τ to σ ≠ τ \sigma\ne\tau σ = τ must change the predicted label from τ \tau τ to σ \sigma σ . By the definition of a large-margin solution, for each of the two words w w w in this comparison, y w k ( w , k ) − y 1 − w k ( w , k ) > n − 5 y_{w_k}(w,k)-y_{1-w_k}(w,k)>n^{-5} y w k ( w , k ) − y 1 − w k ( w , k ) > n − 5 . Since the y σ ( w , k ) − y τ ( w , k ) y_\sigma(w,k)-y_\tau(w,k) y σ ( w , k ) − y τ ( w , k ) , viewed as a function of the attention output A ( w , k ) A(w,k) A ( w , k ) , is Lipschitz, this implies that the attention assigned to position k k k is too small. Hence the indexed position receives at least an inverse polynomial amount of attention. The softmax formula in (2) then implies that g k g_k g k lies within a constant of the maximum score. Comparing it with the two neighboring scores in (10) gives C q u a d ( k ) + ∣ C l i n ( k ) ∣ ≤ M 0 C_{\mathrm{quad}}(k)+|C_{\mathrm{lin}}(k)|\le M_0 C quad ( k ) + ∣ C lin ( k ) ∣ ≤ M 0 , where M 0 M_0 M 0 is independent of n n n . Since every coordinate of a , b , s a,b,s a , b , s lies in [ − B , B ] [-B,B] [ − B , B ] , both χ = a T s \chi=a^\mathsf{T}s χ = a T s and δ = b T s \delta=b^\mathsf{T}s δ = b T s are bounded independently of n n n . Hence, for k ≤ n k\le n k ≤ n , ∣ C q u a d ( k ) ∣ = ∣ χ k + δ ∣ = O ( n ) |C_{\mathrm{quad}}(k)|=|\chi k+\delta|=O(n) ∣ C quad ( k ) ∣ = ∣ χ k + δ ∣ = O ( n ) , and thus ∣ C l i n ( k ) ∣ ≤ M 0 + ∣ C q u a d ( k ) ∣ = O ( n ) |C_{\mathrm{lin}}(k)|\le M_0+|C_{\mathrm{quad}}(k)|=O(n) ∣ C lin ( k ) ∣ ≤ M 0 + ∣ C quad ( k ) ∣ = O ( n ) . Let M = ⌊ n / 4 ⌋ M=\lfloor n/4\rfloor M = ⌊ n /4 ⌋ . Since C l i n ( k ) = 2 χ k 2 + ℓ k + ϕ C_{\mathrm{lin}}(k)=2\chi k^2+\ell k+\phi C lin ( k ) = 2 χ k 2 + ℓ k + ϕ , we have C l i n ( 3 M ) − 2 C l i n ( 2 M ) + C l i n ( M ) = 4 χ M 2 C_{\mathrm{lin}}(3M)-2C_{\mathrm{lin}}(2M)+C_{\mathrm{lin}}(M)=4\chi M^2 C lin ( 3 M ) − 2 C lin ( 2 M ) + C lin ( M ) = 4 χ M 2 . Because each term is O ( n ) O(n) O ( n ) and M = Θ ( n ) M=\Theta(n) M = Θ ( n ) , this gives ∣ χ ∣ = O ( n − 1 ) |\chi|=O(n^{-1}) ∣ χ ∣ = O ( n − 1 ) . Moreover, C l i n ( 2 M ) − C l i n ( M ) = 6 χ M 2 + ℓ M C_{\mathrm{lin}}(2M)-C_{\mathrm{lin}}(M)=6\chi M^2+\ell M C lin ( 2 M ) − C lin ( M ) = 6 χ M 2 + ℓ M . Using ∣ χ ∣ = O ( n − 1 ) |\chi|=O(n^{-1}) ∣ χ ∣ = O ( n − 1 ) in this identity gives ∣ ℓ ∣ = O ( 1 ) |\ell|=O(1) ∣ ℓ ∣ = O ( 1 ) . Repeating the same argument gives
∣ χ ∣ = O ( n − 2 ) , ∣ ℓ ∣ = O ( n − 1 ) . (15) |\chi|=O(n^{-2}),\qquad|\ell|=O(n^{-1}). \tag*{(15)} ∣ χ ∣ = O ( n − 2 ) , ∣ ℓ ∣ = O ( n − 1 ) . (15)
We used the fact
Pr ( ∣ a T s ∣ ≤ ε 1 , ∣ 2 b T s + a T r ∣ ≤ ε 2 ) = O B ( ε 1 ε 2 ) (16) \Pr\left(|a^\mathsf{T}s|\le\varepsilon_1,\ |2b^\mathsf{T}s+a^\mathsf{T}r|\le\varepsilon_2\right)=O_B(\varepsilon_1\varepsilon_2) \tag*{(16)} Pr ( ∣ a T s ∣ ≤ ε 1 , ∣2 b T s + a T r ∣ ≤ ε 2 ) = O B ( ε 1 ε 2 ) (16)
whenever 0 < ε 1 ≤ ε 2 0<\varepsilon_1\le\varepsilon_2 0 < ε 1 ≤ ε 2 are sufficiently small (for detailed proof see Section A.2.2, Lemma 3). Apply this fact to (15) and adding the O ( n − 4 ) O(n^{-4}) O ( n − 4 ) small-margin volume would give the upper bound O ( n − 3 ) O(n^{-3}) O ( n − 3 ) .
Experimental analysis
We next check whether χ = a ⊤ s \chi= a^{\top}s χ = a ⊤ s and ℓ = 2 b ⊤ s + a ⊤ r \ell= 2b^{\top}s + a^{\top}r ℓ = 2 b ⊤ s + a ⊤ r identified by the volume proof track the behavior of trained models. In (10), χ \chi χ controls the error term whose effect grows quadratically with k k k , while ℓ \ell ℓ controls the error term whose effect grows linearly with k k k . For a model trained up to maximum length N N N , we therefore consider the quantities N 2 ∣ χ ∣ N^{2}|\chi| N 2 ∣ χ ∣ and N ∣ ℓ ∣ N|\ell| N ∣ ℓ ∣ , allowing models trained at different maximum lengths to be comparable. Across the 100 positional models trained at five maximum lengths, smaller values of both quantities are associated with higher mean accuracy on unseen lengths; see Figure 1 . Ranking the models separately within each maximum training length gives correlations of − 0.655 -0.655 − 0.655 for N 2 ∣ χ ∣ N^{2}|\chi| N 2 ∣ χ ∣ and − 0.516 -0.516 − 0.516 for N ∣ ℓ ∣ N|\ell| N ∣ ℓ ∣ . Both have p < 10 − 3 p < 10^{-3} p < 1 0 − 3 under permutation tests that preserve the five training-length groups. The training and evaluation protocol is given in Sections D.2 and D.3, and the coefficient analysis is detailed in Section D.4.
Figure 1. Scale-normalized drift coefficients and mean OOD accuracy for trained positional INDEX models. Markers indicate the maximum training length N N N .
The above analysis suggests a direct architectural change: instead of relying on training to place two free coefficients inside shrinking intervals, control one of the length-growing error terms through the model itself.
The Normalized Model
We introduce a modified positional model, denoted A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) . It uses the same input vectors, value map, ReLU classifier, and trainable positional parameters a a a , b b b , r r r , s s s , c K c_K c K as A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) . We split the computation of the attention score into two channels: a linear channel that does not depend on the coordinate of the keys’ positional encoding, and a quadratic channel that depends only on the j 2 j^{2} j 2 coordinate. In the quadratic channel, we modify the queries as follows. Define the fixed smooth map
F ( v ) = v 1 + ∥ v ∥ 2 2 ( v ∈ R 2 ) . (17) F(v) = \frac{v}{\sqrt{1+\lVert v\rVert_{2}^{2}}} \qquad(v \in\mathbb{R}^{2}). \tag*{(17)} F ( v ) = 1 + ∥ v ∥ 2 2 v ( v ∈ R 2 ) . (17)
The linear and quadratic positional channels are
q l i n = a k + b , q q u a d = b + F ( a k ) , k j l i n = r j + c K , k j q u a d = s j 2 . (18) q^{\mathrm{lin}} = ak+b,\qquad q^{\mathrm{quad}} = b+F(ak),\qquad k_{j}^{\mathrm{lin}} = rj+c_K,\qquad k_{j}^{\mathrm{quad}} = sj^{2}. \tag*{(18)} q lin = ak + b , q quad = b + F ( ak ) , k j lin = r j + c K , k j quad = s j 2 . (18)
Thus the linear channel uses the full query a k + b ak+b ak + b , whereas the quadratic channel applies F F F to the index-dependent contribution a k ak ak . The attention score is
g j n o r m = ( q l i n ) ⊤ k j l i n + ( q q u a d ) ⊤ k j q u a d = ( a k + b ) ⊤ ( r j + c K ) + ( b + F ( a k ) ) ⊤ s j 2 . (19) g_{j}^{\mathrm{norm}} = \left(q^{\mathrm{lin}}\right)^{\top} k_{j}^{\mathrm{lin}} + \left(q^{\mathrm{quad}}\right)^{\top} k_{j}^{\mathrm{quad}} = (ak+b)^{\top}(rj+c_K) + (b+F(ak))^{\top}sj^{2}. \tag*{(19)} g j norm = ( q lin ) ⊤ k j lin + ( q quad ) ⊤ k j quad = ( ak + b ) ⊤ ( r j + c K ) + ( b + F ( ak ) ) ⊤ s j 2 . (19)
The attention weights are obtained by applying the same log n \log n log n -scaled softmax to (19); the values and the one-hidden-layer ReLU classifier are unchanged. The normalization introduces no new trainable parameters, so A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) has the same parameter dimension and uses the same M M M as A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) .
This modification could be applied to a general transformer by excluding j 2 j^{2} j 2 from the position encoding at position j j j but adding an additional term f ( q i , k j ) j 2 f(q_i,k_j)j^{2} f ( q i , k j ) j 2 directly into the attention score, with f f f being a scalar-valued function whose output remains bounded. We leave exploration of this more general setting for future work.
The map F F F is approximately the identity near the origin, but its output has norm strictly smaller than one. Consequently, the component of the query that depends on k k k and is multiplied with j 2 j^{2} j 2 no longer grows linearly with k k k . To make this precise, suppose first that a ≠ 0 a \ne0 a = 0 and write a ^ = a / ∥ a ∥ 2 \hat{a}=a/\lVert a\rVert_{2} a ^ = a / ∥ a ∥ 2 . Retaining δ \delta δ and ϕ \phi ϕ from (9), define
χ ^ : = a ^ T s , ℓ ^ : = ℓ + 2 χ ^ , ε χ ( k ) : = ( F ( a k ) − a ^ ) T s . (20) \hat{\chi}:=\hat{a}^{\mathsf{T}}s,\qquad\hat{\ell}:=\ell+2\hat{\chi},\qquad\varepsilon_{\chi}(k):=(F(ak)-\hat{a})^{\mathsf{T}}s. \tag*{(20)} χ ^ := a ^ T s , ℓ ^ := ℓ + 2 χ ^ , ε χ ( k ) := ( F ( ak ) − a ^ ) T s . (20)
Then the modified quadratic and linear coefficients are
C q u a d n o r m ( k ) = χ ^ + δ + ε χ ( k ) , C_{\mathrm{quad}}^{\mathrm{norm}}(k)=\hat{\chi}+\delta+\varepsilon_{\chi}(k), C quad norm ( k ) = χ ^ + δ + ε χ ( k ) ,
C l i n n o r m ( k ) = ℓ ^ k + ϕ + 2 k ε χ ( k ) . (21) C_{\mathrm{lin}}^{\mathrm{norm}}(k)=\hat{\ell}k+\phi+2k\varepsilon_{\chi}(k). \tag*{(21)} C lin norm ( k ) = ℓ ^ k + ϕ + 2 k ε χ ( k ) . (21)
Thus,
g k + Δ n o r m − g k n o r m = Δ C l i n n o r m ( k ) + Δ 2 C q u a d n o r m ( k ) . (22) g_{k+\Delta}^{\mathrm{norm}}-g_{k}^{\mathrm{norm}}=\Delta C_{\mathrm{lin}}^{\mathrm{norm}}(k)+\Delta^{2}C_{\mathrm{quad}}^{\mathrm{norm}}(k). \tag*{(22)} g k + Δ norm − g k norm = Δ C lin norm ( k ) + Δ 2 C quad norm ( k ) . (22)
Moreover,
∣ ε χ ( k ) ∣ ≤ ∥ s ∥ 2 2 k 2 ∥ a ∥ 2 , ∣ 2 k ε χ ( k ) ∣ ≤ ∥ s ∥ 2 k ∥ a ∥ 2 . (23) \lvert\varepsilon_{\chi}(k)\rvert\leq\frac{\lVert s\rVert_{2}}{2k^{2}\lVert a\rVert_{2}},\qquad\lvert2k\varepsilon_{\chi}(k)\rvert\leq\frac{\lVert s\rVert_{2}}{k\lVert a\rVert_{2}}. \tag*{(23)} ∣ ε χ ( k )∣ ≤ 2 k 2 ∥ a ∥ 2 ∥ s ∥ 2 , ∣ 2 k ε χ ( k )∣ ≤ k ∥ a ∥ 2 ∥ s ∥ 2 . (23)
Thus the k 2 k^{2} k 2 drift in (10) is replaced by a linear term and a bounded error 2 k ε χ ( k ) = O ( k − 1 ) 2k\varepsilon_{\chi}(k)=O(k^{-1}) 2 k ε χ ( k ) = O ( k − 1 ) . Only the coefficient ℓ ^ \hat{\ell} ℓ ^ remains to be confined to an interval of width O ( n − 1 ) O(n^{-1}) O ( n − 1 ) .
Theorem 2 (NESV of INDEX under A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) ). For B > 0 B>0 B > 0 and h ≥ 2 h\geq2 h ≥ 2 .
V B I N D E X , A n o r m ( h ) ( n ) = Θ B , h ( n − 1 ) . (24) V_{B}^{\mathrm{INDEX},\mathcal{A}_{\mathrm{norm}}(h)}(n)=\Theta_{B,h}(n^{-1}). \tag*{(24)} V B INDEX , A norm ( h ) ( n ) = Θ B , h ( n − 1 ) . (24)
Proof. The proof follows the same strategy as that of the INDEX bounds for the positional model in § 4.1 . The full proof is given in Appendix B. □ \square □
Compared with the original positional model, selective normalization removes one shrinking direction from the volume calculation. In A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) , the two effective constraints have widths n − 2 n^{-2} n − 2 and n − 1 n^{-1} n − 1 ; in A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) , the saturation of the quadratic query channel leaves only the n − 1 n^{-1} n − 1 constraint. The improvement from Θ ( n − 3 ) \Theta(n^{-3}) Θ ( n − 3 ) to Θ ( n − 1 ) \Theta(n^{-1}) Θ ( n − 1 ) therefore follows from the same score-level mechanism identified by the original proof.
Length-generalization experiments
We train A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) and A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) under the same protocol, using paired seeds, the same training batches, and identical initial values for all parameters shared by the two models. The main comparison uses classifier width h = 8 h=8 h = 8 , maximum training length N = 51 N=51 N = 51 , and 20 seeds.
As shown in Figure 2 , the original model degrades rapidly beyond the training range, whereas the selectively normalized model retains substantially higher accuracy. At length 511, approximately ten times the maximum training length, mean accuracy increases from 60% for A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) to approximately 85% for A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) . Experiments with maximum training lengths N ∈ { 11 , 21 , 31 , 41 } N\in\{11,21,31,41\} N ∈ { 11 , 21 , 31 , 41 } show similar results and are reported in Section D.5.
Figure 2. Length generalization on INDEX for the positional and A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) models trained up to N = 51 N = 51 N = 51 . Shading shows 95% bootstrap confidence intervals.
Taken together, the coefficient analysis and the architectural intervention give two complementary forms of evidence. The original volume proof identifies the parameter combinations whose effects grow with the index k k k , and those combinations are associated with the behavior of trained models. Selectively normalizing the quadratic query channel removes the faster-growing contribution, enlarges the exact-solution volume from Θ ( n − 3 ) \Theta(n^{-3}) Θ ( n − 3 ) to Θ ( n − 1 ) \Theta(n^{-1}) Θ ( n − 1 ) , and improves extrapolation in the model for which the volume calculation is carried out.
Related Work
The INDEX task has been studied many times before. Bhattamishra et al. [4 ] give an efficient one-layer construction in which the data appear before the indexed INDEX, as in our right-hand INDEX task. This differs from left-hand INDEXing, where the INDEX appears before the data and the answer is produced later ([13 ] (Kozachinskiy et al. 2025)). One-layer constructions for related right-hand function-evaluation problems are also studied by Strobl et al. [19 ] .
A line of work related to our normalized model A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) controls attention by normalizing query–key interactions. QKNorm ℓ 2 \ell_2 ℓ 2 -normalizes complete query and key vectors and learns the attention scale (Henry et al. [9 ] ), while scaled cosine attention likewise removes dependence on their magnitudes (Liu et al. [15 ] ). Separately, approaches to length extrapolation often modify the positional contribution to attention, for example by adding distance-dependent score biases (Press et al. [17 ] ) or by designing relative position encoding to improve attention resolution beyond the training lengths (Sun et al. [20 ] ). Our A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) , on the other hand, does not normalize the full query or key vectors, nor the quadratic positional coordinate j 2 j^2 j 2 . Instead, it applies a fixed smooth bounded map to the index-dependent query component in the quadratic positional channel.
Another related line of work studies which functions occupy large or stable regions of transformer parameter space. Hahn & Rofin [8 ] connect Boolean sensitivity to transformer norms and perturbation behavior, while Kover et al. [11 ] study the parameter-space geometry of transformers computing Boolean functions. Empirical work on simplicity bias likewise suggests that the parameter-to-function map favors some Boolean functions over others (Bhattamishra et al. [3 ] ). Our volume measure tracks how volume changes with sequence length, rather than assigning a single complexity or sensitivity measure to the target task. For INDEX, such analysis not only shows that the volume decreases with longer input lengths, but also isolates the sources of such shrinkage.
Discussion and Limitations
Initialization and optimization Parameter-space volume depends on the distribution placed on the parameters. Equation (1) assumes a uniform distribution over a box of size 2 B 2B 2 B in the raw coordinates. But initialization and optimization can concentrate strongly on particular parts of parameter space, so differences in exact-solution volume might not translate exactly into differences in accuracy. Tightening the correspondence would therefore require combining the present analysis with the distributions over parameters induced by initialization and optimization.
Depth Our theoretical results concern fixed-width, one-layer, one-head transformers. This restriction can matter qualitatively. Bhattamishra et al. [4 ] show examples where two-layer transformers of logarithmic size solve problems for which one-layer transformers require linear size. The parameter constraints governing length generalization may therefore change substantially with depth, and extending the volume analysis to deeper transformers is an important next step.
Conclusion
Parameter-space volume is useful not only for measuring how exact solutions change with input length, but also for revealing why they change. On the INDEX task, our volume analysis isolates the length-sensitive components, suggesting a modification to the model itself that improves length extrapolation. This suggests a broader use of volume analysis as a diagnostic for transformer model refinement, especially task-specific ones.
Reproducibility Statement
The baseline architectures, parameter prior, and strict-correctness criterion are defined in § 2 . The A n o r m ( h ) \mathop{\mathrm{Anorm}}(h) Anorm ( h ) architecture is defined in § 4.2 , and the fixed-sinusoidal MAJORITY model is defined in Section C.1. The complete volume arguments, experimental protocol, checkpoint-selection rule, evaluation-bank construction, and supplementary results are presented in the appendix.
AI Use Statement
In this work, we used generative AI tools to aid literature exploration, assist in the writing of proofs (prose editing, LaTeX preparation, proofreading), create or modify scientific figures, and edit code (for experiments). We have not used generative AI tools to develop theoretical models or conceptual frameworks, formulate mathematical claims, provide critical ingredients for proving mathematical claims, propose or refine hypotheses, design or provide feedback on research methodology or experiments, or assist with translation. We have reviewed all AI-assisted work and take responsibility for the final content of this work, including text, claims or artifacts produced with the aid of generative AI.
Proofs of the Baseline NESV Bounds
This appendix proves the four baseline bounds in Theorem 1.
FIRST
The lower bound constructs fixed neighborhoods of parameters independent of input length that gives exact solutions to the task. The upper bound follows from symmetry between the two labels.
Proof of the FIRST bound in Theorem 1. Choose η = min { B / 16 , 1 / 16 } \eta= \min\{B/16,1/16\} η = min { B /16 , 1/16 } and set
a 0 = ( 2 η , 0 ) , b 0 = ( 0 , − η ) , r 0 = ( η , 0 ) , s 0 = ( 0 , η ) , (25) a^0=(2\eta,0),\qquad b^0=(0,-\eta),\qquad r^0=(\eta,0),\qquad s^0=(0,\eta), \tag*{(25)} a 0 = ( 2 η , 0 ) , b 0 = ( 0 , − η ) , r 0 = ( η , 0 ) , s 0 = ( 0 , η ) , (25)
with c K 0 = b V 0 = 0 c_K^0=b_V^0=0 c K 0 = b V 0 = 0 and C V 0 = η I 2 C_V^0=\eta I_2 C V 0 = η I 2 . We call this set of ( a 0 , b 0 , r 0 , s 0 ) (a^0,b^0,r^0,s^0) ( a 0 , b 0 , r 0 , s 0 ) the center. Put q F : = a + b q_F:=a+b q F := a + b , ℓ ^ 1 : = q F T r \widehat{\ell}_1:=q_F^\mathsf{T}r ℓ 1 := q F T r , ℓ ^ 2 : = q F T s \widehat{\ell}_2:=q_F^\mathsf{T}s ℓ 2 := q F T s . At the center, ℓ ^ 1 0 = 2 η 2 \widehat{\ell}_1^0=2\eta^2 ℓ 1 0 = 2 η 2 and ℓ ^ 2 0 = − η 2 \widehat{\ell}_2^0=-\eta^2 ℓ 2 0 = − η 2 . By continuity, there is a fixed positive-volume neighborhood of ( a , b , r , s ) (a,b,r,s) ( a , b , r , s ) on which
∣ ℓ ^ 1 − 2 η 2 ∣ ≤ η 2 8 , ∣ ℓ ^ 2 + η 2 ∣ ≤ η 2 8 . (26) \left|\widehat{\ell}_1-2\eta^2\right|\leq\frac{\eta^2}{8},\qquad\left|\widehat{\ell}_2+\eta^2\right|\leq\frac{\eta^2}{8}. \tag*{(26)} ℓ 1 − 2 η 2 ≤ 8 η 2 , ℓ 2 + η 2 ≤ 8 η 2 . (26)
For j = 1 + Δ j=1+\Delta j = 1 + Δ with Δ ≥ 1 \Delta\geq1 Δ ≥ 1 , the key bias cancels and
g ( 1 ) − g ( 1 + Δ ) = Δ [ ( − ℓ ^ 1 − 2 ℓ ^ 2 ) + ( − ℓ ^ 2 ) Δ ] ≥ η 2 2 Δ 2 . (27) g(1)-g(1+\Delta)=\Delta\left[(-\widehat{\ell}_1-2\widehat{\ell}_2)+(-\widehat{\ell}_2)\Delta\right]
\geq\frac{\eta^2}{2}\Delta^2. \tag*{(27)} g ( 1 ) − g ( 1 + Δ ) = Δ [ ( − ℓ 1 − 2 ℓ 2 ) + ( − ℓ 2 ) Δ ] ≥ 2 η 2 Δ 2 . (27)
Consequently, throughout this fixed positional-parameter neighborhood,
1 − α 1 ≤ ∑ Δ = 1 ∞ n − ( η 2 / 2 ) Δ 2 ⟶ 0. (28) 1-\alpha_1\leq\sum_{\Delta=1}^{\infty}n^{-(\eta^2/2)\Delta^2}\longrightarrow0. \tag*{(28)} 1 − α 1 ≤ Δ = 1 ∑ ∞ n − ( η 2 /2 ) Δ 2 ⟶ 0. (28)
Restrict ( C V , b V ) (C_V,b_V) ( C V , b V ) to a fixed neighborhood on which
∥ C V ε σ + b V − η e σ ∥ ∞ ≤ η 16 ( σ ∈ { 0 , 1 } ) . (29) \left\|C_V\varepsilon_\sigma+b_V-\eta e_\sigma\right\|_\infty\leq\frac{\eta}{16}\qquad(\sigma\in\{0,1\}). \tag*{(29)} ∥ C V ε σ + b V − η e σ ∥ ∞ ≤ 16 η ( σ ∈ { 0 , 1 }) . (29)
For all sufficiently large n n n , (28) gives α 1 ≥ 7 / 8 \alpha_1\geq7/8 α 1 ≥ 7/8 . If y ⋆ = w 1 y^\star=w_1 y ⋆ = w 1 and y ‾ ⋆ = 1 − y ⋆ \overline{y}^\star=1-y^\star y ⋆ = 1 − y ⋆ , the total attention masses on the two symbols satisfy
p y ⋆ − p y ‾ ⋆ ≥ 3 4 . (30) p_{y^\star}-p_{\overline{y}^\star}\geq\frac{3}{4}. \tag*{(30)} p y ⋆ − p y ⋆ ≥ 4 3 . (30)
Convexity of the value perturbation in (29) therefore gives
A y ⋆ − A y ‾ ⋆ ≥ η ( p y ⋆ − p y ‾ ⋆ ) − η 8 ≥ 5 η 8 . (31) A_{y^\star}-A_{\overline{y}^\star}\geq\eta(p_{y^\star}-p_{\overline{y}^\star})-\frac{\eta}{8}\geq\frac{5\eta}{8}. \tag*{(31)} A y ⋆ − A y ⋆ ≥ η ( p y ⋆ − p y ⋆ ) − 8 η ≥ 8 5 η . (31)
Choose W 1 0 , b 1 0 , W 2 0 , b 2 0 W_1^0,b_1^0,W_2^0,b_2^0 W 1 0 , b 1 0 , W 2 0 , b 2 0 as follows. Take the first two rows of W 1 0 W_1^0 W 1 0 to be η e 0 T \eta e_0^\mathsf{T} η e 0 T and η e 1 T \eta e_1^\mathsf{T} η e 1 T , with both corresponding biases equal to η 2 \eta^2 η 2 . Set every remaining row of W 1 0 W_1^0 W 1 0 to zero and its bias to − η -\eta − η . In W 2 0 W_2^0 W 2 0 , give output row zero coefficient η \eta η on hidden unit zero and output row one coefficient η \eta η on hidden unit one, with all other entries zero; set b 2 0 = 0 b_2^0=0 b 2 0 = 0 . The first two hidden units are active throughout a sufficiently small neighborhood of (29), whereas the remaining units are inactive, and
y 0 − y 1 = η 2 ( A 0 − A 1 ) . (32) y_0-y_1=\eta^2(A_0-A_1). \tag*{(32)} y 0 − y 1 = η 2 ( A 0 − A 1 ) . (32)
Thus (31) gives a correct-logit margin of at least that y 0 − y 1 ≥ 5 η 3 / 8 y_0-y_1\geq5\eta^3/8 y 0 − y 1 ≥ 5 η 3 /8 at the center. Allow c K c_K c K to vary over a sufficiently small fixed neighborhood of 0. This does not affect the attention weights, since q F T c K q_F^\mathsf{T}c_K q F T c K is added to every attention score. Together with the fixed neighborhoods chosen above for ( a , b , r , s ) (a,b,r,s) ( a , b , r , s ) , ( C V , b V ) (C_V,b_V) ( C V , b V ) , and ( W 1 , b 1 , W 2 , b 2 ) (W_1,b_1,W_2,b_2) ( W 1 , b 1 , W 2 , b 2 ) , this gives a set of normalized volume c F > 0 c_F>0 c F > 0 , independent of n n n .
For the upper bound, swap the two rows of W 2 W_2 W 2 and the two entries of b 2 b_2 b 2 , leaving every other coordinate unchanged. This is a measure-preserving involution of the raw parameter cube. It maps the exact solutions of FIRST to the exact solutions of the complementary task w ↦ 1 − w 1 w\mapsto1-w_1 w ↦ 1 − w 1 . The two exact-solution sets are disjoint, so each occupies at most one half of the cube. In particular, the NESV is O ( 1 ) O(1) O ( 1 ) .
INDEX
We use the notation from Section 4.1. Thus the attention score at position j j j is
g j = ( a k + b ) ⊤ ( r j + s j 2 + c K ) , (33) g_j = (a k + b)^{\top}(r_j + s_j^2 + c_K), \tag*{(33)} g j = ( ak + b ) ⊤ ( r j + s j 2 + c K ) , (33)
and
χ = a ⊤ s , ℓ = 2 b ⊤ s + a ⊤ r , δ = b ⊤ s , ϕ = b ⊤ r . (34) \chi= a^{\top}s,\qquad\ell= 2b^{\top}s + a^{\top}r,\qquad\delta= b^{\top}s,\qquad\phi= b^{\top}r. \tag*{(34)} χ = a ⊤ s , ℓ = 2 b ⊤ s + a ⊤ r , δ = b ⊤ s , ϕ = b ⊤ r . (34)
For k + Δ ∈ [ n ] k+\Delta\in[n] k + Δ ∈ [ n ] , the score gap at position k + Δ k+\Delta k + Δ is
g k + Δ − g k = Δ C l i n ( k ) + Δ 2 C q u a d ( k ) , (35) g_{k+\Delta} - g_k = \Delta C_{\mathrm{lin}}(k) + \Delta^2 C_{\mathrm{quad}}(k), \tag*{(35)} g k + Δ − g k = Δ C lin ( k ) + Δ 2 C quad ( k ) , (35)
where
C l i n ( k ) = 2 χ k 2 + ℓ k + ϕ , C q u a d ( k ) = χ k + δ . (36) C_{\mathrm{lin}}(k) = 2\chi k^2 + \ell k + \phi,\qquad C_{\mathrm{quad}}(k) = \chi k + \delta. \tag*{(36)} C lin ( k ) = 2 χ k 2 + ℓ k + ϕ , C quad ( k ) = χ k + δ . (36)
Lower bound
Choose η = min { B / 16 , 1 / 16 } \eta= \min\{B/16,1/16\} η = min { B /16 , 1/16 } and consider the solution (which we call the center ):
a o = ( 2 η , 0 ) , b o = ( 0 , − η ) , r o = ( η , 0 ) , s o = ( 0 , η ) . (37) a^o = (2\eta,0),\qquad b^o = (0,-\eta),\qquad r^o = (\eta,0),\qquad s^o = (0,\eta). \tag*{(37)} a o = ( 2 η , 0 ) , b o = ( 0 , − η ) , r o = ( η , 0 ) , s o = ( 0 , η ) . (37)
At this point,
χ = ℓ = ϕ = 0 , δ = − η 2 , (38) \chi= \ell= \phi= 0,\qquad\delta= -\eta^2, \tag*{(38)} χ = ℓ = ϕ = 0 , δ = − η 2 , (38)
and hence
g k − g j = η 2 ( j − k ) 2 . (39) g_k - g_j = \eta^2(j-k)^2. \tag*{(39)} g k − g j = η 2 ( j − k ) 2 . (39)
To obtain a positive-volume family around this point, consider the local coordinate map
Ψ ( a , b , r , s ) = ( χ , ℓ , a 1 , a 2 , b 1 , b 2 , r 2 , s 2 ) . (40) \Psi(a,b,r,s) = (\chi,\ell,a_1,a_2,b_1,b_2,r_2,s_2). \tag*{(40)} Ψ ( a , b , r , s ) = ( χ , ℓ , a 1 , a 2 , b 1 , b 2 , r 2 , s 2 ) . (40)
We call ( a , b , r , s ) (a,b,r,s) ( a , b , r , s ) the untransformed coordinates and ( χ , ℓ , a 1 , a 2 , b 1 , b 2 , r 2 , s 2 ) (\chi,\ell,a_1,a_2,b_1,b_2,r_2,s_2) ( χ , ℓ , a 1 , a 2 , b 1 , b 2 , r 2 , s 2 ) the transformed coordinates. For fixed ( a , b , r 2 , s 2 ) (a,b,r_2,s_2) ( a , b , r 2 , s 2 ) , the Jacobian of ( s 1 , r 1 ) ↦ ( χ , ℓ ) (s_1,r_1)\mapsto(\chi,\ell) ( s 1 , r 1 ) ↦ ( χ , ℓ ) is
\begin{pmatrix}
a_1 & 0 \\
2b_1 & a_1
\end{pmatrix},
\qquad\det= a_1^2. \tag*{(41)}\end{pmatrix}
The determinant is nonzero at (37). The inverse function theorem therefore gives a fixed neighborhood on which Ψ \Psi Ψ is one-to-one and the Jacobians of Ψ \Psi Ψ and Ψ − 1 \Psi^{-1} Ψ − 1 are bounded. Hence there are constants c , C > 0 c,C>0 c , C > 0 , independent of n n n , such that every measurable set E E E in the transformed-coordinate neighborhood satisfies c vol ( E ) ≤ vol ( Ψ − 1 ( E ) ) ≤ C vol ( E ) c\operatorname{vol}(E) \le\operatorname{vol}(\Psi^{-1}(E)) \le C\operatorname{vol}(E) c vol ( E ) ≤ vol ( Ψ − 1 ( E )) ≤ C vol ( E ) .
Restrict
∣ χ ∣ ≤ η 2 64 n 2 , ∣ ℓ ∣ ≤ η 2 64 n , (42) |\chi| \le\frac{\eta^2}{64n^2},\qquad|\ell| \le\frac{\eta^2}{64n}, \tag*{(42)} ∣ χ ∣ ≤ 64 n 2 η 2 , ∣ ℓ ∣ ≤ 64 n η 2 , (42)
while restricting the remaining transformed coordinates to fixed-width intervals independent of n n n sufficiently close to the center that
δ ≤ − 3 η 2 4 , ∣ ϕ ∣ ≤ η 2 16 . (43) \delta\le-\frac{3\eta^2}{4},\qquad|\phi| \le\frac{\eta^2}{16}. \tag*{(43)} δ ≤ − 4 3 η 2 , ∣ ϕ ∣ ≤ 16 η 2 . (43)
For every k ≤ n k\le n k ≤ n , these conditions imply
C q u a d ( k ) ≤ − η 2 2 , ∣ C l i n ( k ) ∣ ≤ η 2 4 . (44) C_{\mathrm{quad}}(k) \le-\frac{\eta^2}{2},\qquad|C_{\mathrm{lin}}(k)| \le\frac{\eta^2}{4}. \tag*{(44)} C quad ( k ) ≤ − 2 η 2 , ∣ C lin ( k ) ∣ ≤ 4 η 2 . (44)
Indeed, the contribution of χ k \chi k χ k to C q u a d ( k ) C_{\mathrm{quad}}(k) C quad ( k ) is at most η 2 / 64 \eta^2/64 η 2 /64 , and the three contributions to C l i n ( k ) C_{\mathrm{lin}}(k) C lin ( k ) are bounded by 2 η 2 / 64 2\eta^2/64 2 η 2 /64 , η 2 / 64 \eta^2/64 η 2 /64 , and η 2 / 16 \eta^2/16 η 2 /16 , respectively. Therefore, for every nonzero integer Δ \Delta Δ with k + Δ ∈ [ n ] k+\Delta\in[n] k + Δ ∈ [ n ] ,
g k − g k + Δ = − Δ C l i n ( k ) − Δ 2 C q u a d ( k ) ≥ η 2 4 Δ 2 . (45) g_k-g_{k+\Delta}=-\Delta C_{\mathrm{lin}}(k)-\Delta^2 C_{\mathrm{quad}}(k)\ge\frac{\eta^2}{4}\Delta^2. \tag*{(45)} g k − g k + Δ = − Δ C lin ( k ) − Δ 2 C quad ( k ) ≥ 4 η 2 Δ 2 . (45)
Under the log n \log n log n attention scale, the total attention outside the indexed position is consequently at most
2 ∑ d = 1 ∞ n − ( η 2 / 4 ) d 2 , (46) 2\sum_{d=1}^{\infty} n^{-(\eta^2/4)d^2}, \tag*{(46)} 2 d = 1 ∑ ∞ n − ( η 2 /4 ) d 2 , (46)
which tends to zero as n → ∞ n \to\infty n → ∞ uniformly in the index k k k and over all positional parameters ( a , b , r , s ) (a,b,r,s) ( a , b , r , s ) in the local neighborhood above satisfying (42) and (43) .
Set C V 0 = η I 2 C_V^0=\eta I_2 C V 0 = η I 2 , b V 0 = 0 b_V^0=0 b V 0 = 0 , and take the parameter values
W 1 0 = [ η I 2 0 ( h − 2 ) × 2 ] , b 1 0 = ( η 2 , η 2 , − η , … , − η ) T , W_1^0=\begin{bmatrix}\eta I_2\\0_{(h-2)\times2}\end{bmatrix},\qquad b_1^0=(\eta^2,\eta^2,-\eta,\ldots,-\eta)^{\mathsf{T}}, W 1 0 = [ η I 2 0 ( h − 2 ) × 2 ] , b 1 0 = ( η 2 , η 2 , − η , … , − η ) T ,
W 2 0 = [ η I 2 0 2 × ( h − 2 ) ] , b 2 0 = 0. W_2^0=\begin{bmatrix}\eta I_2&0_{2\times(h-2)}\end{bmatrix},\qquad b_2^0=0. W 2 0 = [ η I 2 0 2 × ( h − 2 ) ] , b 2 0 = 0.
For all sufficiently large n n n , (46) makes the indexed position receive at least 3 / 4 3/4 3/4 of the total attention. If w k = σ w_k=\sigma w k = σ , the σ \sigma σ coordinate of the attention output exceeds the other coordinate by at least η / 2 \eta/2 η /2 , even if every other token has symbol 1 − σ 1-\sigma 1 − σ . With the chosen parameters, the first two hidden units are active and, for c ∈ { 0 , 1 } c\in\{0,1\} c ∈ { 0 , 1 } , the c c c -th unit outputs η A c + η 2 \eta A_c+\eta^2 η A c + η 2 . The corresponding row of W 2 W_2 W 2 multiplies this quantity by η \eta η , so y c = η 2 A c + η 3 y_c=\eta^2 A_c+\eta^3 y c = η 2 A c + η 3 . The common term η 3 \eta^3 η 3 cancels between the two logits, and therefore y σ − y 1 − σ = η 2 ( A σ − A 1 − σ ) ≥ η 3 2 y_\sigma-y_{1-\sigma}=\eta^2(A_\sigma-A_{1-\sigma})\geq\frac{\eta^3}{2} y σ − y 1 − σ = η 2 ( A σ − A 1 − σ ) ≥ 2 η 3 . This margin is uniform over all inputs and indexes, so there exists fixed neighborhoods independent of n n n of C V , b V , W 1 , b 1 , W 2 , b 2 C_V,b_V,W_1,b_1,W_2,b_2 C V , b V , W 1 , b 1 , W 2 , b 2 that produce exact solutions. The key bias c K c_K c K may also vary over a fixed neighborhood because it cancels from the attention weights.
The two intervals in (42) contribute normalized widths of orders n − 2 n^{-2} n − 2 and n − 1 n^{-1} n − 1 , whereas all other coordinates vary over intervals of width independent of n n n . Therefore
V B I N D E X , A p o s ( h ) ( n ) = Ω B , h ( n − 3 ) . (47) V_B^{\mathrm{INDEX},A_{\mathrm{pos}}(h)}(n)=\Omega_{B,h}(n^{-3}). \tag*{(47)} V B INDEX , A pos ( h ) ( n ) = Ω B , h ( n − 3 ) . (47)
Upper bound
For each indexed position k k k , compare a constant word with a word that differs from it only at position k k k . These two inputs must be assigned different labels. We consider two cases. Let m = y w k ( w , k ) − y 1 − w k ( w , k ) m=y_{w_k}(w,k)-y_{1-w_k}(w,k) m = y w k ( w , k ) − y 1 − w k ( w , k ) . In any correct solution, we will have m > 0 m>0 m > 0 , but if m ≤ n − 5 m\leq n^{-5} m ≤ n − 5 , we call the solution small-margin ; otherwise, we call it large-margin .
Take any one of the inequalities y w k ( w , k ) > y 1 − w k ( w , k ) y_{w_k}(w,k)>y_{1-w_k}(w,k) y w k ( w , k ) > y 1 − w k ( w , k ) ; there are 4 n 4n 4 n such inequalities in total. Fix arbitrary values of a , b , r , s , c K , C V , b V , W 1 , b 1 , W 2 a,b,r,s,c_K,C_V,b_V,W_1,b_1,W_2 a , b , r , s , c K , C V , b V , W 1 , b 1 , W 2 , and b 2 , 1 − w k b_{2,1-w_k} b 2 , 1 − w k . As b 2 , w k b_{2,w_k} b 2 , w k varies, the margin of the inequality varies with slope one. To satisfy 0 < y w k ( w , k ) − y 1 − w k ( w , k ) ≤ n − 5 0<y_{w_k}(w,k)-y_{1-w_k}(w,k)\leq n^{-5} 0 < y w k ( w , k ) − y 1 − w k ( w , k ) ≤ n − 5 , b 2 , w k b_{2,w_k} b 2 , w k needs to lie in an interval of length n − 5 n^{-5} n − 5 . Thus the set of small-margin solutions has normalized volume at most 4 n ⋅ n − 5 / ( 2 B ) = O ( n − 4 ) 4n\cdot n^{-5}/(2B)=O(n^{-4}) 4 n ⋅ n − 5 / ( 2 B ) = O ( n − 4 ) .
For every large-margin solution, changing only the symbol at position k k k from τ \tau τ to σ ≠ τ \sigma\ne\tau σ = τ must change the predicted label from τ \tau τ to σ \sigma σ . By the definition of a large-margin solution, for each of the two words w w w in this comparison, y w k ( w , k ) − y 1 − w k ( w , k ) > n − 5 y_{w_k}(w,k)-y_{1-w_k}(w,k)>n^{-5} y w k ( w , k ) − y 1 − w k ( w , k ) > n − 5 . Since the y σ ( w , k ) − y τ ( w , k ) y_\sigma(w,k)-y_\tau(w,k) y σ ( w , k ) − y τ ( w , k ) , viewed as a function of the attention output A ( w , k ) A(w,k) A ( w , k ) is Lipschitz, this is impossible if the attention assigned to position k k k is too small. To see this, let w w w be the constant-τ \tau τ word and let w ′ w' w ′ be the word obtained by changing only position k k k to σ \sigma σ . Because the query and key maps read only positional coordinates, the two words have the same attention weights. Their attention outputs therefore satisfy
A ( w ′ , k ) − A ( w , k ) = α k C V ( ϵ σ − ϵ τ ) , (48) A(w',k)-A(w,k)=\alpha_k C_V(\epsilon_\sigma-\epsilon_\tau), \tag*{(48)} A ( w ′ , k ) − A ( w , k ) = α k C V ( ϵ σ − ϵ τ ) , (48)
so
∥ A ( w ′ , k ) − A ( w , k ) ∥ ∞ ≤ 2 B α k . (49) \lVert A(w',k)-A(w,k)\rVert_\infty\leq2B\alpha_k. \tag*{(49)} ∥ A ( w ′ , k ) − A ( w , k ) ∥ ∞ ≤ 2 B α k . (49)
Moreover, ReLU is 1-Lipschitz, each row of W 1 W_1 W 1 has ℓ 1 \ell_1 ℓ 1 -norm at most 2 B 2B 2 B , and the difference between rows σ \sigma σ and τ \tau τ of W 2 W_2 W 2 has ℓ 1 \ell_1 ℓ 1 -norm at most 2 h B 2hB 2 h B . Hence
∣ ( y σ ( w ′ , k ) − y τ ( w ′ , k ) ) − ( y σ ( w , k ) − y τ ( w , k ) ) ∣ ≤ 4 h B 2 ∥ A ( w ′ , k ) − A ( w , k ) ∥ ∞ ≤ 8 h B 3 α k . (50) \left|(y_\sigma(w',k)-y_\tau(w',k))-(y_\sigma(w,k)-y_\tau(w,k))\right|
\leq4hB^2\lVert A(w',k)-A(w,k)\rVert_\infty\leq8hB^3\alpha_k. \tag*{(50)} ∣ ( y σ ( w ′ , k ) − y τ ( w ′ , k )) − ( y σ ( w , k ) − y τ ( w , k )) ∣ ≤ 4 h B 2 ∥ A ( w ′ , k ) − A ( w , k ) ∥ ∞ ≤ 8 h B 3 α k . (50)
The first difference is greater than n − 5 n^{-5} n − 5 and the second is less than − n − 5 -n^{-5} − n − 5 , so
α k ≥ n − 5 4 h B 3 . (51) \alpha_k\geq\frac{n^{-5}}{4hB^3}. \tag*{(51)} α k ≥ 4 h B 3 n − 5 . (51)
Hence the indexed position receives at least an inverse polynomial amount of attention. The softmax formula in (2) then implies that g k g_k g k lies within a constant of the maximum score. Indeed,
n − 5 4 h B 3 ≤ α k = η g k ∑ j = 1 n η g j ≤ η g k − max j g j , (52) \frac{n^{-5}}{4hB^3}\leq\alpha_k=\frac{\eta^{g_k}}{\sum_{j=1}^{n}\eta^{g_j}}\leq\eta^{g_k-\max_j g_j}, \tag*{(52)} 4 h B 3 n − 5 ≤ α k = ∑ j = 1 n η g j η g k ≤ η g k − m a x j g j , (52)
and therefore
max j g j − g k ≤ 5 + log ( 4 h B 3 ) log n ≤ M 0 (53) \max_j g_j-g_k\le5+\frac{\log(4hB^3)}{\log n}\le M_0 \tag*{(53)} j max g j − g k ≤ 5 + log n log ( 4 h B 3 ) ≤ M 0 (53)
for all sufficiently large n n n , where M 0 M_0 M 0 is independent of n n n . For every interior index 2 ≤ k ≤ n − 1 2\le k\le n-1 2 ≤ k ≤ n − 1 , comparing g k g_k g k with the two neighboring scores in (10) gives
g k + 1 − g k = C l i n ( k ) + C q u a d ( k ) ≤ M 0 (54) g_{k+1}-g_k=C_{\mathrm{lin}}(k)+C_{\mathrm{quad}}(k)\le M_0 \tag*{(54)} g k + 1 − g k = C lin ( k ) + C quad ( k ) ≤ M 0 (54)
and
g k − 1 − g k = − C l i n ( k ) + C q u a d ( k ) ≤ M 0 . (55) g_{k-1}-g_k=-C_{\mathrm{lin}}(k)+C_{\mathrm{quad}}(k)\le M_0. \tag*{(55)} g k − 1 − g k = − C lin ( k ) + C quad ( k ) ≤ M 0 . (55)
Thus
C q u a d ( k ) + ∣ C l i n ( k ) ∣ ≤ M 0 , (56) C_{\mathrm{quad}}(k)+\lvert C_{\mathrm{lin}}(k)\rvert\le M_0, \tag*{(56)} C quad ( k ) + ∣ C lin ( k )∣ ≤ M 0 , (56)
where M 0 M_0 M 0 is independent of n n n . Since every coordinate of a , b , s a,b,s a , b , s lies in [ − B , B ] [-B,B] [ − B , B ] , both χ = a ⊤ s \chi=a^\top s χ = a ⊤ s and δ = b ⊤ s \delta=b^\top s δ = b ⊤ s are bounded independently of n n n . Hence, for k ≤ n k\le n k ≤ n , ∣ C q u a d ( k ) ∣ = ∣ χ k + δ ∣ = O ( n ) \lvert C_{\mathrm{quad}}(k)\rvert=\lvert\chi k+\delta\rvert=O(n) ∣ C quad ( k )∣ = ∣ χ k + δ ∣ = O ( n ) , and thus ∣ C l i n ( k ) ∣ ≤ M 0 + ∣ C q u a d ( k ) ∣ = O ( n ) \lvert C_{\mathrm{lin}}(k)\rvert\le M_0+\lvert C_{\mathrm{quad}}(k)\rvert=O(n) ∣ C lin ( k )∣ ≤ M 0 + ∣ C quad ( k )∣ = O ( n ) . Let M = ⌊ n / 4 ⌋ M=\lfloor n/4\rfloor M = ⌊ n /4 ⌋ . Since C l i n ( k ) = 2 χ k 2 + ℓ k + ϕ C_{\mathrm{lin}}(k)=2\chi k^2+\ell k+\phi C lin ( k ) = 2 χ k 2 + ℓ k + ϕ , we have C l i n ( 3 M ) − 2 C l i n ( 2 M ) + C l i n ( M ) = 4 χ M 2 C_{\mathrm{lin}}(3M)-2C_{\mathrm{lin}}(2M)+C_{\mathrm{lin}}(M)=4\chi M^2 C lin ( 3 M ) − 2 C lin ( 2 M ) + C lin ( M ) = 4 χ M 2 . Because each term on the left is O ( n ) O(n) O ( n ) and M = Θ ( n ) M=\Theta(n) M = Θ ( n ) , this gives ∣ χ ∣ = O ( n − 1 ) \lvert\chi\rvert=O(n^{-1}) ∣ χ ∣ = O ( n − 1 ) . Moreover, C l i n ( 2 M ) − C l i n ( M ) = 6 χ M 2 + ℓ M C_{\mathrm{lin}}(2M)-C_{\mathrm{lin}}(M)=6\chi M^2+\ell M C lin ( 2 M ) − C lin ( M ) = 6 χ M 2 + ℓ M . Using ∣ χ ∣ = O ( n − 1 ) \lvert\chi\rvert=O(n^{-1}) ∣ χ ∣ = O ( n − 1 ) in this identity gives ∣ ℓ ∣ = O ( 1 ) \lvert\ell\rvert=O(1) ∣ ℓ ∣ = O ( 1 ) . These preliminary bounds make
∣ C q u a d ( k ) ∣ = ∣ χ k + δ ∣ = O ( 1 ) (57) \lvert C_{\mathrm{quad}}(k)\rvert=\lvert\chi k+\delta\rvert=O(1) \tag*{(57)} ∣ C quad ( k )∣ = ∣ χ k + δ ∣ = O ( 1 ) (57)
uniformly for k ≤ n k\le n k ≤ n . Equation (56) then gives ∣ C l i n ( k ) ∣ = O ( 1 ) \lvert C_{\mathrm{lin}}(k)\rvert=O(1) ∣ C lin ( k )∣ = O ( 1 ) . Repeating the same argument, now using these improved bounds, gives
∣ χ ∣ = O ( n − 2 ) , ∣ ℓ ∣ = O ( n − 1 ) . (58) \lvert\chi\rvert=O(n^{-2}),\qquad\lvert\ell\rvert=O(n^{-1}). \tag*{(58)} ∣ χ ∣ = O ( n − 2 ) , ∣ ℓ ∣ = O ( n − 1 ) . (58)
We used the fact Pr ( ∣ a ⊤ s ∣ ≤ ϵ 1 , ∣ 2 b ⊤ s + a ⊤ r ∣ ≤ ϵ 2 ) = O B ( ϵ 1 ϵ 2 ) \Pr\left(\lvert a^\top s\rvert\le\epsilon_1,\ \lvert2b^\top s+a^\top r\rvert\le\epsilon_2\right)=O_B(\epsilon_1\epsilon_2) Pr ( ∣ a ⊤ s ∣ ≤ ϵ 1 , ∣ 2 b ⊤ s + a ⊤ r ∣ ≤ ϵ 2 ) = O B ( ϵ 1 ϵ 2 ) whenever 0 < ϵ 1 ≤ ϵ 2 0<\epsilon_1\le\epsilon_2 0 < ϵ 1 ≤ ϵ 2 are sufficiently small.
Lemma 3 (Joint two-slab estimate). Let a , b , r , s a,b,r,s a , b , r , s be independent and uniform on [ − B , B ] 2 [-B,B]^2 [ − B , B ] 2 . There are constants C s l a b , ϵ B > 0 C_{\mathrm{slab}},\epsilon_B>0 C slab , ϵ B > 0 , depending only on B B B , such that, whenever 0 < ϵ 1 ≤ ϵ 2 ≤ ϵ B 0<\epsilon_1\le\epsilon_2\le\epsilon_B 0 < ϵ 1 ≤ ϵ 2 ≤ ϵ B ,
Pr ( ∣ a ⊤ s ∣ ≤ ϵ 1 , ∣ 2 b ⊤ s + a ⊤ r ∣ ≤ ϵ 2 ) ≤ C s l a b ϵ 1 ϵ 2 . (59) \Pr\left(\lvert a^\top s\rvert\le\epsilon_1,\ \lvert2b^\top s+a^\top r\rvert\le\epsilon_2\right)\le C_{\mathrm{slab}}\epsilon_1\epsilon_2. \tag*{(59)} Pr ( ∣ a ⊤ s ∣ ≤ ϵ 1 , ∣ 2 b ⊤ s + a ⊤ r ∣ ≤ ϵ 2 ) ≤ C slab ϵ 1 ϵ 2 . (59)
Proof. Scaling changes only the constant, so take B = 1 B=1 B = 1 . Fix ( a , s ) (a,s) ( a , s ) , and set
ρ = ( ∥ a ∥ 2 + ∥ s ∥ 2 ) 1 / 2 . (60) \rho=\left(\lVert a\rVert^2+\lVert s\rVert^2\right)^{1/2}. \tag*{(60)} ρ = ( ∥ a ∥ 2 + ∥ s ∥ 2 ) 1/2 . (60)
The second constraint defines a slab in ( b , r ) (b,r) ( b , r ) with normal vector ( 2 s , a ) (2s,a) ( 2 s , a ) . One coordinate of this vector has magnitude at least a constant multiple of ρ \rho ρ , so, after fixing the other three coordinates, the allowed fraction of the remaining coordinate is at most
C min { 1 , ϵ 2 ρ } . (61) C\min\left\{1,\frac{\epsilon_2}{\rho}\right\}. \tag*{(61)} C min { 1 , ρ ϵ 2 } . (61)
To estimate the first constraint at fixed radius ρ \rho ρ . Write
a = ρ cos ϑ a ^ , s = ρ sin ϑ s ^ , 0 ≤ ϑ ≤ π 2 , (62) a=\rho\cos\vartheta\,\widehat a,\qquad s=\rho\sin\vartheta\,\widehat s,\qquad0\le\vartheta\le\frac{\pi}{2}, \tag*{(62)} a = ρ cos ϑ a , s = ρ sin ϑ s , 0 ≤ ϑ ≤ 2 π , (62)
where a ^ , s ^ ∈ S 1 \widehat a,\widehat s\in S^1 a , s ∈ S 1 . If φ \varphi φ is the angle between a ^ \widehat a a and s ^ \widehat s s , then
∣ a ⊤ s ∣ = ρ 2 sin ϑ cos ϑ ∣ cos φ ∣ . (63) \lvert a^\top s\rvert=\rho^2\sin\vartheta\cos\vartheta\lvert\cos\varphi\rvert. \tag*{(63)} ∣ a ⊤ s ∣ = ρ 2 sin ϑ cos ϑ ∣ cos φ ∣ . (63)
For fixed ϑ \vartheta ϑ , the fraction of angle φ \varphi φ satisfying the first constraint is at most
C min { 1 , ϵ 1 ρ 2 sin ϑ cos ϑ } . (64) C\min\left\{1,\frac{\epsilon_1}{\rho^2\sin\vartheta\cos\vartheta}\right\}. \tag*{(64)} C min { 1 , ρ 2 sin ϑ cos ϑ ϵ 1 } . (64)
The angular density contains the factor sin ϑ cos ϑ \sin\vartheta\cos\vartheta sin ϑ cos ϑ , therefore integrating over ϑ \vartheta ϑ bounds the angular fraction by
C min { 1 , ϵ 1 ρ 2 } . (65) C\min\left\{1,\frac{\epsilon_1}{\rho^2}\right\}. \tag*{(65)} C min { 1 , ρ 2 ϵ 1 } . (65)
because when t ≤ 1 t \le1 t ≤ 1 , ∫ 0 π / 2 min { sin ϑ cos ϑ , t } d ϑ = O ( t ) \int_{0}^{\pi/2} \min\{\sin\vartheta\cos\vartheta,t\}\,\mathrm{d}\vartheta= O(t) ∫ 0 π /2 min { sin ϑ cos ϑ , t } d ϑ = O ( t ) . The radial volume element for ( a , s ) ∈ R 4 (a,s) \in\mathbb{R}^{4} ( a , s ) ∈ R 4 is proportional to ϱ 3 d ϱ \varrho^{3}\,\mathrm{d}\varrho ϱ 3 d ϱ . Enlarging the cube to a fixed ball and combining (61) and (65), the required probability is at most a constant times
∫ 0 R 0 ϱ 3 min { 1 , ε 1 ϱ 2 } min { 1 , ε 2 ϱ } d ϱ . (66) \int_{0}^{R_{0}} \varrho^{3}\min\left\{1,\frac{\varepsilon_{1}}{\varrho^{2}}\right\}\min\left\{1,\frac{\varepsilon_{2}}{\varrho}\right\}\,\mathrm{d}\varrho. \tag*{(66)} ∫ 0 R 0 ϱ 3 min { 1 , ϱ 2 ε 1 } min { 1 , ϱ ε 2 } d ϱ . (66)
Assume 0 < ε 1 ≤ ε 2 ≤ 1 0 < \varepsilon_{1} \le\varepsilon_{2} \le1 0 < ε 1 ≤ ε 2 ≤ 1 . If ε 2 ≤ ε 1 \varepsilon_{2} \le\sqrt{\varepsilon_{1}} ε 2 ≤ ε 1 , split the integral at ε 2 \varepsilon_{2} ε 2 and ε 1 \sqrt{\varepsilon_{1}} ε 1 to obtain
I ≤ ∫ 0 ε 2 ϱ 3 d ϱ + ε 2 ∫ ε 2 ε 1 ϱ 2 d ϱ + ε 1 ε 2 ∫ ε 1 R 0 d ϱ ≤ C ε 1 ε 2 . (67) \begin{aligned}
I &\le\int_{0}^{\varepsilon_{2}} \varrho^{3}\,\mathrm{d}\varrho+\varepsilon_{2}\int_{\varepsilon_{2}}^{\sqrt{\varepsilon_{1}}}\varrho^{2}\,\mathrm{d}\varrho+\varepsilon_{1}\varepsilon_{2}\int_{\sqrt{\varepsilon_{1}}}^{R_{0}}\mathrm{d}\varrho\\
&\le C\varepsilon_{1}\varepsilon_{2}. \tag*{(67)}
\end{aligned} I ≤ ∫ 0 ε 2 ϱ 3 d ϱ + ε 2 ∫ ε 2 ε 1 ϱ 2 d ϱ + ε 1 ε 2 ∫ ε 1 R 0 d ϱ ≤ C ε 1 ε 2 . (67)
If ε 1 ≤ ε 2 \sqrt{\varepsilon_{1}} \le\varepsilon_{2} ε 1 ≤ ε 2 , split instead at ε 1 \sqrt{\varepsilon_{1}} ε 1 and ε 2 \varepsilon_{2} ε 2 . Rescaling restores B B B and proves the lemma.
Applying the above lemma to (58), the large-margin solutions have normalized volume O ( n − 3 ) O(n^{-3}) O ( n − 3 ) : the entries of a a a , b b b , r r r , s s s are independent parameter coordinates, and all remaining coordinates integrate out. Adding the O ( n − 4 ) O(n^{-4}) O ( n − 4 ) small-margin volume gives
V B I N D E X , A p o s ( h ) ( n ) = O B , h ( n − 3 ) . (68) V_{B}^{\mathrm{INDEX},A_{\mathrm{pos}}(h)}(n)=O_{B,h}(n^{-3}). \tag*{(68)} V B INDEX , A pos ( h ) ( n ) = O B , h ( n − 3 ) . (68)
Together with (47), this proves the INDEX claim in Theorem 1.
MAJORITY
In the position-free model A g e n A_{\mathrm{gen}} A gen , every input with the same number of ones produces the same attention output. The proof therefore reduces MAJORITY to a one-dimensional sequence indexed by the count and measures how much of the parameter space places the decision boundary between the two central counts. Let
t = ∑ j = 1 n w j , v b = V ( e b ) , q = Q ( 0 2 ) , (69) t=\sum_{j=1}^{n}w_j,\qquad v_b=V(e_b),\qquad q=Q(0_2), \tag*{(69)} t = j = 1 ∑ n w j , v b = V ( e b ) , q = Q ( 0 2 ) , (69)
and define the query–key score contrast
X = q ⊤ W K ( e 1 − e 0 ) , Γ = exp ( ( log n ) X ) . (70) X=q^{\top}W_K(e_1-e_0),\qquad\Gamma=\exp((\log n)X). \tag*{(70)} X = q ⊤ W K ( e 1 − e 0 ) , Γ = exp (( log n ) X ) . (70)
All zero tokens share one score and all one tokens share another, so the total attention mass on the one tokens and the attention output are exactly
ρ t = t Γ n − t + t Γ , A t = v 0 + ρ t ( v 1 − v 0 ) . (71) \rho_t=\frac{t\Gamma}{n-t+t\Gamma},\qquad A_t=v_0+\rho_t(v_1-v_0). \tag*{(71)} ρ t = n − t + t Γ t Γ , A t = v 0 + ρ t ( v 1 − v 0 ) . (71)
Thus the 2 n 2^n 2 n inputs reduce to n + 1 n+1 n + 1 possible count levels. Throughout this subsection, write n = 2 m + 1 n=2m+1 n = 2 m + 1 . For an attention scale β > 0 \beta>0 β > 0 and a score contrast x x x , let
Δ ρ n , β ( x ) = ρ m + 1 − ρ m , (72) \Delta\rho_{n,\beta}(x)=\rho_{m+1}-\rho_m, \tag*{(72)} Δ ρ n , β ( x ) = ρ m + 1 − ρ m , (72)
where Γ = e β x \Gamma=e^{\beta x} Γ = e β x . The counts m m m and m + 1 m+1 m + 1 are the two adjacent levels at which the majority label changes.
Lemma 4 (Central attention gap). For Γ = e β x \Gamma=e^{\beta x} Γ = e β x ,
Δ ρ n , β ( x ) = n e β x ( m + 1 + m e β x ) ( m + ( m + 1 ) e β x ) (73) \Delta\rho_{n,\beta}(x)=\frac{ne^{\beta x}}{(m+1+me^{\beta x})(m+(m+1)e^{\beta x})} \tag*{(73)} Δ ρ n , β ( x ) = ( m + 1 + m e β x ) ( m + ( m + 1 ) e β x ) n e β x (73) = n n 2 + ( n 2 − 1 ) sinh 2 ( β x / 2 ) . (74) =\frac{n}{n^{2}+(n^{2}-1)\sinh^{2}(\beta x/2)}. \tag*{(74)} = n 2 + ( n 2 − 1 ) sinh 2 ( β x /2 ) n . (74) Moreover,
0 < Δ ρ n , β ( x ) ≤ 1 n , ∫ R Δ ρ n , β ( x ) d x = 4 artanh ( 1 / n ) β . (75) 0<\Delta\rho_{n,\beta}(x)\le\frac{1}{n},\qquad\int_{\mathbb{R}}\Delta\rho_{n,\beta}(x)\,\mathrm{d}x=\frac{4\operatorname{artanh}(1/n)}{\beta}. \tag*{(75)} 0 < Δ ρ n , β ( x ) ≤ n 1 , ∫ R Δ ρ n , β ( x ) d x = β 4 artanh ( 1/ n ) . (75)
Proof. Substitute t = m , m + 1 t=m,m+1 t = m , m + 1 into (71) and subtract to obtain (73). Dividing its denominator by e β x e^{\beta x} e β x and using n = 2 m + 1 n=2m+1 n = 2 m + 1 gives (74). The maximum is attained at x = 0 x=0 x = 0 . For the integral, set z = tanh ( β x / 2 ) z=\tanh(\beta x/2) z = tanh ( β x /2 ) . Then
d x = 2 d z β ( 1 − z 2 ) , Δ ρ n , β ( x ) = n ( 1 − z 2 ) n 2 − z 2 . (76) dx=\frac{2\,dz}{\beta(1-z^2)},\qquad\Delta\rho_{n,\beta}(x)=\frac{n(1-z^2)}{n^2-z^2}. \tag*{(76)} d x = β ( 1 − z 2 ) 2 d z , Δ ρ n , β ( x ) = n 2 − z 2 n ( 1 − z 2 ) . (76)
Therefore
∫ R Δ ρ n , β ( x ) d x = 2 n β ∫ − 1 1 d z n 2 − z 2 = 4 artanh ( 1 / n ) β . (77) \int_{\mathbb{R}}\Delta\rho_{n,\beta}(x)\,dx=\frac{2n}{\beta}\int_{-1}^{1}\frac{dz}{n^2-z^2}=\frac{4\operatorname{artanh}(1/n)}{\beta}. \tag*{(77)} ∫ R Δ ρ n , β ( x ) d x = β 2 n ∫ − 1 1 n 2 − z 2 d z = β 4 artanh ( 1/ n ) . (77)
For fixed values of all parameters except b 2 , 1 b_{2,1} b 2 , 1 , exact correctness requires b 2 , 1 b_{2,1} b 2 , 1 to place the decision threshold between the two central count levels. Define the bias-free logit difference
H ( z ) = ( e 1 − e 0 ) T W 2 ReLU ( W 1 z + b 1 ) . (78) H(z)=(e_1-e_0)^{\mathsf{T}}W_2\operatorname{ReLU}(W_1z+b_1). \tag*{(78)} H ( z ) = ( e 1 − e 0 ) T W 2 ReLU ( W 1 z + b 1 ) . (78)
Lemma 5 (Output-bias fiber). Condition on every raw parameter except b 2 , 1 b_{2,1} b 2 , 1 . The set of values of b 2 , 1 b_{2,1} b 2 , 1 that can extend the conditioned coordinates to an exact MAJORITY solution has length at most
8 h B 3 Δ ρ n , β ( X ) . (79) 8hB^3\Delta\rho_{n,\beta}(X). \tag*{(79)} 8 h B 3 Δ ρ n , β ( X ) . (79)
Proof. Correctness on the count-m m m and count-( m + 1 ) (m+1) ( m + 1 ) levels requires
H ( A m ) + b 2 , 1 − b 2 , 0 < 0 , (80) H(A_m)+b_{2,1}-b_{2,0}<0, \tag*{(80)} H ( A m ) + b 2 , 1 − b 2 , 0 < 0 , (80)
H ( A m + 1 ) + b 2 , 1 − b 2 , 0 > 0. (81) H(A_{m+1})+b_{2,1}-b_{2,0}>0. \tag*{(81)} H ( A m + 1 ) + b 2 , 1 − b 2 , 0 > 0. (81)
Thus b 2 , 1 b_{2,1} b 2 , 1 must lie in
( b 2 , 0 − H ( A m + 1 ) , b 2 , 0 − H ( A m ) ) , (82) \left(b_{2,0}-H(A_{m+1}),\ b_{2,0}-H(A_m)\right), \tag*{(82)} ( b 2 , 0 − H ( A m + 1 ) , b 2 , 0 − H ( A m ) ) , (82)
whose length is H ( A m + 1 ) − H ( A m ) H(A_{m+1})-H(A_m) H ( A m + 1 ) − H ( A m ) when this difference is positive. ReLU is 1-Lipschitz, each row of W 1 W_1 W 1 has ℓ 1 \ell_1 ℓ 1 -norm at most 2 B 2B 2 B , and the difference between the two rows of W 2 W_2 W 2 has ℓ 1 \ell_1 ℓ 1 -norm at most 2 h B 2hB 2 h B . Hence H H H is 4 h B 2 4hB^2 4 h B 2 -Lipschitz in ℓ ∞ \ell_\infty ℓ ∞ . Moreover, A m + 1 − A m = Δ ρ n , log n ( X ) ( v 1 − v 0 ) A_{m+1}-A_m=\Delta\rho_{n,\log n}(X)(v_1-v_0) A m + 1 − A m = Δ ρ n , l o g n ( X ) ( v 1 − v 0 ) , so
∥ A m + 1 − A m ∥ ∞ ≤ 2 B Δ ρ n , β ( X ) . (83) \lVert A_{m+1}-A_m\rVert_\infty\le2B\Delta\rho_{n,\beta}(X). \tag*{(83)} ∥ A m + 1 − A m ∥ ∞ ≤ 2 B Δ ρ n , β ( X ) . (83)
Multiplying the two bounds proves the claim.
To average the fiber length over the query and key parameters, we use a uniform density bound for X X X .
Lemma 6 (Density of the score contrast). Under the uniform raw-cube measure, the random variable X = q T W K ( e 1 − e 0 ) X=q^{\mathsf{T}}W_K(e_1-e_0) X = q T W K ( e 1 − e 0 ) has a density f X f_X f X satisfying
∥ f X ∥ ∞ ≤ B − 2 . (84) \lVert f_X\rVert_\infty\le B^{-2}. \tag*{(84)} ∥ f X ∥ ∞ ≤ B − 2 . (84)
Proof. Write Δ K = W K ( e 1 − e 0 ) \Delta_K=W_K(e_1-e_0) Δ K = W K ( e 1 − e 0 ) . Each coordinate of Δ K \Delta_K Δ K is the difference of two independent uniform variables and has triangular density bounded by ( 2 B ) − 1 (2B)^{-1} ( 2 B ) − 1 . Conditional on q a g g ≠ 0 q_{\mathrm{agg}}\ne0 q agg = 0 , choose a coordinate with magnitude ∥ q a g g ∥ ∞ \lVert q_{\mathrm{agg}}\rVert_\infty ∥ q agg ∥ ∞ and condition on the other coordinate of Δ K \Delta_K Δ K . Scaling gives
∥ f X ∣ q a g g ∥ ∞ ≤ 1 2 B ∥ q a g g ∥ ∞ . (85) \lVert f_{X\mid q_{\mathrm{agg}}}\rVert_\infty\le\frac{1}{2B\lVert q_{\mathrm{agg}}\rVert_\infty}. \tag*{(85)} ∥ f X ∣ q agg ∥ ∞ ≤ 2 B ∥ q agg ∥ ∞ 1 . (85)
Since q a g g = Q ( 0 ) = b Q q_{\mathrm{agg}}=Q(0)=b_Q q agg = Q ( 0 ) = b Q is uniform on [ − B , B ] 2 [-B,B]^2 [ − B , B ] 2 ,
E [ ∥ q a g g ∥ ∞ − 1 ] = 2 B . (86) \mathbb{E}\left[\lVert q_{\mathrm{agg}}\rVert_\infty^{-1}\right]=\frac{2}{B}. \tag*{(86)} E [ ∥ q agg ∥ ∞ − 1 ] = B 2 . (86)
Averaging proves the result.
By Fubini’s theorem and Lemmas 4 to 6,
V B M A J O R I T Y , A g e n ( h ) ( n ) ≤ 4 h B 2 E [ Δ ρ n , log n ( X ) ] (87) V_{B}^{\mathrm{MAJORITY},A_{\mathrm{gen}}(h)}(n) \leq4hB^{2}\mathbb{E}\left[\Delta_{\rho_{n,\log n}}(X)\right] \tag*{(87)} V B MAJORITY , A gen ( h ) ( n ) ≤ 4 h B 2 E [ Δ ρ n , l o g n ( X ) ] (87)
≤ 4 h B 2 ∥ f X ∥ ∞ ∫ R Δ ρ n , log n ( x ) d x ≤ 16 h artanh ( 1 / n ) log n . \begin{aligned}
\leq4hB^{2}\lVert f_{X}\rVert_{\infty}\int_{\mathbb{R}}\Delta_{\rho_{n,\log n}}(x)\,\mathrm{d}x \\
&\leq\frac{16h\operatorname{artanh}(1/n)}{\log n}.
\end{aligned} ≤ 4 h B 2 ∥ f X ∥ ∞ ∫ R Δ ρ n , l o g n ( x ) d x ≤ log n 16 h artanh ( 1/ n ) .
Since artanh ( 1 / n ) ≤ n / ( n 2 − 1 ) \operatorname{artanh}(1/n) \leq n/(n^{2}-1) artanh ( 1/ n ) ≤ n / ( n 2 − 1 ) , this is O h ( ( n log n ) − 1 ) O_{h}((n\log n)^{-1}) O h (( n log n ) − 1 ) .
For the matching lower bound, we need a positive mass of score contrasts on which the central gap is of order 1 / n 1/n 1/ n and a fixed-volume set of the remaining parameters that turns this gap into a correct bias interval.
Lemma 7 (Lower contrast mass). There is a constant c X = c X ( B ) > 0 c_{X}=c_{X}(B)>0 c X = c X ( B ) > 0 such that, for all sufficiently large n n n ,
Pr ( ∣ X ∣ ≤ 1 log n ) ≥ c X log n . (88) \Pr\left(|X|\leq\frac{1}{\log n}\right)\geq\frac{c_{X}}{\log n}. \tag*{(88)} Pr ( ∣ X ∣ ≤ log n 1 ) ≥ log n c X . (88)
Proof. Write Δ K = W K ( e 1 − e 0 ) \Delta_{K}=W_{K}(e_{1}-e_{0}) Δ K = W K ( e 1 − e 0 ) and q a g g = ( q 1 , q 2 ) q_{\mathrm{agg}}=(q_{1},q_{2}) q agg = ( q 1 , q 2 ) . Restrict to
q 1 ∈ [ B / 2 , B ] , ∣ q 2 ∣ ≤ B / 4 , ∣ Δ K , 2 ∣ ≤ B / 2. (89) q_{1}\in[B/2,B],\qquad|q_{2}|\leq B/4,\qquad|\Delta_{K,2}|\leq B/2. \tag*{(89)} q 1 ∈ [ B /2 , B ] , ∣ q 2 ∣ ≤ B /4 , ∣ Δ K , 2 ∣ ≤ B /2. (89)
These independent events have probabilities at least 1 / 4 1/4 1/4 , 1 / 4 1/4 1/4 , and 3 / 8 3/8 3/8 . Conditional on them, the inequality
∣ q 1 Δ K , 1 + q 2 Δ K , 2 ∣ ≤ ε (90) |q_{1}\Delta_{K,1}+q_{2}\Delta_{K,2}|\leq\varepsilon \tag*{(90)} ∣ q 1 Δ K , 1 + q 2 Δ K , 2 ∣ ≤ ε (90)
asks that Δ K , 1 \Delta_{K,1} Δ K , 1 lie in an interval of length at least 2 ε / B 2\varepsilon/B 2 ε / B , centered in [ − B / 4 , B / 4 ] [-B/4,B/4] [ − B /4 , B /4 ] . If ε ≤ B 2 / 8 \varepsilon\leq B^{2}/8 ε ≤ B 2 /8 , the interval lies in [ − B / 2 , B / 2 ] [-B/2,B/2] [ − B /2 , B /2 ] , where the triangular density of Δ K , 1 \Delta_{K,1} Δ K , 1 is at least 3 / ( 8 B ) 3/(8B) 3/ ( 8 B ) . Hence
Pr ( ∣ X ∣ ≤ ε ) ≥ 9 ε 512 B 2 . (91) \Pr(|X|\leq\varepsilon)\geq\frac{9\varepsilon}{512B^{2}}. \tag*{(91)} Pr ( ∣ X ∣ ≤ ε ) ≥ 512 B 2 9 ε . (91)
Taking ε = 1 / log n \varepsilon=1/\log n ε = 1/ log n proves the lemma.
Lemma 8 (Positive-volume monotone decoder family). There are constants c Ω , κ > 0 c_{\Omega},\kappa>0 c Ω , κ > 0 and a set of values of ( W V , b V , W 1 , b 1 , W 2 , b 2 , 0 ) (W_{V},b_{V},W_{1},b_{1},W_{2},b_{2,0}) ( W V , b V , W 1 , b 1 , W 2 , b 2 , 0 ) of normalized volume at least c Ω c_{\Omega} c Ω such that the bias-free logit difference along v 0 + p ( v 1 − v 0 ) v_{0}+p(v_{1}-v_{0}) v 0 + p ( v 1 − v 0 ) is affine with derivative at least κ \kappa κ for all p ∈ [ 0 , 1 ] p\in[0,1] p ∈ [ 0 , 1 ] . For every parameter choice in this set, b 2 , 1 b_{2,1} b 2 , 1 may vary over an interval of length at least
κ ( ρ m + 1 − ρ m ) (92) \kappa(\rho_{m+1}-\rho_{m}) \tag*{(92)} κ ( ρ m + 1 − ρ m ) (92) while preserving exact MAJORITY correctness.
Proof. Let e V = ( 1 , 0 ) T e_{V}=(1,0)^{\mathsf{T}} e V = ( 1 , 0 ) T and choose W V , b V W_{V},b_{V} W V , b V so that
v 0 = 0 , v 1 = η e V . (93) v_{0}=0,\qquad v_{1}=\eta e_{V}. \tag*{(93)} v 0 = 0 , v 1 = η e V . (93)
Give one hidden unit first-layer row η e V T \eta e_{V}^{\mathsf{T}} η e V T and bias η \eta η , make every other hidden unit strictly inactive, and set the difference between output rows on the active hidden unit to η \eta η . Set the other output-row differences and b 2 , 0 b_{2,0} b 2 , 0 to zero. Along the value segment, define
ψ ( p ) = H ( v 0 + p ( v 1 − v 0 ) ) . (94) \psi(p)=H(v_{0}+p(v_{1}-v_{0})). \tag*{(94)} ψ ( p ) = H ( v 0 + p ( v 1 − v 0 )) . (94)
For these parameter values,
ψ ( p ) = η 2 + η 3 p . (95) \psi(p)=\eta^{2}+\eta^{3}p. \tag*{(95)} ψ ( p ) = η 2 + η 3 p . (95)
The active pre-activation lies in [ η , η + η 2 ] [\eta,\eta+\eta^{2}] [ η , η + η 2 ] , while every other pre-activation equals − η -\eta − η . A fixed open raw-coordinate box around these parameter values therefore preserves the activation pattern, keeps ψ \psi ψ affine with derivative at least η 3 / 2 \eta^{3}/2 η 3 /2 , and keeps b 2 , 0 − ψ b_{2,0}-\psi b 2 , 0 − ψ inside ( − B , B ) (-B,B) ( − B , B ) . Take κ = η 3 / 2 \kappa=\eta^{3}/2 κ = η 3 /2 and let c Ω c_{\Omega} c Ω be the normalized volume of this box. For parameters in the box, the interval
( b 2 , 0 − ψ ( ρ m + 1 ) , b 2 , 0 − ψ ( ρ m ) ) (96) \left(b_{2,0}-\psi(\rho_{m+1}),\,b_{2,0}-\psi(\rho_{m})\right) \tag*{(96)} ( b 2 , 0 − ψ ( ρ m + 1 ) , b 2 , 0 − ψ ( ρ m ) ) (96)
has length at least κ ( ρ m + 1 − ρ m ) \kappa(\rho_{m+1}-\rho_{m}) κ ( ρ m + 1 − ρ m ) and lies in the raw bias range. Since both ρ t \rho_{t} ρ t and ψ \psi ψ are increasing, every t ≤ m t\leq m t ≤ m gives a negative logit difference and every t ≥ m + 1 t\geq m+1 t ≥ m + 1 gives a positive one. Thus all count levels are classified correctly.
On the event in (88), ∣ log n X ∣ ≤ 1 \lvert\log n X\rvert\le1 ∣ log n X ∣ ≤ 1 , so (74) gives ρ m + 1 − ρ m ≥ 1 n ( 1 + sinh 2 ( 1 / 2 ) ) = Ω ( n − 1 ) \rho_{m+1}-\rho_m \ge\frac{1}{n(1+\sinh^2(1/2))}=\Omega(n^{-1}) ρ m + 1 − ρ m ≥ n ( 1 + s i n h 2 ( 1/2 )) 1 = Ω ( n − 1 ) .
Restrict the ( W V , b V , W 1 , b 1 , W 2 , b 2 , 0 ) (W_V,b_V,W_1,b_1,W_2,b_2,0) ( W V , b V , W 1 , b 1 , W 2 , b 2 , 0 ) to the set in Lemma 8. The remaining bias interval then has normalized length Ω ( 1 / n ) \Omega(1/n) Ω ( 1/ n ) . Multiplying this length by the Ω ( 1 / log n ) \Omega(1/\log n) Ω ( 1/ log n ) contrast event and the fixed parameter box volume gives
V B M A J O R I T Y , A g e n ( h ) ( n ) ≥ C − n log n . (97) V_B^{\mathrm{MAJORITY},\mathcal{A}_{\mathrm{gen}}(h)}(n) \ge\frac{C_-}{n\log n}. \tag*{(97)} V B MAJORITY , A gen ( h ) ( n ) ≥ n log n C − . (97)
Together with (87), this proves the MAJORITY claim in Theorem 1.
PARITY
For PARITY, the count reduction in (71) gives a sequence of points along the value segment on which the required label flips. The proof compares the resulting number of sign changes with the number of activation changes available to a one-hidden-layer ReLU classifier. If v 0 ≠ v 1 v_0 \ne v_1 v 0 = v 1 , then
0 = ρ 0 < ρ 1 < ⋯ < ρ n = 1. (98) 0=\rho_0<\rho_1<\cdots<\rho_n=1. \tag*{(98)} 0 = ρ 0 < ρ 1 < ⋯ < ρ n = 1. (98)
Since every count-t t t attention output has the form A t = v 0 + ρ t ( v 1 − v 0 ) A_t=v_0+\rho_t(v_1-v_0) A t = v 0 + ρ t ( v 1 − v 0 ) , all such outputs lie on the line segment joining v 0 v_0 v 0 and v 1 v_1 v 1 . Parameterize this segment by A ( p ) = v 0 + p ( v 1 − v 0 ) A(p)=v_0+p(v_1-v_0) A ( p ) = v 0 + p ( v 1 − v 0 ) , p ∈ [ 0 , 1 ] p\in[0,1] p ∈ [ 0 , 1 ] and define the difference between the two output logits along it by
f ( p ) = ( e 1 − e 0 ) T [ W 2 ReLU ( W 1 A ( p ) + b 1 ) + b 2 ] . (99) f(p)=(e_1-e_0)^{\mathsf{T}}\left[W_2\operatorname{ReLU}(W_1A(p)+b_1)+b_2\right]. \tag*{(99)} f ( p ) = ( e 1 − e 0 ) T [ W 2 ReLU ( W 1 A ( p ) + b 1 ) + b 2 ] . (99)
This is a continuous piecewise-affine function of p p p , and each hidden preactivation can change sign at most once.
Proof of the PARITY bound in Theorem 1. If v 0 = v 1 v_0=v_1 v 0 = v 1 , every count level has the same attention output, so exact parity is impossible. Otherwise, exact parity makes f ( ρ t ) f(\rho_t) f ( ρ t ) alternate in sign. By continuity, for each t = 0 , … , n − 1 t=0,\ldots,n-1 t = 0 , … , n − 1 , choose a zero z t ∈ ( ρ t , ρ t + 1 ) z_t\in(\rho_t,\rho_{t+1}) z t ∈ ( ρ t , ρ t + 1 ) . For each t = 1 , … , n − 1 t=1,\ldots,n-1 t = 1 , … , n − 1 , the interval ( z t − 1 , z t ) (z_{t-1},z_t) ( z t − 1 , z t ) contains ρ t \rho_t ρ t , where f f f is nonzero. If no hidden pre-activation changed sign in this interval, the activation pattern would be fixed and f f f would be affine there. An affine function that vanishes at both endpoints is identically zero, contradicting f ( ρ t ) ≠ 0 f(\rho_t)\ne0 f ( ρ t ) = 0 . Hence each of the n − 1 n-1 n − 1 disjoint intervals ( z t − 1 , z t ) (z_{t-1},z_t) ( z t − 1 , z t ) contains a point at which a hidden ReLU pre-activation changes sign. Since each hidden pre-activation changes sign at most once, this requires h ≥ n − 1 h\ge n-1 h ≥ n − 1 . Therefore the exact-solution set is empty whenever n > h + 1 n>h+1 n > h + 1 .
Proof of the A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) INDEX Bound
This appendix proves Theorem 2. Recall the fixed map
F ( v ) = v 1 + ∥ v ∥ 2 2 (100) F(v)=\frac{v}{\sqrt{1+\lVert v\rVert_2^2}} \tag*{(100)} F ( v ) = 1 + ∥ v ∥ 2 2 v (100)
and the A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) positional score
g j n o r m = ( a k + b ) T ( r j + c K ) + ( b + F ( a k ) ) T s j 2 . (101) g_j^{\mathrm{norm}}=(ak+b)^{\mathsf{T}}(r_j+c_K)+(b+F(ak))^{\mathsf{T}}s_j^2. \tag*{(101)} g j norm = ( ak + b ) T ( r j + c K ) + ( b + F ( ak ) ) T s j 2 . (101)
χ ^ = a ^ T s , ℓ ^ = ℓ + 2 χ ^ , ε χ ( k ) = ( F ( a k ) − a ^ ) T s , (102) \widehat{\chi}=\widehat{a}^{\mathsf{T}}s,\qquad\widehat{\ell}=\ell+2\widehat{\chi},\qquad\varepsilon_{\chi}(k)=(F(ak)-\widehat{a})^{\mathsf{T}}s, \tag*{(102)} χ = a T s , ℓ = ℓ + 2 χ , ε χ ( k ) = ( F ( ak ) − a ) T s , (102)
with δ = b T s \delta=b^{\mathsf{T}}s δ = b T s and ϕ = b T r \phi=b^{\mathsf{T}}r ϕ = b T r as in (9). Then,
C q u a d n o r m ( k ) = χ ^ + δ + ε χ ( k ) , C l i n n o r m ( k ) = ℓ ^ k + ϕ + 2 k ε χ ( k ) , (103) C_{\mathrm{quad}}^{\mathrm{norm}}(k)=\widehat{\chi}+\delta+\varepsilon_{\chi}(k),\qquad C_{\mathrm{lin}}^{\mathrm{norm}}(k)=\widehat{\ell}k+\phi+2k\varepsilon_{\chi}(k), \tag*{(103)} C quad norm ( k ) = χ + δ + ε χ ( k ) , C lin norm ( k ) = ℓ k + ϕ + 2 k ε χ ( k ) , (103)
Whenever k + Δ ∈ [ n ] k+\Delta\in[n] k + Δ ∈ [ n ] ,
g k + Δ n o r m − g k n o r m = Δ C l i n n o r m ( k ) + Δ 2 C q u a d n o r m ( k ) . (104) g_{k+\Delta}^{\mathrm{norm}}-g_k^{\mathrm{norm}}=\Delta C_{\mathrm{lin}}^{\mathrm{norm}}(k)+\Delta^2 C_{\mathrm{quad}}^{\mathrm{norm}}(k). \tag*{(104)} g k + Δ norm − g k norm = Δ C lin norm ( k ) + Δ 2 C quad norm ( k ) . (104)
Since F ( a k ) F(ak) F ( ak ) is collinear with a a a ,
F ( a k ) = λ a ( k ) a ^ , λ a ( k ) = k ∥ a ∥ 2 1 + k 2 ∥ a ∥ 2 2 . (105) F(ak)=\lambda_a(k)\widehat{a},\qquad\lambda_a(k)=\frac{k\lVert a\rVert_2}{\sqrt{1+k^2\lVert a\rVert_2^2}}. \tag*{(105)} F ( ak ) = λ a ( k ) a , λ a ( k ) = 1 + k 2 ∥ a ∥ 2 2 k ∥ a ∥ 2 . (105)
Moreover,
0 ≤ 1 − λ a ( k ) ≤ 1 2 k 2 ∥ a ∥ 2 2 , ∣ 2 k ε χ ( k ) ∣ ≤ ∥ s ∥ 2 2 k ∥ a ∥ 2 2 . (106) 0\le1-\lambda_a(k)\le\frac{1}{2k^2\lVert a\rVert_2^2},\qquad\lvert2k\varepsilon_{\chi}(k)\rvert\le\frac{\lVert s\rVert_2^2}{k\lVert a\rVert_2^2}. \tag*{(106)} 0 ≤ 1 − λ a ( k ) ≤ 2 k 2 ∥ a ∥ 2 2 1 , ∣ 2 k ε χ ( k )∣ ≤ k ∥ a ∥ 2 2 ∥ s ∥ 2 2 . (106)
Lower bound
Use the same positional center as in (37). At this point, a 0 = ( 1 , 0 ) a^{0}=(1,0) a 0 = ( 1 , 0 ) is orthogonal to s 0 = ( 0 , η ) s^{0}=(0,\eta) s 0 = ( 0 , η ) , and hence
ℓ ^ = ϕ = 0 , Q a 0 ( k ) = − η 2 ( k ≥ 1 ) . (107) \widehat{\ell}=\phi=0,\qquad Q_{a^{0}}(k)=-\eta^{2}\qquad(k\ge1). \tag*{(107)} ℓ = ϕ = 0 , Q a 0 ( k ) = − η 2 ( k ≥ 1 ) . (107)
Thus
C q u a d n o r m ( k ) = − η 2 , C l i n n o r m ( k ) = 0 , (108) C^{\mathrm{norm}}_{\mathrm{quad}}(k)=-\eta^{2},\qquad C^{\mathrm{norm}}_{\mathrm{lin}}(k)=0, \tag*{(108)} C quad norm ( k ) = − η 2 , C lin norm ( k ) = 0 , (108)
and therefore,
g k n o r m − g j n o r m = η 2 ( j − k ) 2 . (109) g_{k}^{\mathrm{norm}}-g_{j}^{\mathrm{norm}}=\eta^{2}(j-k)^{2}. \tag*{(109)} g k norm − g j norm = η 2 ( j − k ) 2 . (109)
Work in a fixed neighborhood of this center on which a 1 > η a_{1}>\eta a 1 > η . The map a ↦ a ^ a\mapsto\widehat{a} a ↦ a is smooth there. Replace the raw coordinate r 1 r_{1} r 1 by ℓ ^ \widehat{\ell} ℓ , keeping ( a , b , r 2 , s ) (a,b,r_{2},s) ( a , b , r 2 , s ) as the other coordinates. Since
∂ ℓ ^ ∂ r 1 = a 1 , (110) \frac{\partial\widehat{\ell}}{\partial r_{1}}=a_{1}, \tag*{(110)} ∂ r 1 ∂ ℓ = a 1 , (110)
the corresponding coordinate change is locally invertible, with Jacobian and inverse Jacobian bounded on a sufficiently small fixed neighborhood. Thus boxes in these transformed coordinates and their preimages in the original coordinates have volumes within fixed multiplicative constants, independent of n n n . Shrink the fixed intervals for the other transformed coordinates so that throughout the neighborhood
∥ a ∥ 2 ≥ η , b ⊤ s ≤ − 7 η 2 8 , ∣ a ^ ⊤ s ∣ ≤ min { η 2 8 , η 4 16 } , ∣ ϕ ∣ ≤ η 2 16 . (111) \lVert a\rVert_{2}\ge\eta,\qquad b^{\top}s\le-\frac{7\eta^{2}}{8},\qquad\lvert\widehat{a}^{\top}s\rvert\le\min\left\{\frac{\eta^{2}}{8},\frac{\eta^{4}}{16}\right\},\qquad\lvert\phi\rvert\le\frac{\eta^{2}}{16}. \tag*{(111)} ∥ a ∥ 2 ≥ η , b ⊤ s ≤ − 8 7 η 2 , ∣ a ⊤ s ∣ ≤ min { 8 η 2 , 16 η 4 } , ∣ ϕ ∣ ≤ 16 η 2 . (111)
By (105), for every k ≥ 1 k\ge1 k ≥ 1 ,
C q u a d n o r m ( k ) = δ + λ a ( k ) χ ^ ≤ − 3 η 2 4 . (112) C^{\mathrm{norm}}_{\mathrm{quad}}(k)=\delta+\lambda_{a}(k)\widehat{\chi}\le-\frac{3\eta^{2}}{4}. \tag*{(112)} C quad norm ( k ) = δ + λ a ( k ) χ ≤ − 4 3 η 2 . (112)
Furthermore, (106) and (111) give
∣ 2 k ε χ ( k ) ∣ ≤ ∣ a ^ ⊤ s ∣ ∥ a ∥ 2 2 ≤ η 2 16 ( k ≥ 1 ) . (113) \lvert2k\varepsilon\chi(k)\rvert\le\frac{\lvert\widehat{a}^{\top}s\rvert}{\lVert a\rVert_{2}^{2}}\le\frac{\eta^{2}}{16}\qquad(k\ge1). \tag*{(113)} ∣ 2 k ε χ ( k )∣ ≤ ∥ a ∥ 2 2 ∣ a ⊤ s ∣ ≤ 16 η 2 ( k ≥ 1 ) . (113)
Here we used that 2 k ε χ ( k ) = 2 k ( λ a ( k ) − 1 ) a ^ ⊤ s 2k\varepsilon\chi(k)=2k(\lambda_{a}(k)-1)\widehat{a}^{\top}s 2 k ε χ ( k ) = 2 k ( λ a ( k ) − 1 ) a ⊤ s .
Now restrict the only shrinking transformed coordinate by
∣ ℓ ^ ∣ ≤ η 2 16 n . (114) \lvert\widehat{\ell}\rvert\le\frac{\eta^{2}}{16n}. \tag*{(114)} ∣ ℓ ∣ ≤ 16 n η 2 . (114)
For every k ≤ n k\le n k ≤ n , equations (111), (113), and (114) imply
∣ ℓ ^ k + ϕ + 2 k ε χ ( k ) ∣ ≤ 3 η 2 16 . (115) \lvert\widehat{\ell}_{k}+\phi+2k\varepsilon\chi(k)\rvert\le\frac{3\eta^{2}}{16}. \tag*{(115)} ∣ ℓ k + ϕ + 2 k ε χ ( k )∣ ≤ 16 3 η 2 . (115)
Therefore, for every nonzero integer Δ \Delta Δ with k + Δ ∈ [ n ] k+\Delta\in[n] k + Δ ∈ [ n ] ,
g k n o r m − g k + Δ n o r m ≥ 3 η 2 4 Δ 2 − 3 η 2 16 ∣ Δ ∣ ≥ η 2 2 Δ 2 . (116) g_{k}^{\mathrm{norm}}-g_{k+\Delta}^{\mathrm{norm}}\ge\frac{3\eta^{2}}{4}\Delta^{2}-\frac{3\eta^{2}}{16}\lvert\Delta\rvert
\ge\frac{\eta^{2}}{2}\Delta^{2}. \tag*{(116)} g k norm − g k + Δ norm ≥ 4 3 η 2 Δ 2 − 16 3 η 2 ∣ Δ ∣ ≥ 2 η 2 Δ 2 . (116)
Under the log n \log n log n attention scale, the total attention outside position k k k is at most
2 ∑ d = 1 ∞ e − ( η 2 / 2 ) d 2 , (117) 2\sum_{d=1}^{\infty}e^{-(\eta^{2}/2)d^{2}}, \tag*{(117)} 2 d = 1 ∑ ∞ e − ( η 2 /2 ) d 2 , (117)
which tends to zero uniformly in k k k and in the parameters in the neighborhood above. Thus the same fixed neighborhoods of C V , b V , W 1 , b 1 , W 2 , b 2 C_{V},b_{V},W_{1},b_{1},W_{2},b_{2} C V , b V , W 1 , b 1 , W 2 , b 2 used in the baseline INDEX lower bound preserve a positive logit difference for the correct label, and c K c_{K} c K may vary over a fixed neighborhood because it cancels from the attention weights. The transformed coordinate ℓ ^ \widehat{\ell} ℓ varies over an interval of width Θ ( n − 1 ) \Theta(n^{-1}) Θ ( n − 1 ) , whereas a , b , r 2 , s , c K , C V , b V , W 1 , b 1 , W 2 , b 2 a,b,r_{2},s,c_{K},C_{V},b_{V},W_{1},b_{1},W_{2},b_{2} a , b , r 2 , s , c K , C V , b V , W 1 , b 1 , W 2 , b 2 vary over fixed-width intervals. Boundedness of the local Jacobian then gives
V B I N D E X , A n o r m ( h ) ( n ) = Ω B , h ( n − 1 ) . (118) V_{B}^{\mathrm{INDEX},\mathrm{Anorm}(h)}(n)=\Omega_{B,h}(n^{-1}). \tag*{(118)} V B INDEX , Anorm ( h ) ( n ) = Ω B , h ( n − 1 ) . (118)
Upper bound
Use the same 4 n 4n 4 n inequalities y w k ( w , k ) > y 1 − w k ( w , k ) y_{w_k}(w,k)>y_{1-w_k}(w,k) y w k ( w , k ) > y 1 − w k ( w , k ) as in the original INDEX upper bound. The same output-bias argument shows that exact solutions for which one of these margins lies in ( 0 , n − 5 ] (0,n^{-5}] ( 0 , n − 5 ] have normalized volume O B ( n − 4 ) O_B(n^{-4}) O B ( n − 4 ) . For every remaining exact solution, the indexed position receives at least c 0 n − 5 c_0n^{-5} c 0 n − 5 attention in each constant-word/single-change comparison. Hence its score lies within a constant M 0 M_0 M 0 of the maximum score, uniformly in n n n . Comparing the indexed position with its two neighbors in (104) gives
C q u a d n o r m ( k ) + ∣ C l i n n o r m ( k ) ∣ ≤ M 0 ( 2 ≤ k ≤ n − 1 ) . (119) C^{\mathrm{norm}}_{\mathrm{quad}}(k)+\lvert C^{\mathrm{norm}}_{\mathrm{lin}}(k)\rvert\le M_0 \qquad(2\le k\le n-1). \tag*{(119)} C quad norm ( k ) + ∣ C lin norm ( k )∣ ≤ M 0 ( 2 ≤ k ≤ n − 1 ) . (119)
Since ∥ F ( a k ) ∥ 2 < 1 \lVert F(ak)\rVert_2<1 ∥ F ( ak ) ∥ 2 < 1 and the parameters are bounded, there exists a constant C 0 = C 0 ( B ) C_0=C_0(B) C 0 = C 0 ( B ) such that
∣ C q u a d n o r m ( k ) ∣ = ∣ ( b + F ( a k ) ) T s ∣ ≤ C 0 ( a , b , s ∈ [ − B , B ] 2 , k ≥ 1 ) . (120) \lvert C^{\mathrm{norm}}_{\mathrm{quad}}(k)\rvert=\lvert(b+F(ak))^{\mathsf T}s\rvert\le C_0 \qquad(a,b,s\in[-B,B]^2,\ k\ge1). \tag*{(120)} ∣ C quad norm ( k )∣ = ∣( b + F ( ak ) ) T s ∣ ≤ C 0 ( a , b , s ∈ [ − B , B ] 2 , k ≥ 1 ) . (120)
It follows from (119) that
∣ ℓ ^ k + ϕ + 2 k ε χ ( k ) ∣ ≤ M 1 ( 2 ≤ k ≤ n − 1 ) (121) \lvert\widehat{\ell}k+\phi+2k\varepsilon\chi(k)\rvert\le M_1 \qquad(2\le k\le n-1) \tag*{(121)} ∣ ℓ k + ϕ + 2 k ε χ ( k )∣ ≤ M 1 ( 2 ≤ k ≤ n − 1 ) (121)
for another constant M 1 = M 1 ( B , h ) M_1=M_1(B,h) M 1 = M 1 ( B , h ) .
Split the raw parameter cube according to whether
∥ a ∥ 2 ≤ n − 1 / 2 . (122) \lVert a\rVert_2\le n^{-1/2}. \tag*{(122)} ∥ a ∥ 2 ≤ n − 1/2 . (122)
Because a a a consists of two independent raw coordinates, the normalized volume of this part is at most the area of a radius-n − 1 / 2 n^{-1/2} n − 1/2 disk divided by ( 2 B ) 2 (2B)^2 ( 2 B ) 2 , and hence is O B ( n − 1 ) O_B(n^{-1}) O B ( n − 1 ) . On its complement, take k 0 = ⌊ n / 2 ⌋ k_0=\lfloor n/2\rfloor k 0 = ⌊ n /2 ⌋ . For all sufficiently large n n n , k 0 k_0 k 0 is interior and k 0 ≥ n / 3 k_0\ge n/3 k 0 ≥ n /3 . By (106) ,
∣ 2 k ε χ ( k 0 ) ∣ ≤ ∥ s ∥ 2 k 0 ∥ a ∥ 2 = O B ( 1 ) (123) \lvert2k\varepsilon\chi(k_0)\rvert\le\frac{\lVert s\rVert_2}{k_0\lVert a\rVert_2}=O_B(1) \tag*{(123)} ∣ 2 k ε χ ( k 0 )∣ ≤ k 0 ∥ a ∥ 2 ∥ s ∥ 2 = O B ( 1 ) (123)
because ∥ a ∥ 2 > n − 1 / 2 \lVert a\rVert_2>n^{-1/2} ∥ a ∥ 2 > n − 1/2 . Boundedness also gives ∣ ϕ ∣ = O B ( 1 ) \lvert\phi\rvert=O_B(1) ∣ ϕ ∣ = O B ( 1 ) . Equation (121) at k 0 k_0 k 0 therefore forces
∣ ℓ ^ ∣ ≤ C n (124) \lvert\widehat{\ell}\rvert\le\frac{C}{n} \tag*{(124)} ∣ ℓ ∣ ≤ n C (124)
for C = C ( B , h ) C=C(B,h) C = C ( B , h ) .
Conditional on ( a , b , s ) (a,b,s) ( a , b , s ) ,
ℓ ^ = a T r + ( 2 b T s + 2 a ^ T s ) . (125) \widehat{\ell}=a^{\mathsf T}r+(2b\mathsf T s+2\widehat{a}^{\mathsf T}s). \tag*{(125)} ℓ = a T r + ( 2 b T s + 2 a T s ) . (125)
so (124) defines a slab in the independent variable r r r with normal a a a . Choose a coordinate i i i with ∣ a i ∣ ≥ ∥ a ∥ 2 / 2 \lvert a_i\rvert\ge\lVert a\rVert_2/\sqrt{2} ∣ a i ∣ ≥ ∥ a ∥ 2 / 2 and fix the other coordinate of r r r . The allowed values of r i r_i r i lie in an interval of length at most C / ( n ∥ a ∥ 2 ) C/(n\lVert a\rVert_2) C / ( n ∥ a ∥ 2 ) , up to a constant depending only on B B B and h h h . Thus the normalized volume is at most
C B min { 1 , 1 n ∥ a ∥ 2 } . (126) C_B\min\left\{1,\frac{1}{n\lVert a\rVert_2}\right\}. \tag*{(126)} C B min { 1 , n ∥ a ∥ 2 1 } . (126)
Enlarging the square for a a a to a fixed-radius disk and integrating in polar coordinates on the complement of (122) gives
∫ a ∈ [ − B , B ] 2 ∥ a ∥ 2 > n − 1 / 2 C B n ∥ a ∥ 2 d a ≤ C B ′ n ∫ n − 1 / 2 2 B d ρ = O B ( n − 1 ) . (127) \int_{\substack{a\in[-B,B]^2\\ \lVert a\rVert_2>n^{-1/2}}}\frac{C_B}{n\lVert a\rVert_2}\,da
\le\frac{C'_B}{n}\int_{n^{-1/2}}^{\sqrt{2}B}d\rho
=O_B(n^{-1}). \tag*{(127)} ∫ a ∈ [ − B , B ] 2 ∥ a ∥ 2 > n − 1/2 n ∥ a ∥ 2 C B d a ≤ n C B ′ ∫ n − 1/2 2 B d ρ = O B ( n − 1 ) . (127)
All remaining raw coordinates integrate out. Adding the O ( n − 1 ) O(n^{-1}) O ( n − 1 ) small-a a a region and the O ( n − 4 ) O(n^{-4}) O ( n − 4 ) small-margin region gives
V B I N D E X , A n o r m ^ ( h ) ( n ) = O B , h ( n − 1 ) . (128) V_B^{\mathrm{INDEX},\widehat{\mathrm{Anorm}}(h)}(n)=O_{B,h}(n^{-1}). \tag*{(128)} V B INDEX , Anorm ( h ) ( n ) = O B , h ( n − 1 ) . (128)
Together with (118) , this proves Theorem 2 .
Fixed Sinusoidal Encoding on MAJORITY
This appendix analyzes the fixed-frequency sinusoidal MAJORITY model used in the discussion.
Model and matched bound
Let n = 2 m + 1 n=2m+1 n = 2 m + 1 be odd, let p j = ( sin j , cos j ) ⊤ p_j=(\sin j,\cos j)^\top p j = ( sin j , cos j ) ⊤ , and define
x j sin = [ e w j p j ] ∈ R 4 , z sin = 0 4 . (129) x_j^{\sin}=\begin{bmatrix}e_{w_j}\\p_j\end{bmatrix}\in\mathbb{R}^4,\qquad z^{\sin}=0_4. \tag*{(129)} x j s i n = [ e w j p j ] ∈ R 4 , z s i n = 0 4 . (129)
The frequency is fixed at one and is not a trainable coordinate. The query, key, and value maps are unrestricted affine maps from R 4 \mathbb{R}^4 R 4 to R 2 \mathbb{R}^2 R 2 , the attention multiplier is β n = log n \beta_n=\log n β n = log n , and the output is the same-width-h h h one-hidden-layer ReLU classifier as in Section 2. We denote this architecture by A sin ( h ) \mathcal{A}_{\sin}(h) A s i n ( h ) . All scalar parameters are bounded in [ − B , B ] [-B,B] [ − B , B ] .
Theorem 9 (Fixed-sinusoidal MAJORITY volume). For every fixed B > 0 B>0 B > 0 and h ≥ 2 h\ge2 h ≥ 2 ,
V B M A J O R I T Y , A sin , g e n ( h ) ( n ) = Θ ( 1 n 3 log n ) . (130) V_B^{\mathrm{MAJORITY},\mathcal{A}_{\sin,\mathrm{gen}}(h)}(n)=\Theta\left(\frac{1}{n^3\log n}\right). \tag*{(130)} V B MAJORITY , A s i n , gen ( h ) ( n ) = Θ ( n 3 log n 1 ) . (130)
Write the columns of W K W_K W K and W V W_V W V as
W K = [ k 0 k 1 k sin k cos ] , W V = [ v 0 v 1 v sin v cos ] , (131) W_K=[k_0\ k_1\ k_{\sin}\ k_{\cos}],\qquad W_V=[v_0\ v_1\ v_{\sin}\ v_{\cos}], \tag*{(131)} W K = [ k 0 k 1 k s i n k c o s ] , W V = [ v 0 v 1 v s i n v c o s ] , (131)
and define
q = b Q , λ = β n q ⊤ ( k 1 − k 0 ) , Γ = e λ , q=b_Q,\qquad\lambda=\beta_n q^\top(k_1-k_0),\qquad\Gamma=e^\lambda, q = b Q , λ = β n q ⊤ ( k 1 − k 0 ) , Γ = e λ ,
a = β n [ q ⊤ k sin q ⊤ k cos ] , P j = e a ⊤ p j , T = ∑ j = 1 n P j , a=\beta_n
\begin{bmatrix}
q^\top k_{\sin}\\
q^\top k_{\cos}
\end{bmatrix},\qquad P_j=e^{a^\top p_j},\qquad T=\sum_{j=1}^{n}P_j, a = β n [ q ⊤ k s i n q ⊤ k c o s ] , P j = e a ⊤ p j , T = j = 1 ∑ n P j ,
v b = v b + b V ( b ∈ { 0 , 1 } ) , C V = [ v sin v cos ] , μ = 1 T ∑ j = 1 n P j p j . (132) v_b=v_b+b_V\quad(b\in\{0,1\}),\qquad C_V=[v_{\sin}\ v_{\cos}],\qquad\mu=\frac{1}{T}\sum_{j=1}^{n}P_jp_j. \tag*{(132)} v b = v b + b V ( b ∈ { 0 , 1 }) , C V = [ v s i n v c o s ] , μ = T 1 j = 1 ∑ n P j p j . (132)
The common key-bias and symbol-zero score contributions cancel, so the attention weights are
α j ( w ) = P j Γ w j ∑ i = 1 n P i Γ w i . (133) \alpha_j(w)=\frac{P_j\Gamma^{w_j}}{\sum_{i=1}^{n}P_i\Gamma^{w_i}}. \tag*{(133)} α j ( w ) = ∑ i = 1 n P i Γ w i P j Γ w j . (133)
For t ∈ [ 0 , 1 ] n t\in[0,1]^n t ∈ [ 0 , 1 ] n , introduce the algebraic extensions
D ( t ) = T + ( Γ − 1 ) ∑ j P j t j , (134) D(t)=T+(\Gamma-1)\sum_jP_jt_j, \tag*{(134)} D ( t ) = T + ( Γ − 1 ) j ∑ P j t j , (134)
N ( t ) = ∑ j P j ( v 0 + C V p j ) + ∑ j t j P j [ Γ v 1 − v 0 + ( Γ − 1 ) C V p j ] . (135) N(t)=\sum_jP_j(v_0+C_Vp_j)+\sum_jt_jP_j\left[\Gamma v_1-v_0+(\Gamma-1)C_Vp_j\right]. \tag*{(135)} N ( t ) = j ∑ P j ( v 0 + C V p j ) + j ∑ t j P j [ Γ v 1 − v 0 + ( Γ − 1 ) C V p j ] . (135)
Then D ( t ) > 0 D(t)>0 D ( t ) > 0 on the cube and A ( w ) = N ( w ) / D ( w ) A(w)=N(w)/D(w) A ( w ) = N ( w ) / D ( w ) on binary inputs.
The necessary positional compensation
Let d i = ( W 2 ) 1 i − ( W 2 ) 0 i d_i=(W_2)_{1i}-(W_2)_{0i} d i = ( W 2 ) 1 i − ( W 2 ) 0 i and b = b 2 , 1 − b 2 , 0 b=b_{2,1}-b_{2,0} b = b 2 , 1 − b 2 , 0 . After multiplying the logit difference by the positive denominator D ( t ) D(t) D ( t ) , the resulting function is continuous and piecewise affine in t t t . For an activation pattern σ ⊆ [ h ] \sigma\subseteq[h] σ ⊆ [ h ] , define
ℓ σ = ∑ i ∈ σ d i ( W 1 ) i , : ⊤ , c σ = b + ∑ i ∈ σ d i b 1 , i , \ell_\sigma=\sum_{i\in\sigma}d_i(W_1)_{i,:}^{\top},\qquad c_\sigma=b+\sum_{i\in\sigma}d_ib_{1,i}, ℓ σ = i ∈ σ ∑ d i ( W 1 ) i , : ⊤ , c σ = b + i ∈ σ ∑ d i b 1 , i ,
δ σ = ℓ σ ⊤ ( v 1 − v 0 ) , ξ σ = C V ⊤ ℓ σ , (136) \delta_\sigma=\ell_\sigma^\top(v_1-v_0),\qquad\xi_\sigma=C_V^\top\ell_\sigma, \tag*{(136)} δ σ = ℓ σ ⊤ ( v 1 − v 0 ) , ξ σ = C V ⊤ ℓ σ , (136)
and
c σ ∗ = − ℓ σ ⊤ v 0 + Γ v 1 1 + Γ − ξ σ ⊤ μ . (137) c_\sigma^*=-\ell_\sigma^\top\frac{v_0+\Gamma v_1}{1+\Gamma}-\xi_\sigma^\top\mu. \tag*{(137)} c σ ∗ = − ℓ σ ⊤ 1 + Γ v 0 + Γ v 1 − ξ σ ⊤ μ . (137)
Lemma 10 (Positional compensation). Outside a set of raw-cube measure zero, every exact solution at a sufficiently large odd length has an activation pattern σ ⊆ [ h ] \sigma\subseteq[h] σ ⊆ [ h ] such that δ σ ≠ 0 \delta_\sigma\ne0 δ σ = 0 and
∥ a + sinh λ δ σ ξ σ ∥ 2 ≤ C n . (138) \left\|a+\frac{\sinh\lambda}{\delta_\sigma}\xi_\sigma\right\|_2\le\frac{C}{n}. \tag*{(138)} a + δ σ sinh λ ξ σ 2 ≤ n C . (138)
while
∣ c σ − c σ ∗ ∣ ≤ C ∣ δ σ ∣ n Γ ( 1 + Γ ) 2 . (139) \lvert c_\sigma-c_\sigma^*\rvert\le\frac{C\lvert\delta_\sigma\rvert}{n}\frac{\Gamma}{(1+\Gamma)^2}. \tag*{(139)} ∣ c σ − c σ ∗ ∣ ≤ n C ∣ δ σ ∣ ( 1 + Γ ) 2 Γ . (139)
The constants are uniform over the bounded raw parameter cube, including when q q q and δ σ \delta_\sigma δ σ are arbitrarily small but nonzero.
Proof. Exclude first the finite union of sets on which one of the affine pieces defined below vanishes at t = 0 t=0 t = 0 ; each is null by slicing along b 2 , 1 b_{2,1} b 2 , 1 . On activation pattern σ \sigma σ , the denominator-scaled logit difference is an affine function L σ ( t ) = L σ ( 0 ) + ∑ j ℓ ^ σ , j t j L_\sigma(t)=L_\sigma(0)+\sum_j\widehat{\ell}_{\sigma,j}t_j L σ ( t ) = L σ ( 0 ) + ∑ j ℓ σ , j t j , where
ℓ ^ σ , j = P j ( κ σ + ν σ T p j ) , κ σ = ℓ T ( Γ v 1 − v 0 ) + ( Γ − 1 ) c σ , ν σ = ( Γ − 1 ) ξ σ . (140) \widehat{\ell}_{\sigma,j}=P_j(\kappa_\sigma+\nu_\sigma^\mathsf{T}p_j),\qquad
\kappa_\sigma=\ell^\mathsf{T}(\Gamma v_1-v_0)+(\Gamma-1)c_\sigma,\qquad
\nu_\sigma=(\Gamma-1)\xi_\sigma. \tag*{(140)} ℓ σ , j = P j ( κ σ + ν σ T p j ) , κ σ = ℓ T ( Γ v 1 − v 0 ) + ( Γ − 1 ) c σ , ν σ = ( Γ − 1 ) ξ σ . (140)
Fix t ∈ [ 0 , 1 ] n t\in[0,1]^n t ∈ [ 0 , 1 ] n with ∑ j t j = n / 2 \sum_jt_j=n/2 ∑ j t j = n /2 . Preserving ∑ j t j \sum_jt_j ∑ j t j , ∑ j P j t j \sum_jP_jt_j ∑ j P j t j , ∑ j P j sin j t j \sum_jP_j\sin jt_j ∑ j P j sin j t j , and ∑ j P j cos j t j \sum_jP_j\cos jt_j ∑ j P j cos j t j , one can move to a point with at most four fractional coordinates. Rounding those coordinates to words with respectively m m m and m + 1 m+1 m + 1 ones and using exact correctness forces a zero of one affine piece within four coordinate changes. Applying this to the centrally symmetric convex body generated by P j ( 1 , p j ) ∈ R 3 P_j(1,p_j)\in\mathbb{R}^3 P j ( 1 , p j ) ∈ R 3 and using the elementary convex-body slab bound yields, for some σ \sigma σ ,
∑ j = 1 n ∣ ℓ ^ σ , j − med ( ℓ ^ σ , 1 , … , ℓ ^ σ , n ) ∣ ≤ C h M σ , ∣ L σ ( 1 2 1 ) ∣ ≤ C h M σ , (141) \sum_{j=1}^{n}\left\lvert\widehat{\ell}_{\sigma,j}-\operatorname{med}(\widehat{\ell}_{\sigma,1},\ldots,\widehat{\ell}_{\sigma,n})\right\rvert\le C_hM_\sigma,\qquad
\left\lvert L_\sigma\left(\tfrac12\mathbf{1}\right)\right\rvert\le C_hM_\sigma, \tag*{(141)} j = 1 ∑ n ℓ σ , j − med ( ℓ σ , 1 , … , ℓ σ , n ) ≤ C h M σ , L σ ( 2 1 1 ) ≤ C h M σ , (141)
where M σ = max j ∣ ℓ ^ σ , j ∣ M_\sigma=\max_j\lvert\widehat{\ell}_{\sigma,j}\rvert M σ = max j ∣ ℓ σ , j ∣ . The fixed phases j m o d 2 π j\bmod2\pi j mod 2 π are equidistributed because ∣ ∑ j = 1 n e i k j ∣ = O k ( 1 ) \left\lvert\sum_{j=1}^{n}e^{ikj}\right|=O_k(1) ∑ j = 1 n e ik j = O k ( 1 ) for each fixed nonzero integer k k k . Applied to the sequence e a T p j ( κ σ + ν σ T p j ) e^{a^\mathsf{T}p_j}(\kappa_\sigma+\nu_\sigma^\mathsf{T}p_j) e a T p j ( κ σ + ν σ T p j ) , the first inequality in (141) first bounds ∥ a ∥ 2 \lVert a\rVert_2 ∥ a ∥ 2 , then a compactness argument forces a a a and ν σ / κ σ \nu_\sigma/\kappa_\sigma ν σ / κ σ to approach zero, and finally the first two discrete Fourier modes of the second-order Taylor expansion give
κ σ ≠ 0 , M σ ≍ ∣ κ σ ∣ , ∥ a ∥ 2 2 ≤ C n , ∥ a + ν σ κ σ ∥ 2 ≤ C n . (142) \kappa_\sigma\ne0,\qquad M_\sigma\asymp\lvert\kappa_\sigma\rvert,\qquad
\lVert a\rVert_2^2\le\frac{C}{n},\qquad
\left\lVert a+\frac{\nu_\sigma}{\kappa_\sigma}\right\rVert_2\le\frac{C}{n}. \tag*{(142)} κ σ = 0 , M σ ≍ ∣ κ σ ∣ , ∥ a ∥ 2 2 ≤ n C , a + κ σ ν σ 2 ≤ n C . (142)
To return to the raw parameters, put e c = c σ − c σ ∗ e_c=c_\sigma-c_\sigma^* e c = c σ − c σ ∗ and τ = 2 Γ δ σ / ( 1 + Γ ) \tau=2\Gamma\delta_\sigma/(1+\Gamma) τ = 2Γ δ σ / ( 1 + Γ ) . Direct substitution gives
L σ ( 1 2 1 ) = ( 1 + Γ ) T 2 e c , κ σ = τ − ν σ T μ + ( Γ − 1 ) e c . (143) L_\sigma\left(\tfrac12\mathbf{1}\right)=\frac{(1+\Gamma)T}{2}e_c,\qquad
\kappa_\sigma=\tau-\nu_\sigma^\mathsf{T}\mu+(\Gamma-1)e_c. \tag*{(143)} L σ ( 2 1 1 ) = 2 ( 1 + Γ ) T e c , κ σ = τ − ν σ T μ + ( Γ − 1 ) e c . (143)
Since T ≍ n T\asymp n T ≍ n , (141) and (142) imply ∣ e c ∣ ≤ C ∣ κ σ ∣ / ( ( 1 + Γ ) n ) \lvert e_c\rvert\le C\lvert\kappa_\sigma\rvert/((1+\Gamma)n) ∣ e c ∣ ≤ C ∣ κ σ ∣ / (( 1 + Γ ) n ) and ∣ κ σ − τ ∣ ≤ C n − 1 / 2 ∣ κ σ ∣ \lvert\kappa_\sigma-\tau\rvert\le Cn^{-1/2}\lvert\kappa_\sigma\rvert ∣ κ σ − τ ∣ ≤ C n − 1/2 ∣ κ σ ∣ . Hence δ σ ≠ 0 \delta_\sigma\ne0 δ σ = 0 , ∣ τ ∣ ≍ ∣ κ σ ∣ \lvert\tau\rvert\asymp\lvert\kappa_\sigma\rvert ∣ τ ∣ ≍ ∣ κ σ ∣ , and ∥ ν σ / τ − ν σ / κ σ ∥ 2 ≤ C / n \lVert\nu_\sigma/\tau-\nu_\sigma/\kappa_\sigma\rVert_2\le C/n ∥ ν σ / τ − ν σ / κ σ ∥ 2 ≤ C / n . Using ν σ / τ = ( sinh λ / δ σ ) ξ σ \nu_\sigma/\tau=(\sinh\lambda/\delta_\sigma)\xi_\sigma ν σ / τ = ( sinh λ / δ σ ) ξ σ proves (138) , and the bound on e c e_c e c proves (139) . □
Volume integration
Proof of Theorem 9. For the upper bound, fix one of the finitely many activation patterns σ \sigma σ and condition on q q q , the two symbol key columns, and all value and classifier coordinates except b 2 , 1 b_{2,1} b 2 , 1 , leaving the two positional key columns unconditioned. Each coordinate of (138) restricts one independent positional key column to a slab whose conditional normalized width is at most
C B min { 1 , 1 n β n ∥ q ∥ ∞ } . (144) C_B\min\left\{1,\frac{1}{n\beta_n\lVert q\rVert_\infty}\right\}. \tag*{(144)} C B min { 1 , n β n ∥ q ∥ ∞ 1 } . (144)
The two columns use disjoint raw coordinates. After they are fixed, (139) restricts b 2 , 1 b_{2,1} b 2 , 1 to an interval of normalized length O B , h ( 1 / n ) O_{B,h}(1/n) O B , h ( 1/ n ) . Summing over σ \sigma σ and integrating t = ∥ q ∥ ∞ t=\lVert q\rVert_\infty t = ∥ q ∥ ∞ , whose density under the uniform square measure is proportional to t t t , gives
V B M A J O R I T Y , A sin , g e n ( h ) ( n ) ≤ C B , h n ∫ 0 B t min { 1 , 1 n β n t } 2 d t ≤ C B , h ( 1 + log ( n β n ) ) n 3 β n 2 = O B , h ( 1 n 3 log n ) . (145) V_B^{\mathrm{MAJORITY},A_{\sin,\mathrm{gen}}(h)}(n)
\le\frac{C_{B,h}}{n}\int_0^B t\min\left\{1,\frac{1}{n\beta_n t}\right\}^{2}\,dt
\le\frac{C_{B,h}(1+\log(n\beta_n))}{n^3\beta_n^2}
=O_{B,h}\left(\frac{1}{n^3\log n}\right). \tag*{(145)} V B MAJORITY , A s i n , gen ( h ) ( n ) ≤ n C B , h ∫ 0 B t min { 1 , n β n t 1 } 2 d t ≤ n 3 β n 2 C B , h ( 1 + log ( n β n )) = O B , h ( n 3 log n 1 ) . (145)
For the lower bound, restrict the value and classifier coordinates to a fixed positive-volume open box on which the bias-free logit difference has the form ℓ T A + c h \ell^\mathsf{T}A+c_h ℓ T A + c h for every attainable attention output, with constants 0 < δ − ≤ δ : = ℓ T ( v 1 − v 0 ) ≤ δ + 0 < \delta_{-} \le\delta:= \ell^{\mathsf{T}}(v_{1}-v_{0}) \le\delta_{+} 0 < δ − ≤ δ := ℓ T ( v 1 − v 0 ) ≤ δ + and ξ = C V T ℓ \xi= C_{V}^{\mathsf{T}}\ell ξ = C V T ℓ satisfying ∥ ξ ∥ 2 / δ ≤ 1 / 100 \lVert\xi\rVert_{2}/\delta\le1/100 ∥ ξ ∥ 2 / δ ≤ 1/100 . Such a box is obtained from an interior center with v 0 = 0 v_{0}=0 v 0 = 0 , v 1 = η ( 1 , 0 ) T v_{1}=\eta(1,0)^{\mathsf{T}} v 1 = η ( 1 , 0 ) T , C V = 0 C_{V}=0 C V = 0 , and one uniformly active hidden unit. Set
A ∗ = v 0 + Γ v 1 1 + Γ + C V μ , b 2 , 1 ∗ = b 2 , 0 − c H − ℓ T A ∗ . (146) A^{*}=\frac{v_{0}+\Gamma v_{1}}{1+\Gamma}+C_{V}\mu,\qquad b_{2,1}^{*}=b_{2,0}-c_{H}-\ell^{\mathsf{T}}A^{*}. \tag*{(146)} A ∗ = 1 + Γ v 0 + Γ v 1 + C V μ , b 2 , 1 ∗ = b 2 , 0 − c H − ℓ T A ∗ . (146)
At this centered bias, the exact logit difference is
( y ( w ) ) 1 − ( y ( w ) ) 0 = ∑ j ( w j − 1 / 2 ) ℓ ^ j D ( w ) , ℓ ^ j = P j [ 2 Γ δ 1 + Γ + ( Γ − 1 ) ξ T ( p j − μ ) ] . (147) (y(w))_{1}-(y(w))_{0}=\frac{\sum_{j}(w_{j}-1/2)\widehat{\ell}_{j}}{D(w)},\qquad\widehat{\ell}_{j}=P_{j}\left[\frac{2\Gamma\delta}{1+\Gamma}+(\Gamma-1)\xi^{\mathsf{T}}(p_{j}-\mu)\right]. \tag*{(147)} ( y ( w ) ) 1 − ( y ( w ) ) 0 = D ( w ) ∑ j ( w j − 1/2 ) ℓ j , ℓ j = P j [ 1 + Γ 2Γ δ + ( Γ − 1 ) ξ T ( p j − μ ) ] . (147)
If ∣ λ ∣ ≤ c 1 n − 1 / 2 |\lambda|\le c_{1}n^{-1/2} ∣ λ ∣ ≤ c 1 n − 1/2 and ∥ a + ( sinh λ / δ ) ξ ∥ 2 ≤ c 2 / n \lVert a+(\sinh\lambda/\delta)\xi\rVert_{2}\le c_{2}/n ∥ a + ( sinh λ / δ ) ξ ∥ 2 ≤ c 2 / n , a uniform first-order expansion of (147) gives ℓ ^ j / τ = F 0 + O ( 1 / n ) \widehat{\ell}_{j}/\tau=F_{0}+O(1/n) ℓ j / τ = F 0 + O ( 1/ n ) with τ = 2 Γ δ / ( 1 + Γ ) \tau=2\Gamma\delta/(1+\Gamma) τ = 2Γ δ / ( 1 + Γ ) and F 0 ≥ 3 / 4 F_{0}\ge3/4 F 0 ≥ 3/4 . Therefore the numerator has the MAJORITY sign and magnitude bounded below by a positive constant, while D ( w ) = O ( n ) D(w)=O(n) D ( w ) = O ( n ) ; an interval ∣ b 2 , 1 − b 2 , 1 ∗ ∣ < c 3 / n |b_{2,1}-b_{2,1}^{*}|<c_{3}/n ∣ b 2 , 1 − b 2 , 1 ∗ ∣ < c 3 / n preserves strict correctness on every input.
It remains to measure a full-dimensional set satisfying these conditions. Restrict the query bias to
q 1 > 0 , ∣ q 2 ∣ ≤ q 1 / 4 , r : = β n q 1 ∈ [ L n , c n ] . (148) q_{1}>0,\qquad|q_{2}|\le q_{1}/4,\qquad r:=\beta_{n}q_{1}\in\left[\frac{L}{n},\frac{c}{\sqrt{n}}\right]. \tag*{(148)} q 1 > 0 , ∣ q 2 ∣ ≤ q 1 /4 , r := β n q 1 ∈ [ n L , n c ] . (148)
For sufficiently small c c c , the symbol key columns may vary over their full raw squares while ∣ λ ∣ ≤ c 1 n − 1 / 2 |\lambda|\le c_{1}n^{-1/2} ∣ λ ∣ ≤ c 1 n − 1/2 . Conditional on these choices and on the decoder box, the two coordinates of the compensation condition restrict one entry of each positional key column to an interval of length Θ ( 1 / ( n r ) ) \Theta(1/(nr)) Θ ( 1/ ( n r )) ; fixed-width restrictions on the other entries keep these intervals inside the raw cube. Their joint normalized mass is therefore Ω B , h ( 1 / ( n 2 r 2 ) ) \Omega_{B,h}(1/(n^{2}r^{2})) Ω B , h ( 1/ ( n 2 r 2 )) , and the admissible output-bias interval contributes Ω B , h ( 1 / n ) \Omega_{B,h}(1/n) Ω B , h ( 1/ n ) . Since the query-cone measure after integrating q 2 q_{2} q 2 is a constant multiple of r d r / β n 2 r\,dr/\beta_{n}^{2} r d r / β n 2 ,
V B M A J O R I T Y , A s i n , g e n ( h ) ( n ) ≥ c B , h n 3 β n 2 ∫ L / n c / n d r r ≥ c B , h ′ n 3 log n . (149) V_{B}^{\mathrm{MAJORITY},A_{\mathrm{sin,gen}}(h)}(n)\ge\frac{c_{B,h}}{n^{3}\beta_{n}^{2}}\int_{L/n}^{c/\sqrt{n}}\frac{dr}{r}
\ge\frac{c'_{B,h}}{n^{3}\log n}. \tag*{(149)} V B MAJORITY , A sin , gen ( h ) ( n ) ≥ n 3 β n 2 c B , h ∫ L / n c / n r d r ≥ n 3 log n c B , h ′ . (149)
Every restricted raw coordinate varies over an interval of positive width and every unrestricted coordinate integrates out, so this is a full-dimensional lower bound. Together with (145) , it proves the theorem.
Experimental Details and Selected Additional Results
This appendix specifies the experimental protocol used for the main-text comparisons and reports the additional results referenced in the discussion of sinusoidal positional encoding.
Reported models and benchmark provenance
The baseline positional implementation is the model A p o s ( h ) A_{\mathrm{pos}}(h) A pos ( h ) from § 2 , with quadratic positional coordinates ( j , j 2 ) (j,j^{2}) ( j , j 2 ) , and the selectively normalized implementation is A n o r m ( h ) A_{\mathrm{norm}}(h) A norm ( h ) from § 4.2 . For the baseline MAJORITY experiment, we use the unrestricted affine NoPE implementation of A g e n ( h ) A_{\mathrm{gen}}(h) A gen ( h ) . The additional sinusoidal MAJORITY control is the fixed-frequency general model A s i n ( h ) A_{\mathrm{sin}}(h) A sin ( h ) defined in Section C.1.
We use the same 20 seeds, 2000–2019, at each maximum training length
N ∈ { 11 , 21 , 31 , 41 , 51 } . (150) N\in\{11,21,31,41,51\}. \tag*{(150)} N ∈ { 11 , 21 , 31 , 41 , 51 } . (150)
Training and qualification did not have access to the test banks, and every newly trained checkpoint was selected and frozen before its test evaluation.
Training, selection, and initialization
Training uses Adam with learning rate 3 × 10 − 4 3 \times10^{-4} 3 × 1 0 − 4 , β 1 = 0.9 \beta_1 = 0.9 β 1 = 0.9 , β 2 = 0.999 \beta_2 = 0.999 β 2 = 0.999 , numerical stabilizer 10 − 8 10^{-8} 1 0 − 8 , no weight decay, batch size 256, and gradient-norm clipping at one. Each update uses a fresh batch of independent uniformly random bits. For FIRST and INDEX, the index k k k is sampled uniformly from the positions in the sampled sequence. For FIRST and INDEX, one data length is sampled uniformly from { 1 , … , N } \{1,\ldots,N\} { 1 , … , N } per batch. For MAJORITY, the sampled length is uniform over the odd integers in that range. Computation uses float64. At data length L L L , attention scores are multiplied by log L \log L log L , without an additional 1 / d 1/\sqrt{d} 1/ d factor.
Every run is trained for at most 30,000 updates and is validated every 500 updates on a fixed bank of 1,000 examples at length N N N . Training stops after three consecutive perfect validations. The selected checkpoint maximizes validation accuracy; ties are resolved first by lower cross-entropy and then by the earlier update. No input longer than N N N is used in checkpoint selection.
For the A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) and A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) models, the vectors a a a , r r r , s s s , b b b , c K c_K c K are initialized from centered normal distributions with standard deviations 0.1 / N 0.1/N 0.1/ N , 0.1 / N 0.1/N 0.1/ N , 0.1 / N 2 0.1/N^2 0.1/ N 2 , 0.1 0.1 0.1 , 0.1 0.1 0.1 , respectively. Other parameters use Xavier-uniform initialization and their biases are zero. A p o s ( h ) / A n o r m ( h ) \mathcal{A}_{\mathrm{pos}}(h)/\mathcal{A}_{\mathrm{norm}}(h) A pos ( h ) / A norm ( h ) pairs use identical initial tensors and the same training streams. For A g e n \mathcal{A}_{\mathrm{gen}} A gen and A s i n \mathcal{A}_{\mathrm{sin}} A sin , content query/key blocks and the bounded sinusoidal positional blocks use Xavier-uniform initialization, while shared value, bias, and classifier blocks are copied from the paired A p o s \mathcal{A}_{\mathrm{pos}} A pos seed.
Evaluation banks, metrics, and uncertainty
For a maximum training length N N N , the common test grid is
N , 2 N + 1 , 3 N , 5 N , 8 N + 1 , 10 N + 1. (151) N,\quad2N+1,\quad3N,\quad5N,\quad8N+1,\quad10N+1. \tag*{(151)} N , 2 N + 1 , 3 N , 5 N , 8 N + 1 , 10 N + 1. (151)
At each test length, all seeds and model variants for the same task use the same saved bank of 1,000 examples. For FIRST, the first bit is exactly balanced and the remaining bits are random. For MAJORITY, 500 random strings are paired with their complements. For INDEX, each of 500 random string–query pairs is paired with the complemented string and the same query.
Test accuracy is the fraction correct on one saved bank. The longest-test statistic is the mean across the 20 seeds at L = 10 N + 1 L = 10N+1 L = 10 N + 1 . For coefficient analyses and other OOD summaries, the seed-level mean OOD accuracy is the equal-weight mean across the five test lengths strictly greater than N N N . Confidence intervals are pointwise percentile 95% intervals.
Coefficient analysis
The coefficient analysis uses the 100 selected INDEX checkpoints on A p o s \mathcal{A}_{\mathrm{pos}} A pos : 20 seeds at each of the five values of N N N in (150). For each checkpoint, we compute
χ = a T s , ℓ = 2 b T s + a T r (152) \chi= a^{\mathsf{T}}s,\qquad\ell= 2b^{\mathsf{T}}s + a^{\mathsf{T}}r \tag*{(152)} χ = a T s , ℓ = 2 b T s + a T r (152)
directly from the learned parameters.
To avoid treating differences among the five training maxima as evidence for a coefficient association, we rank each coefficient magnitude and the seed-level mean OOD accuracy separately within each value of N N N , and then pool the within-N N N ranks. The resulting correlations are − 0.655 -0.655 − 0.655 for N ∣ χ ∣ N\lvert\chi\rvert N ∣ χ ∣ and − 0.516 -0.516 − 0.516 for N ∣ ℓ ∣ N\lvert\ell\rvert N ∣ ℓ ∣ . The two-sided permutation test uses 10,000 permutations and shuffles ranks only within the same value of N N N ; both tests give p < 10 − 3 p < 10^{-3} p < 1 0 − 3 .
Selected results across maximum training lengths
Table 2 reports the longest-test results. Each entry is the mean percentage accuracy across 20 seeds, followed by its pointwise 95% seed-bootstrap interval.
Table 2 : Accuracy at the longest tested length L = 10 N + 1 L = 10N + 1 L = 10 N + 1 . Entries are percentages, with pointwise 95% seed-bootstrap intervals in parentheses.
Table 2. Accuracy at the longest tested length L = 10 N + 1 L = 10N + 1 L = 10 N + 1 . Entries are percentages, with pointwise 95% seed-bootstrap intervals in parentheses.
Sinusoidal positional encoding on MAJORITY
Relevant results on the performance of A s i n \mathcal{A}_{\mathrm{sin}} A sin compared to A g e n \mathcal{A}_{\mathrm{gen}} A gen on MAJORITY is displayed in Table 3 .
Table 3 : Mean OOD accuracy on MAJORITY for A g e n \mathcal{A}_{\mathrm{gen}} A gen and A s i n \mathcal{A}_{\mathrm{sin}} A sin general models. Entries are percentages, averaged equally over the five test lengths above N N N , with 95% confidence intervals in parentheses.
Table 3. Mean OOD accuracy on MAJORITY for A g e n \mathcal{A}_{\mathrm{gen}} A gen and A s i n \mathcal{A}_{\mathrm{sin}} A sin general models. Entries are percentages, averaged equally over the five test lengths above N N N , with 95% confidence intervals in parentheses.
Sanity checks for Anorm(h) on other tasks
We also compared A p o s ( h ) \mathcal{A}_{\mathrm{pos}}(h) A pos ( h ) to A n o r m ( h ) \mathcal{A}_{\mathrm{norm}}(h) A norm ( h ) on FIRST and MAJORITY. For FIRST, both positional models achieve 100% mean accuracy at L = 10 N + 1 L = 10N + 1 L = 10 N + 1 for every N N N in (150).
For our setup of MAJORITY, A p o s \mathcal{A}_{\mathrm{pos}} A pos and A n o r m \mathcal{A}_{\mathrm{norm}} A norm are equivalent, hence producing same results for every seed.