betaFeedback

WorksComputer Science

Emergent Inverse-Depth Scaling From Nonlinearity In Attention

Abstract

Scaling laws describe power-law improvements in model performance with dataset size and parameter count, yet their underlying mechanisms are not fully understood. To explain the parameter count scaling, existing theory posits power-law scaling with model depth. In linear-attention models, this scaling is tied to a power-law data spectrum: unable to selectively attend to relevant tokens, these models learn according to global spectral strength, with stronger directions learned before weaker ones. Large language models, however, can be strongly nonlinear. Here, we show that nonlinear attention yields inverse-depth decay of loss across all tested data spectra. Nonlinearity enables attention to focus selectively on relevant tokens, allowing strong and weak spectral directions to be learned in parallel. Similar focusing across layers motivates a connection to the central limit theorem: shared error across layers sets the loss plateau, while aggregation turns layer-specific differences into continued gains with depth. Our findings suggest that depth scaling may arise from nonlinearity in attention, which allows large language models to focus locally and may make the global covariance structure less relevant.

Introduction

Neural scaling laws describe how model loss decreases with the size of the dataset and the model, providing a practical basis for predicting performance and allocating computational resources [15, 17, 16]. Despite their predictive success, these laws remain largely empirical, and the mechanisms underlying their behavior are not fully understood. Clarifying their origins could help establish the scope of these laws and reveal how scaling can be made more efficient.

Recent theoretical work has begun to examine model-size scaling more closely by separating the roles of width and depth [2, 21, 4]. Increasing width provides more representational capacity within each layer, whereas increasing depth adds successive processing steps; the two can therefore improve performance through different mechanisms. Here, we focus on how models use additional layers and how this gives rise to scaling with depth. Previous work on linear-attention models ties power-law depth scaling to a power-law data spectrum [4]. Yet it does not account for nonlinear attention in practical large language models. In contrast, empirical work on these models suggests that inverse-depth scaling can arise through an ensemble of layers with similar behavior [22], without explaining the underlying reason for this layerwise similarity. We therefore ask:

Our research question:

How does nonlinearity in attention affect depth scaling and its underlying mechanisms?

We study this question in the common setting of in-context learning (ICL), where a model uses examples in its context to make predictions for a new query. Our tasks model the second half of an induction head’s computation: retrieving the token that matches the query and copying its associated value [11, 28, 26]. To isolate the role of nonlinearity, we compare controlled Transformers with linear or nonlinear attention across independently varied data spectra.

Figure 1 summarizes the resulting picture. In an easy task, the linear-attention model follows a spectrum-dependent power law, while a single-layer nonlinear-attention model is enough to solve the task. In a difficult task, the linear-attention model quickly plateaus, whereas the nonlinear-attention model exhibits inverse-depth loss scaling. Unlike the linear-attention model, which cannot selectively focus on relevant tokens, the nonlinear-attention model can attend to them directly, allowing strong and weak spectral directions to be learned in parallel and enabling better utilization of depth. Further analysis decomposes the loss into cross-layer and within-layer terms and connects this decomposition to the central limit theorem. The asymptotic behavior of these terms explains the origins of the loss plateau and the reducible loss.

Diagram comparing linear and nonlinear attention across easy and difficult tasks

Figure 1. The nonlinear-attention model can yield inverse-depth scaling across all tested data spectra. This overview compares depth-dependent performance across models and tasks. Colors distinguish data spectra, and all panels are plotted on a log-log scale.

Finally, we relax several simplifying assumptions of the controlled setup to move closer to standard Transformers and observe similar signs of inverse-depth scaling. These results suggest that nonlinearity in attention can be a plausible source of depth scaling in real models and may make scaling less dependent on the global covariance structure of the data.

Our contributions are the following:

  • We discover that nonlinearity in attention can qualitatively affect depth scaling, enabling emergent inverse-depth loss scaling across all tested spectra.

  • We explain how nonlinear attention enables parallel learning of strong and weak spectral directions, in contrast to the sequential learning behavior of linear-attention models.

  • We connect inverse-depth scaling to the central limit theorem through a loss decomposition that identifies the origins of the loss plateau and the gains from depth.

Problem Setup

Task Setup

In-context learning is a common setting in which predictions rely on interactions among context tokens. These interactions expose the structure of the data, providing a useful setting for studying the origins of depth scaling. We consider a controlled ICL problem in which each context contains PP inputs xi∈Rd\mathbf{x}_i \in\mathbb{R}^d with labels generated by a teacher vector β∈Rd\boldsymbol{\beta} \in\mathbb{R}^d:

yi=βTxi,i=1,…,P.(1)y_i = \boldsymbol{\beta}^{\mathsf{T}}\mathbf{x}_i, \qquad i=1,\ldots,P. \tag*{(1)}

Let λk\lambda_k and ωk\omega_k denote the eigenvalues of the input and teacher covariances, respectively. To control input and task structure independently, we vary these spectra as

λk∝k−a,ωk∝k−b,k=1,…,d.(2)\lambda_k \propto k^{-a}, \qquad\omega_k \propto k^{-b}, \qquad k=1,\ldots,d. \tag*{(2)}

Here, a,b≥0a,b \ge0 are the input-spectrum and teacher-spectrum exponents, respectively. They independently control how rapidly the corresponding variances decay across feature directions. Setting either exponent to zero gives an isotropic covariance for the corresponding distribution.

In natural language, different contexts may share similar features but express them along different directions. Following Bordelon et al. [4], we model this variation by independently sampling an orthogonal rotation matrix O∈Rd×dO \in\mathbb{R}^{d \times d} for each context. Conditioned on OO, the input and teacher covariances are

Σ=Cov⁡(xi∣O)=Odiag⁡(λ1,…,λd)OT,Ω=Cov⁡(β∣O)=Odiag⁡(ω1,…,ωd)OT.(3)\begin{aligned} \Sigma&= \operatorname{Cov}(\mathbf{x}_i \mid O) = O\operatorname{diag}(\lambda_1,\ldots,\lambda_d)O^{\mathsf{T}},\\ \Omega&= \operatorname{Cov}(\boldsymbol{\beta} \mid O) = O\operatorname{diag}(\omega_1,\ldots,\omega_d)O^{\mathsf{T}}. \tag*{(3)} \end{aligned}

Conditioned on OO, we sample the teacher vector independently of the context and test inputs, which are drawn i.i.d.:

β∼N(0,Ω),(4)\boldsymbol{\beta} \sim\mathcal{N}(0,\Omega), \tag*{(4)}
x1,…,xP,xtest∼i.i.d.N(0,Σ).\mathbf{x}_1,\ldots,\mathbf{x}_P,\mathbf{x}_{\mathrm{test}} \mathrel{\overset{\mathrm{i.i.d.}}{\sim}} \mathcal{N}(0,\Sigma).

The model must therefore infer the relevant directions from each context rather than rely on fixed directions across contexts.

We first construct an easy task using a widely studied ICL setting ([12, 34, 1, 4]). Given context inputs and their teacher-generated labels, the model must predict the label assigned to a test input by the same teacher. Following Bordelon et al. [4], we consider the infinite-context limit P→∞P \to\infty, in which a context token can be found arbitrarily close to the test token. The task can therefore be approximated by retrieving the closest context token and copying its label. This retrieval-and-copying operation corresponds to the second half of an induction-head circuit identified in language models ([11, 28, 26]). The task can thus be viewed, in an idealized sense, as an exact-match problem:

xtest=xj,ytest∗=yj,j∈{1,…,P},P→∞.(5)\mathbf{x}_{\mathrm{test}} = \mathbf{x}_j,\qquad y_{\mathrm{test}}^{*} = y_j,\qquad j \in\{1,\ldots,P\},\quad P \to\infty. \tag*{(5)}

However, in practical ICL and language settings, prediction often requires combining information from multiple context tokens rather than retrieving a single one. Motivated by this need, we construct a difficult task that extends this induction-head-inspired operation from top-1 retrieval to top-kk aggregation. We measure relevance by cosine similarity and average the selected labels. The selected index set and target are defined by

Sk(xtest)=TopK⁡i∈{1,…,P}xiTxtest∥xi∥∥xtest∥,ytest∗=1k∑i∈Sk(xtest)yi.(6)S_k(x_{\mathrm{test}})=\operatorname{TopK}_{i\in\{1,\ldots,P\}}\frac{x_i^\mathsf{T}x_{\mathrm{test}}}{\lVert x_i\rVert\lVert x_{\mathrm{test}}\rVert}, \qquad y_{\mathrm{test}}^*=\frac{1}{k}\sum_{i\in S_k(x_{\mathrm{test}})}y_i. \tag*{(6)}

Here, TopK returns the indices of the kk largest scores. Figure 2 summarizes these induction-head-inspired top-1 copying and top-kk aggregation tasks.

Easy and difficult task diagrams

Figure 2. Both tasks model the second half of an induction head: the easy task copies the most relevant token’s label, while the difficult task averages the labels of the top-kk relevant tokens.

Model Setup

Large language models combine positional encodings, multiple attention heads, MLP blocks, normalization, and task-specific readouts. While important in practice, these components make it difficult to isolate the mechanisms underlying depth scaling. Building on Bordelon et al. [4], we therefore use a simplified architecture that retains the components needed for context-dependent retrieval and label propagation, allowing a controlled comparison between linear and nonlinear attention.

Embeddings. Each context provides PP input–label pairs (xi,yi)(x_i,y_i), where the teacher vector β\beta generates yiy_i from xix_i according to equation (1). The model has access to all context input–label pairs and the test input, but cannot access the test label. The corresponding entry at the test position is initialized to zero. We collect the token inputs and the observed labels into

X=[x1,…,xP,xtest]∈Rd×(P+1),yin=(y1,…,yP,0)∈R1×(P+1).(7)X=[x_1,\ldots,x_P,x_{\mathrm{test}}]\in\mathbb{R}^{d\times(P+1)}, \qquad y^{\mathrm{in}}=(y_1,\ldots,y_P,0)\in\mathbb{R}^{1\times(P+1)}. \tag*{(7)}

Let N≥dN\ge d denote the hidden dimension, avoiding a representational bottleneck. Each token state lies in RN\mathbb{R}^N. With encoder matrices Wx∈RN×dW_x\in\mathbb{R}^{N\times d} and Wy∈RN×1W_y\in\mathbb{R}^{N\times1}, we encode input and label information into separate streams:

Hx=WxX∈RN×(P+1),Hy0=Wyyin∈RN×(P+1).(8)H_x=W_xX\in\mathbb{R}^{N\times(P+1)}, \qquad H_y^0=W_y y^{\mathrm{in}}\in\mathbb{R}^{N\times(P+1)}. \tag*{(8)}

This encoding separates the input features used for token matching from the labels to be propagated. The input features determine which context tokens are relevant to the query, and attention passes their label information to the test token.

The model has LL residual layers, indexed by ℓ∈{1,…,L}\ell\in\{1,\ldots,L\}. At each layer, attention uses the input features to determine how label information is propagated. For simplicity, we first keep HxH_x fixed across layers, while HyℓH_y^\ell is updated as label information is passed among tokens. We use layer-specific query and key matrices Wqℓ,Wkℓ∈RN×NW_q^\ell,W_k^\ell\in\mathbb{R}^{N\times N} and a shared value matrix Wv∈RN×NW_v\in\mathbb{R}^{N\times N}. Thus, each layer can select relevant tokens differently while using a common transformation to propagate label information.

Nonlinear attention. We first define the model with nonlinear attention. We apply pre-norm to the input-stream hidden state for better training stability and alignment with practical models, and denote the normalized state by H^x\widehat{H}_x. At layer ℓ\ell, the query, key, and value representations are

Qℓ=WqℓH^x,Kℓ=WkℓH^x,Vℓ=WvHyℓ−1,Qℓ,Kℓ,Vℓ∈RN×(P+1).(9)Q^\ell= W_q^\ell\widehat{H}_x,\qquad K^\ell= W_k^\ell\widehat{H}_x,\qquad V^\ell= W_v H_y^{\ell-1},\qquad Q^\ell, K^\ell, V^\ell\in\mathbb{R}^{N \times(P+1)}. \tag*{(9)}

Let M denote the attention-mask matrix. The attention matrix and residual update are

Aℓ=M⊙softmax⁡((Qℓ)⊤Kℓ)∈R(P+1)×(P+1),A^\ell= \mathrm{M} \odot\operatorname{softmax}\left((Q^\ell)^\top K^\ell\right) \in\mathbb{R}^{(P+1)\times(P+1)},
Hyℓ=Hyℓ−1+1LVℓ(Aℓ)⊤∈RN×(P+1).(10)H_y^\ell= H_y^{\ell-1} + \frac{1}{L}V^\ell(A^\ell)^\top\in\mathbb{R}^{N\times(P+1)}. \tag*{(10)}

Linear attention. The linear-attention model removes nonlinearities and retains the raw bilinear attention scores. Its attention matrix and residual update are

Aℓ=1PNM⊙((Qℓ)⊤Kℓ)∈R(P+1)×(P+1),A^\ell= \frac{1}{PN}\mathrm{M} \odot\left((Q^\ell)^\top K^\ell\right) \in\mathbb{R}^{(P+1)\times(P+1)},
Hyℓ=Hyℓ−1+1LVℓ(Aℓ)⊤∈RN×(P+1).(11)H_y^\ell= H_y^{\ell-1} + \frac{1}{L}V^\ell(A^\ell)^\top\in\mathbb{R}^{N\times(P+1)}. \tag*{(11)}

