atlas

Research map / Architectures and efficiency / Attention and transformers

When can in-context learning generalize out of task distribution?

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Training dynamics of in-context learning · 0 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.

Trains GPT-2-style transformers for in-context linear regression with task vectors drawn from hyperspherical caps of varying angle, finding a sharp transition from specialized to out-of-task-distribution generalizing ICL as task diversity grows.

Problem

When can in-context learning generalize to tasks outside the pretraining task distribution, and what pretraining task diversity is required for this out-of-distribution generalization?

Approach

Defines a new notion of task diversity based on the angular size of the pretraining task subset on the hypersphere (cap half-angle), distinct from the number of pretraining tasks, and shows a sharp specialization-to-generalization transition as this diversity increases; a phase diagram combines both diversity axes.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Increase the pretraining task-cap half-angle beyond about 120°Transformer trained on linear regression ICL · Linear regression, tasks outside the training captest MSEHelped
Increase the pretraining task-cap half-angle from the specialized regime to about 135°Transformer trained on noisy linear regression ICL · Linear regression with σ² = 1/4, OOD tasksexcess test errorHelped
Increase task diversityTransformer trained on linear regression ICL · Linear regression, short in-distribution contextstest errorMixed
Increase task diversity to φ ≳ 45°Transformer pretrained on tasks with radius R=1 · Tasks with R<1test errorHelped
Increase the number of pretraining tasksTransformer trained on linear regression ICL · In-distribution tasks interpolated between training tasksloss relative to dMMSEHelped
Increase regression dimension (ablation)Transformer trained on linear regression ICL · Linear regression, OOD taskstransition angleNo clear effect
Vary transformer depth (ablation)Transformer trained with N=2¹¹ tasks · Linear regression, OOD taskstransition angleNo clear effect
Replace linear labels with logistic-regression classification labels (ablation)Transformer trained for ICL · Logistic regression, OOD taskstest errorHelped
Replace linear labels with nonlinear ReLU regression labels (ablation)Transformer trained for ICL · Nonlinear regression, OOD taskstest lossHelped
Restrict input vectors to a hyperspherical cap while keeping task vectors uniform over the full sphere (ablation)Transformer trained on linear regression ICL · Data distribution shift, OOD taskstest errorHelped
Remove input components perpendicular to the cap-center vector during early training (ablation)Transformer trained with φ=45° · Linear regression trainingtraining lossNo clear effect

Surprising findings

Limitations

Experimental setup

Datasets: synthetic linear regression tasks sampled from hyperspherical caps

Benchmarks: synthetic linear regression test bands on hypersphere (delta=175 deg OOD, delta near 0 ID)

Metrics: mean squared error normalized NSR transition metric

Baselines: ordinary least squares Bayes-optimal estimator dMMSE estimator

Builds on: Raventós et al. pretraining task diversity AdamW GPT-2

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