Manuscript Offprint
arXiv:2610.10761What can linear attention learn from nonlinear teachers in-context?
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Mary Letey
Applied Mathematics, Harvard University
Kempner Institute, Harvard University
Yue M. Lu
Applied Mathematics, Harvard University
Arman Rysmakhanov
Williams College
Applied Mathematics, Harvard University
Cengiz Pehlevan
Applied Mathematics, Harvard University
Kempner Institute, Harvard University
Jacob A. Zavatone-Veth
Center for Brain Science, Harvard University
Society of Fellows, Harvard University
Abstract
Linear attention is a tractable model for understanding the mechanisms governing in-context learning in transformers. For linear regression tasks, recent asymptotic analyses have characterised its learning and generalisation behaviour. We extend this theory to nonlinear single-index targets, . Our main result establishes a nonlinearity–noise equivalence: linear attention extracts only the linear Hermite component of , while the remaining nonlinear structure contributes to the generalisation error as effective noise. This reduction allows results from the corresponding linear theory to be transferred to nonlinear tasks. We illustrate its implications for finite pretraining data and for the transition from task memorisation to task generalisation as task diversity increases. These results identify a limitation of the reduced linear-attention model and provide a tractable starting point for studying nonlinear in-context learning.
1 Introduction
Linear attention is a useful setting for studying in-context learning because its simplified structure admits detailed analysis of the computations performed over prompt data. This led to work connecting in-context learning to regression and statistical estimation, including recent asymptotic analyses that describe generalisation in linear-regression tasks (Zhang et al., 2023; Von Oswald et al., 2023; Lu et al., 2025; Bordelon et al., 2025; Letey et al., 2026b,a).
At the same time, linear-attention mechanisms are becoming more prevalent in real-world models. Earlier work focused on computational efficiency and recurrent fast-weight interpretations
Equal contribution.
This work was performed while at Harvard University.
Code for figures is available on github.
40th Conference on Neural Information Processing Systems (NeurIPS 2026) Workshop: 2nd Workshop on Principles of Generative Modeling (PriGM) at NeurIPS 2026.
(Katharopoulos et al., 2020; Schlag et al., 2021), while more recent architectures introduce delta-rule updates and gating to improve recurrent memory (Yang et al., 2024, 2023). This motivates the study of in-context learning using linear attention; specifically, we must ask which components of a nonlinear task a linear-attention block can extract in-context, and which components must instead be supplied by the surrounding architecture.
We investigate an extension of the linear-regression ICL model induced by a reduced linear-attention block (Lu et al., 2025; Zhang et al., 2023). The key extension is the addition of nonlinear target functions, i.e., single-index targets. This is a classic extension of regression in statistical estimation (Mei and Montanari, 2022; Gerace et al., 2020), appearing in both the standard supervised-learning literature and more recent ICL results. Concurrent work by Gu et al. (2026) also studies this problem, with the addition of nonlinear readout on linear attention, thus adding expressivity to learn beyond the linear mode. Alternatively, we focus specifically on linear attention and highlight its limitations on this task. Oko et al. (2024) show that transformers learn single-index tasks in context at a rate governed by the information exponent of the link function, defined as the index of its first nonzero Hermite coefficient. Related dependence on the information exponent appears in non-ICL settings (Damian et al., 2023). We likewise analyse the link function by expanding it in Hermite polynomials (Joshi et al., 2026; Eftekhari et al., 2021; Dudeja and Hsu, 2018).
This work serves to formalise the following intuition: linear attention cannot learn beyond the linear Hermite mode of the link function. If no linear mode is present, all signal is indistinguishable from noise. This hypothesis is natural from standard results studying learnability of single-index targets (Li and Duan, 1989; Brillinger, 2011; Thrampoulidis et al., 2015): when the student and link function are not compatible the full target nonlinearity cannot be learned. We expect this to apply to our case of linear attention here, as due to the lack of explicit nonlinear activation in the linear attention architecture, it cannot represent nonlinear functions of the target label. This is precisely what we show in the following.
A prompt is a sequence
with
We take and independent Gaussian label noise and . The parameters are set from such samples of these sequences, each with a potentially different defining task . As in prior work, we consider two distributions over tasks. For the training sequences, we use tasks sampled independently from ; these tasks are split uniformly across the sequences in the training batch. At test time, the model is tested on sequences with tasks sampled independently from .
Nonlinearity. For , expand in an orthonormal Hermite basis:
We assume has at most polynomial growth, i.e., for some power and constant .
Proportional limit. We take with
all of order one, as in prior work (Lu et al., 2025; Letey et al., 2026b).
Reduced linear-attention predictor. The next-token prediction is approximated by
where, for one prompt,
For training prompts, write and . Ridge regression gives
and the test error is
3 Theoretical results and analysis
Define and as
where is the label-noise variance.
Result 1: Asymptotic formula for ridgeless ICL error
Suppose that the pretraining and test tasks are sampled from and , respectively, where
If the link function has a nonzero linear mode, , then
If instead , then
The derivation is given in Appendix C. In other words, linear attention learns the linear mode, while the other modes appear as noise. If there is no linear mode to learn, ICL reduces to no-signal regression with sample ratio and label noise . In this case, the error has no dependence on context length or task diversity, since those quantities modulate the learnability of a linear component that is not present.
Figure 1 provides a demonstration of Result 1, particularly the change in effective noise. The ICL performance of the nonlinear function at the baseline noise level is therefore empirically equivalent to that of the linear function at a higher noise level. This new effective noise is computed as to balance the scaling of the task covariances in Result 1.
Phase transition in task diversity. Previous work has found that taking with gives a sharp transition at . This corresponds to a transition between the model