Attention masks. As in large language models, we use attention masks to control information flow between tokens. For the linear-attention model, we adopt the masking scheme of Bordelon et al. [4], allowing successive layers to extract and propagate information at different levels of granularity. For the nonlinear-attention model, we initially disable context updates to focus on how different layers retrieve information from a fixed context. In both models, the test token can attend to all context tokens to access their label information. Note that in the nonlinear-attention model, softmax is computed only over tokens that can be attended to, so disabled positions do not affect the distribution. Further details on the masks and context updates are given in Appendix § 10.§ 3.

Output and loss. We obtain the prediction by applying a linear readout Wo∈R1×NW_o \in\mathbb{R}^{1\times N} to the final test-token state hy,testLh_{y,\mathrm{test}}^L. The model is trained to minimize the mean squared error over independently sampled contexts:

y^L=Wohy,testL,RL=Econtext[(y^L−y∗)2].(12)\widehat{y}_L = W_o h_{y,\mathrm{test}}^L,\qquad\mathcal{R}_L = \mathbb{E}_{\mathrm{context}}\left[(\widehat{y}_L-y^*)^2\right]. \tag*{(12)}

Throughout, RL\mathcal{R}_L denotes the evaluation mean squared error of a depth-LL model; we write RL(a,b)\mathcal{R}_L(a,b) when making its dependence on the data-spectrum exponents explicit.

All models are trained until the loss has converged. In Appendix § 10, we relax several simplifying assumptions to better reflect the architectures of standard Transformers and large language models, and extend our experiments and analyses to these settings.

Easy Task Analysis

Linear-Attention Model

Figure 3(a,b) shows that the linear-attention model’s loss on the easy task decreases with depth according to a power law across all tested settings, with an exponent that depends on the data spectra.

Depth scaling and normalized mode-wise loss

Figure 3. On the easy task, the linear-attention model exhibits spectrum-dependent depth scaling and learns spectral modes sequentially. (a) Varying bb at fixed a=2a=2. (b) Varying aa at fixed b=2b=2. Dashed curves show power-law fits, with the corresponding exponents indicated. (c) Normalized loss of representative spectral modes. Values below 2% are displayed at the threshold marked by the dashed line.

Heuristically, we can interpret the depth-LL linear-attention model’s output as a polynomial in the data covariance:

y^L=β⊤pL(Σ)xtest,pL(Σ)=∑r=1LarΣr.(13)\hat{y}_L = \beta^{\top}p_L(\Sigma)x_{\mathrm{test}}, \qquad p_L(\Sigma) = \sum_{r=1}^{L} a_r\Sigma^r. \tag*{(13)}

The target is

y∗=β⊤xtest.(14)y^* = \beta^{\top}x_{\mathrm{test}}. \tag*{(14)}

Therefore, the model needs to approximate the identity map with pL(Σ)p_L(\Sigma); Appendix § 8.§ 1 derives this covariance-polynomial representation. Greater depth allows the model to use higher powers of the covariance, incorporating information at different levels of granularity to improve the approximation. The asymptotic behavior of this approximation gives rise to power-law depth scaling. Different data spectra change the covariance Σ\Sigma in the polynomial, leading to different convergence rates with depth. This produces spectrum-dependent depth scaling.

This mechanism also has a feature-learning interpretation. We decompose the power-law input covariance into individual spectral modes and normalize each mode’s loss, which allows us to compare how fully each mode has been learned. Small kk indexes stronger features with large eigenvalues, whereas large kk indexes weaker features with small eigenvalues. Figure 3(c) reveals a clear separation in their learning dynamics: stronger modes are learned almost perfectly within a few layers, while weaker modes require substantially greater depth. Appendix § 8.§ 4 further shows that individual modes can converge exponentially at different characteristic depths, with their superposition yielding spectrum-dependent power-law scaling.

Nonlinear-Attention Model

We next evaluate the nonlinear-attention model on the easy task. Figure 4(a,Figure 4b) shows that a single-layer nonlinear-attention model achieves zero loss on the easy task across all tested data spectra. Unlike the spectrum-dependent improvement of the linear-attention model, its performance does not improve further with depth.

Training loss and top-1 attention mass for the easy task

Figure 4. A single nonlinear-attention layer solves the easy task by focusing on the matching token. (a) Varying aa at fixed b=0b = 0. (b) Varying bb at fixed a=0a = 0. (c) Top-1 attention mass approaches one during training.

The key distinction is that nonlinear attention can selectively focus on the relevant token in each context, whereas linear attention cannot fully exclude contributions from irrelevant tokens. During training, the queries and keys attain large norms, amplifying differences between attention logits and placing softmax in an effectively low-temperature regime. Almost all attention is then assigned to the matching token, allowing its label to be copied in a single layer. Figure 4(c) supports this explanation: during training, attention shifts from a nearly uniform distribution toward the top-1 token, whose attention mass approaches one. The same qualitative behavior holds across the tested spectra.

Difficult Task Analysis

Linear-Attention Model

We next evaluate the linear-attention model on the difficult task. Here, we choose k=2k = 2 as a representative case of top-kk aggregation. Figure 5(a,Figure 5b) shows that the loss reaches a spectrum-dependent plateau within one or two layers. Unlike the continued improvement on the easy task, additional depth provides little further benefit.

Loss curves for fixed $a=0$ and fixed $b=0$

Figure 5. On the difficult task, linear attention rapidly reaches a spectrum-dependent loss plateau with little benefit from further depth. (a) Varying bb at fixed a=0a=0. (b) Varying aa at fixed b=0b=0.

Intuitively, the selected tokens vary across contexts, so their average fluctuates around a shared mean. The target therefore contains a predictable component and a context-specific deviation. Linear attention can capture the shared component, but lacks the context-specific token selection needed to fully recover the deviation. This leaves an irreducible loss that sets the plateau.

We analyze the reducible part using the covariance-polynomial formulation in § 3.1. The prediction retains the same form, while the predictable target has the leading-order form

y^L=β⊤pL(Σ)xtest,yˉ∗∝β⊤Σxtest,(15)\hat{y}_L = \beta^\top p_L(\Sigma)x_{\mathrm{test}}, \qquad\bar{y}^* \propto\beta^\top\Sigma x_{\mathrm{test}}, \tag*{(15)}

Unlike the identity map in the easy task, this leading target can already be represented by a degree-one polynomial. Additional depth therefore provides little further reduction in loss. Appendix § 8.§ 3 provides the geometric illustration, detailed derivation, and comparison between predicted and measured loss floors.

Nonlinear-Attention Model

We next evaluate the nonlinear-attention model on the same difficult task with k=2k = 2. Figure 6(a,Figure 6b) shows that additional depth continues to reduce the loss, in contrast to the rapid saturation of the linear-attention model.

Figure 6. On the difficult task, nonlinear attention yields inverse-depth decay across all tested data spectra. (a) Varying bb at fixed a=0a = 0. (b) Varying aa at fixed b=0b = 0. (c,d) CLC_L and AL−CLA_L - C_L converge to spectrum-dependent constants.

To quantify this depth dependence, we fit the evaluation loss to

RL(a,b)=L0(a,b)+c(a,b)L−α(a,b),(16)\mathcal{R}_{L}(a,b) = L_{0}(a,b) + c(a,b)L^{-\alpha(a,b)}, \tag*{(16)}

by minimizing squared residuals between the logarithms of the observed and modeled losses. The fitted exponents shown in Figure 6(a,b) are close to one across the tested data spectra, indicating emergent inverse-depth scaling in the deep regime.

With input and label information carried in separate streams and context states fixed across layers, our model admits an equivalent parallel representation: each layer forms a prediction from the same context, and the final output averages these predictions. Increasing depth therefore increases the number of predictors in the ensemble, suggesting an analogy with the central limit theorem, where averaging layer-specific fluctuations can yield a 1/L1/L decay in squared error. To distinguish the error reduced by ensembling from the error that remains, we derive the exact loss decomposition

RL(a,b)=CL(a,b)+AL(a,b)−CL(a,b)L.(17)\mathcal{R}_{L}(a,b) = C_{L}(a,b) + \frac{A_{L}(a,b) - C_{L}(a,b)}{L}. \tag*{(17)}

Here, CLC_{L} measures error shared across predictors, whereas AL−CLA_{L} - C_{L} measures pairwise differences between their errors. A detailed derivation is provided in Appendix § 9. Figure 6(c,d) tracks these two terms across different data spectra. As depth increases, both converge to spectrum-dependent constants:

CL(a,b)⟶C∞(a,b),AL(a,b)−CL(a,b)⟶Δ∞(a,b),L→∞.(18)C_{L}(a,b) \longrightarrow C_{\infty}(a,b), \qquad A_{L}(a,b) - C_{L}(a,b) \longrightarrow\Delta_{\infty}(a,b), \qquad L \to\infty. \tag*{(18)}

The loss plateau and the depth-dependent improvement have different origins. The error shared across predictors cannot be canceled by ensembling and sets the irreducible loss within this ensemble. For the top-2 task, this shared error reflects the mismatch between smooth softmax attention and the sharp target distribution (1/2,1/2,0,…,0)(1/2, 1/2, 0, \ldots, 0), which is difficult to match consistently across contexts.

In contrast, AL−CLA_{L} - C_{L} quantifies error variation across predictors. Ensembling allows these errors to partially cancel, reducing their contribution by a factor of 1/L1/L and enabling continued improvement with depth. Detailed derivations and attention-mass diagnostics are provided in Appendices § 9 and § 11.§ 2, respectively.

We again examine individual spectral modes and normalize their excess losses to compare relative learning progress. Figure 7(a) shows similar improvement rates across modes, and the normalized curves in panel (b) nearly collapse. In contrast to the linear-attention model’s sequential learning, nonlinear attention can focus directly on relevant tokens in each context and improve strong and weak features in parallel, even without context updates that expose progressively finer-grained information.

Mode-wise raw loss and normalized mode-wise reducible loss

Figure 7. With nonlinear attention, strong and weak spectral modes are learned in parallel. (a) Different modes are learned at similar rates. (b) Normalized mode-wise reducible losses nearly collapse onto a common curve, indicating parallel learning across modes.

Building on our analysis of the differences between linear and nonlinear attention, we further compare their irreducible losses on the difficult task. Table 1 shows that the nonlinear-attention model achieves a substantially lower loss floor, clearly outperforming the linear-attention model.

(a,b)(a,b)(0,0)(0,0)(0,0.25)(0,0.25)(0,0.5)(0,0.5)(0,1)(0,1)(0.25,0)(0.25,0)(0.5,0)(0.5,0)(1,0)(1,0)
Nonlinear L0L_02.0071.2680.8360.4241.2550.7980.341
Linear L0L_059.85323.0559.7662.50422.9629.5012.120

Table 1. Nonlinear-attention models achieve substantially lower irreducible loss than linear-attention models on the difficult task.

We extend our setup toward standard Transformers by encoding inputs and labels in a shared space, untying the value matrix, and updating context states across layers. We observe similar signs of inverse-depth scaling (Appendix § 10). These results suggest that this mechanism may also contribute to depth scaling in realistic models with nonlinear attention, where data structure need not be the dominant factor.

Related Work

Empirical neural scaling laws relate loss to model size and dataset size, supporting performance prediction and resource allocation [15, 17, 16]. Theoretical explanations have related them to data geometry and covariance spectra [32, 2]. More recent work identifies mechanisms arising from representation superposition and the dynamics of learning peaked distributions [21, 23, 18]. Despite these advances, much of the literature treats model size as an aggregate quantity rather than resolving the different contributions of width and depth.

As a key component of model-size scaling, depth has been studied through several complementary accounts of how networks utilize layers. Compositional learning builds complex representations by successively combining simpler features, making hierarchical structure more efficiently learnable [3, 19, 29, 5]. The dynamical-systems perspective treats residual layers as discrete steps of an ordinary differential equation (E, 2017; Haber & Ruthotto, 2018; Chen et al., 2018; Sander et al., 2022; Chizat, 2025). The ensemble-averaging perspective views depth as the aggregation of related predictors [33, 24, 22]. These perspectives explain how networks use depth but do not fully explain the origins of depth scaling. We examine how nonlinearity in attention shapes its underlying mechanisms and resulting scaling laws.

More directly, Bordelon et al. [4] build on the established ICL regression setting [12, 34] to derive spectrum-dependent depth scaling for deep linear-attention models. A line of theoretical work has largely focused on analytically tractable linear models [1, 35, 25], leaving the mechanisms through which nonlinear attention affect depth scaling unresolved. Liu et al. [22] report inverse-depth scaling in LLMs and connect it to ensemble averaging, without explaining why this ensemble-like behavior emerges. Liu & Gore [20] further argue that generic mechanisms may determine scaling exponents, while data and architecture affect the coefficients. Our work complements these studies by explaining how nonlinear attention enables ensemble-like behavior across layers and gives rise to inverse-depth scaling.

Discussion

Our results identify nonlinearity in attention as a source of depth scaling beyond power-law data spectra. Nonlinear attention can focus directly on relevant tokens in each context, allowing strong and weak spectral directions to be learned in parallel. Linear attention lacks this selective ability, tying its learning dynamics to global spectral strength. Similar focusing across layers supports an ensemble interpretation: aggregation reduces layer-specific errors while leaving a shared loss floor, connecting inverse-depth improvement to the central limit theorem. These findings suggest that practical depth scaling can originate from attention nonlinearity rather than data structure alone.

Our study has many limitations. Our simplified architecture omits components of full LLMs, so the identified mechanism is not guaranteed to operate in those models. Although architectural extensions show similar scaling signals, a clear theoretical account of their mechanisms is still lacking. Our experiments are restricted to ICL tasks, leaving generalization to real-world datasets and broader task classes untested. The identified mechanism need not be universal or dominant, and other processes may produce different scaling or interact with it. Our analysis also does not address how depth scaling couples to model width and dataset size.

