mlsanityData to 14 Oct 2026

Understanding Generalization and Forgetting in In-Context Continual Learning

arXiv 2605.28705 ↗First posted 27 May 2026cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

In-context learning (ICL) derives its power from enabling Large Language Models to adapt to new tasks via prompt-based reasoning alone, entirely bypassing the need for parameter updates. Existing theories primarily study ICL in single-task settings, while real-world prompts often contain sequences of heterogeneous tasks, leaving a gap in understanding whether Large Language Models implicitly perform continual learning during inference. To bridge this gap, we propose the first theoretical framework for in-context continual learning, modeling how a pretrained Transformer processes multiple sequential tasks within a single prompt through shared attention mechanisms. Focusing on linear and masked linear self-attention, we derive error expressions for model predictions under sequential task prompts and analyze their generalization and forgetting behavior. Our results reveal that standard attention mechanisms inevitably induce intertask interference by uniformly or causally aggregating historical contexts, leading to systematic bias. We further provide a bias-variance-interference decomposition of prediction error, characterizing when historical in-context information yields positive transfer or provable negative transfer. This analysis exposes fundamental limits of attention-based continual inference and offers theoretical explanations for order sensitivity and performance degradation in long prompts.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 37 of its 43 references that are in the map. First posted on arXiv 27 May 2026.

Builds on

37 of 43 references.

References · 37

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2024Qwen2.5 Technical Reportcited by 4,942
  3. 2015Character-level Convolutional Networks for Text Classificationcited by 2,330
  4. 2018Experience Replay for Continual Learningcited by 1,095
  5. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  6. 2022Transformers learn in-context by gradient descentcited by 732
  7. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  8. 2018Overcoming catastrophic forgetting with hard attention to the taskcited by 681
  9. 2023Are Emergent Abilities of Large Language Models a Mirage?cited by 523
  10. 2021MetaICL: Learning to Learn In Contextcited by 454
  11. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  12. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
25 more
  1. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
  2. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  3. 2024Continual Learning of Large Language Models: A Comprehensive Surveycited by 234
  4. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
  5. 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
  6. 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 96
  7. 2022How catastrophic can catastrophic forgetting be in linear regression?cited by 81
  8. 2023Theory on Forgetting and Generalization of Continual Learningcited by 72
  9. 2024Towards Lifelong Learning of Large Language Models: A Surveycited by 64
  10. 2020Gradient-based Editing of Memory Examples for Online Task-free Continual Learningcited by 62
  11. 2024Asymptotic theory of in-context learning by linear attentioncited by 55
  12. 2024How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?cited by 35
  13. 2024In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initializationcited by 33
  14. 2022Continual Learning with Recursive Gradient Optimizationcited by 32
  15. 2024Understanding Forgetting in Continual Learning with Linear Regressioncited by 30
  16. 2025Optimal Task Order for Continual Learning of Multiple Taskscited by 14
  17. 2024Understanding Reasoning in Chain-of-Thought from the Hopfieldian Viewcited by 11
  18. 2023Metalearning Continual Learning Algorithmscited by 7
  19. 2024In-context Continual Learning Assisted by an External Continual Learnercited by 7
  20. 2024On the Learn-to-Optimize Capabilities of Transformers in In-Context Sparse Recoverycited by 6
  21. 2025Provable Benefits of Task-Specific Prompts for In-context Learningcited by 4
  22. 2026In-Context Learning Operates as Concept Subspace Learningcited by 3
  23. 2026Understanding the Dynamics of Demonstration Conflict in In-Context Learningcited by 2
  24. 2026Provable Effects of Data Replay in Continual Learning: A Feature Learning Perspectivecited by 1
  25. 2026Benign Overfitting in Adversarial Training for Vision Transformerscited by 1

Built on by

Not cited yet.