Figure 1: We simulate ICL test loss directly from data to verify Result 1. The linear target is , while the nonlinear target is . , , , .
memorising the pretraining tasks and actually generalising to the correct task structure for good performance on .
Indeed, if we take for simplicity, when the error approaches the new noise floor (so long as )
rather than the noise floor obtained for a linear target (Lu et al., 2025). This is demonstrated in Figure 2.

Figure 2: We see that nonlinear functions raise the limiting ICL test error, even in the best possible data case of due to nonlearnable signal captured as noise. Here , .
4 Conclusion
We have extended the asymptotic theory of in-context learning by a reduced linear-attention block from linear regression tasks to nonlinear single-index targets. The resulting equivalence shows that the model uses the target function only through its linear Hermite component, while the remaining Hermite modes contribute as effective noise. Consequently, increasing the amount of pretraining data or the diversity of pretraining tasks cannot remove the error floor created by nonlinear components that are invisible to this predictor. This limitation persists beyond the task-diversity transition, where the error approaches rather than the original label-noise level .
Acknowledgments and Disclosure of Funding
M.L. is supported by a Graduate Fellowship from the Kempner Institute for the Study of Natural and Artificial Intelligence. A.R. was supported by the Alumni Sponsored Internship Program (ASIP) of Williams College. Y.M.L. gratefully acknowledges support from a Harvard College Professorship, the Harvard FAS Dean's Fund for Promising Scholarship, and DARPA grant DIAL-FP-038. C.P. is supported by an NSF CAREER Award (IIS-2239780), DARPA grants DIAL-FP-038 and AIQ-HR00112520041, and the Simons Collaboration on the Physics of Learning and Neural Computation. J.Z.-V. was supported by a Junior Fellowship from the Harvard Society of Fellows. This work has been made possible in part by a gift from the Chan Zuckerberg Initiative Foundation to establish the Kempner Institute for the Study of Natural and Artificial Intelligence.
References
Blake Bordelon, Mary I. Letey, and Cengiz Pehlevan. Theory of scaling laws for in-context regression: Depth, width, context and time, 2025. URL https://arxiv.org/abs/2510.01098.
David R Brillinger. A generalized linear model with “gaussian” regressor variables. In Selected Works of David Brillinger, pages 589–606. Springer, 2011.
Alex Damian, Eshaan Nichani, Rong Ge, and Jason D Lee. Smoothing the landscape boosts the signal for sgd: Optimal sample complexity for learning single index models. Advances in Neural Information Processing Systems, 36:752–784, 2023.
Rishabh Dudeja and Daniel Hsu. Learning single-index models in gaussian space. In Conference On Learning Theory, pages 1887–1930. PMLR, 2018.
Hamid Eftekhari, Moulinath Banerjee, and Ya'acov Ritov. Inference in high-dimensional single-index models under symmetric designs. Journal of Machine Learning Research, 22(27):1–63, 2021.
Federica Gerace, Bruno Loureiro, Florent Krzakala, Marc Mézard, and Lenka Zdeborová. Generalisation error in learning with random features and the hidden manifold model. In International Conference on Machine Learning, pages 3452–3462. PMLR, 2020.
Haotian Gu, Yizhou Xu, and Lenka Zdeborová. In-context learning of single-index targets: Comparing kernel and feature learners, 2026. URL https://arxiv.org/abs/2610.01712.
Nirmit Joshi, Hugo Koubbi, Theodor Misiakiewicz, and Nati Srebro. Learning single index models via harmonic decomposition. Advances in Neural Information Processing Systems, 38:45052–45127, 2026.
Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are RNNs: Fast autoregressive transformers with linear attention. In International conference on machine learning, pages 5156–5165. PMLR, 2020.
Mary Letey, Yue M. Lu, Cengiz Pehlevan, and Jacob A Zavatone-Veth. Sequential correlations change in-context learning: Effective context length and architectural mismatch. In High-dimensional Learning Dynamics 2026, 2026a. URL https://openreview.net/forum?id=AYprbQxAbI.
Mary Letey, Jacob A Zavatone-Veth, Yue M. Lu, and Cengiz Pehlevan. Pretrain-test task alignment governs generalization in in-context learning. In The Fourteenth International Conference on Learning Representations, 2026b. URL https://openreview.net/forum?id=KZLeg0MQ2r.
Ker-Chau Li and Naihua Duan. Regression analysis under link violation. The Annals of Statistics, 17(3):1009–1052, 1989.
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. URL https://www.pnas.org/doi/abs/10.1073/pnas.2502599122.
Song Mei and Andrea Montanari. The generalization error of random features regression: Precise asymptotics and the double descent curve. Communications on Pure and Applied Mathematics, 75(4):667–766, 2022.
Kazusato Oko, Yujin Song, Taiji Suzuki, and Denny Wu. Pretrained transformer efficiently learns low-dimensional target functions in-context, 2024. URL https://arxiv.org/abs/2411.02544.
Imanol Schlag, Kazuki Irie, and Jürgen Schmidhuber. Linear transformers are secretly fast weight programmers. In International conference on machine learning, pages 9355–9366. PMLR, 2021.
Christos Thrampoulidis, Ehsan Abbasi, and Babak Hassibi. Lasso with non-linear measurements is equivalent to one with linear measurements. Advances in Neural Information Processing Systems, 28, 2015.
Johannes Von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vladymyrov. Transformers learn in-context by gradient descent. In Andreas Krause, Emma Brunskill, Kyunghyun Cho, Barbara Engelhardt, Sivan Sabato, and Jonathan Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 35151–35174. PMLR, 23–29 Jul 2023. URL https://proceedings.mlr.press/v202/von-oswald23a.html.
Songlin Yang, Bailin Wang, Yikang Shen, Rameswar Panda, and Yoon Kim. Gated linear attention transformers with hardware-efficient training. arXiv preprint arXiv:2312.06635, 2023.
Songlin Yang, Bailin Wang, Yu Zhang, Yikang Shen, and Yoon Kim. Parallelizing linear transformers with the delta rule over sequence length. Advances in neural information processing systems, 37:115491–115522, 2024.
Yufeng Zhang, Fengzhuo Zhang, Zhuoran Yang, and Zhaoran Wang. What and how does in-context learning learn? bayesian model averaging, parameterization, and generalization, 2023. URL https://arxiv.org/abs/2305.19420.
A Gaussian equivalent for
The input to the nonlinearity will be . In order to expand in the basis of Hermite polynomials, we must first understand the distribution of this random variable. We know that, conditional on fixed task w,
for
Now consider the distribution of the scale random variable induced by . Let for . For a matrix , define . We have that
We will thus assume two conditions on C.
• Scaling freedom. We fix or . If the goal is to study the effect of isotropy or anisotropy induced by task covariance , it makes sense to normalise to total amount of signal, which is equivalent to normalising . This also corresponds to normalising the strength of the input to the nonlinearity, which is also standard in actual neural networks.
• Sufficient effective rank. We will of course need to control the fluctuations of the scale away from 1. This corresponds to controlling the effective rank: we will assume
Note that this is not a superfluous condition; it is precisely the condition that will be needed for the later application of the formulas from Letey et al. (2026b).
To justify representing by g in the moments below, first consider the fourth moment
If grows at most polynomially, then for in a neighbourhood of 1 the integrand is dominated by a function of the form , with in a small neighbourhood of . Thus the fourth moment is finite and, by dominated convergence, . The same argument applies to the other moments involving polynomials of and that are used below. Since and by the assumptions above, we have in probability.
Given the above arguments, we will heuristically proceed in Appendix B with the usual treatment of as for . Again, we reiterate that this replacement is true asymptotically using the trace scaling, effective rank, and uniform integrability assumptions above; it is not true that identically, the way it would if we assumed was spherical, as is standard in the SIM literature
B Population averages
From the assumptions and discussion in Appendix A, we will treat asymptotically and proceed with the moment calculations using Hermite expansion. When appears in an expression, we will write this as for precision, knowing that is a random variable we are asymptotically treating as 1.
Lemma 1: Conditional expectations of order-two quantities
For fixed with , we have conditional expectations (over and ) given by
Proof. First, we have
Then (12) follows from
Decompose into the component aligned with and its orthogonal component:
Combining these expressions,
Equation (13) follows by vectorising this expression. For the final moment calculation, we write
We compute each of the three blocks directly.
We neglect the last in our final expression. For the vector block, we have
Finally the scalar block is
Together, the leading terms in these three blocks give (14).
C Derivation of the ICL formula
This section will demonstrate how our stated formula for ICL error follows directly from the moment calculations in Section B and the results and derivation of Letey et al. (2026b). In particular, comparing equations (12), (13), and (14) with Lemma 2 of Letey et al. (2026b), we see that the nonlinear link function affects the second-moment expressions for , , and only through the transformations
This immediately gives the stated result so long as .
To treat the case , we return to the task-conditional second moments. Setting gives
We see that there is no longer any task randomness in these moments, which simplifies the resolvent calculation. Following closely the calculation of Letey et al. (2026b), we arrive at a similar self-consistent asymptotic expression for the extended resolvent
for
Previously, would have contained task randomness that would have made difficult to analyse. Here, however, we obtain the simpler equation
Write ; we seek solutions where is nonnegative. Taking the ridgeless limit , we obtain
Substituting above and directly into the formula of Letey et al. (2026b) gives
which is exactly (10).