Aggregation also raises a question about how efficiently depth is used. If a few layers perform the essential computation while others mainly average residual errors, separate parameters at every layer may be wasteful. Looped Transformers reuse parameters across depth (Dehghani et al., [9]; Geiping et al., [13]) and may retain aggregation benefits with fewer parameters. Testing this possibility could guide more parameter-efficient use of depth in future language models.

AI Use Statement

We used generative AI tools to support brainstorming, articulate candidate mathematical claims, generate code under explicit human instructions, and assist with language editing. We did not use generative AI to generate synthetic datasets, conduct data analysis, or write mathematical proofs. All AI-assisted ideas and writing were critically reviewed by the authors, and all AI-generated code was independently inspected and verified. The authors performed the data analysis and mathematical proofs and take full responsibility for the final content of this work.

Linear-Attention Model Theory

Covariance Polynomials in the Linear-Attention Model

We first derive the theory of the linear-attention model on the easy task. In general, its output is an ordered matrix polynomial of degree at most LL in the data covariance. The isotropic setting analyzed by Bordelon et al. [4] then follows as a special case of our theory.

Let UU collect the context inputs, qq denote the query, and SS be the empirical input covariance:

U=[x1,…,xP]∈Rd×P,q=xtest∈Rd,U = [x_1,\ldots,x_P] \in\mathbb{R}^{d \times P}, \qquad q = x_{\mathrm{test}} \in\mathbb{R}^{d},
y=UTβ,S=1PUUT.(19)y = U^{\mathsf{T}}\beta, \qquad S = \frac{1}{P}UU^{\mathsf{T}}. \tag*{(19)}

The input and teacher covariances are

Σ=Odiag⁡(λ1,…,λd)OT,\Sigma= O\operatorname{diag}(\lambda_1,\ldots,\lambda_d)O^{\mathsf{T}},
Ω=Odiag⁡(ω1,…,ωd)OT,\Omega= O\operatorname{diag}(\omega_1,\ldots,\omega_d)O^{\mathsf{T}},

where the random orthogonal rotation OO is fixed within a context and sampled independently across contexts. Contexts therefore share the same spectra but express their features in different directions. Within each context, conditioning on OO, the context inputs and test token are sampled identically and independently, while the teacher vector is sampled independently from its corresponding distribution:

x1,…,xP,xtest∼i.i.d.N(0,Σ),β∼N(0,Ω).x_1,\ldots,x_P,x_{\mathrm{test}} \mathrel{\overset{\mathrm{i.i.d.}}{\sim}} \mathcal{N}(0,\Sigma), \qquad\beta\sim\mathcal{N}(0,\Omega).

Define the effective query–key matrix

Bℓ=1NWxT(Wkℓ)TWqℓWx,ℓ=1,…,L,(20)B_\ell= \frac{1}{N}W_x^{\mathsf{T}}(W_k^\ell)^{\mathsf{T}}W_q^\ell W_x,\qquad\ell=1,\ldots,L, \tag*{(20)}

where NN is the hidden-state dimension. Before masking, token ii assigns context token jj the weight

(WqℓWxxi)T(WkℓWxxj)NP=xjTBℓxiP.\frac{(W_q^\ell W_xx_i)^{\mathsf{T}}(W_k^\ell W_xx_j)}{NP} = \frac{x_j^{\mathsf{T}}B_\ell x_i}{P}.

Separate the context and test label states as

Hyℓ=[Zℓ,hℓ],Zℓ∈RN×P,hℓ∈RN.H_y^\ell= [Z_\ell,h_\ell],\qquad Z_\ell\in\mathbb{R}^{N \times P},\qquad h_\ell\in\mathbb{R}^{N}.

The linear-attention mask defined in § 2.2 gives

Z0=WyβTU,h0=0,Z_0 = W_y\beta^{\mathsf{T}}U,\qquad h_0 = 0,
Zℓ=Zℓ−1−1LPWvZℓ−1UTBℓU,Z_\ell= Z_{\ell-1} - \frac{1}{LP}W_vZ_{\ell-1}U^{\mathsf{T}}B_\ell U,
hℓ=hℓ−1+1LPWvZℓ−1UTBℓq.(21)h_\ell= h_{\ell-1} + \frac{1}{LP}W_vZ_{\ell-1}U^{\mathsf{T}}B_\ell q. \tag*{(21)}

Write Zℓ=FℓUZ_\ell= F_\ell U, where FℓF_\ell maps inputs to context label states. Substituting UUT/P=SUU^{\mathsf{T}}/P=S yields

F0=WyβT,Fℓ∈RN×d,F_0 = W_y\beta^{\mathsf{T}},\qquad F_\ell\in\mathbb{R}^{N \times d},
Fℓ=Fℓ−1−1LWvFℓ−1SBℓ,F_\ell= F_{\ell-1} - \frac{1}{L}W_vF_{\ell-1}SB_\ell,
hℓ−hℓ−1=(Fℓ−1−Fℓ)q.(22)h_\ell-h_{\ell-1}=(F_{\ell-1}-F_\ell)q. \tag*{(22)}

Therefore, the output is

y^L=Wo∑ℓ=1L(Fℓ−1−Fℓ)q=Wo(F0−FL)q.(23)\widehat{y}_L = W_o\sum_{\ell=1}^{L}(F_{\ell-1}-F_\ell)q = W_o(F_0-F_L)q. \tag*{(23)}

The first two steps show how the polynomial is built:

F1=WyβT−1LWvWyβTSB1,F_1 = W_y\beta^{\mathsf{T}}-\frac{1}{L}W_vW_y\beta^{\mathsf{T}}SB_1,
F2=WyβT−1LWvWyβT(SB1+SB2)+1L2Wv2WyβTSB1SB2.F_2 = W_y\beta^{\mathsf{T}}-\frac{1}{L}W_vW_y\beta^{\mathsf{T}}(SB_1+SB_2) +\frac{1}{L^2}W_v^2W_y\beta^{\mathsf{T}}SB_1SB_2.

With readout coefficients

mr=WoWvrWy,r=1,…,L,m_r = W_o W_v^r W_y,\qquad r=1,\ldots,L,

substitution into the output gives

PL(S)=∑r=1L(−1)r−1mrLr∑1≤ℓ1<⋯<ℓr≤LSBℓ1⋯SBℓr.(24)\mathcal{P}_L(S)=\sum_{r=1}^{L}\frac{(-1)^{r-1}m_r}{L^r}\sum_{1\leq\ell_1<\cdots<\ell_r\leq L}SB_{\ell_1}\cdots SB_{\ell_r}. \tag*{(24)}

The prediction and easy-task target are

y^L=βTPL(S)q,y∗=βTq.(25)\widehat{y}_L=\beta^{\mathsf{T}}\mathcal{P}_L(S)q,\qquad y^*=\beta^{\mathsf{T}}q. \tag*{(25)}

Thus learning the easy task amounts to approximating the identity on the relevant input directions. Define

DL(S)=Id−PL(S).D_L(S)=I_d-\mathcal{P}_L(S).

Averaging over the teacher at fixed inputs gives

Eβ[(y^L−y∗)2∣U,q,O]=Eβ[(βTDL(S)q)2∣U,q,O]=qTDL(S)TE[ββT∣U,q,O]DL(S)q=qTDL(S)TΩDL(S)q.\begin{aligned} \mathbb{E}_{\beta}[(\widehat{y}_L-y^*)^2\mid U,q,O] &=\mathbb{E}_{\beta}[(\beta^{\mathsf{T}}D_L(S)q)^2\mid U,q,O]\\ &=q^{\mathsf{T}}D_L(S)^{\mathsf{T}}\mathbb{E}[\beta\beta^{\mathsf{T}}\mid U,q,O]D_L(S)q\\ &=q^{\mathsf{T}}D_L(S)^{\mathsf{T}}\Omega D_L(S)q. \end{aligned}

The evaluation loss RL\mathcal{R}_L defined in equation (12) is therefore

RL=E[(y^L−y∗)2]=EU,q,O[qTDL(S)TΩDL(S)q].(26)\mathcal{R}_L=\mathbb{E}[(\widehat{y}_L-y^*)^2] =\mathbb{E}_{U,q,O}[q^{\mathsf{T}}D_L(S)^{\mathsf{T}}\Omega D_L(S)q]. \tag*{(26)}

Constrained and Free Polynomial Depth Scaling

Repeated updates. Following the repeated-update construction of Bordelon et al. [4], we impose isotropic matching and align the shared value map with the label embedding:

Bℓ=κId(ℓ=1,…,L),WvWy=vWy.(27)B_\ell=\kappa I_d\quad(\ell=1,\ldots,L),\qquad W_vW_y=vW_y. \tag*{(27)}

Each degree-rr product in equation (24) then equals κrSr\kappa^rS^r, and there are (Lr)\binom{L}{r} choices of rr layers. Hence

PL(S)=∑r=1L(−1)r−1mrLr(Lr)κrSr=pL(S),(28)\mathcal{P}_L(S)=\sum_{r=1}^{L}\frac{(-1)^{r-1}m_r}{L^r}\binom{L}{r}\kappa^rS^r=p_L(S), \tag*{(28)}
pL(λ)=∑r=1Larλr,ar=(−1)r−1(Lr)(κ/L)rmr.p_L(\lambda)=\sum_{r=1}^{L}a_r\lambda^r,\qquad a_r=(-1)^{r-1}\binom{L}{r}(\kappa/L)^rm_r.

In the infinite-context limit P→∞P\to\infty, we use S≈ΣS\approx\Sigma. Thus

Id−pL(Σ)=Odiag⁡(1−pL(λ1),…,1−pL(λd))OT.I_d-p_L(\Sigma)=O\operatorname{diag}(1-p_L(\lambda_1),\ldots,1-p_L(\lambda_d))O^{\mathsf{T}}.

Using E[qqT∣O]=Σ\mathbb{E}[qq^{\mathsf{T}}\mid O]=\Sigma in equation (26) gives the population-covariance approximation RLpop\mathcal{R}^{\mathrm{pop}}_L to RL\mathcal{R}_L:

RLpop=EOtr⁡[DL(Σ)TΩDL(Σ)Σ]=EOtr⁡[Odiag⁡(λkωk[1−pL(λk)]2)k=1dOT]=∑k=1dλkωk[1−pL(λk)]2.(29)\begin{aligned} \mathcal{R}^{\mathrm{pop}}_L &=\mathbb{E}_O\operatorname{tr}[D_L(\Sigma)^{\mathsf{T}}\Omega D_L(\Sigma)\Sigma]\\ &=\mathbb{E}_O\operatorname{tr}\left[O\operatorname{diag}\left(\lambda_k\omega_k[1-p_L(\lambda_k)]^2\right)_{k=1}^{d}O^{\mathsf{T}}\right]\\ &=\sum_{k=1}^{d}\lambda_k\omega_k[1-p_L(\lambda_k)]^2. \tag*{(29)} \end{aligned}

Define rL(λ)=1−pL(λ)r_L(\lambda)=1-p_L(\lambda). Since pL(0)=0p_L(0)=0, we have rL(0)=1r_L(0)=1, and therefore

deg⁡rL≤L,rL(0)=1,RLpop=∑k=1dλkωkrL(λk)2.(30)\deg r_L\leq L,\qquad r_L(0)=1,\qquad\mathcal{R}^{\mathrm{pop}}_L=\sum_{k=1}^{d}\lambda_k\omega_kr_L(\lambda_k)^2. \tag*{(30)}

For a specific data spectrum, write

λk=cλk−a,ωk=cωk−b,\lambda_k = c_\lambda k^{-a}, \qquad\omega_k = c_\omega k^{-b},
a≥0,b≥0,ζ=a+b−1a(a>0).a \ge0,\qquad b \ge0,\qquad\zeta= \frac{a+b-1}{a}\qquad(a>0).

where cλ,cω>0c_\lambda,c_\omega>0 and λ1=cλ\lambda_1=c_\lambda. For a>0a>0, the change of variables from feature index to eigenvalue is

k=(cλλ)1/a,∣dkdλ∣=cλ1/aaλ−1−1/a.k = \left(\frac{c_\lambda}{\lambda}\right)^{1/a},\qquad\left|\frac{dk}{d\lambda}\right| = \frac{c_\lambda^{1/a}}{a}\lambda^{-1-1/a}.

Substituting into equation 30 and replacing the sum by its continuum integral gives

RLpop=cλcω∑k=1dk−(a+b)rL(cλk−a)2≈cλcω∫1dk−(a+b)rL(cλk−a)2 dk=cωcλ1−ζa∫λdλ1λζ−1rL(λ)2 dλ.(31)\begin{aligned} \mathcal{R}^{\mathrm{pop}}_L = c_\lambda c_\omega\sum_{k=1}^{d} k^{-(a+b)}r_L(c_\lambda k^{-a})^2 \\ &\approx c_\lambda c_\omega\int_1^d k^{-(a+b)}r_L(c_\lambda k^{-a})^2\,dk \\ &= \frac{c_\omega c_\lambda^{1-\zeta}}{a}\int_{\lambda_d}^{\lambda_1}\lambda^{\zeta-1}r_L(\lambda)^2\,d\lambda. \tag*{(31)} \end{aligned}

For a+b>1a+b>1, we have ζ>0\zeta>0, which makes the continuum weight integrable at zero. When dd is sufficiently large, λd\lambda_d is close to zero and the finite-dimensional cutoff does not yet affect the loss. We may then approximate the dense spectrum by a measure on [0,λ1][0,\lambda_1]. This gives

