arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2501.16265cs.LG
收藏

线性注意力中上下文学习的训练动力学

Training Dynamics of In-Context Learning in Linear Attention

Gatsby Computational Neuroscience Unit, University College London(伦敦大学学院盖茨比计算神经科学中心)

Yedi Zhang, Aaditya K. Singh, Peter E. Latham, Andrew Saxe

AI总结:

本文研究了多头线性自注意力在上下文线性回归中的梯度下降训练动力学,分析了合并与分离键查询矩阵两种参数化方式,揭示了前者损失单次突降、后者呈鞍点到鞍点动力学且实现主成分回归,从而理论描述了ICL能力的演化。

摘要:

尽管基于注意力的模型展现出了上下文学习(ICL)的卓越能力,但对于这些模型如何通过梯度下降训练获得这种能力的理论理解仍处于初步阶段。为回答这一问题,我们研究了为上下文线性回归训练的多头线性自注意力的梯度下降动力学。我们考察了线性自注意力的两种参数化方式:一种将键和查询权重合并为单个矩阵(在理论研究中常见),另一种使用分离的键和查询矩阵(更接近实际设置)。对于合并参数化,我们表明训练动力学有两个不动点,且损失轨迹表现出单次、突然的下降。我们推导出了针对特定类别数据集和初始化的解析时间过程解。对于分离参数化,我们表明训练动力学具有指数级多的不动点,且损失表现出鞍点到鞍点动力学,我们将其简化为标量常微分方程。在训练期间,模型在上下文中实现主成分回归,且主成分数量随训练时间增加。总体而言,我们提供了关于ICL能力如何在线性注意力的梯度下降训练过程中演化的理论描述,揭示了取决于键和查询参数化方式的突然获得或渐进改进。

英文摘要:

While attention-based models have demonstrated the remarkable ability of in-context learning (ICL), the theoretical understanding of how these models acquired this ability through gradient descent training is still preliminary. Towards answering this question, we study the gradient descent dynamics of multi-head linear self-attention trained for in-context linear regression. We examine two parametrizations of linear self-attention: one with the key and query weights merged as a single matrix (common in theoretical studies), and one with separate key and query matrices (closer to practical settings). For the merged parametrization, we show that the training dynamics has two fixed points and the loss trajectory exhibits a single, abrupt drop. We derive an analytical time-course solution for a certain class of datasets and initialization. For the separate parametrization, we show that the training dynamics has exponentially many fixed points and the loss exhibits saddle-to-saddle dynamics, which we reduce to scalar ordinary differential equations. During training, the model implements principal component regression in context with the number of principal components increasing over training time. Overall, we provide a theoretical description of how ICL abilities evolve during gradient descent training of linear attention, revealing abrupt acquisition or progressive improvements depending on how the key and query are parametrized.

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

↑