arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.19442cs.LGcs.AImath.OCmath.STstat.MLstat.TH
收藏

多头Softmax注意力模型在上下文学习中的训练动力学:涌现、收敛与最优性

Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimality

Yale University(耶鲁大学)

Siyu Chen, Heejune Sheen, Tianhao Wang, Zhuoran Yang

AI总结:

本文研究多头softmax注意力模型在多任务线性回归上下文学习中的梯度流训练动力学,证明其全局收敛性,揭示注意力头任务分配的三阶段涌现现象,并证明所得模型在常数因子内达到最优。

摘要:

我们研究了用于多任务线性回归上下文学习的多头softmax注意力模型在梯度流训练下的动力学行为。我们在适当的初始化选择下建立了梯度流的全局收敛性。此外,我们证明了一个有趣的“任务分配”现象在梯度流动力学过程中涌现,即每个注意力头专注于解决多任务模型中的单个任务。具体来说,我们证明梯度流动力学可以分为三个阶段——一个预热阶段,在该阶段损失下降相当缓慢,注意力头逐渐建立对各个任务的倾向;一个涌现阶段,在该阶段每个头选择单个任务且损失迅速下降;以及一个收敛阶段,在该阶段注意力参数收敛到一个极限。此外,我们证明了梯度流的最优性,即梯度流学习到的极限模型在常数因子范围内与最佳可能的多头softmax注意力模型相当。我们的分析还刻画了单头和多头注意力模型之间在ICL预测精度上的严格分离。我们收敛分析的关键技术是将参数空间中的梯度流动力学映射到谱域中的一组常微分方程,其中注意力权重的半奇异值的相对大小决定任务分配。据我们所知,我们的工作首次为多头softmax注意力模型提供了收敛性结果。

英文摘要:

We study the dynamics of gradient flow for training a multi-head softmax attention model for in-context learning of multi-task linear regression. We establish the global convergence of gradient flow under suitable choices of initialization. In addition, we prove that an interesting "task allocation" phenomenon emerges during the gradient flow dynamics, where each attention head focuses on solving a single task of the multi-task model. Specifically, we prove that the gradient flow dynamics can be split into three phases -- a warm-up phase where the loss decreases rather slowly and the attention heads gradually build up their inclination towards individual tasks, an emergence phase where each head selects a single task and the loss rapidly decreases, and a convergence phase where the attention parameters converge to a limit. Furthermore, we prove the optimality of gradient flow in the sense that the limiting model learned by gradient flow is on par with the best possible multi-head softmax attention model up to a constant factor. Our analysis also delineates a strict separation in terms of the prediction accuracy of ICL between single-head and multi-head attention models. The key technique for our convergence analysis is to map the gradient flow dynamics in the parameter space to a set of ordinary differential equations in the spectral domain, where the relative magnitudes of the semi-singular values of the attention weights determines task allocation. To our best knowledge, our work provides the first convergence result for the multi-head softmax attention model.

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

↑