RLpop∝∫0λ1λζ−1rL(λ)2 dλ.(32)\mathcal{R}^{\mathrm{pop}}_L \propto\int_0^{\lambda_1}\lambda^{\zeta-1}r_L(\lambda)^2\,d\lambda. \tag*{(32)}

Because WvW_v is shared across layers,

mr=WoWvTWy∝vr,γ=κv.m_r = W_oW_v^{\mathsf{T}}W_y \propto v^r,\qquad\gamma=\kappa v.

Optimizing WoWyW_oW_y to 1 allows the repeated-update construction to solve the easy task in the large-depth limit. Substituting into equation 28 gives

pL(λ)=∑r=1L(−1)r−1(Lr)(γλ/L)r=1−(1−γλ/L)L,p_L(\lambda)=\sum_{r=1}^{L}(-1)^{r-1}\binom{L}{r}(\gamma\lambda/L)^r=1-(1-\gamma\lambda/L)^L,
rL(λ)=(1−γλ/L)L.(33)r_L(\lambda)=(1-\gamma\lambda/L)^L. \tag*{(33)}

For the residual to vanish as L→∞L\to\infty, the scalar updates must contract rather than amplify positive-eigenvalue directions. At the largest eigenvalue this requires

∣1−γλ1/L∣<1⟺0<γ<2Lλ1.|1-\gamma\lambda_1/L|<1\quad\Longleftrightarrow\quad0<\gamma<\frac{2L}{\lambda_1}.

Using the optimal-scale estimate of Bordelon et al. [4],

γ∗≈Lλ1,γ∗L≈1λ1,\gamma^*\approx\frac{L}{\lambda_1},\qquad\frac{\gamma^*}{L}\approx\frac{1}{\lambda_1},

the continuum loss becomes, with u=2Lλ/λ1u=2L\lambda/\lambda_1,

RLcon≈cωcλ1−ζa∫0λ1λζ−1(1−λ/λ1)2L dλ∼cωcλ1−ζa(λ12L)ζ∫0∞uζ−1e−u du(34)\begin{aligned} \mathcal{R}^{\mathrm{con}}_L\approx\frac{c_\omega c_\lambda^{1-\zeta}}{a}\int_0^{\lambda_1}\lambda^{\zeta-1}(1-\lambda/\lambda_1)^{2L}\,d\lambda\\ &\sim\frac{c_\omega c_\lambda^{1-\zeta}}{a}\left(\frac{\lambda_1}{2L}\right)^\zeta\int_0^\infty u^{\zeta-1}e^{-u}\,du \tag*{(34)} \end{aligned}
∝L−ζ.\propto L^{-\zeta}.

Here, RLcon\mathcal{R}^{\mathrm{con}}_L denotes the loss of the repeated-update reference within the population approximation. This exponent is consistent with the result of Bordelon et al. [4].

Free polynomials. We then derive the depth-scaling exponent when the polynomial coefficients are free by removing the repeated-update conditions in equation (27). We assume only that the depth-LL predictor is an arbitrary polynomial in Σ\Sigma of degree at most LL. Substitution into equation (26) gives the freely optimized population-polynomial reference RLfree\mathcal{R}^{\mathrm{free}}_L:

PL(Σ)=pL(Σ),deg⁡pL≤L,pL(0)=0,S≈Σ,RLpop=∑k=1dλkωk[1−pL(λk)]2,RLfree∝min⁡deg⁡r≤Lr(0)=1∫0λ1λζ−1r(λ)2 dλ,r=1−pL.(35)\begin{aligned} \mathcal{P}_L(\Sigma) &= p_L(\Sigma), \qquad\deg p_L \le L,\qquad p_L(0)=0,\qquad S\approx\Sigma,\\ \mathcal{R}^{\mathrm{pop}}_L &= \sum_{k=1}^{d}\lambda_k\omega_k[1-p_L(\lambda_k)]^2,\\ \mathcal{R}^{\mathrm{free}}_L &\propto\min_{\substack{\deg r\le L\\r(0)=1}}\int_0^{\lambda_1}\lambda^{\zeta-1}r(\lambda)^2\,d\lambda,\qquad r=1-p_L. \tag*{(35)} \end{aligned}

Let ϕn\phi_n be a degree-nn polynomial orthonormal under this weight:

∫0λ1λζ−1ϕn(λ)ϕm(λ) dλ=δnm,\int_0^{\lambda_1}\lambda^{\zeta-1}\phi_n(\lambda)\phi_m(\lambda)\,d\lambda=\delta_{nm},

where δnm\delta_{nm} equals one for n=mn=m and zero otherwise. Expanding the residual and using r(0)=1r(0)=1 gives

r(λ)=∑n=0Ldnϕn(λ),∑n=0Ldnϕn(0)=1,∫0λ1λζ−1r(λ)2 dλ=∑n=0Ldn2.\begin{aligned} r(\lambda)&=\sum_{n=0}^{L}d_n\phi_n(\lambda),\qquad\sum_{n=0}^{L}d_n\phi_n(0)=1,\\ \int_0^{\lambda_1}\lambda^{\zeta-1}r(\lambda)^2\,d\lambda&=\sum_{n=0}^{L}d_n^2. \end{aligned}

Cauchy–Schwarz now gives the minimum directly:

1=(∑n=0Ldnϕn(0))2≤(∑n=0Ldn2)(∑n=0Lϕn(0)2).(36)\begin{aligned} 1&=\left(\sum_{n=0}^{L}d_n\phi_n(0)\right)^2\\ &\le\left(\sum_{n=0}^{L}d_n^2\right)\left(\sum_{n=0}^{L}\phi_n(0)^2\right). \tag*{(36)} \end{aligned}

Equality is attained by coefficients proportional to the endpoint values:

dn∗=ϕn(0)∑m=0Lϕm(0)2,RLfree∝[∑n=0Lϕn(0)2]−1.(37)d_n^*=\frac{\phi_n(0)}{\sum_{m=0}^{L}\phi_m(0)^2},\qquad\mathcal{R}^{\mathrm{free}}_L\propto\left[\sum_{n=0}^{L}\phi_n(0)^2\right]^{-1}. \tag*{(37)}

For this weight, the basis consists of shifted Jacobi polynomials:

ϕn(λ)=2n+ζλ1ζ Pn(ζ−1,0)(1−2λ/λ1),(38)\phi_n(\lambda)=\sqrt{\frac{2n+\zeta}{\lambda_1^\zeta}}\,P_n^{(\zeta-1,0)}(1-2\lambda/\lambda_1), \tag*{(38)}

where Pn(ζ−1,0)P_n^{(\zeta-1,0)} is the degree-nn Jacobi polynomial. Using its value at 1 gives

ϕn(0)2=2n+ζλ1ζ[Γ(n+ζ)Γ(ζ)Γ(n+1)]2∼2λ1ζΓ(ζ)2n2ζ−1.\phi_n(0)^2=\frac{2n+\zeta}{\lambda_1^\zeta}\left[\frac{\Gamma(n+\zeta)}{\Gamma(\zeta)\Gamma(n+1)}\right]^2 \sim\frac{2}{\lambda_1^\zeta\Gamma(\zeta)^2}n^{2\zeta-1}.

Consequently,

∑n=0Lϕn(0)2∼2λ1ζΓ(ζ)2∫0Ln2ζ−1 dn=L2ζζλ1ζΓ(ζ)2.(39)\begin{aligned} \sum_{n=0}^{L}\phi_n(0)^2&\sim\frac{2}{\lambda_1^\zeta\Gamma(\zeta)^2}\int_0^{L}n^{2\zeta-1}\,dn\\ &=\frac{L^{2\zeta}}{\zeta\lambda_1^\zeta\Gamma(\zeta)^2}. \tag*{(39)} \end{aligned}

The two polynomial families therefore give

RLcon∝L−ζ,RLfree∝L−2ζ,ζ=a+b−1a.(40)R_L^{\mathrm{con}} \propto L^{-\zeta}, \qquad R_L^{\mathrm{free}} \propto L^{-2\zeta}, \qquad\zeta= \frac{a+b-1}{a}. \tag*{(40)}

Table 2 compares these reference exponents with the measured values.

(a,b)(a,b)Constrained ζ\zetaMeasured α\alphaFree 2ζ2\zeta
(2,0.5)(2,0.5)0.7501.1211.500
(2,1)(2,1)1.0001.4852.000
(2,1.5)(2,1.5)1.2501.6842.500
(2,2)(2,2)1.5001.9873.000
(0.5,2)(0.5,2)3.0003.3106.000
(1,2)(1,2)2.0002.5524.000
(1.5,2)(1.5,2)1.6672.1633.333

Table 2. Measured depth-scaling exponents of the linear-attention model on the easy task lie between two reference values.

The actual model is less constrained than the repeated-update construction of Bordelon et al. [4], which relies on the two conditions in equation (27), but it is not as unconstrained as the idealized free polynomial, whose coefficients are optimized independently. It is therefore reasonable for the measured exponents to lie between these two reference values.

Note that this theoretical analysis has several requirements, including the population-covariance approximation S≈ΣS \approx\Sigma, corresponding to P→∞P \to\infty; a dense spectrum with ζ>0\zeta> 0; and a sufficiently large spectral range λ1/λd\lambda_1/\lambda_d. At the evaluated depths, repeated updates require 1≪L≪λ1/λd1 \ll L \ll\lambda_1/\lambda_d, whereas free polynomials require 1≪L≪λ1/λd1 \ll L \ll\sqrt{\lambda_1/\lambda_d}.

Predicting the Linear-Model Loss Floor

In this subsection, we characterize the predictable component of the difficult-task target and the resulting irreducible loss floor for the linear-attention model. We further validate these theoretical predictions using Monte Carlo estimates.

For a test token qq sampled independently of the context inputs, the difficult-task target is

Sk(q)=TopK⁡1≤i≤Pq⊤xi∥q∥∥xi∥,t=1k∑i∈Sk(q)xi∈Rd,y∗=β⊤t.(41)S_k(q) = \operatorname{TopK}_{1 \le i \le P} \frac{q^\top x_i}{\lVert q\rVert\lVert x_i\rVert}, \qquad t = \frac{1}{k}\sum_{i \in S_k(q)} x_i \in\mathbb{R}^d, \qquad y^* = \beta^\top t. \tag*{(41)}

From Appendix § 8.§ 1, assuming S≈ΣS \approx\Sigma,

y^L=β⊤pL(Σ)q,pL(Σ)=∑r=1LarΣr.(42)\hat{y}_L = \beta^\top p_L(\Sigma)q, \qquad p_L(\Sigma) = \sum_{r=1}^{L} a_r\Sigma^r. \tag*{(42)}

Write uL(q)=pL(Σ)qu_L(q) = p_L(\Sigma)q. Since y^L−y∗=β⊤(uL−t)\hat{y}_L - y^* = \beta^\top(u_L - t), averaging first over the independent teacher gives

Eβ[(y^L−y∗)2∣U,q,O]=(t−uL)⊤E[ββ⊤∣O](t−uL)=(t−uL)⊤Ω(t−uL).\mathbb{E}_{\beta}\left[(\hat{y}_L-y^*)^2 \mid U,q,O\right] = (t-u_L)^\top\mathbb{E}[\beta\beta^\top\mid O](t-u_L) = (t-u_L)^\top\Omega(t-u_L).

Thus RLpop=E∥t−uL∥Ω2R_L^{\mathrm{pop}} = \mathbb{E}\lVert t-u_L\rVert_{\Omega}^2, where ∥z∥Ω2=z⊤Ωz\lVert z\rVert_{\Omega}^2 = z^\top\Omega z. At fixed qq, OO, the selected target tt varies across contexts, whereas uLu_L does not. Separate its conditional mean from this variation:

tˉ=E[t∣q,O],δ=t−tˉ,E[δ∣q,O]=0.\bar{t} = \mathbb{E}[t \mid q,O], \qquad\delta= t-\bar{t}, \qquad\mathbb{E}[\delta\mid q,O] = 0.

Substituting t−uL=δ+(tˉ−uL)t-u_L = \delta+ (\bar{t}-u_L) and expanding gives

∥t−uL∥Ω2=∥δ∥Ω2+∥tˉ−uL∥Ω2+2δ⊤Ω(tˉ−uL).\lVert t-u_L\rVert_{\Omega}^2 = \lVert\delta\rVert_{\Omega}^2 + \lVert\bar{t}-u_L\rVert_{\Omega}^2 + 2\delta^\top\Omega(\bar{t}-u_L).

The cross term vanishes after conditioning because Ω\Omega and tˉ−uL\bar{t}-u_L are fixed given q,Oq,O:

E[δ⊤Ω(tˉ−pL(Σ)q)]=E[E[δ∣q,O]⊤Ω(tˉ−pL(Σ)q)]=0.\mathbb{E}\left[\delta^\top\Omega\left(\bar{t}-p_L(\Sigma)q\right)\right] =\mathbb{E}\left[\mathbb{E}[\delta\mid q,O]^\top\Omega\left(\bar{t}-p_L(\Sigma)q\right)\right] =0.

Hence the population risk separates into

RLpop=E∥t−pL(Σ)q∥22=E∥δ∥22⏟context-specific variation+E∥tˉ−pL(Σ)q∥22⏟polynomial approximation error.(43)\begin{aligned} \mathcal{R}^{\mathrm{pop}}_L=\mathbb{E}\left\lVert t-p_L(\Sigma)q\right\rVert_2^2 \\ &=\underbrace{\mathbb{E}\left\lVert\delta\right\rVert_2^2}_{\text{context-specific variation}} +\underbrace{\mathbb{E}\left\lVert\bar{t}-p_L(\Sigma)q\right\rVert_2^2}_{\text{polynomial approximation error}}. \tag*{(43)} \end{aligned}

