arXiv:2507.13338cs.LG2025-07被引 17

让Transformer训练全程保持有限的Lipschitz常数,提升模型稳定性。

Training Transformers with Enforced Lipschitz Constants

  • 设计高效权重矩阵范数约束工具,支持Transformer全程约束Lipschitz常数。
  • 2层的Lipschitz Transformer在Shakespeare上达60%准确率,145M参数达21%。
  • 无需层归一化等稳定技巧,仍能训练,适合关注鲁棒性的研究者。

神经网络对输入和权重扰动高度敏感,易导致对抗样本脆弱、训练发散和过拟合等问题。以往研究尝试构建完全由Lipschitz组件组成的网络,但尚未实现现代Transformer架构在训练过程中持续维持Lipschitz证书。本文提出高效计算工具,用于保持权重矩阵的范数约束,并成功训练出全程满足Lipschitz约束的Transformer模型。实验发现优化器动态至关重要:从AdamW切换到Muon后,结合权重衰减与谱归一化,可在更低的Lipschitz界下达到相同性能。受Muon更新具有固定谱范数启发,我们协同设计一种权重约束方法,在MLP和200万参数Transformer上改进了性能与Lipschitz常数的权衡。2-Lipschitz Transformer在Shakespeare文本上达到60%验证准确率;扩展至145M参数,10-Lipschitz模型在互联网文本上达21%准确率。为匹配NanoGPT基准(39.4%),其上界需增至10^264。然而,这些模型无需层归一化、QK归一化或logit tanh软截断等稳定性措施即可训练。

原文摘要 · Abstract (English)

Neural networks are often highly sensitive to input and weight perturbations. This sensitivity has been linked to pathologies such as vulnerability to adversarial examples, divergent training, and overfitting. To combat these problems, past research has looked at building neural networks entirely from Lipschitz components. However, these techniques have not matured to the point where researchers have trained a modern architecture such as a transformer with a Lipschitz certificate enforced beyond initialization. To explore this gap, we begin by developing and benchmarking novel, computationally-efficient tools for maintaining norm-constrained weight matrices. Applying these tools, we are able to train transformer models with Lipschitz bounds enforced throughout training. We find that optimizer dynamics matter: switching from AdamW to Muon improves standard methods -- weight decay and spectral normalization -- allowing models to reach equal performance with a lower Lipschitz bound. Inspired by Muon's update having a fixed spectral norm, we co-design a weight constraint method that improves the Lipschitz vs. performance tradeoff on MLPs and 2M parameter transformers. Our 2-Lipschitz transformer on Shakespeare text reaches validation accuracy 60%. Scaling to 145M parameters, our 10-Lipschitz transformer reaches 21% accuracy on internet text. However, to match the NanoGPT baseline validation accuracy of 39.4%, our Lipschitz upper bound increases to 10^264. Nonetheless, our Lipschitz transformers train without stability measures such as layer norm, QK norm, and logit tanh softcapping.

TransformerLipschitz稳定性训练优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。