In-context classification: Calibration and noise in linear attention with softmax readout
stat.ML, cs.LG
Submitted: 2026-10-12
Updated: 2026-10-12
License: http://creativecommons.org/licenses/by/4.0/
The gist: We study in-context binary classification in a simple attention model trained to minimise a logistic loss.
Terminology
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 proportional to token dimension, and total training prompts proportional to dimension squared. 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.
Sources
- Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Time
- The phase transition for the existence of the maximum likelihood estimate in high-dimensional logistic regression
- Phase transitions for the existence of unregularized M-estimators in single index models
- Pretrained transformer efficiently learns low-dimensional target functions in-context
- Transformers Efficiently Perform In-Context Logistic Regression via Normalized Gradient Descent
Related papers
- Behavior of prediction performance metrics with rare events
- Optimal Estimation of Generic Dynamics by Path-Dependent Neural Jump ODEs
- A Posterior-Dynamics Framework for Imaging Inverse Problems with Pretrained Diffusion Priors
- Efficient quadratic entropy with distance sketches
- Embedding-Bias in Conditional Independence Testing
- From Log-Odds to Shapley Values: An Explanatory Geometry for the Weighted Naive Bayes Classifier