用数学流模型解释多头注意力动态,揭示其能量衰减与稳定机制。
Multi-Headed Transformer Architectures as Time-dependent Wasserstein Gradient Flows
- 将多头变换器数据流动建模为随时间演化的熵梯度流
- 证明权重演化收敛至能量驻点,且在噪声扰动下仍稳定
- 适合研究Transformer理论机制的学者与深度学习工程师
近年来,Transformer架构彻底改变了自然语言处理领域,但现有理论模型常与实际架构脱节,依赖强假设。本文将多头Transformer中的数据流建模为特定交互能量下的时变梯度流,显式引入时间依赖性,允许各头、各层使用不同权重,无需限制初始化方式。在权重演化满足可积性条件下,证明了梯度流的ω-极限集元素为极限权重分布下的能量驻点。进一步分析了初始数据和权重扰动下的稳定性:一方面,建立了梯度流对初始数据的连续依赖性与唯一性;另一方面,证明了扰动后交互能量Γ-收敛于原能量,从而保证梯度流收敛。数值实验验证了能量耗散关系,并揭示了自主型(Ornstein-Uhlenbeck)与真正非自治型(振荡权重)情形下的渐近行为。
原文摘要 · Abstract (English)
In recent years, transformer architectures have revolutionized the field of language processing, opening the door to previously unforeseen possibilities. However, from a theoretical point of view, the mathematical models proposed in the literature often lack direct contact with the actual architectures and depend on strong simplifying assumptions. In this paper, we reduce this gap by modelling the data flow in multi-headed transformer architectures as time-dependent gradient flows for a suitable interaction energy capturing the design of the attention mechanism. The explicit dependence on time allows us to consider different weights for each head and for each layer, without imposing constraints on the initialization method. Moreover, we prove that, under a suitable integrability assumption on the evolution of the weights, each element of the $ω$-limit set of the gradient flows is a stationary point of the interaction energy at a limiting weight distribution. Finally, we analyse the stability of the gradient flows considering perturbations of both the initial data and the weights. Specifically, on the one hand, we study the robustness of the proposed models with respect to noisy inputs, establishing a continuous dependence of the gradient flows on the initial data and uniqueness of the flows. On the other hand, we prove the $Γ$-convergence of the perturbed interaction energy to the unperturbed one, leading to the convergence of the corresponding gradient flows. We complement these theoretical results with numerical experiments that confirm the predicted energy-dissipation identity and clarify the asymptotic behavior of the dynamics in both the autonomous-like (Ornstein--Uhlenbeck) and the genuinely non-autonomous (oscillating-weights) regimes.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。