arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.04279cs.LG
收藏

多头自注意力的梯度流结构与定量动力学

Gradient Flow Structure and Quantitative Dynamics of Multi-Head Self-Attention

Ayan Pendharkar

Ayan Pendharkar

AI总结:

本文研究多头自注意力的动力学,揭示其梯度流结构及聚类行为,提出非单调性障碍并建立稳定性机制,通过简化模型推导关键温度与聚类速率关系。

摘要:

Transformer自注意力可解释为单位球面上的梯度流,在softmax相互作用势下,token演化并趋向聚类。尽管先前研究已确立单头注意力的聚类行为,多头设置因几何干扰导致标准单调性论证失效。本文发展了多头自注意力动力学的理论框架,解决若干开放问题。我们证明,在适当条件下,自然多头能量函数在平坦和球面动态下非递减。识别了单头单调性障碍为径向阴影项,即各头输出对token方向的投影,即使在正交假设下仍存在。我们引入确保单调性的充分条件,并建立对近似正交性的鲁棒性。在简化标量头设置中,推导了关键逆温度的闭式表达式,证明异质头具有超加性聚类速率。在此设置中,还证明了ReLU与softmax注意力在线性动态中的聚类时间分离。最后,建立熵产恒等式,证明注意力熵随聚类进程单调增加。本文结果为多头注意力动力学提供了统一视角,阐明了transformer模型中聚类和稳定性机制。

英文摘要:

Transformer self-attention can be interpreted as a gradient flow on the unit sphere, in which tokens evolve under softmax interaction potentials and tend to form clusters. While prior work has established clustering behavior for single-head attention, the multi-head setting remains less understood due to geometric interference between heads, which invalidates standard monotonicity arguments. In this work, we develop a theoretical framework for multi-head self-attention dynamics and resolve several open questions. We show that, under suitable conditions on the score matrices, a natural multi-head energy functional is non-decreasing along both flat and spherical dynamics. We identify the key obstruction to per-head monotonicity as radial shadow terms, which are projections of each head's output onto token directions, persisting even under orthogonality assumptions. We introduce a sufficient condition ensuring monotonicity and establish robustness to approximate orthogonality. In a simplified scalar-head regime with equiangular token configurations, we derive a closed-form expression for the critical inverse temperature governing clustering behavior, and show that heterogeneous heads exhibit super-additive clustering rates. In this regime, we also prove a separation in clustering time between ReLU and softmax attention in the linearized dynamics. Finally, we establish an entropy production identity and show that attention entropy increases monotonically toward equilibrium as clustering progresses. Our results provide a unified perspective on the dynamics of multi-head attention and clarify the mechanisms underlying clustering and stability in transformer models.

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

↑