arXivDaily arXiv每日学术速递 周一至周五更新
​通知:联邦节假日调休:哥伦布日 / 原住民日(Columbus Day / Indigenous Peoples' Day),今日(13日)无更新。
arXiv 2605.28705cs.LG

理解上下文持续学习中的泛化与遗忘

Understanding Generalization and Forgetting in In-Context Continual Learning

Mohamed bin Zayed University of Artificial Intelligence (MBZUAI)(穆罕默德·本·扎耶德人工智能大学);University of Buffalo(布法罗大学)

Guangyu Li, Meng Ding, Lijie Hu

AI总结:

提出首个上下文持续学习理论框架,分析预训练Transformer在单提示中处理多序列任务时的泛化与遗忘行为,揭示注意力机制导致的干扰和偏差。

摘要:

上下文学习(ICL)的强大之处在于使大型语言模型能够仅通过基于提示的推理来适应新任务,完全绕过了参数更新的需要。现有理论主要在单任务设置下研究ICL,而现实中的提示通常包含异构任务序列,这导致我们无法理解大型语言模型是否在推理过程中隐式地执行持续学习。为了弥补这一差距,我们提出了首个用于上下文持续学习的理论框架,模拟预训练Transformer如何通过共享注意力机制在单个提示内处理多个顺序任务。聚焦于线性和掩码线性自注意力,我们推导了顺序任务提示下模型预测的误差表达式,并分析了它们的泛化和遗忘行为。我们的结果表明,标准注意力机制通过均匀或因果地聚合历史上下文,不可避免地引起任务间干扰,导致系统性偏差。我们进一步提供了预测误差的偏差-方差-干扰分解,刻画了历史上下文信息何时产生正迁移或可证明的负迁移。这一分析揭示了基于注意力的持续推理的基本限制,并为长提示中的顺序敏感性和性能退化提供了理论解释。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