The transformer's remarkable ability to perform in-context learning (ICL) has sparked a wide range of studies designed to understand its strengths and limitations. However, a theoretical understanding of when ICL can and cannot generalize beyond its pre-training data still remains unclear. This paper puts forth a minimal mathematical model that provably identifies when ICL can generalize out-of-distribution (OOD). By studying linear regression tasks parameterized with low-rank covariance matrices, we model distribution shifts as varying angles between subspaces and derive conditions under which a single-layer linear attention model interpolates across all angles. We show that if pre-training task vectors are drawn from a union of subspaces, transformers can generalize to all angle shifts--enabling ICL even in regions with zero probability mass in the training distribution. On the other hand, if the pre-training tasks are drawn from a single Gaussian, the test risk shows a non-negligible dependence on the angle, implying that ICL cannot generalize OOD. We empirically show that our results also hold for models such as GPT-2, and present experiments on how our results extend to nonlinear function classes.


翻译:Transformer具备卓越的上下文学习能力,这一特性催生了大量关于其优势与局限性的研究。然而,关于上下文学习何时能泛化到预训练数据之外、何时不能的理论理解仍不明确。本文提出了一个最小数学模型,可明确识别上下文学习何时能实现分布外泛化。通过研究具有低秩协方差矩阵的线性回归任务,我们将分布偏移建模为子空间之间变化的角度,并推导出单层线性注意力模型在所有角度下进行插值的条件。我们证明:若预训练任务向量来自子空间的并集,Transformer能泛化至所有角度偏移——即便在训练分布概率质量为零的区域也能实现上下文学习。反之,若预训练任务来自单一高斯分布,测试风险与角度呈现不可忽略的依赖关系,意味着上下文学习无法实现分布外泛化。实验表明,我们的结论同样适用于GPT-2等模型,并进一步展示了该结果如何拓展至非线性函数类。

0
下载
关闭预览

相关内容

【阿姆斯特丹博士论文】在测试时学习泛化
专知会员服务
12+阅读 · 2025年6月3日
【博士论文】信息论视角下的泛化理论方法,274页pdf
专知会员服务
51+阅读 · 2024年4月28日
《分布外泛化评估》综述
专知会员服务
44+阅读 · 2024年3月6日
【剑桥大学博士论文】机器学习中的分布外泛化,214页pdf
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
VIP会员
相关主题
最新内容
美国从乌克兰无人机战争中学习经验
专知会员服务
1+阅读 · 今天15:03
ICML 2026 | 面向视觉语言模型的语义鲁棒性认证
专知会员服务
0+阅读 · 今天14:31
学习数据的几何:形状空间分析数学综述
专知会员服务
8+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
10+阅读 · 6月17日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员