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 empirically validate our theoretical results.


翻译:基于Transformer的大型语言模型展现出上下文学习能力,使其能够通过包含少量示例的提示来适应下游任务。在实践中,此类模型通常经过微调以提升其在下游任务上的零样本性能,从而使其能够在无需示例的情况下完成任务,进而降低推理成本。然而,微调可能会损害上下文学习能力,限制微调模型在微调期间未见任务上的表现。我们利用线性注意力模型,提供了一个理论分析,刻画了微调目标如何修改注意力参数,并识别了导致少样本性能下降的条件。我们证明,微调所有注意力参数可能损害上下文学习,而将更新限制在值矩阵上则能在保持上下文学习的同时改善零样本性能。我们进一步表明,引入辅助的少样本损失主要能增强模型在目标任务上的上下文学习,但会以牺牲在微调期间未见任务上的上下文学习能力为代价。我们的理论结果得到了实验验证。

0
下载
关闭预览

相关内容

【博士论文】基于多模态基础模型的上下文学习
专知会员服务
23+阅读 · 2025年12月17日
《语言模型的推理时间学习算法》162页博士论文
专知会员服务
13+阅读 · 2025年11月23日
【NeurIPS 2021】流形上的注意力机制:规范等变的Transformer
最新《弱监督预训练语言模型微调》报告,52页ppt
专知会员服务
38+阅读 · 2020年12月26日
深度学习的下一步:Transformer和注意力机制
云头条
56+阅读 · 2019年9月14日
Attention!注意力机制模型最新综述(附下载)
THU数据派
29+阅读 · 2019年4月13日
深入理解BERT Transformer ,不仅仅是注意力机制
大数据文摘
22+阅读 · 2019年3月19日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
10+阅读 · 2015年12月31日
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
Arxiv
0+阅读 · 2月24日
Arxiv
0+阅读 · 2月11日
VIP会员
相关VIP内容
【博士论文】基于多模态基础模型的上下文学习
专知会员服务
23+阅读 · 2025年12月17日
《语言模型的推理时间学习算法》162页博士论文
专知会员服务
13+阅读 · 2025年11月23日
【NeurIPS 2021】流形上的注意力机制:规范等变的Transformer
最新《弱监督预训练语言模型微调》报告,52页ppt
专知会员服务
38+阅读 · 2020年12月26日
相关基金
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
10+阅读 · 2015年12月31日
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
Top
微信扫码咨询专知VIP会员