atlas

Research map / Label-efficient and robust learning / OOD and anomaly detection

Can In-context Learning Really Generalize to Out-of-distribution Tasks?

ICLR 2025 · Label-efficient and robust learning › OOD and anomaly detection · approach: Out-of-distribution generalization theory · 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.

Shows via synthetic GPT-2 experiments and theory that ICL on OOD function classes tends to implement pretraining function classes (with gradient descent-like behavior), only solves abstract-label classification in-distribution, and selects pretraining priors by low test error and input-distribution similarity.

Problem

Whether in-context learning can truly generalize to out-of-distribution tasks unseen during pretraining, and what mechanism governs ICL's behavior on OOD tasks.

Approach

ICL on OOD functions behaves like the pretraining function class optimized by gradient descent on the context; when pretrained on multiple tasks, ICL selects the pretraining function with lower test error on the context and the input distribution closest to the downstream one, backed by a theorem on a mixed-Gaussian pretraining model.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use ICL on a function class not seen during pretrainingGPT-2 pretrained on linear, quadratic, or ReLU regression · Unseen mathematical function classestest errorMixed
Train on retrieval tasks with more diverse random label mappings (ablation)Transformer retrieval model · Retrieval with OOD labelstest errorHelped
Train on the largest tested range of label mappings, s~U(100, 2000) (ablation)Transformer on linear regression + retrieval · Unseen abstract labelstest errorHelped
Increase the number of in-distribution linear-regression training vectors (ablation)GPT-2 pretrained on linear regression · Quadratic and ReLU NN regressiontest errorNo clear effect
Evaluate on an OOD quadratic-regression function instead of an ID linear-regression function (ablation)Transformer pretrained on linear regression + retrieval · Quadratic regression + retrieval with OOD labelstest errorHurt
Use synthetic OOD word classification rather than retrievalLlama-3-8B · Synthetic word classification and retrievalaccuracyHurt
Pretrain GPT-2 on the same synthetic word-classification taskGPT-2 · Synthetic word classificationtest errorHelped
Pretrain on a mixture of linear, quadratic, and ReLU regression tasks instead of one task (ablation)GPT-2 · Square root, cubic, linear+quadratic, and 2-layer Sigmoid regressiontest errorHelped
Use a pretraining function class with lower error on the downstream contextICL algorithm selection · OOD taskstest errorHelped
Use a pretraining input distribution closer to the downstream input distributionICL algorithm selection · OOD taskspretraining-task weightHelped
Increase context length when classifying ambiguous sentencesReal-world LLMs · Ambiguous sentence classificationtop-5 accuracyHelped
Predict the reversed query word rather than the reversed target labelLlama-3-8B · Antonym, country-capital, English-French, and English-Germantop-1 accuracyHelped

Surprising findings

Limitations

Experimental setup

Datasets: synthetic Gaussian function-regression data SST-2-style abstract-label tasks Llama-3-8B word embeddings for synthetic word classification antonym, country-capital, English-French, English-German translation pairs

Benchmarks: synthetic OOD function regression (square root, cubic, linear+quadratic, 2-layer sigmoid) synthetic word classification with Llama embeddings ambiguous sentence classification (sentiment/type/location)

Metrics: test square error top-1 accuracy top-5 accuracy prefix matching score

Baselines: gradient descent-trained models of the pretraining function class single-task pretrained GPT-2 models Llama-2-7B Llama-3-8B

Builds on: Transformers learn in-context by gradient descent Bayesian ICL theory for mixed Gaussian pretraining what one-layer linear self-attention learns in context

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