atlas

Research map / Architectures and efficiency / Attention and transformers

In-Context Linear Regression Demystified: Training Dynamics and Mechanistic Interpretability of Multi-Head Softmax Attention

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Attention head mechanisms

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Empirically and theoretically dissects how randomly initialized one-layer multi-head softmax attention learns in-context linear regression, showing it converges to a near-debiased gradient descent predictor with sign-matching, homogeneous KQ scaling and zero-sum OV patterns, extended to non-isotropic and multi-task settings.

Problem

Understanding how multi-head softmax attention is trained to perform in-context linear regression, including the emergent KQ/OV weight structure, its learned predictor, and its statistical efficiency relative to single-head, linear attention, and Bayes-optimal estimators.

Approach

Shows that gradient training from random initialization produces diagonal KQ and last-entry OV patterns with sign-matched positive/negative heads and zero-sum OV; reduces the model to an approximate loss in (omega, mu) and proves the learned multi-head predictor approximates one-step debiased GD, nearly Bayes-optimal up to a constant factor.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add a second attention headSingle-head softmax attention · In-context linear regressionprediction errorHelped
Increase the number of heads from one to two or moreSoftmax attention · In-context linear regressionprediction errorHelped
Increase the number of heads beyond twoMulti-head softmax attention · In-context linear regressionprediction errorNo clear effect
Replace softmax attention with linear attention (ablation)Transformer for in-context linear regression · Longer test sequenceslength generalizationHurt
Increase the test sequence lengthSoftmax attention · In-context linear regressionprediction errorHelped
Use multi-head softmax attention instead of the vanilla gradient descent predictorIn-context linear regression · In-context linear regressionprediction errorNo clear effect
Use multi-head attention instead of the Bayes estimatorIn-context linear regression · In-context linear regressionprediction errorHurt
Increase the number of heads from one to four in the two-task settingMulti-task in-context linear regression · Two-task linear regression (N=2)task-specific predictor capabilityHelped
Use three heads rather than assigning two dedicated heads to each taskMulti-task in-context linear regression · Two-task linear regression (N=2)debiased gradient descent approximationNo clear effect

Surprising findings

Limitations

Experimental setup

Datasets: synthetic linear regression data generated on the fly

Benchmarks: synthetic in-context linear regression (ICL loss vs. sequence length)

Metrics: ICL prediction loss (MSE)

Baselines: single-head softmax attention linear attention vanilla GD predictor debiased GD predictor optimally tuned ridge (Bayes) estimator

Builds on: linear transformers implement preconditioned gradient descent softmax attention as kernel regressor in-context linear regression KQ and OV circuits

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy