arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2004.08249cs.LGcs.CLstat.ML
收藏

理解训练 Transformer 的困难

Understanding the Difficulty of Training Transformers

University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Microsoft Research(微软研究院);Microsoft Dynamics 365 AI(微软Dynamics 365人工智能部门)

Liyuan Liu, Xiaodong Liu, Jianfeng Gao, Weizhu Chen, Jiawei Han

AI总结:

本文从理论与实证分析 Transformer 训练困难,指出残差分支依赖导致的扰动放大是不稳定根源,并提出 Admin 初始化方法以提升稳定性、收敛速度和最终性能。

摘要:

Transformer 已在许多 NLP 任务中被证明是有效的。然而,训练它们需要在精心设计前沿优化器和学习率调度器方面付出非同寻常的努力(例如,传统 SGD 无法有效训练 Transformer)。我们在此的目标是从实证和理论两个角度理解“是什么使 Transformer 训练复杂化”。我们的分析揭示,不平衡的梯度并非训练不稳定的根本原因。相反,我们识别出一种对训练有重大影响的放大效应——对于多层 Transformer 模型中的每一层,对其残差分支的严重依赖会使训练不稳定,因为它会放大小的参数扰动(例如参数更新),并导致模型输出受到显著干扰。然而,我们观察到轻微依赖会限制模型潜力,并导致训练出的模型较差。受分析启发,我们提出 Admin(Adaptive model initialization,自适应模型初始化),以稳定早期阶段的训练并在后期释放其全部潜力。大量实验表明,Admin 更稳定、收敛更快,并带来更好的性能。实现已发布于:https://github.com/LiyuanLucasLiu/Transforemr-Clinic。

英文摘要:

Transformers have proved effective in many NLP tasks. However, their training requires non-trivial efforts regarding designing cutting-edge optimizers and learning rate schedulers carefully (e.g., conventional SGD fails to train Transformers effectively). Our objective here is to understand $\textit{what complicates Transformer training}$ from both empirical and theoretical perspectives. Our analysis reveals that unbalanced gradients are not the root cause of the instability of training. Instead, we identify an amplification effect that influences training substantially -- for each layer in a multi-layer Transformer model, heavy dependency on its residual branch makes training unstable, since it amplifies small parameter perturbations (e.g., parameter updates) and results in significant disturbances in the model output. Yet we observe that a light dependency limits the model potential and leads to inferior trained models. Inspired by our analysis, we propose Admin ($\textbf{Ad}$aptive $\textbf{m}$odel $\textbf{in}$itialization) to stabilize stabilize the early stage's training and unleash its full potential in the late stage. Extensive experiments show that Admin is more stable, converges faster, and leads to better performance. Implementations are released at: https://github.com/LiyuanLucasLiu/Transforemr-Clinic.

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

↑