We denote the first term by RirrR_{\mathrm{irr}}. It is independent of the polynomial degree, whereas increasing the degree can reduce only the second term.

Predictable component of the difficult-task target. Section 4.1 states that the predictable component is approximately proportional to Σq\Sigma q. We now derive this result by approximating cosine-similarity ranking with the inner-product scores si=q⊤xis_i=q^\top x_i. Conditional on q,Oq,O, the pair (xi,si)(x_i,s_i) is jointly Gaussian, with

E[si∣q,O]=0,Var⁡(si∣q,O)=q⊤Σq=:V(q),Cov⁡(xi,si∣q,O)=Σq.\mathbb{E}[s_i\mid q,O]=0,\qquad \operatorname{Var}(s_i\mid q,O)=q^\top\Sigma q=:V(q),\qquad \operatorname{Cov}(x_i,s_i\mid q,O)=\Sigma q.

The Gaussian conditioning formula therefore gives

E[xi∣si,q,O]=Cov⁡(xi,si∣q,O)Var⁡(si∣q,O)si=ΣqV(q)si.(44)\mathbb{E}[x_i\mid s_i,q,O] =\frac{\operatorname{Cov}(x_i,s_i\mid q,O)}{\operatorname{Var}(s_i\mid q,O)}s_i =\frac{\Sigma q}{V(q)}s_i. \tag*{(44)}

Let s(1)≥⋯≥s(P)s_{(1)}\ge\cdots\ge s_{(P)} be the ordered scores, and let x(j)x_{(j)} denote the input attaining s(j)s_{(j)}. Since zi=si/V(q)z_i=s_i/\sqrt{V(q)} are independent standard normal variables, define

γP,k=E[1k∑j=1kz(j)].\gamma_{P,k}=\mathbb{E}\left[\frac{1}{k}\sum_{j=1}^{k}z_{(j)}\right].

Applying equation (44) to the kk selected inputs and averaging over their ordered scores gives

tˉ(q)=E[1k∑j=1kx(j)∣q,O]=ΣqV(q)E[1k∑j=1ks(j)∣q,O]=γP,kΣqq⊤Σq.(45)\begin{aligned} \bar{t}(q)=\mathbb{E}\left[\frac{1}{k}\sum_{j=1}^{k}x_{(j)}\mathrel{\Big|}q,O\right] \\ &=\frac{\Sigma q}{V(q)}\mathbb{E}\left[\frac{1}{k}\sum_{j=1}^{k}s_{(j)}\mathrel{\Big|}q,O\right] =\gamma_{P,k}\frac{\Sigma q}{\sqrt{q^\top\Sigma q}}. \tag*{(45)} \end{aligned}

To remove the remaining query-dependent denominator, note that for q∼N(0,Σ)q\sim\mathcal{N}(0,\Sigma),

E[V(q)∣O]=tr⁡(Σ2),Var⁡(V(q)∣O)=2tr⁡(Σ4).\mathbb{E}[V(q)\mid O]=\operatorname{tr}(\Sigma^2),\qquad \operatorname{Var}(V(q)\mid O)=2\operatorname{tr}(\Sigma^4).

When 2tr⁡(Σ4)/tr⁡(Σ2)2≪12\operatorname{tr}(\Sigma^4)/\operatorname{tr}(\Sigma^2)^2\ll1, we can replace V(q)V(q) by its mean. Combining this with the cosine-to-score approximation yields

tˉ(q)≈cΣq,c=γP,ktr⁡(Σ2).\bar{t}(q)\approx c\Sigma q,\qquad c=\frac{\gamma_{P,k}}{\sqrt{\operatorname{tr}(\Sigma^2)}}.

Since the teacher is independent of the selected inputs given q,Oq,O,

E[y∗∣q,β,O]=β⊤E[t∣q,O]≈cβ⊤Σq.(46)\mathbb{E}[y^*\mid q,\beta,O]=\beta^\top\mathbb{E}[t\mid q,O]\approx c\beta^\top\Sigma q. \tag*{(46)}

Thus, the predictable component is proportional to Σq\Sigma q and can already be represented by the degree-one polynomial p1(Σ)=cΣp_1(\Sigma)=c\Sigma. Higher polynomial degrees cannot remove the context-specific variation in equation (43), explaining both the rapid saturation and the nonzero loss floor of the linear-attention model.

An explicit expression for the irreducible loss. Let a=(a1,…,aL)T\mathbf{a}=(a_1,\ldots,a_L)^{\mathsf{T}} collect the polynomial coefficients and define

ΦL(q)=[Σq,…,ΣLq],pL(Σ)q=ΦL(q)a.(47)\Phi_L(q)=[\Sigma q,\ldots,\Sigma^Lq],\qquad p_L(\Sigma)q=\Phi_L(q)\mathbf{a}. \tag*{(47)}

The corresponding population loss expands as

RLpop(a)=E∥t−ΦL(q)a∥22=E[tTΩt]−2aTE[ΦL(q)TΩt]+aTE[ΦL(q)TΩΦL(q)]a=T−2aTh+aTGa,(48)\mathcal{R}^{\mathrm{pop}}_L(\mathbf{a})=\mathbb{E}\lVert t-\Phi_L(q)\mathbf{a}\rVert_2^2 =\mathbb{E}[t^{\mathsf{T}}\Omega t]-2\mathbf{a}^{\mathsf{T}}\mathbb{E}[\Phi_L(q)^{\mathsf{T}}\Omega t] +\mathbf{a}^{\mathsf{T}}\mathbb{E}[\Phi_L(q)^{\mathsf{T}}\Omega\Phi_L(q)]\mathbf{a} =T-2\mathbf{a}^{\mathsf{T}}h+\mathbf{a}^{\mathsf{T}}G\mathbf{a}, \tag*{(48)}

where

T=E[tTΩt],h=E[ΦL(q)TΩt],G=E[ΦL(q)TΩΦL(q)].(49)T=\mathbb{E}[t^{\mathsf{T}}\Omega t],\qquad h=\mathbb{E}[\Phi_L(q)^{\mathsf{T}}\Omega t],\qquad G=\mathbb{E}[\Phi_L(q)^{\mathsf{T}}\Omega\Phi_L(q)]. \tag*{(49)}

In particular, the entries of the Gram matrix are determined by the spectra:

Grs=E[(Σrq)TΩ(Σsq)]=tr⁡(ΩΣr+s+1),1≤r,s≤L.(50)G_{rs}=\mathbb{E}[(\Sigma^r q)^{\mathsf{T}}\Omega(\Sigma^s q)]=\operatorname{tr}(\Omega\Sigma^{r+s+1}),\qquad1\le r,s\le L. \tag*{(50)}

Differentiating equation (48) with respect to a\mathbf{a} gives the normal equations Ga=hG\mathbf{a}=h. Hence

a∗=G†h,RL,∗pop=T−hTG†h.(51)\mathbf{a}_*=G^\dagger h,\qquad\mathcal{R}^{\mathrm{pop}}_{L,*}=T-h^{\mathsf{T}}G^\dagger h. \tag*{(51)}

The decomposition in equation (43) also gives

min⁡aRLpop(a)=Rirr+min⁡aE∥tˉ−ΦL(q)a∥Ω2.(52)\min_{\mathbf{a}}\mathcal{R}^{\mathrm{pop}}_L(\mathbf{a})=\mathcal{R}_{\mathrm{irr}}+\min_{\mathbf{a}}\mathbb{E}\lVert\bar{t}-\Phi_L(q)\mathbf{a}\rVert_\Omega^2. \tag*{(52)}

Under the degree-one approximation tˉ≈cΣq\bar{t}\approx c\Sigma q in equation (46), the second term is negligible. Combining equation (51) and equation (52) therefore gives the explicit prediction

Rirr≈T−hTG†h.(53)\mathcal{R}_{\mathrm{irr}}\approx T-h^{\mathsf{T}}G^\dagger h. \tag*{(53)}

We evaluate this prediction by Monte Carlo sampling in the original cosine task. We independently sample nn query–rotation–context triples. For sample ii, tit_i is the resulting cosine-selected target and Ωi=Oidiag⁡(ω1,…,ωd)OiT\Omega_i=O_i\operatorname{diag}(\omega_1,\ldots,\omega_d)O_i^{\mathsf{T}}. The hats below denote empirical estimates computed from these samples:

T^=1n∑i=1ntiTΩiti,h^=1n∑i=1nΦL(qi)TΩiti,\widehat{T}=\frac{1}{n}\sum_{i=1}^{n}t_i^{\mathsf{T}}\Omega_i t_i,\qquad\widehat{h}=\frac{1}{n}\sum_{i=1}^{n}\Phi_L(q_i)^{\mathsf{T}}\Omega_i t_i,
G^=1n∑i=1nΦL(qi)TΩiΦL(qi),R^irr=T^−h^TG^†h^.(54)\widehat{G}=\frac{1}{n}\sum_{i=1}^{n}\Phi_L(q_i)^{\mathsf{T}}\Omega_i\Phi_L(q_i),\qquad\widehat{\mathcal{R}}_{\mathrm{irr}}=\widehat{T}-\widehat{h}^{\mathsf{T}}\widehat{G}^{\dagger}\widehat{h}. \tag*{(54)}

Table 3 compares this Monte Carlo prediction of equation (53) with the actual loss plateau of the trained model. Their close agreement validates the predicted irreducible floor.

(a,b)(a,b)Theory-predicted lossMeasured lossDifference
k=2k=2
(0,0)(0,0)59.3714±0.021359.3714 \pm0.021359.850259.85020.80%0.80\%
(0.25,0.25)(0.25,0.25)9.7004±0.00499.7004 \pm0.00499.73879.73870.39%0.39\%
(0.5,0.5)(0.5,0.5)2.2715±0.00612.2715 \pm0.00612.32742.32742.40%2.40\%
(1,0.25)(1,0.25)1.2246±0.01061.2246 \pm0.01061.22591.22590.11%0.11\%
(1,1)(1,1)0.4975±0.01020.4975 \pm0.01020.50360.50361.22%1.22\%
k=16k=16
(0.5,0.5)(0.5,0.5)0.3218±0.00420.3218 \pm0.00420.30830.30834.38%4.38\%
(1,0)(1,0)0.4481±0.00860.4481 \pm0.00860.44520.44520.67%0.67\%
(1,0.25)(1,0.25)0.3186±0.00850.3186 \pm0.00850.32220.32221.11%1.11\%
(1.25,0)(1.25,0)0.3595±0.00900.3595 \pm0.00900.36590.36591.75%1.75\%

Table 3. The theoretically predicted irreducible loss closely matches the actual loss plateau of the linear-attention model.

Geometric interpretation. We now provide a heuristic geometric picture of the predictable component and irreducible loss, using the top-2 task as an example. In Figure 8, the horizontal ray represents the query xtestx_{\mathrm{test}}. The black vectors Ox1→\overrightarrow{Ox_1} and Ox2→\overrightarrow{Ox_2} are the two selected context inputs, and their average is the green target Ot→=(x1+x2)/2\overrightarrow{Ot} = (x_1 + x_2)/2. The blue vector OC→\overrightarrow{OC} represents the conditional mean tˉ\bar{t}, whereas the red vector Ct→=t−tˉ\overrightarrow{Ct} = t - \bar{t} is the context-specific residual. Linear attention can approximate the predictable blue component through the population covariance, but it lacks the context-specific selection required to follow the red residual for each realized context. This residual therefore produces the irreducible loss floor.

Geometric interpretation of the predictable and unpredictable components

Figure 8. The linear-attention model captures only the average predictable component of the difficult-task target. The green target is the average of the two selected inputs. Blue shows the best predictable component OC→\overrightarrow{OC}; red shows the context-specific residual.

Power Laws from Mode-Wise Exponential Decay

As a heuristic model of Figure 3(c), we show how exponential decay at different rates can combine into a power law. Let feature kk have initial loss weight wk≥0w_k \ge0 and characteristic depth τk>0\tau_k > 0:

Rk(L)=wke−L/τk,RL=∑kwke−L/τk.\mathcal{R}_k(L) = w_k e^{-L/\tau_k}, \qquad\mathcal{R}_L = \sum_k w_k e^{-L/\tau_k}.

Assume the loss-weighted distribution of characteristic depths follows a power law, ρ(τ)=Cτ−β\rho(\tau) = C\tau^{-\beta} for τ≥τ0>0\tau\ge\tau_0 > 0, with C>0C > 0 and β>1\beta> 1. The aggregate loss is

RL≈∫τ0∞ρ(τ)e−L/τ dτ.(55)\mathcal{R}_L \approx\int_{\tau_0}^{\infty} \rho(\tau)e^{-L/\tau}\,d\tau. \tag*{(55)}

With x=L/τx = L/\tau and dτ=−Lx−2 dxd\tau= -Lx^{-2}\,dx, this becomes

RL≈CL1−β∫0L/τ0xβ−2e−x dx∼CΓ(β−1)L−(β−1),L≫τ0.(56)\begin{aligned} \mathcal{R}_L &\approx CL^{1-\beta}\int_0^{L/\tau_0} x^{\beta-2}e^{-x}\,dx \\ &\sim C\Gamma(\beta-1)L^{-(\beta-1)}, \qquad L \gg\tau_0. \tag*{(56)} \end{aligned}

Thus exponential convergence of individual features produces power-law depth scaling when their characteristic depths have a broad power-law distribution. Stronger features converge first, while weaker features continue to contribute as depth increases.

Nonlinear-Attention Model Theory

In this section, we derive the loss decomposition for the nonlinear-attention model on the difficult task studied in § 4.2.

