In-context Learning of Single-index Targets: Comparing Kernel and Feature Learners

cs.LG cond-mat.dis-nn stat.ML Haotian Gu, Yizhou Xu, Lenka Zdeborov\'a · Oct 1, 2026
Local to this browser
What it does
This paper studies nonlinear in-context learning via single-index models, comparing a kernel learner (fixed spherical-harmonic features followed by linear attention) against a feature learner (linear attention on raw inputs followed by a...
Why it matters
Using the replica method, the authors derive predictions for memorization and generalization errors across varying pretraining data, task diversity, and context lengths, and validate them numerically over a broad parameter range. The...
Main concern
The paper makes a useful theoretical advance by clearly delineating when fixed-kernel and feature-learning ICL architectures excel. Its core replica-based predictions match finite-dimensional experiments well, and the revealed...
Community signal
0
0 up · 0 down
Sign in to vote with arrows
AI Review AI reviewed
Plain-language introduction

This paper studies nonlinear in-context learning via single-index models, comparing a kernel learner (fixed spherical-harmonic features followed by linear attention) against a feature learner (linear attention on raw inputs followed by a learned nonlinear readout). Using the replica method, the authors derive predictions for memorization and generalization errors across varying pretraining data, task diversity, and context lengths, and validate them numerically over a broad parameter range. The analysis reveals phase diagrams for architectural advantage and qualitatively different context-length scalings: the kernel learner needs $L = \Theta(d^k)$ to recover degree-$k$ harmonics, while the feature learner exploits all teacher components at $L = \Theta(d)$.

Critical review
Verdict
Bottom line

The paper makes a useful theoretical advance by clearly delineating when fixed-kernel and feature-learning ICL architectures excel. Its core replica-based predictions match finite-dimensional experiments well, and the revealed context-length scaling laws are conceptually crisp. However, the analysis relies on a non-rigorous replica ansatz and an idealized two-stage training protocol, so the results are best read as a well-validated model study rather than a rigorous or practically universal description of nonlinear ICL.

“The results are derived using the replica method together with a Gaussian-equivalence ansatz... In our ICL setting, however, we use it as an ansatz and validate the resulting predictions numerically.”
paper · Section 3
“we idealize its estimation error away by taking $N' \to \infty$ and $N'/N \to 0$”
paper · Section 2.3
What holds up

The replica predictions closely match numerical experiments across parameter regimes, as seen in Figure 2 where solid replica curves and numerical circles align. The context-length scaling distinctions are particularly sharp: the kernel learner exhibits stage-wise learning at separate $d^k$ scales while the feature learner transitions once at $L=\Theta(d)$, with both effects confirmed in Figure 4. The phase diagrams in Figure 3 honestly map regions where each architecture is advantageous.

“we can observe a good agreement between the numerics and the replica prediction”
paper · Section 4.1
“The kernel learner acquires the degree-one and degree-two components at the separate scales $L \asymp d$ and $L \asymp d^{2}$, whereas the feature learner recovers both components at the same time.”
paper · Figure 4 caption
Main concerns

The analysis rests on three significant idealizations. First, the replica method is explicitly non-rigorous in this ICL setting: 'In our ICL setting, however, we use it as an ansatz and validate the resulting predictions numerically.' Second, the feature learner's training is idealized in two stages with infinite fresh data for the readout—'we idealize its estimation error away by taking $N' \to \infty$ and $N'/N \to 0$'—which may not reflect practical joint training dynamics. Third, the kernel learner uses spherical-harmonic features hand-crafted to contain the exact teacher: 'because the degree-one and degree-two harmonic basis contains the teacher, the kernel learner has no representation error ($\nu_{\rm out}=0$),' giving it an unrealistic advantage over generic random-feature embeddings that practical fixed-kernel methods would actually use.

“In our ICL setting, however, we use it as an ansatz and validate the resulting predictions numerically.”
paper · Section 3
“we idealize its estimation error away by taking $N' \to \infty$ and $N'/N \to 0$”
paper · Section 2.3
“Note that because the degree-one and degree-two harmonic basis contains the teacher, the kernel learner has no representation error ($\nu_{\rm out}=0$).”
paper · Section 4
Evidence and comparison

Within the studied idealized model, the evidence supports the claims: the phase diagrams in Figure 3 systematically vary task diversity, context length, and pretraining size, showing consistent regions where each learner wins. Comparisons to related work are fair—the authors clearly position their contribution against linear-target ICL theory and cite the relevant parallel work on single-index models by Oko et al. and Nishikawa et al. The key caveat is that the scope is narrow (one-layer linear attention, isotropic spherical data, hand-crafted or two-stage readouts), so the practical relevance to standard softmax-attention Transformers remains open.

“Most of this theory, however, focuses on linear targets. Nonlinear tasks introduce an additional question... Single-index models provide a natural setting for this question”
paper · Section 1
Reproducibility

No code repository or supplementary code is mentioned. While hyperparameters are reported in Section 4 ($\Delta=0.01$, $\lambda=0.001$, L-BFGS, AdamW) and the task construction is fully specified, independently reproducing the replica fixed-point equations would require significant implementation effort without released code. The numerical experiments themselves are deterministic given the protocol, so in principle an independent implementation could verify the teacher-kernel overlap case shown in Figure 2, but the barrier to reproduction is nontrivial.

Abstract

In-context learning (ICL) enables a pretrained model to infer a task from demonstrations without updating its parameters. While much of the existing theory focuses on linear target functions, in this paper we study nonlinear cases by comparing two one-layer attention architectures on the same family of single-index tasks. A kernel learner first maps inputs through a fixed nonlinear feature map and then applies linear attention, whereas a feature learner applies attention to the original input, followed by a learned nonlinear readout. We derive predictions for their memorization and generalization errors using the replica method, retaining the effects of pretraining size, task-pool diversity, and training and inference context lengths. The resulting predictions closely match numerical experiments across a broad range of regimes. Our analysis yields phase diagrams that characterize when each architecture is advantageous as the amount of pretraining data, task diversity, and context lengths vary. We further identify qualitatively different context-length scalings for the two learners. Together, these results clarify how architectural choices interact with the dataset and govern nonlinear in-context learning.

Challenge the Review

Pick a starting point or write your own. Challenges run in the background, so you can keep reading while the AI investigates.

No challenges yet. Disagree with the review? Ask the AI to revisit a specific claim.