mlsanityData to 14 Oct 2026

Theory on Attention Dynamics for Out-of-Distribution In-Context Learning

arXiv 2609.36448 ↗First posted 29 Sep 2026cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Transformers have demonstrated remarkable in-context learning (ICL) capabilities, enabling them to perform new tasks without additional fine-tuning. However, their performance often deteriorates when encountering out-of-distribution (OOD) inputs that deviate from the training distribution, and the underlying theory remains poorly understood. To fill this gap, we characterize the OOD error under the input distribution shift through the interplay between the dynamics of the so-called α-type and β-type attention weights, which represent the transformer's confidence in identifying the correct and incorrect features, respectively. Our results indicate that the OOD error for each feature depends on all pairwise interactions between the training features and OOD features, and under certain cases the transformer performs no better than random guessing. To improve the OOD generalization performance, we next investigate the impact of model finetuning with the OOD data, and particularly, characterize the model forgetting performance on the source domain. Interestingly, the performance on the source domain may not always degrade after finetuning, which highly depends on the nature of the feature shift: finetuning on OOD domain keeps enhancing the confidence of identifying correct features from the original distribution, while the interference from other incorrect features may either increase or decrease. Extensive experiments on both synthetic and real data are conducted to corroborate the theoretical insights.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 61 of its 73 references that are in the map. First posted on arXiv 29 Sep 2026.

Builds on

61 of 73 references.

References · 61

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2020The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution Generalizationcited by 1,850
  4. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  5. 2022In-context Learning and Induction Headscited by 964
  6. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  7. 2023A Comprehensive Survey of Continual Learning: Theory, Method and Applicationcited by 872
  8. 2022Transformers learn in-context by gradient descentcited by 732
  9. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  10. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  11. 2023Larger language models do in-context learning differentlycited by 394
  12. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
38 more
  1. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
  2. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
  3. 2020Pretrained Transformers Improve Out-of-Distribution Robustnesscited by 294
  4. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  5. 2023Looped Transformers as Programmable Computerscited by 237
  6. 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
  7. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
  8. 2021CDTrans: Cross-domain Transformer for Unsupervised Domain Adaptationcited by 129
  9. 2024In-Context Learning with Long-Context Models: An In-Depth Explorationcited by 128
  10. 2023The Learnability of In-Context Learningcited by 127
  11. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
  12. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
  13. 2023In-Context Convergence of Transformerscited by 115
  14. 2024Revisiting Catastrophic Forgetting in Large Language Model Tuningcited by 99
  15. 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
  16. 2021Delving Deep into the Generalization of Vision Transformers under Distribution Shiftscited by 85
  17. 2023In-Context Learning through the Bayesian Prismcited by 83
  18. 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 75
  19. 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 74
  20. 2022Safe Self-Refinement for Transformer-based Domain Adaptationcited by 61
  21. 2024Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformerscited by 50
  22. 2023A Latent Space Theory for Emergent Abilities in Large Language Modelscited by 43
  23. 2024An Information-Theoretic Analysis of In-Context Learningcited by 40
  24. 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
  25. 2024On the Out-Of-Distribution Generalization of Multimodal Large Language Modelscited by 30
  26. 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformerscited by 28
  27. 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
  28. 2022On the Compositional Generalization Gap of In-Context Learningcited by 24
  29. 2024Can In-context Learning Really Generalize to Out-of-distribution Tasks?cited by 23
  30. 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
  31. 2024Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannotcited by 22
  32. 2024Probing the Decision Boundaries of In-context Learning in Large Language Modelscited by 17
  33. 2024One-Layer Transformer Provably Learns One-Nearest Neighbor In Contextcited by 16
  34. 2025When can in-context learning generalize out of task distribution?cited by 16
  35. 2023Towards Understanding How Transformers Learn In-context Through a Representation Learning Lenscited by 15
  36. 2024Trained Transformer Classifiers Generalize and Exhibit Benign Overfitting In-Contextcited by 15
  37. 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
  38. 2025Understanding In-Context Learning on Structured Manifolds: Bridging Attention to Kernel Methodscited by 15

50 most cited of 61 All 61 (JSON)

Built on by

Not cited yet.