arXiv:2610.17061stat.MLOct 2026

Manuscript Offprint

arXiv:2610.17061

In-context classification: Calibration and noise in linear attention with softmax readout

Arman Rysmakhanov, Mary Letey, Yue M. Lu, Jacob Zavatone-Veth, Cengiz Pehlevan

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

ABSTRACT

We study in-context binary classification in a simple attention model trained to minimise a logistic loss. Each prompt has a latent logistic teacher, and the learner must infer its direction from Bernoulli-labeled context examples. We derive an asymptotic prediction for the test logit in a high-dimensional regime with context length ℓ∝d\ell \propto d and total training prompts n∝d2n \propto d^2. Our formula cleanly separates calibration, test-time context noise, and non-isotropic parameter-estimation noise as interpretable effects on in-context performance. Our analysis also identifies the ridgeless separability regime and addresses the effects of context length, pretraining-set size, regularisation, and sampling temperature on in-context classification performance. The theory’s predictions closely agree with finite-dimensional simulations and fully trained linear-attention models, while experiments with standard softmax attention show qualitatively related behaviour beyond the regime assumed by our analysis.

1 INTRODUCTION

In-context learning (ICL) is the ability of a model to adapt its predictions from examples in a prompt, without updating its parameters (Brown et al., 2020; Von Oswald et al., 2023; Wei et al., 2022). It is a striking capability of modern sequence models, which can, for instance, implement a range of statistical algorithms in-context (Bai et al., 2023). However, the statistical mechanism that turns a context into a new-task prediction is not fully understood.

Simplified ICL models offer a useful route to this question because they make explicit which prompt statistics an architecture can use (Akyürek et al., 2023; Von Oswald et al., 2023; Zhang et al., 2023; Lu et al., 2025; Oko et al., 2024; Vasudeva et al., 2025; Letey et al., 2026b,a). In particular, a significant body of recent work has explored ICL in the context of the test problem of linear regression. For these tasks, linear attention (Katharopoulos et al., 2020) has been shown to be a good surrogate for understanding how and what transformers learn (Ahn et al., 2024; Zhang et al., 2024; Wu et al., 2024; Lu et al., 2025; Letey et al., 2026b,a; Bordelon et al., 2025). Together, these works demonstrate how reduced models can yield substantial insight into the mechanisms of ICL.

Despite extensive progress in the theory of in-context learning, many works focus on regression; binary classification introduces qualitatively different questions and phenomena. In the setting studied here, each prompt is generated by a latent task direction, and its context labels are Bernoulli observations determined by that direction. A successful predictor must therefore output a calibrated probability rather than merely recover a sign. Logistic regression, a canonical high-dimensional inference problem, is a natural target for such investigation. This problem has been widely studied (Mai et al., 2019; Sur and Candès, 2019), including its phase transitions (Candes and Sur, 2018; Barbier et al., 2019), universality (Pesce et al., 2023), and generalisation (Gerace et al., 2020; Mei and Montanari, 2022), leading to a rich understanding of a single instance of this estimation problem.

∗^{*}Equal contribution.

†^{\dagger}This work was performed while at Harvard University.

By contrast, the in-context setting involves learning a general estimator that can approximately solve new instances of logistic regression. Recent works have investigated whether transformers can learn to do this, perhaps by performing normalised gradient descent (Zhang and Cao, 2026). Moreover, studies of multiclass classification have shown that properties of the data greatly affect the model's ability to learn in-context (Chan et al., 2022). Yet, a detailed understanding of in-context classification, comparable to what has been achieved for regression, is still lacking.

Here, we study in-context logistic regression using a reduced linear-attention model with a softmax readout. We derive a high-dimensional characterisation of the output logit, and corresponding test errors, in a proportional regime where context length scales with token dimension and the number of pretraining sequences scales with its square. We characterise the joint law of the output logit and teacher logit, leading to the following findings.

• The form of the output logit is highly interpretable, and decomposes into three parts: scaling of the teacher-aligned signal, noise from test-time context, and anisotropy induced by finitely many pretraining sequences.

  • This separation distinguishes the roles of context length and training-set size, and recovers the Bayes logit in the joint large-context, large-pretraining-data ridgeless limit.

• We predict the separability boundary at which the ridgeless logistic estimator ceases to have a finite solution.

• Finally, we verify the theory through finite-dimensional simulations and show that its predicted logit distribution describes the output of a trained linear-attention model.

References (40)