arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.02579cond-mat.dis-nncs.LG
收藏

信号传播的几何动力学可预测Transformer的可训练性

Geometric Dynamics of Signal Propagation Predict Trainability of Transformers

Stanford University(斯坦福大学)

Aditya Cowsik, Tamra Nebabu, Xiao-Liang Qi, Surya Ganguli

AI总结:

该研究将Transformer中token表征传播视为粒子动力系统,推导几何演化方程与两个Lyapunov指数,发现其可预测训练最终测试损失,且指数同时为零是实现最小损失的充要条件。

摘要:

我们研究了深度随机初始化Transformer中的前向信号传播与梯度反向传播,得出了关于初始化超参数的简单充要条件,可确保深度Transformer的可训练性。我们的方法将n个token的表征在Transformer层间传播的演化过程,视为由n个相互作用粒子构成的离散时间动力系统。我们推导了该粒子系统从置换对称单形出发的演化几何的简单更新方程。我们的更新方程表明,在没有MLP层的情况下,该系统会坍缩为一条直线,这与此前关于Transformer秩坍缩的研究结论一致。但与此前工作不同的是,我们的演化方程可以在存在非线性MLP层的额外条件下定量追踪粒子几何形态,并且揭示了一种随初始化超参数(如注意力残差连接与MLP残差连接的强度、权重方差)变化的有序-混沌相变。在有序相中,粒子相互吸引并坍缩为一条直线;而在混沌相中,粒子相互排斥并收敛为正则n单形。我们解析推导了两个Lyapunov指数:一个是角度指数,用于调控该粒子系统偏离混沌边缘的程度;另一个是梯度指数,用于调控反向传播梯度的指数增长或衰减速率。我们通过实验表明,值得注意的是,训练结束时的最终测试损失仅通过训练初始时的这两个指数就能很好地预测,且这两个指数同时为零的条件,是实现最小测试损失的简单充要条件。

英文摘要:

We investigate forward signal propagation and gradient back propagation in deep, randomly initialized transformers, yielding simple necessary and sufficient conditions on initialization hyperparameters that ensure trainability of deep transformers. Our approach treats the evolution of the representations of $n$ tokens as they propagate through the transformer layers in terms of a discrete time dynamical system of $n$ interacting particles. We derive simple update equations for the evolving geometry of this particle system, starting from a permutation symmetric simplex. Our update equations show that without MLP layers, this system will collapse to a line, consistent with prior work on rank collapse in transformers. However, unlike prior work, our evolution equations can quantitatively track particle geometry in the additional presence of nonlinear MLP layers, and it reveals an order-chaos phase transition as a function of initialization hyperparameters, like the strength of attentional and MLP residual connections and weight variances. In the ordered phase the particles are attractive and collapse to a line, while in the chaotic phase the particles are repulsive and converge to a regular $n$-simplex. We analytically derive two Lyapunov exponents: an angle exponent that governs departures from the edge of chaos in this particle system, and a gradient exponent that governs the rate of exponential growth or decay of backpropagated gradients. We show through experiments that, remarkably, the final test loss at the end of training is well predicted just by these two exponents at the beginning of training, and that the simultaneous vanishing of these two exponents yields a simple necessary and sufficient condition to achieve minimal test loss.

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

↑