研究SignGD优化两层Transformer的训练动态与泛化能力。
On the Optimization and Generalization of Two-layer Transformers with Sign Gradient Descent
- 用SignGD分析两层Transformer的四阶段训练过程。
- 证明其快速收敛但噪声数据上泛化差。
- 发现Adam行为类似,需高质量数据才有效。
Adam优化器在实践中广泛用于Transformer训练,但其复杂性使理论分析困难。Sign Gradient Descent(SignGD)作为其有效替代,虽简单却缺乏理论理解。本文研究SignGD如何优化一个两层Transformer——包含可训练参数化的softmax注意力层和线性层——在含噪声的线性可分数据集上的表现。我们识别出四个训练阶段,各阶段呈现独特行为。基于此,证明该Transformer在噪声数据上实现快速收敛但泛化性能差。同时发现,Adam在此设置下表现出与SignGD相似的优化与泛化特性。此外,结果表明SignGD的泛化不佳并非仅由数据噪声引起,提示SignGD与Adam均需高质量数据才能适用于真实任务。合成与真实数据集上的实验验证了理论结论。
原文摘要 · Abstract (English)
The Adam optimizer is widely used for transformer optimization in practice, which makes understanding the underlying optimization mechanisms an important problem. However, due to the Adam's complexity, theoretical analysis of how it optimizes transformers remains a challenging task. Fortunately, Sign Gradient Descent (SignGD) serves as an effective surrogate for Adam. Despite its simplicity, theoretical understanding of how SignGD optimizes transformers still lags behind. In this work, we study how SignGD optimizes a two-layer transformer -- consisting of a softmax attention layer with trainable query-key parameterization followed by a linear layer -- on a linearly separable noisy dataset. We identify four stages in the training dynamics, each exhibiting intriguing behaviors. Based on the training dynamics, we prove the fast convergence but poor generalization of the learned transformer on the noisy dataset. We also show that Adam behaves similarly to SignGD in terms of both optimization and generalization in this setting. Additionally, we find that the poor generalization of SignGD is not solely due to data noise, suggesting that both SignGD and Adam requires high-quality data for real-world tasks. Finally, experiments on synthetic and real-world datasets empirically support our theoretical results.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。