arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.11751stat.MLcond-mat.dis-nncs.LG
收藏

线性注意力上下文学习的渐近理论

Asymptotic theory of in-context learning by linear attention

The John A. Paulson School of Engineering and Applied Sciences, Harvard University(哈佛大学约翰·A·保罗森工程与应用科学学院);Center for Brain Science, Harvard University(哈佛大学脑科学中心);Society of Fellows, Harvard University(哈佛大学 fellows 会);Department of Physics, Harvard University(哈佛大学物理系);Perimeter Institute for Theoretical Physics, Waterloo, ON N2L 2Y5, Canada(理论物理研究所,滑铁卢,加拿大);The Kempner Institute for the Study of Natural and Artificial Intelligence, 150 Western Avenue, Alston, MA 02134(自然与人工智能研究 institute)

Yue M. Lu, Mary I. Letey, Jacob A. Zavatone-Veth, Anindita Maiti, Cengiz Pehlevan

AI总结:

该研究在线性注意力的线性回归ICL可解模型中,推导了高维标度下学习曲线的精确渐近结果,发现双下降现象与任务多样性相关的相变,并通过实验验证了理论结论。

摘要:

Transformer具备一项卓越能力:无需预先明确训练,仅依据输入自身提供的示例即可学习并执行任务。这种被称为上下文学习(in-context learning, ICL)的能力被认为是Transformer成功的基石,但关于实现成功ICL所需的样本复杂度、预训练任务多样性以及上下文长度的问题仍未得到解决。本文在线性注意力执行线性回归任务的可精确求解ICL模型中,为上述问题给出了精确答案。我们在一个现象丰富的标度区域内推导了学习曲线的精确渐近结果:该区域中token维度趋于无穷大,上下文长度与预训练任务多样性随token维度成比例缩放,预训练示例数量呈二次方缩放。我们发现随着预训练示例增加,学习曲线呈现双下降现象,并揭示了模型行为在低任务多样性区域与高任务多样性区域之间存在相变:在低多样性区域,模型倾向于记忆训练任务;而在高多样性区域,模型实现了真正的上下文学习,且泛化能力超出预训练任务范围。这些理论见解通过线性注意力和完整非线性Transformer架构的实验得到了实证验证。

英文摘要:

Transformers have a remarkable ability to learn and execute tasks based on examples provided within the input itself, without explicit prior training. It has been argued that this capability, known as in-context learning (ICL), is a cornerstone of Transformers' success, yet questions about the necessary sample complexity, pretraining task diversity, and context length for successful ICL remain unresolved. Here, we provide a precise answer to these questions in an exactly solvable model of ICL of a linear regression task by linear attention. We derive sharp asymptotics for the learning curve in a phenomenologically-rich scaling regime where the token dimension is taken to infinity; the context length and pretraining task diversity scale proportionally with the token dimension; and the number of pretraining examples scales quadratically. We demonstrate a double-descent learning curve with increasing pretraining examples, and uncover a phase transition in the model's behavior between low and high task diversity regimes: In the low diversity regime, the model tends toward memorization of training tasks, whereas in the high diversity regime, it achieves genuine in-context learning and generalization beyond the scope of pretrained tasks. These theoretical insights are empirically validated through experiments with both linear attention and full nonlinear Transformer architectures.

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

↑