atlas

Research map / Architectures and efficiency / Attention and transformers

How Transformers Utilize Multi-Head Attention in In-Context Learning? A Case Study on Sparse Linear Regression

NeurIPS 2024 · Architectures and efficiency › Attention and transformers · approach: Training dynamics of in-context learning · 1 citations (OpenAlex)

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.

Studies how a trained multi-head transformer performs in-context sparse linear regression, finds multi-head use in the first layer and a single dominant head in later layers, and proposes and theoretically analyzes a preprocess-then-optimize mechanism.

Problem

Trained transformers' in-context learning mechanisms, especially the role of multiple heads across layers, are poorly understood; prior theory mostly relies on hand-designed constructions for linear regression.

Approach

Empirically, the first attention layer uses all heads significantly while later layers rely on one head; this motivates a preprocess-then-optimize hypothesis where layer one reweights features by estimated feature-label correlations and later layers run gradient descent on the preprocessed data, which provably achieves lower excess risk than GD or ridge on raw features.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Increase the number of attention heads (from h=1 to h=4 or h=8)Transformer · Sparse linear regressionexcess riskHelped
Mask individual heads in the first layer (ablation)Trained multi-head transformer · Sparse linear regressionrelative excess-risk increase after maskingMixed
Mask individual heads in subsequent layers (ablation)Trained multi-head transformer · Sparse linear regressionrelative excess-risk increase after maskingMixed
Keep all first-layer heads and only the most important head in subsequent layers (ablation)Trained multi-head transformer · Sparse linear regressionexcess riskNo clear effect
Use multiple heads (h=4,8) rather than a single head to produce first-layer representations for gradient-descent probingTransformer · Sparse linear regressionexcess risk after gradient descent on probed representationsHelped
Preprocess the data before gradient descentGradient descent on sparse linear regression examples · Sparse linear regressionexcess riskHelped
Use multi-head attention in the first layer and retain one head in subsequent layers, rather than single-head attention throughoutTransformer · Sparse linear regressionexcess riskHelped

Surprising findings

Limitations

Experimental setup

Datasets: synthetic sparse linear regression data (d=16, s=4, Gaussian features)

Benchmarks: synthetic sparse linear regression

Metrics: excess risk head importance weight probing excess risk

Baselines: ordinary least squares ridge regression lasso gradient descent on raw inputs

Builds on: gradient descent emulation by transformers linear attention transformers ridge regression Lasso

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