分析层归一化位置对Transformer训练稳定性的影响
Stability of Transformers under Layer Normalization
- 从正向与反向传播角度理论分析归一化位置的影响
- 推导出隐藏状态增长的显式边界,揭示训练动态
- 为新架构设计提供稳定性检验框架,适合模型开发者
尽管广泛使用,深度Transformer的训练仍可能不稳定。层归一化作为标准组件虽能提升稳定性,但其放置位置常凭经验选择。本文系统研究了不同层归一化位置下Transformer的前向(隐藏状态)与反向(梯度)稳定性。理论分析揭示训练过程是趋向于规则解还是病态行为。针对前向稳定性,我们推导出训练后隐藏状态增长的显式上界;针对反向稳定性,分析了层归一化对梯度反向传播的影响,解释了各放置方式的训练动态。分析还指导了残差步长的缩放策略,恰当选择可进一步提升稳定性和性能。数值结果验证了理论发现。此外,本框架为新架构修改提供了原则性稳定性检验方法,为未来设计提供指导。
原文摘要 · Abstract (English)
Despite their widespread use, training deep Transformers can be unstable. Layer normalization, a standard component, improves training stability, but its placement has often been ad-hoc. In this paper, we conduct a principled study on the forward (hidden states) and backward (gradient) stability of Transformers under different layer normalization placements. Our theory provides key insights into the training dynamics: whether training drives Transformers toward regular solutions or pathological behaviors. For forward stability, we derive explicit bounds on the growth of hidden states in trained Transformers. For backward stability, we analyze how layer normalization affects the backpropagation of gradients, thereby explaining the training dynamics of each layer normalization placement. Our analysis also guides the scaling of residual steps in Transformer blocks, where appropriate choices can further improve stability and performance. Our numerical results corroborate our theoretical findings. Beyond these results, our framework provides a principled way to sanity-check the stability of Transformers under new architectural modifications, offering guidance for future designs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。