arXiv:2501.16265cs.LG2025-01ICML被引 49

揭示线性注意力模型在上下文学习中能力的演化机制

Training Dynamics of In-Context Learning in Linear Attention

  • 对比两种参数化方式,分析梯度下降下的训练动态
  • 不同参数化导致能力突变或渐进提升,与主成分数量变化相关
  • 适合研究大模型内在机制的理论工作者参考

尽管基于注意力的模型展现出强大的上下文学习(ICL)能力,但其通过梯度下降训练获得该能力的理论理解仍不充分。本文研究了用于上下文线性回归的多头线性自注意力在梯度下降下的训练动态。考察了两种线性自注意力的参数化:一种是将键和查询权重合并为单个矩阵(常见于理论研究),另一种是分别设置键和查询矩阵(更接近实际应用)。对于合并参数化,我们发现训练动态具有两个不动点,损失轨迹呈现单一且突然的下降;并推导出特定数据集和初始化下的解析时间解。对于分离参数化,我们发现存在指数级多个不动点,损失呈现鞍点到鞍点的动力学行为,并可简化为标量常微分方程。训练过程中,模型在上下文中实现主成分回归,且主成分数量随训练时间增加。总体而言,本文提供了线性注意力模型在梯度下降训练中实现ICL能力演化的理论描述,揭示了能力获取的突变或渐进特性取决于键与查询的参数化方式。

原文摘要 · Abstract (English)

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.

注意力机制上下文学习理论分析

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。