arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.23197cs.CLcs.LGstat.ML
收藏

微调不忘上下文学习:线性注意力模型的理论分析

Fine-Tuning Without Forgetting In-Context Learning: A Theoretical Analysis of Linear Attention Models

KAIST(韩国科学技术院)

Chungpa Lee, Jy-yong Sohn, Kangwook Lee

AI总结:

本文通过线性注意力模型理论分析,揭示了微调目标如何修改注意力参数并导致少样本性能下降的条件,提出仅更新值矩阵可保持上下文学习能力。

摘要:

基于Transformer的大型语言模型展现出上下文学习能力,能够通过少量示例提示适应下游任务。实践中,这类模型常被微调以提升下游任务的零样本性能,使其无需示例即可解决问题,从而降低推理成本。然而,微调可能削弱上下文学习能力,限制微调模型在未见任务上的表现。利用线性注意力模型,我们提供了理论分析,刻画了微调目标如何修改注意力参数,并识别了导致少样本性能下降的条件。我们表明,微调所有注意力参数会损害上下文学习,而仅更新值矩阵可在保持上下文学习的同时提升零样本性能。我们进一步证明,引入辅助的少样本损失主要增强目标任务的上下文学习,但以牺牲微调未见任务上的上下文学习能力为代价。我们提供了来自合成和真实数据集的实验证据,与理论定性预测一致。

英文摘要:

Transformer-based large language models exhibit in-context learning, enabling adaptation to downstream tasks via few-shot prompting with demonstrations. In practice, such models are often fine-tuned to improve zero-shot performance on downstream tasks, allowing them to solve tasks without examples and thereby reducing inference costs. However, fine-tuning can degrade in-context learning, limiting the performance of fine-tuned models on tasks not seen during fine-tuning. Using linear attention models, we provide a theoretical analysis that characterizes how fine-tuning objectives modify attention parameters and identifies conditions under which this leads to degraded few-shot performance. We show that fine-tuning all attention parameters can harm in-context learning, whereas restricting updates to the value matrix improves zero-shot performance while preserving in-context learning. We further show that incorporating an auxiliary few-shot loss enhances in-context learning primarily on the target task, at the expense of degraded in-context learning ability on tasks not seen during fine-tuning. We provide empirical evidence from synthetic and real-world datasets consistent with the qualitative predictions of our theory.

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

↑