We first introduce the notation. Throughout this section, E\mathbb{E} denotes an expectation over contexts. Let LL be the number of layers and PP the number of context tokens. We use ℓ=1,…,L\ell= 1, \ldots, L for layers and i=1,…,Pi = 1, \ldots, P for tokens. Write kk for the number of labels selected by the top-kk task. We measure the relevance of each context token to the test token using cosine similarity:

si=xtestTxi∥xtest∥2∥xi∥2,(57)s_i = \frac{x_{\mathrm{test}}^{\mathsf{T}}x_i}{\lVert x_{\mathrm{test}}\rVert_2\lVert x_i\rVert_2}, \tag*{(57)}
si(1)≥⋯≥si(P),Sk={i(1),…,i(k)}.s_{i_{(1)}} \ge\cdots\ge s_{i_{(P)}}, \qquad S_k = \{i_{(1)},\ldots,i_{(k)}\}.

Thus SkS_k contains the kk context indices closest to the test token. For the label column y=(y1,…,yP)Ty = (y_1,\ldots,y_P)^{\mathsf{T}}, define the target row tk=(tk,1,…,tk,P)t_k = (t_{k,1},\ldots,t_{k,P}) by

tk,i={1/k,i∈Sk,0,i∉Sk,(58)t_{k,i} = \begin{cases} 1/k, & i \in S_k,\\ 0, & i \notin S_k, \end{cases} \tag*{(58)}
y∗=tky=1k∑i∈Skyi.y^* = t_k y = \frac{1}{k}\sum_{i\in S_k} y_i.

Let pℓip_{\ell i} be the attention weight from the test token to context token ii at layer ℓ\ell, with softmax normalized over the PP context sources since the test token does not attend to itself:

pℓ=(pℓ1,…,pℓP),∑i=1Ppℓi=1.(59)p_\ell= (p_{\ell1},\ldots,p_{\ell P}), \qquad\sum_{i=1}^{P}p_{\ell i}=1. \tag*{(59)}

With fixed context states, each layer reads the same label column yy. The common scalar gain gLg_L includes the value map and readout:

y^L=1L∑ℓ=1Lfℓ,\widehat{y}_L = \frac{1}{L}\sum_{\ell=1}^{L} f_\ell,
fℓ=gLpℓy=gL∑i=1Ppℓiyi,f_\ell= g_Lp_\ell y = g_L\sum_{i=1}^{P}p_{\ell i}y_i,
gL=WoWvWy.(60)g_L = W_oW_vW_y. \tag*{(60)}

Define the layer error relative to the same target as eℓ=fℓ−y∗e_\ell= f_\ell-y^*. For L>1L>1, assuming finite expected squared errors, let

AL=1L∑ℓ=1LE[eℓ2],A_L = \frac{1}{L}\sum_{\ell=1}^{L}\mathbb{E}[e_\ell^2],
CL=1L(L−1)∑ℓ≠mE[eℓem].(61)C_L = \frac{1}{L(L-1)}\sum_{\ell\ne m}\mathbb{E}[e_\ell e_m]. \tag*{(61)}

The second sum is over ordered distinct pairs. Since y^L−y∗=L−1∑ℓeℓ\widehat{y}_L-y^* = L^{-1}\sum_\ell e_\ell, expanding the square gives

RL=E[(y^L−y∗)2]=1L2[∑ℓE[eℓ2]+∑ℓ≠mE[eℓem]]=ALL+L−1LCL=CL+AL−CLL.(62)\begin{aligned} R_L &= \mathbb{E}\left[(\widehat{y}_L-y^*)^2\right]\\ &= \frac{1}{L^2}\left[\sum_\ell\mathbb{E}[e_\ell^2]+\sum_{\ell\ne m}\mathbb{E}[e_\ell e_m]\right]\\ &= \frac{A_L}{L}+\frac{L-1}{L}C_L\\ &= C_L+\frac{A_L-C_L}{L}. \tag*{(62)} \end{aligned}

Expanding pairwise differences and using equation (61),

∑ℓ≠mE[(eℓ−em)2]=2(L−1)∑ℓE[eℓ2]−2∑ℓ≠mE[eℓem]=2L(L−1)(AL−CL).\begin{aligned} \sum_{\ell\ne m}\mathbb{E}[(e_\ell-e_m)^2] =2(L-1)\sum_\ell\mathbb{E}[e_\ell^2]-2\sum_{\ell\ne m}\mathbb{E}[e_\ell e_m] \\ &=2L(L-1)(A_L-C_L). \end{aligned}

Dividing by 2L(L−1)2L(L-1) gives

AL−CL=12L(L−1)∑ℓ≠mE[(eℓ−em)2]≥0.(63)A_L-C_L=\frac{1}{2L(L-1)}\sum_{\ell\ne m}\mathbb{E}[(e_\ell-e_m)^2]\ge0. \tag*{(63)}

CLC_L captures the error shared across layers, whereas AL−CLA_L - C_L measures their disagreement. Averaging reduces the latter contribution to (AL−CL)/L(A_L - C_L)/L. The shared component cannot be removed through aggregation and therefore gives rise to the irreducible loss, while differences among layer errors can partially cancel and produce the reducible loss.

Importantly, this decomposition does not by itself imply inverse-depth scaling. We first establish the emergence of inverse-depth scaling empirically through systematic experiments and rigorous power-law fitting, and then use the decomposition to identify the components and mechanisms underlying this behavior.

This decomposition relies on the parallel interpretation of our controlled model: the layers act as independently parameterized predictors whose aggregate forms the final output. A layerwise decomposition is therefore natural in this setting. In the generalized settings considered below, however, it is neither the only possible decomposition nor necessarily the most natural one. For example, when inputs and labels share a single stream, the model becomes cascaded and each layer depends on the preceding layers. A mean-field treatment [27, 8, 30] may then be more appropriate, separating each layer’s output into a mean component coupled to the other layers and a layer-specific fluctuation. Developing a rigorous decomposition for more complex systems, including large language models, remains an important direction for understanding the role of depth in realistic models.

Generalized Model Experiments and Analysis

We now relax some design choices from the controlled model in § 2.2 to move the architecture closer to standard Transformers and LLMs. First, the original two-stream encoding separates token matching from label propagation: queries and keys interact only with the input stream, whereas values and the output map interact only with the label stream. Second, all layers share a value matrix, which improves training stability and keeps the model concise. Third, the nonlinear-attention model initially keeps the context states fixed, isolating the process by which different layers retrieve relevant information from the context. In the following subsections, we relax these assumptions one at a time and conduct analogous experiments and analyses for each extension.

Encoding Input and Label Information into One Space

Section 2.2 initializes separate input and label streams, Hx=WxXH_x = W_xX and Hy0=WyyinH_y^0 = W_yy^{\mathrm{in}}. In standard LLMs, token and label information are commonly encoded in a shared representation space. We therefore embed both sources of information in a shared token state:

H0=WxX+Wyyin∈RN×(P+1).(64)H^0 = W_xX + W_yy^{\mathrm{in}} \in\mathbb{R}^{N \times(P+1)}. \tag*{(64)}

Queries, keys, and values are now all computed from the same evolving state:

Qℓ=WqℓHℓ−1,Kℓ=WkℓHℓ−1,Vℓ=WvHℓ−1.(65)Q^\ell= W_q^\ell H^{\ell-1}, \qquad K^\ell= W_k^\ell H^{\ell-1}, \qquad V^\ell= W_v H^{\ell-1}. \tag*{(65)}

For nonlinear attention, the shared state is updated as

Aℓ=M⊙softmax⁡((Qℓ)TKℓ),Hℓ=Hℓ−1+1LVℓ(Aℓ)T.(66)\begin{aligned} A^\ell&= M \odot\operatorname{softmax}\left((Q^\ell)^\mathsf{T}K^\ell\right), \\ H^\ell&= H^{\ell-1} + \frac{1}{L}V^\ell(A^\ell)^\mathsf{T}. \tag*{(66)} \end{aligned}

Thus token matching, information propagation, and residual updates all act within a common representation space, and each layer operates on the state produced by the preceding layers.

To define the two decomposition terms in this cascaded model, let zℓ=Wohtestℓz_\ell= W_o h^\ell_{\mathrm{test}} denote the test-token readout after layer ℓ\ell. Define the base readout and layer increments as

bL=z0,dℓ=zℓ−zℓ−1,y^L=bL+∑ℓ=1Ldℓ.(67)b_L = z_0, \qquad d_\ell= z_\ell- z_{\ell-1}, \qquad\widehat{y}_L = b_L + \sum_{\ell=1}^{L} d_\ell. \tag*{(67)}

We can express the final prediction as an average of effective layerwise predictors by setting

fℓ=bL+Ldℓ,eℓ=fℓ−y∗,y^L−y∗=1L∑ℓ=1Leℓ.(68)f_\ell= b_L + Ld_\ell, \qquad e_\ell= f_\ell- y^*, \qquad\widehat{y}_L - y^* = \frac{1}{L}\sum_{\ell=1}^{L} e_\ell. \tag*{(68)}

For L>1L > 1, the shared-error and disagreement terms are then defined as

CL=1L(L−1)∑ℓ≠mE[eℓem],AL−CL=12L(L−1)∑ℓ≠mE[(eℓ−em)2]=1L−1∑ℓ=1LE[(fℓ−y^L)2].(69)\begin{aligned} C_L &= \frac{1}{L(L-1)}\sum_{\ell\ne m}\mathbb{E}[e_\ell e_m],\\ A_L-C_L &= \frac{1}{2L(L-1)}\sum_{\ell\ne m}\mathbb{E}[(e_\ell-e_m)^2]\\ &= \frac{1}{L-1}\sum_{\ell=1}^{L}\mathbb{E}[(f_\ell-\hat{y}_L)^2]. \tag*{(69)} \end{aligned}

With these definitions, the loss retains the exact identity

RL=CL+AL−CLL.(70)R_L=C_L+\frac{A_L-C_L}{L}. \tag*{(70)}

We evaluate this generalized model on the difficult task. Figure 9 shows that CLC_L and AL−CLA_L-C_L continue to approach finite constants, while the loss exhibits an approximate inverse-depth trend beyond moderate depth.

Three plots showing loss and error terms versus inverse depth and depth

Figure 9. The single-stream nonlinear-attention model exhibits a similar inverse-depth scaling signal. (a) The model is evaluated under isotropic data spectra. (b,c) The shared-error term CLC_L and disagreement term AL−CLA_L-C_L both approach finite constants with depth.

Layer-Decoupled Value Matrices

In standard LLMs, value matrices are typically parameterized independently across layers. We therefore replace the value matrix WvW_v shared in § 2.2 with independently parameterized matrices WvℓW_v^\ell, giving

Qℓ=WqℓHx,Kℓ=WkℓHx,Vℓ=WvℓHyℓ−1.(71)Q^\ell=W_q^\ell H_x,\qquad K^\ell=W_k^\ell H_x,\qquad V^\ell=W_v^\ell H_y^{\ell-1}. \tag*{(71)}

This modification allows each layer to apply a distinct transformation to the retrieved label information.

Let pℓp_\ell denote the attention weights from the test token to the context tokens, and let yy collect their labels. The corresponding layerwise predictor and error are

gℓ=WoWvℓWy,fℓ=gℓpℓy,eℓ=fℓ−y∗,y^L=1L∑ℓ=1Lfℓ.(72)g_\ell=W_oW_v^\ell W_y,\qquad f_\ell=g_\ell p_\ell y,\qquad e_\ell=f_\ell-y^*,\qquad\hat{y}_L=\frac{1}{L}\sum_{\ell=1}^{L}f_\ell. \tag*{(72)}

For L>1L > 1, the shared-error and disagreement terms are

CL=1L(L−1)∑ℓ≠mE[eℓem],AL−CL=12L(L−1)∑ℓ≠mE[(eℓ−em)2]=12L(L−1)∑ℓ≠mE[((gℓpℓ−gmpm)y)2].(73)\begin{aligned} C_L &= \frac{1}{L(L-1)}\sum_{\ell\ne m}\mathbb{E}[e_\ell e_m],\\ A_L-C_L &= \frac{1}{2L(L-1)}\sum_{\ell\ne m}\mathbb{E}[(e_\ell-e_m)^2]\\ &= \frac{1}{2L(L-1)}\sum_{\ell\ne m}\mathbb{E}\left[((g_\ell p_\ell-g_m p_m)y)^2\right]. \tag*{(73)} \end{aligned}

The loss therefore retains the exact identity

RL=CL+AL−CLL.(74)R_L = C_L + \frac{A_L-C_L}{L}. \tag*{(74)}

We evaluate this generalized model on the difficult task. Figure 10 shows that CLC_L and AL−CLA_L-C_L continue to approach finite constants, while the loss displays an approximate inverse-depth trend beyond moderate depth. Thus, the same inverse-depth scaling signal remains visible after relaxing the shared-value assumption.

The nonlinear-attention model with layer-specific value matrices exhibits a similar inverse-depth scaling signal

Figure 10. The nonlinear-attention model with layer-specific value matrices exhibits a similar inverse-depth scaling signal. (a) The model is evaluated under isotropic data spectra. (b,c) The shared-error term CLC_L and disagreement term AL−CLA_L-C_L both approach finite constants with depth.

Allowing Context Updates in the Nonlinear-Attention Model

Our linear-attention model in § 2.2 follows Bordelon et al. [4], including their attention-masking scheme. Let 1P∈RP\mathbf{1}_P \in\mathbb{R}^P denote the all-ones vector. For a single test token, their mask can be written as

M=(−1P1PT0P×11PT0).(75)M = \begin{pmatrix} -\mathbf{1}_P\mathbf{1}_P^{\mathsf{T}} & \mathbf{0}_{P\times1} \\ \mathbf{1}_P^{\mathsf{T}} & 0 \end{pmatrix}. \tag*{(75)}

where the upper-left block governs context-to-context updates, while the lower-left block allows the test token to attend to the context tokens. Intuitively, this sign structure lets linear attention extract data structure at progressively finer spectral resolutions. The negative context-to-context block preferentially subtracts components shared by highly similar context tokens from their label states. Dominant spectral features produce larger similarity-weighted updates and are therefore resolved earlier, whereas weaker features persist until greater depth and can be learned in deeper layers. This behavior is consistent with the sequential mode learning in Figure 3(c). By contrast, the positive test-to-context block allows retrieved information to accumulate in the test token’s label state, which is initialized at zero and updated across layers.

To isolate how the test token retrieves and aggregates information from the context, the controlled nonlinear-attention model in § 2.2 initially disables context updates by setting the upper-left block to zero:

M(0)=(0P×P0P×11PT0).(76)M(0) = \begin{pmatrix} \mathbf{0}_{P\times P} & \mathbf{0}_{P\times1} \\ \mathbf{1}_P^{\mathsf{T}} & 0 \end{pmatrix}. \tag*{(76)}

Standard Transformers, however, update context representations across layers. To examine how these updates affect the nonlinear-attention model, we parameterize the previously zero context-to-context block by a trainable scalar mm. Specifically, we use

M(m)=(m1P1PT0P×11PT0),(77)M(m) = \begin{pmatrix} m\mathbf{1}_P\mathbf{1}_P^{\mathsf{T}} & \mathbf{0}_{P\times1} \\ \mathbf{1}_P^{\mathsf{T}} & 0 \end{pmatrix}, \tag*{(77)}

where the scalar mm is shared across all layers and learned jointly with the other model parameters.

We evaluate this generalized model on the difficult task with isotropic data spectra, using top-2 and top-16 targets. Figure 11(a,Figure 11b) shows qualitatively different depth dependence. For top-2, the loss continues to decrease substantially with depth and exhibits a signal consistent with inverse-depth scaling. For top-16, by contrast, increasing depth does not improve the loss.

Four-panel plots showing loss and learned context-update scalar versus inverse depth and depth

Figure 11. Enabling context updates preserves an inverse-depth scaling signal on the top-2 task but not on the top-16 task. Under isotropic data spectra, (a) the top-2 loss exhibits an inverse-depth scaling signal, whereas (b) the top-16 loss quickly saturates. (c,d) The learned context-update scalar mm varies with depth for top-2 but stabilizes for top-16.

The learned context-update scalar mm provides an additional diagnostic. Figure 11(c,d) shows that the learned scalar mm varies substantially with depth for top-2, whereas for top-16 it remains near the stable negative value −2.3-2.3.

To interpret this task-dependent behavior, we first derive its exact effect in a two-layer model. Write the label state as Hyℓ=[Zℓ,hℓ]H_y^\ell= [Z_\ell, h_\ell], where Zℓ∈RN×PZ_\ell\in\mathbb{R}^{N \times P} contains the context states and hℓ∈RNh_\ell\in\mathbb{R}^{N} is the test-token state. Let y=(y1,…,yP)⊤y = (y_1,\ldots,y_P)^\top, so that Z0=Wyy⊤Z_0 = W_y y^\top and h0=0h_0 = 0. Without changing the mechanism of interest we take Wv=INW_v = I_N for simplicity. Let pℓ∈R1×Pp_\ell\in\mathbb{R}^{1 \times P} denote the test-to-context attention row at layer ℓ\ell, and let A1∈RP×PA_1 \in\mathbb{R}^{P \times P} denote the first layer’s context-to-context attention matrix.

Applying equation (10) with the mask in equation (77) gives

Z1=Z0+m2Z0A1⊤,h1=12Z0p1⊤,h2=h1+12Z1p2⊤.(78)\begin{aligned} Z_1 &= Z_0 + \frac{m}{2} Z_0 A_1^\top,\\ h_1 &= \frac{1}{2} Z_0 p_1^\top,\\ h_2 &= h_1 + \frac{1}{2} Z_1 p_2^\top. \tag*{(78)} \end{aligned}

Substituting Z0=Wyy⊤Z_0 = W_y y^\top gives

h2=Wy[12(p1+p2)y+m4p2A1y].(79)h_2 = W_y\left[\frac{1}{2}(p_1+p_2)y+\frac{m}{4}p_2 A_1 y\right]. \tag*{(79)}

Defining the scalar readout gain g=WoWyg = W_o W_y, the prediction is

y^2=g2(p1+p2)y+gm4p2A1y.(80)\widehat{y}_2 = \frac{g}{2}(p_1+p_2)y+\frac{gm}{4}p_2 A_1 y. \tag*{(80)}

The first term reads the original context labels directly. The second reads them after A1A_1 has mixed information across context tokens.

For arbitrary depth, the corresponding recursion is

Zℓ=Zℓ−1(IP+mLAℓ⊤),hℓ=hℓ−1+1LZℓ−1pℓ⊤.(81)\begin{aligned} Z_\ell&= Z_{\ell-1}\left(I_P+\frac{m}{L}A_\ell^\top\right),\\ h_\ell&= h_{\ell-1}+\frac{1}{L}Z_{\ell-1}p_\ell^\top. \tag*{(81)} \end{aligned}

Consequently,

y^L=gL[p1y+∑ℓ=2Lpℓ(IP+mLAℓ−1)⋯(IP+mLA1)y].(82)\widehat{y}_L = \frac{g}{L}\left[p_1y+\sum_{\ell=2}^{L}p_\ell\left(I_P+\frac{m}{L}A_{\ell-1}\right)\cdots\left(I_P+\frac{m}{L}A_1\right)y\right]. \tag*{(82)}

Thus, context updates affect prediction through operators IP+(m/L)AℓI_P+(m/L)A_\ell. Whether and how they improve depth utilization depends on the spectral structure of AℓA_\ell.

Figure 12 visualizes the two context attention structures. For the top-2 task, the measured A1A_1 is nearly the identity. For the top-16 task, the measured A1A_1 is broader and flatter. This contrast is induced by the sharpness of the target distribution. The sharp top-2 target requires the model to preserve the identities of a few selected tokens, favoring well-separated embeddings and a nearly identity attention map. The flatter top-16 target instead favors stronger coupling across embeddings and therefore produces a broader attention map.

Learned context-attention structures for top-2 and top-16 tasks

Figure 12. The learned context-attention structure depends strongly on the aggregation target. The context-attention matrix A1A_1 is (a) sharply concentrated on the diagonal for top-2 task, but (b) distributed broadly across context tokens for top-16 task.

To quantify this contrast, we model each measured attention matrix by an identity component IPI_P and a uniform mixing component JPJ_P. Specifically, for k∈{2,16}k \in\{2,16\}, we fit ρk\rho_k by least squares in

A1(k)≈ρkIP+(1−ρk)JP,JP:=1P1PTP.(83)A_1^{(k)} \approx\rho_k I_P + (1-\rho_k)J_P,\qquad J_P := \frac{\mathbf{1}_P\mathbf{1}_P^{\mathsf{T}}}{P}. \tag*{(83)}

The identity term preserves each context embedding separately, whereas JPJ_P replaces every embedding by their common average. The fitted results are

ρ2=0.9999,Rtop-22>0.99999,\rho_2 = 0.9999,\qquad R_{\mathrm{top\text{-}2}}^2 > 0.99999,
ρ16=0.0989,Rtop-162=0.99996.(84)\rho_{16} = 0.0989,\qquad R_{\mathrm{top\text{-}16}}^2 = 0.99996. \tag*{(84)}

This model therefore confirms that the top-2 matrix is almost exactly the identity, while the top-16 matrix is dominated by uniform cross-token mixing.

For top-2, the near-identity structure gives p2A1≈p2p_2A_1 \approx p_2, and

y^2≈92p1y+92(1+m/2)p2y.(85)\widehat{y}_2 \approx\frac{9}{2}p_1y + \frac{9}{2}(1+m/2)p_2y. \tag*{(85)}

The context update therefore introduces no independent token-weighting direction: the prediction remains an aggregation of p1p_1 and p2p_2. Accordingly, its loss remains close to that of the fixed-context model and still exhibits approximate inverse-depth scaling over the observed depth range.

For top-16, let u=1PT/Pu = \mathbf{1}_P^{\mathsf{T}}/P. Since p21P=1p_2\mathbf{1}_P = 1, we have p2JP=up_2J_P = u and hence

p2A1≈ρ16p2+(1−ρ16)u.(86)p_2A_1 \approx\rho_{16}p_2 + (1-\rho_{16})u. \tag*{(86)}

Equation (86) shows that the context update adds the uniform token-weighting direction uu, beyond the direct rows p1p_1 and p2p_2. Defining pˉ=(p1+p2)/2\bar{p} = (p_1+p_2)/2, the exact two-layer prediction is

y^2=g(pˉ+m4p2A1)y.(87)\widehat{y}_2 = g\left(\bar{p}+\frac{m}{4}p_2A_1\right)y. \tag*{(87)}

A negative mm therefore produces a global shift that subtracts the common attention floor, rather than merely combining more direct attention rows. This additional degree of freedom allows the model to achieve low loss with few layers, explaining its early saturation. The same argument extends to models with more than two layers.

This distinction is also relevant to language modeling. Many language tasks require focusing on only a few relevant tokens and learning a sparse and peaked distribution. In such regimes, context interactions may primarily reweight information that has already been selected. Depth utilization can therefore remain governed by selective retrieval and cross-layer aggregation, making the inverse-depth mechanism relevant even when context representations are not fixed.

Overall, these generalized models exhibit inverse-depth scaling signals that are qualitatively consistent with the controlled-model analysis over the accessible depth ranges. Training these models at much greater depths is substantially more computationally expensive, preventing experiments on the same scale as those conducted for the controlled model. We therefore interpret these results as evidence of similar scaling signals, rather than as a definitive guarantee of asymptotic inverse-depth scaling. Their appearance under more realistic architectural choices nevertheless suggests that the mechanism may remain relevant to practical models.

More Experiments and Fitting Details

This section supplements the controlled-model results with additional experiments and provides the fitting procedures used to quantify the observed depth-scaling laws. We report fits for both the easy and difficult tasks, analyze context-dependent token selection, test broader targets and data spectra, and examine the convergence of the shared-error term.

Power-Law Fitting Procedures

We use a common log-space fitting procedure to quantify the depth-scaling laws in § 3.1 and 4.2. Each spectrum is fitted independently using

RL=L0+cL−α,c>0,α>0,(88)\mathcal{R}_L = L_0 + cL^{-\alpha}, \qquad c > 0,\qquad\alpha> 0, \tag*{(88)}

where L0L_0 is the asymptotic loss floor and α\alpha is the decay exponent.

For observations at depths {Li}\{L_i\}, we minimize the squared residuals between the logarithms of the observed and modeled losses:

(L^0,c^,α^)=arg⁡min⁡L0,c,α∑i[log⁡RLi−log⁡(L0+cLi−α)]2.(89)(\widehat{L}_0,\widehat{c},\widehat{\alpha}) = \underset{L_0,c,\alpha}{\arg\min}\sum_i \left[\log\mathcal{R}_{L_i} - \log\left(L_0+cL_i^{-\alpha}\right)\right]^2. \tag*{(89)}

For the easy task, we set L0=0L_0=0. As shown in Appendix § 8.§ 1, given sufficient depth, width, dataset size, context length, and training time, the linear-attention model can solve this task exactly by using a covariance polynomial to approximate the identity map. For the difficult task, the decomposition in Appendix § 9 contains an error component shared across layers, so we estimate L0L_0 jointly with cc and α\alpha.

Complementary Token Selection Across Contexts

We further compare how nonlinear-attention models of different depths perform on the difficult task. We train an L=1L=1 model and an L=256L=256 model on the difficult task with k=2k=2 under identical conditions. We then sample 10,240 fresh contexts independently from the data distribution and evaluate both models on the same set.

For each context, we order the tokens by their similarity to the test token. Under the parallel interpretation developed in Appendix § 9, the final output aggregates the contributions of the individual layers. We therefore summarize their collective token selection by the aggregated attention distribution and compare it with the target distribution over the ordered tokens. Formally,

pˉL(c)=1L∑ℓ=1Lpℓ(c),p∗=(1/2,1/2,0,…,0),\bar{p}_L(c)=\frac{1}{L}\sum_{\ell=1}^{L}p_\ell(c),\qquad p^*=(1/2,1/2,0,\ldots,0),
EL(c)=∥pˉL(c)−p∗∥22.(90)E_L(c)=\lVert\bar{p}_L(c)-p^*\rVert_2^2. \tag*{(90)}

Lower values indicate more accurate identification and weighting of the two target tokens. For each model separately, we sort the sampled contexts by EL(c)E_L(c) and denote the qqth percentile by QL(q)Q_L(q). Thus, small qq corresponds to contexts on which a model most closely matches the target distribution, whereas large qq probes its high-error tail.

Figure 13a compares the resulting error distributions. Panel (b) reports

Greater depth makes token selection more reliable across contexts

Figure 13. Greater depth makes token selection more reliable across contexts. (a) Selection-loss percentiles for L=1L = 1 and L=256L = 256. (b) Their difference ΔQ(q)=Q1(q)−Q256(q)\Delta Q(q) = Q_1(q) - Q_{256}(q); positive values favor L=256L = 256.

ΔQ(q)=Q1(q)−Q256(q),(91)\Delta Q(q) = Q_1(q) - Q_{256}(q), \tag*{(91)}

Positive ΔQ(q)\Delta Q(q) therefore indicates that the deeper model has lower selection loss at percentile qq. The one-layer model is slightly more accurate on the contexts in its lowest-error tail, but its error grows much more rapidly across harder contexts. The 256-layer model instead markedly reduces the upper tail, indicating more reliable token selection across the context distribution.

This pattern follows from the fact that each query–key parameterization must serve the entire context distribution. With only one layer, a single selection rule may fit some contexts particularly well but cannot identify the correct top-2 tokens uniformly. Greater depth supplies multiple independently parameterized rules whose errors can be complementary across contexts. Their aggregation improves coverage: for a context that is difficult for one rule, other layers may still identify the relevant tokens, thereby reducing the high-error tail.

The slight advantage of the one-layer model at the lowest percentiles suggests a possible tradeoff between specialization and coverage. A single selection rule may become highly accurate on a limited subset of contexts, whereas complementary rules across layers can cover a broader range. This observation suggests a testable hypothesis for settings with finitely many or clustered context types: different layers may specialize in different context classes, and their aggregation may combine these specialized behaviors. If this hypothesis holds, it would suggest that current architectures use depth inefficiently, as not every layer makes an indispensable contribution. Further exploring designs that exploit such layerwise specialization may help LLMs utilize depth better.

Broader Targets and Data Spectra

The main-text experiments with the nonlinear-attention model on the difficult task use top-2 aggregation and vary one spectral parameter while fixing the other at zero. We now test whether the observed depth scaling depends on either restriction. First, we retain the top-2 target but consider jointly structured input and task spectra, with both aa and bb nonzero. Second, we replace top-2 aggregation with top-16 aggregation, yielding a flatter target distribution, and evaluate several spectral settings. For each configuration, we fit the evaluation loss using the model and log-space objective defined in Appendix § 11.§ 1.

Figure 14 shows approximately inverse-depth loss decay across both extensions, and Table 4 quantifies the corresponding exponents. For the jointly nonzero top-2 settings, panels (c,d) further show that both decomposition terms approach spectrum-dependent finite values, matching the convergence pattern observed in the main text. With jointly nonzero spectra, the top-2 exponents remain close to one. Note that the top-16 exponents deviate relatively more from one at the depths considered, suggesting that the top-16 task may enter the asymptotic inverse-depth regime only at greater depths. This contrast also suggests that inverse-depth scaling from cross-layer aggregation may be more pronounced for

Emergent inverse-depth scaling plots

Figure 14. Emergent inverse-depth scaling in the deep regime generalizes across broader targets and data spectra. (a) Performance on the top-2 task with both spectral parameters nonzero. (b) Performance on top-16 aggregation across representative spectra. (c) CLC_L and (d) AL−CLA_L - C_L converge to finite constants with depth for the three top-2 spectra.

Target(a,b)(a,b)L0L_0α±SE\alpha\pm\mathrm{SE}R2R^2
Top-2(0.25,0.25)(0.25, 0.25)0.8180680.97±0.010.97 \pm0.010.9998
(0.25,0.5)(0.25, 0.5)0.5596940.93±0.060.93 \pm0.060.9984
(0.5,0.5)(0.5, 0.5)0.3821880.97±0.010.97 \pm0.010.9999
Top-16(0,0.25)(0, 0.25)0.1732370.79±0.020.79 \pm0.020.9999
(0,0.5)(0, 0.5)0.1144360.88±0.030.88 \pm0.030.9998
(0.25,0.25)(0.25, 0.25)0.1152480.81±0.020.81 \pm0.020.9998
(0.25,0.5)(0.25, 0.5)0.0797850.81±0.040.81 \pm0.040.9994

Table 4. Fitted depth-scaling exponents remain close to one across broader targets and data spectra.

sparse, sharply concentrated target distributions. These results show that the inverse-depth scaling behavior is not restricted to specific spectra or target distributions.

Convergence of the Shared-Error Term

The direct loss fits in § 4.2 provide empirical evidence for approximate inverse-depth scaling over the tested depth range. As a consistency check on the decomposition in Appendix § 9, we examine how its shared-error term CLC_L approaches the fitted loss floor. For each spectrum, we fix L0L_0 to the corresponding estimate in Table 1 and model the gap as

L0−CL=cL−α,c>0,α>0.(92)L_0-C_L=cL^{-\alpha}, \qquad c>0,\quad\alpha>0. \tag*{(92)}

Following the log-space procedure in Appendix § 11.§ 1, we estimate the two parameters by least squares:

(c^,α^)=arg min⁡c>0, α>0∑i[log⁡(L0−CLi)−log⁡(cLi−α)]2.(93)(\widehat{c},\widehat{\alpha})=\underset{c>0,\ \alpha>0}{\operatorname{arg\,min}}\sum_i\left[\log(L_0-C_{L_i})-\log(cL_i^{-\alpha})\right]^2. \tag*{(93)}
(a,b)(a,b)α±SE\alpha\pm\mathrm{SE}R2R^2
(0,0)(0,0)0.980±0.0070.980 \pm0.0070.999810.99981
(0,0.25)(0,0.25)0.983±0.0380.983 \pm0.0380.993960.99396
(0,0.5)(0,0.5)0.977±0.0140.977 \pm0.0140.999230.99923
(0,1)(0,1)0.982±0.0110.982 \pm0.0110.999460.99946
(0.25,0)(0.25,0)0.990±0.0150.990 \pm0.0150.999040.99904
(0.5,0)(0.5,0)0.986±0.0050.986 \pm0.0050.999880.99988
(1,0)(1,0)0.994±0.0050.994 \pm0.0050.999920.99992

Table 5. The gap L0−CLL_0-C_L decays approximately inversely with depth over the fitted range.

With L0L_0 fixed by the direct loss fits, the high R2R^2 values and small fitting uncertainties show that L0−CLL_0-C_L is well described by a power law over the tested depths. Its fitted decay exponents are close to one, consistent with the inverse-depth trend observed in the loss.

References

  1. [1]Kwangjun Ahn, Xiang Cheng, Hadi Daneshmand, and Suvrit Sra. Transformers learn to implement preconditioned gradient descent for in-context learning. In Advances in Neural Information Processing Systems, volume 36, pp. 45614–45650, 2023. doi: 10.52202/075280-1977.DOI
  2. [2]Yasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee, and Utkarsh Sharma. Explaining neural scaling laws. Proceedings of the National Academy of Sciences, 121(27):e2311878121, 2024. doi: 10.1073/pnas.2311878121.DOI
  3. [3]Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1798–1828, 2013. doi: 10.1109/TPAMI.2013.50.DOI
  4. [4]Blake Bordelon, Mary Letey, and Cengiz Pehlevan. Theory of scaling laws for in-context regression: Depth, width, context and time. In International Conference on Learning Representations, 2026.arxiv.org/abs/2510.01098
  5. [5]Francesco Cagnetta, Leonardo Petrini, Umberto M. Tomasini, Alessandro Favero, and Matthieu Wyart. How deep neural networks learn compositional data: The random hierarchy model. Physical Review X, 14(3):031001, 2024. doi: 10.1103/PhysRevX.14.031001.DOI
  6. [8]Lénaïc Chizat and Francis Bach. On the global convergence of gradient descent for over-parameterized models using optimal transport. In Advances in Neural Information Processing Systems, volume 31, pp. 3040–3050, 2018.arxiv.org/abs/1805.09545
  7. [9]Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In International Conference on Learning Representations, 2019.arxiv.org/abs/1807.03819
  8. [11]Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova DasSarma, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. A mathematical framework for transformer circuits. Transformer Circuits Thread, 2021. URL https://transformer-circuits.pub/2021/framework/index.html.
  9. [12]Shivam Garg, Dimitris Tsipras, Percy Liang, and Gregory Valiant. What can transformers learn in-context? a case study of simple function classes. In Advances in Neural Information Processing Systems, volume 35, pp. 30583–30598, 2022. doi: 10.52202/068431-2217.DOI
  10. [13]Jonas Geiping, Sean McLeish, Neel Jain, John Kirchenbauer, Siddharth Singh, Brian R. Bartoldson, Bhavya Kailkhura, Abhinav Bhatele, and Tom Goldstein. Scaling up test-time compute with latent reasoning: A recurrent depth approach. In Advances in Neural Information Processing Systems, volume 38, pp. 46242–46293, 2025. doi: 10.52202/085713-1380.
  11. [15]Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory Diamos, Heewoo Jun, Hassan Kianinejad, Md. Mostofa Ali Patwary, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409, 2017.arxiv.org/abs/1712.00409
  12. [16]Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Thomas Hennigan, Eric Noland, Katherine Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karén Simonyan, Erich Elsen, Oriol Vinyals, Jack Rae, and Laurent Sifre. An empirical analysis of compute-optimal large language model training. In Advances in Neural Information Processing Systems, volume 35, pp. 30016–30030, 2022. doi: 10.52202/068431-2176.
  13. [17]Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.arxiv.org/abs/2001.08361
  14. [18]Marcel Kühn, Yoon Thelge, and Bernd Rosenow. A boundary-layer mechanism for one-third scaling in online softmax classification. arXiv preprint arXiv:2605.22341, 2026.arxiv.org/abs/2605.22341
  15. [19]Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521:436–444, 2015. doi: 10.1038/nature14539.DOI
  16. [20]Yizhou Liu and Jeff Gore. Neural scaling universality: If exponents are fixed, time to understand coefficients. arXiv preprint arXiv:2606.25008, 2026.arxiv.org/abs/2606.25008
  17. [21]Yizhou Liu, Ziming Liu, and Jeff Gore. Superposition yields robust neural scaling. In Advances in Neural Information Processing Systems, volume 38, pp. 176757–176793, 2025. doi: 10.52202/085713-5320.DOI
  18. [22]Yizhou Liu, Sara Kangaslahti, Ziming Liu, and Jeff Gore. Inverse depth scaling from most layers being similar. In Proceedings of the 43rd International Conference on Machine Learning, volume 306, pp. 77093–77118, 2026a. URL https://proceedings.mlr.press/v306/liu26bt.html.arxiv.org/abs/2602.05970
  19. [23]Yizhou Liu, Ziming Liu, Cengiz Pehlevaln, and Jeff Gore. Universal one-third time scaling in learning peaked distributions. In Proceedings of the 43rd International Conference on Machine Learning, volume 306, pp. 77529–77558, 2026b. URL https://proceedings.mlr.press/v306/liu26cl.html.arxiv.org/abs/2602.03685
  20. [24]Yiping Lu, Chao Ma, Yulong Lu, Jianfeng Lu, and Lexing Ying. A mean-field analysis of deep ResNet and beyond: Towards provable optimization via overparameterization from depth. In Proceedings of the 37th International Conference on Machine Learning, volume 119, pp. 6426–6436, 2020. URL https://proceedings.mlr.press/v119/lu20b.html.arxiv.org/abs/2003.05508
  21. [25]Yue M. Lu, Mary Letey, Jacob A. Zavatone-Veth, Anindita Maiti, and Cengiz Pehlevan. Asymptotic theory of in-context learning by linear attention. Proceedings of the National Academy of Sciences, 122(28):e2502599122, 2025. doi: 10.1073/pnas.2502599122.DOI
  22. [26]Ang Lv, Ruobing Xie, Xingwu Sun, Zhanhui Kang, and Rui Yan. Language models “grok” to copy. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 2: Short Papers), pp. 735–741, 2025. doi: 10.18653/v1/2025.naacl-short.61.DOI
  23. [27]Song Mei, Andrea Montanari, and Phan-Minh Nguyen. A mean field view of the landscape of two-layer neural networks. Proceedings of the National Academy of Sciences, 115(33):E7665–E7671, 2018. doi: 10.1073/pnas.1806579115.DOI
  24. [28]Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Scott Johnston, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. In-context learning and induction heads. arXiv preprint arXiv:2209.11895, 2022.arxiv.org/abs/2209.11895
  25. [29]Tomaso Poggio, Hrushikesh Mhaskar, Lorenzo Rosasco, Brando Miranda, and Qianli Liao. Why and when can deep—but not shallow—networks avoid the curse of dimensionality: A review. International Journal of Automation and Computing, 14(5):503–519, 2017. doi: 10.1007/s11633-017-1054-2.DOI
  26. [30]Grant M. Rotskoff and Eric Vanden-Eijnden. Parameters as interacting particles: Long time convergence and asymptotic error scaling of neural networks. In Advances in Neural Information Processing Systems, volume 31, pp. 7146–7155, 2018.
  27. [32]Utkarsh Sharma and Jared Kaplan. Scaling laws from the data manifold dimension. Journal of Machine Learning Research, 23(9):1–34, 2022.
  28. [33]Andreas Veit, Michael J. Wilber, and Serge Belongie. Residual networks behave like ensembles of relatively shallow networks. In Advances in Neural Information Processing Systems, volume 29, pp. 550–558, 2016.
  29. [34]Johannes von Oswald, Eyvind Niklasson, Ettore Randazzo, Joao Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vladymyrov. Transformers learn in-context by gradient descent. In Proceedings of the 40th International Conference on Machine Learning, volume 202, pp. 35151–35174, 2023. URL https://proceedings.mlr.press/v202/von-oswald23a.html.arxiv.org/abs/2212.07677
  30. [35]Ruiqi Zhang, Spencer Frei, and Peter L. Bartlett. Trained transformers learn linear models in-context. Journal of Machine Learning Research, 25(49):1–55, 2024.arxiv.org/abs/2306.09927

Paper details

vlnc:W_ne4xujs7
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

generative AI tools

View statement
Looking for related papers…
Contents