Saved in:
Bibliographic Details
Main Authors: Letey, Mary I., Zavatone-Veth, Jacob A., Lu, Yue M., Pehlevan, Cengiz
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2509.26551
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909816871452672
author Letey, Mary I.
Zavatone-Veth, Jacob A.
Lu, Yue M.
Pehlevan, Cengiz
author_facet Letey, Mary I.
Zavatone-Veth, Jacob A.
Lu, Yue M.
Pehlevan, Cengiz
contents In-context learning (ICL) is a central capability of Transformer models, but the structures in data that enable its emergence and govern its robustness remain poorly understood. In this work, we study how the structure of pretraining tasks governs generalization in ICL. Using a solvable model for ICL of linear regression by linear attention, we derive an exact expression for ICL generalization error in high dimensions under arbitrary pretraining-testing task covariance mismatch. This leads to a new alignment measure that quantifies how much information about the pretraining task distribution is useful for inference at test time. We show that this measure directly predicts ICL performance not only in the solvable model but also in nonlinear Transformers. Our analysis further reveals a tradeoff between specialization and generalization in ICL: depending on task distribution alignment, increasing pretraining task diversity can either improve or harm test performance. Together, these results identify train-test task alignment as a key determinant of generalization in ICL.
format Preprint
id arxiv_https___arxiv_org_abs_2509_26551
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Pretrain-Test Task Alignment Governs Generalization in In-Context Learning
Letey, Mary I.
Zavatone-Veth, Jacob A.
Lu, Yue M.
Pehlevan, Cengiz
Machine Learning
In-context learning (ICL) is a central capability of Transformer models, but the structures in data that enable its emergence and govern its robustness remain poorly understood. In this work, we study how the structure of pretraining tasks governs generalization in ICL. Using a solvable model for ICL of linear regression by linear attention, we derive an exact expression for ICL generalization error in high dimensions under arbitrary pretraining-testing task covariance mismatch. This leads to a new alignment measure that quantifies how much information about the pretraining task distribution is useful for inference at test time. We show that this measure directly predicts ICL performance not only in the solvable model but also in nonlinear Transformers. Our analysis further reveals a tradeoff between specialization and generalization in ICL: depending on task distribution alignment, increasing pretraining task diversity can either improve or harm test performance. Together, these results identify train-test task alignment as a key determinant of generalization in ICL.
title Pretrain-Test Task Alignment Governs Generalization in In-Context Learning
topic Machine Learning
url https://arxiv.org/abs/2509.26551