stat.MLFeb 5, 2025

Why Transformers Struggle with Distribution-Independent In-Context Learning

Authors: Omar Naim, Jerome Bolte, Nicholas Asher

Organizations: Institut de Recherche en Informatique de Toulouse; University of Toulouse; Toulouse, France · Toulouse School of Economics; University of Toulouse Capitole; Toulouse, France · Institut de Recherche en Informatique de Toulouse; Centre Nationale de la Recherche Scientifique; Toulouse, France

Abstract

With in-context learning (ICL), transformer models adapt to new tasks from illustrative examples at inference time without updating their parameters. A common interpretation is that transformers implement implicit learning algorithms in their forward pass. We test this interpretation and ICL capability under distribution shift in noiseless polynomial regression, where the context uniquely determines the target function. Models that are near-perfect in distribution exhibit sharp performance degradation under shifts in the input or target-function distribution. This behavior persists across polynomial degrees and multiple training interventions, and in higher-dimensional nonlinear regression. We identify two architectural mechanisms that explain this breakdown: output saturation at finite boundary values linked to final normalization, and attention concentration on a small subset of the context, which can limit context-dependent adaptation required for ICL. Controlled experiments, architectural ablations, targeted interventions, and theoretical analysis provide strong evidence for both mechanisms and their consequence: strong in-distribution ICL does not imply distribution-independent ICL, which calls for caution when using ICL instead of explicit retraining or adaptation under distribution shift.

Figures & tables

Appendix figures & tables24 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Transformers Learn Robust In-Context Regression under Distributional Uncertainty

    Mar 19, 2026Hoang T. H. Cao, Hai D. V. Trinh, Tho Quan +1in-context regressionIn-Context Learning

  2. Optimal In-context Adaptivity and Distributional Robustness of Transformers

    Oct 27, 2025Tianyi Ma, Tengyao Wang, Richard J. SamworthIn-Context LearningDistribution Shift Robustness

  3. Bigger Is Safer: Provable Robustness in In-Context Learning Scales with Capacity

    Feb 19, 2026Di Zhang, Ningxu Zhang, Zimeng LiuIn-Context LearningDistribution Shift Robustness