The learning rate warmup heuristic achieves remarkable success in stabilizing training, accelerating convergence and improving generalization for adaptive stochastic optimization algorithms like RMSprop and Adam. Pursuing the theory behind warmup, we identify a problem of the adaptive learning rate -its variance is problematically large in the early stage, and presume warmup works as a variance reduction technique. We provide both empirical and theoretical evidence to verify our hypothesis. We further propose Rectified Adam (RAdam), a novel variant of Adam, by introducing a term to rectify the variance of the adaptive learning rate. Experimental results on image classification, language modeling, and neural machine translation verify our intuition and demonstrate the efficacy and robustness of RAdam. 1 * Work was done during an internship at Microsoft Dynamics 365 AI. † Work was done during an internship at Microsoft Dynamics 365 AI.
translated by 谷歌翻译
神经架构的创新促进了语言建模和计算机视觉中的重大突破。不幸的是,如果网络参数未正确初始化,新颖的架构通常会导致挑战超参数选择和培训不稳定。已经提出了许多架构特定的初始化方案,但这些方案并不总是可移植到新体系结构。本文介绍了毕业,一种用于初始化神经网络的自动化和架构不可知论由方法。毕业基础是一个简单的启发式;调整每个网络层的规范,使得具有规定的超参数的SGD或ADAM的单个步骤导致可能的损耗值最小。通过在每个参数块前面引入标量乘数变量,然后使用简单的数字方案优化这些变量来完成此调整。 GradInit加速了许多卷积架构的收敛性和测试性能,无论是否有跳过连接,甚至没有归一化层。它还提高了机器翻译的原始变压器架构的稳定性,使得在广泛的学习速率和动量系数下使用ADAM或SGD来训练它而无需学习速率预热。代码可在https://github.com/zhuchen03/gradinit上获得。
translated by 谷歌翻译
The vast majority of successful deep neural networks are trained using variants of stochastic gradient descent (SGD) algorithms. Recent attempts to improve SGD can be broadly categorized into two approaches: (1) adaptive learning rate schemes, such as AdaGrad and Adam, and (2) accelerated schemes, such as heavy-ball and Nesterov momentum. In this paper, we propose a new optimization algorithm, Lookahead, that is orthogonal to these previous approaches and iteratively updates two sets of weights. Intuitively, the algorithm chooses a search direction by looking ahead at the sequence of "fast weights" generated by another optimizer. We show that Lookahead improves the learning stability and lowers the variance of its inner optimizer with negligible computation and memory cost. We empirically demonstrate Lookahead can significantly improve the performance of SGD and Adam, even with their default hyperparameter settings on ImageNet, CIFAR-10/100, neural machine translation, and Penn Treebank.
translated by 谷歌翻译
我们使用高斯过程扰动模型在高维二次上的真实和批量风险表面之间的高斯过程扰动模型分析和解释迭代平均的泛化性能。我们从我们的理论结果中获得了三个现象\姓名:}(1)将迭代平均值(ia)与大型学习率和正则化进行了改进的正规化的重要性。 (2)对较少频繁平均的理由。 (3)我们预计自适应梯度方法同样地工作,或者更好,而不是其非自适应对应物的迭代平均值。灵感来自这些结果\姓据{,一起与}对迭代解决方案多样性的适当正则化的重要性,我们提出了两个具有迭代平均的自适应算法。与随机梯度下降(SGD)相比,这些结果具有明显更好的结果,需要较少调谐并且不需要早期停止或验证设定监视。我们在各种现代和古典网络架构上展示了我们对CiFar-10/100,Imagenet和Penn TreeBank数据集的方法的疗效。
translated by 谷歌翻译
深度学习在广泛的AI应用方面取得了有希望的结果。较大的数据集和模型一致地产生更好的性能。但是,我们一般花费更长的培训时间,以更多的计算和沟通。在本调查中,我们的目标是在模型精度和模型效率方面提供关于大规模深度学习优化的清晰草图。我们调查最常用于优化的算法,详细阐述了大批量培训中出现的泛化差距的可辩论主题,并审查了解决通信开销并减少内存足迹的SOTA策略。
translated by 谷歌翻译
The Transformer is widely used in natural language processing tasks. To train a Transformer however, one usually needs a carefully designed learning rate warm-up stage, which is shown to be crucial to the final performance but will slow down the optimization and bring more hyperparameter tunings. In this paper, we first study theoretically why the learning rate warm-up stage is essential and show that the location of layer normalization matters. Specifically, we prove with mean field theory that at initialization, for the original-designed Post-LN Transformer, which places the layer normalization between the residual blocks, the expected gradients of the parameters near the output layer are large. Therefore, using a large learning rate on those gradients makes the training unstable. The warm-up stage is practically helpful for avoiding this problem. On the other hand, our theory also shows that if the layer normalization is put inside the residual blocks (recently proposed as Pre-LN Transformer), the gradients are well-behaved at initialization. This motivates us to remove the warm-up stage for the training of Pre-LN Transformers. We show in our experiments that Pre-LN Transformers without the warm-up stage can reach comparable results with baselines while requiring significantly less training time and hyper-parameter tuning on a wide range of applications.
translated by 谷歌翻译
我们提出ACPROP(异步 - 居中 - PROP),一个适应优化器,它结合了第二次动量和异步更新的居中(例如,用于$ T $ -Th更新,分母使用信息最多为步骤$ T-1 $,而Dumerator使用梯度$ t-the step)。 ACPROP具有强大的理论特性和经验性能。用reddi等人的例子。 (2018),我们表明异步优化器(例如Adashift,ACProp)的收敛条件较弱,而不是同步优化器(例如ADAM,RMSPROP,Adabelief);在异步优化器中,我们表明,第二次势头的中心进一步削弱了收敛条件。我们展示了随机非凸面的$ O(\ FRAC {1} {\ SQRT {})$的收敛速度,它与ORACLE率和优于$ O(\ FRAC {logt}相匹配{\ sqrt {t}})$ rmsprop和adam的$率。我们在广泛的实证研究中验证了ACPROP:ACPRAC在使用CNN的图像分类中表现出SGD和其他自适应优化器,并且在各种GAN模型,加固学习和变压器的培训中优于良好调整的自适应优化器。总而言之,ACPROP具有良好的理论特性,包括弱收敛条件和最佳收敛速度,以及强的经验性能,包括SGD等良好普遍性,如亚当等训练稳定性。我们在https://github.com/juntang-zhuang/acprop-optimizer提供实现。
translated by 谷歌翻译
非凸优化的传统分析通常取决于平滑度的假设,即要求梯度为Lipschitz。但是,最近的证据表明,这种平滑度条件并未捕获一些深度学习目标功能的特性,包括涉及复发性神经网络和LSTM的函数。取而代之的是,他们满足了更轻松的状况,并具有潜在的无界光滑度。在这个轻松的假设下,从理论和经验上表明,倾斜的SGD比香草具有优势。在本文中,我们表明,在解决此类情况时,剪辑对于ADAM型算法是不可或缺的:从理论上讲,我们证明了广义标志GD算法可以获得与带有剪辑的SGD相似的收敛速率,但根本不需要显式剪辑。一端的这个算法家族恢复了符号,另一端与受欢迎的亚当算法非常相似。我们的分析强调了动量在分析符号类型和ADAM型算法中发挥作用的关键作用:它不仅降低了噪声的影响,因此在先前的符号分析中消除了大型迷你批次的需求显着降低了无界平滑度和梯度规范的影响。我们还将这些算法与流行的优化器进行了比较,在一组深度学习任务上,观察到我们可以在击败其他人的同时匹配亚当的性能。
translated by 谷歌翻译
优化通常是一个确定性问题,其中通过诸如梯度下降的一些迭代过程找到解决方案。然而,当培训神经网络时,由于样本的子集的随机选择,损耗函数会超过(迭代)时间。该随机化将优化问题转变为随机级别。我们建议将损失视为关于一些参考最优参考的嘈杂观察。这种对损失的解释使我们能够采用卡尔曼滤波作为优化器,因为其递归制剂旨在估计来自嘈杂测量的未知参数。此外,我们表明,用于未知参数的演进的卡尔曼滤波器动力学模型可用于捕获高级方法的梯度动态,如动量和亚当。我们称之为该随机优化方法考拉,对于Kalman优化算法而言,具有损失适应性的缺陷。考拉是一种易于实现,可扩展,高效的方法来训练神经网络。我们提供了通过实验的收敛分析和显示,它产生了与跨多个神经网络架构和机器学习任务的现有技术优化算法的现有状态的参数估计,例如计算机视觉和语言建模。
translated by 谷歌翻译
众所周知,随机梯度噪声(SGN)是深度学习的隐式正则化,对于深层网络的优化和概括至关重要。一些作品试图通过注入随机噪声来改善深度学习来人为地模拟SGN。但是,事实证明,注入的简单随机噪声不能像sgn一样工作,而sgn是各向异性和参数依赖性的。为了以低计算成本模拟SGN,并且在不更改学习率或批处理大小的情况下,我们提出了正面的动量(PNM)方法,这是经典优化器中常规动量的强大替代方法。引入的PNM方法维持两个近似独立的动量项。然后,我们可以通过调整动量差异来明确控制SGN的大小。从理论上讲,我们证明了PNM比随机梯度下降(SGD)的收敛保证和概括优势。通过将PNM与动量和Adam合并到两个常规优化器SGD中,我们的广泛实验在经验上验证了基于PNM的变体的显着优势,而不是相应的常规动量基于动量的优化器。
translated by 谷歌翻译
We introduce Adam, an algorithm for first-order gradient-based optimization of stochastic objective functions, based on adaptive estimates of lower-order moments. The method is straightforward to implement, is computationally efficient, has little memory requirements, is invariant to diagonal rescaling of the gradients, and is well suited for problems that are large in terms of data and/or parameters. The method is also appropriate for non-stationary objectives and problems with very noisy and/or sparse gradients. The hyper-parameters have intuitive interpretations and typically require little tuning. Some connections to related algorithms, on which Adam was inspired, are discussed. We also analyze the theoretical convergence properties of the algorithm and provide a regret bound on the convergence rate that is comparable to the best known results under the online convex optimization framework. Empirical results demonstrate that Adam works well in practice and compares favorably to other stochastic optimization methods. Finally, we discuss AdaMax, a variant of Adam based on the infinity norm. * Equal contribution. Author ordering determined by coin flip over a Google Hangout.
translated by 谷歌翻译
这项工作研究了基于梯度的算法的现有理论分析与训练深神经网络的实践之间的深刻断开。具体而言,我们提供了数值证据,表明在大规模神经网络训练(例如Imagenet + Resnet101和WT103 + Transformerxl模型)中,神经网络的权重不会融合到损失的梯度为零的固定点。然而,值得注意的是,我们观察到,即使权重不融合到固定点,最小化损耗函数的进展和训练损失稳定下来。受到这一观察的启发,我们提出了一种基于动力学系统的千古理论来解释它的新观点。我们没有研究权重演化,而是研究权重分布的演变。我们证明了权重分布到近似不变的度量,从而解释了训练损失如何稳定而无需重合到固定点。我们进一步讨论了这种观点如何更好地调整优化理论与机器学习实践中的经验观察。
translated by 谷歌翻译
我们研究了使用尖刺,现场依赖的随机矩阵理论研究迷你批次对深神经网络损失景观的影响。我们表明,批量黑森州的极值值的大小大于经验丰富的黑森州。我们还获得了类似的结果对Hessian的概括高斯牛顿矩阵近似。由于我们的定理,我们推导出作为批量大小的最大学习速率的分析表达式,为随机梯度下降(线性缩放)和自适应算法(例如ADAM(Square Root Scaling)提供了通知实际培训方案,例如光滑,非凸深神经网络。虽然随机梯度下降的线性缩放是在我们概括的更多限制性条件下导出的,但是适应优化者的平方根缩放规则是我们的知识,完全小说。随机二阶方法和自适应方法的百分比,我们得出了最小阻尼系数与学习率与批量尺寸的比率成比例。我们在Cifar-$ 100 $和ImageNet数据集上验证了我们的VGG / WimerEsnet架构上的索赔。根据我们对象检的调查,我们基于飞行学习率和动量学习者开发了一个随机兰齐齐竞争,这避免了对这些关键的超参数进行昂贵的多重评估的需求,并在预残留的情况下显示出良好的初步结果Cifar的architecure - $ 100 $。
translated by 谷歌翻译
In several recently proposed stochastic optimization methods (e.g. RMSProp, Adam, Adadelta), parameter updates are scaled by the inverse square roots of exponential moving averages of squared past gradients. Maintaining these perparameter second-moment estimators requires memory equal to the number of parameters. For the case of neural network weight matrices, we propose maintaining only the per-row and percolumn sums of these moving averages, and estimating the per-parameter second moments based on these sums. We demonstrate empirically that this method produces similar results to the baseline. Secondly, we show that adaptive methods can produce larger-than-desired updates when the decay rate of the second moment accumulator is too slow. We propose update clipping and a gradually increasing decay rate scheme as remedies. Combining these methods and dropping momentum, we achieve comparable results to the published Adam regime in training the Transformer model on the WMT 2014 English-German machine translation task, while using very little auxiliary storage in the optimizer. Finally, we propose scaling the parameter updates based on the scale of the parameters themselves.
translated by 谷歌翻译
随机梯度体面(SGD)是深神经网络成功背后的核心技术之一。梯度提供有关功能具有最陡变化率的方向的信息。基本SGD的主要问题是通过梯度行为而对所有参数的相等大小的步骤进行更改。因此,深度网络优化的有效方式是为每个参数进行自适应步骤尺寸。最近,已经进行了几次尝试,以改善梯度下降方法,例如Adagrad,Adadelta,RMSProp和Adam。这些方法依赖于平方过去梯度的指数移动平均线的平方根。因此,这些方法不利用梯度的局部变化。在本文中,基于当前和立即梯度(即,差异)之间的差异提出了一种新颖的优化器。在所提出的差异优化技术中,以这样的方式调整步长,使得它应该具有更大的梯度改变参数的较大步长,以及用于较低梯度改变参数的较低步长。收敛分析是使用在线学习框架的遗憾方法完成。在本文中进行严格的分析超过三种合成复合的非凸功能。图像分类实验也在CiFar10和CiFAR100数据集上进行,以观察漫反射的性能,相对于最先进的优化器,例如SGDM,Adagrad,Adadelta,RMSProp,Amsgrad和Adam。基于基于单元(Reset)的基于卷积神经网络(CNN)架构用于实验中。实验表明,Diffgrad优于其他优化器。此外,我们表明差异对使用不同的激活功能训练CNN的均匀良好。源代码在https://github.com/shivram1987/diffgrad公开使用。
translated by 谷歌翻译
L 2 regularization and weight decay regularization are equivalent for standard stochastic gradient descent (when rescaled by the learning rate), but as we demonstrate this is not the case for adaptive gradient algorithms, such as Adam. While common implementations of these algorithms employ L 2 regularization (often calling it "weight decay" in what may be misleading due to the inequivalence we expose), we propose a simple modification to recover the original formulation of weight decay regularization by decoupling the weight decay from the optimization steps taken w.r.t. the loss function. We provide empirical evidence that our proposed modification (i) decouples the optimal choice of weight decay factor from the setting of the learning rate for both standard SGD and Adam and (ii) substantially improves Adam's generalization performance, allowing it to compete with SGD with momentum on image classification datasets (on which it was previously typically outperformed by the latter). Our proposed decoupled weight decay has already been adopted by many researchers, and the community has implemented it in TensorFlow and PyTorch; the complete source code for our experiments is
translated by 谷歌翻译
自适应梯度算法借用重球加速度的移动平均思想,以估计梯度的准确梯度矩和二阶矩,以加速收敛。然而,在理论上,在理论上,在许多经验情况下,在自适应梯度环境下,Nesterov加速度比重球加速度快的速度快得多。在这项工作中,我们提出了Adan的自适应Nesterov动量算法,以有效加快深层神经网络的训练。 Adan首先重新制定了Nesterov加速度,以开发新的Nesterov动量估计(NME)方法,该方法避免了外推点上计算梯度的额外计算和内存开销。然后,Adan采用NME来估计自适应梯度算法中梯度的一阶和二阶时刻,以进行收敛加速。此外,我们证明Adan在$ O(\ epsilon^{ - 3.5})内找到了$ \ epsilon $ - 附近的一阶固定点,$最著名的下限。广泛的实验结果表明,Adan超过了视觉变压器(VIT)和CNN上的相应SOTA优化器,并为许多流行网络设置了新的SOTA,例如Resnet,Convnext,Vit,Vit,Swin,Mae,Mae,LSTM,LSTM,Transformer-XL和BERT,以及BERT和BERT和BERT 。更令人惊讶的是,Adan可以利用SOTA优化器的一半培训成本(时代)在E.T.C. Vit和Resnet上获得更高或可比的性能,并且还显示出对大型Minibatch尺寸的宽容,例如1K到32K。我们希望Adan能够通过降低培训成本并减轻尝试各种架构的不同优化者的工程负担来为深度学习的发展做出贡献。代码将在https://github.com/sail-sg/adan上发布。
translated by 谷歌翻译
Adaptive optimization methods are well known to achieve superior convergence relative to vanilla gradient methods. The traditional viewpoint in optimization, particularly in convex optimization, explains this improved performance by arguing that, unlike vanilla gradient schemes, adaptive algorithms mimic the behavior of a second-order method by adapting to the global geometry of the loss function. We argue that in the context of neural network optimization, this traditional viewpoint is insufficient. Instead, we advocate for a local trajectory analysis. For iterate trajectories produced by running a generic optimization algorithm OPT, we introduce $R^{\text{OPT}}_{\text{med}}$, a statistic that is analogous to the condition number of the loss Hessian evaluated at the iterates. Through extensive experiments, we show that adaptive methods such as Adam bias the trajectories towards regions where $R^{\text{Adam}}_{\text{med}}$ is small, where one might expect faster convergence. By contrast, vanilla gradient methods like SGD bias the trajectories towards regions where $R^{\text{SGD}}_{\text{med}}$ is comparatively large. We complement these empirical observations with a theoretical result that provably demonstrates this phenomenon in the simplified setting of a two-layer linear network. We view our findings as evidence for the need of a new explanation of the success of adaptive methods, one that is different than the conventional wisdom.
translated by 谷歌翻译
我们研究基于梯度的随机近似问题的甲骨文复杂性。尽管在许多设置中,最佳算法和紧密的下界因这些问题而闻名,但在实践中使用时,这些最佳算法并不能达到最佳性能。我们通过关注实例依赖性复杂性而不是最坏情况的复杂性来解决这个理论实践差距。特别是,我们首先总结了已知的实例依赖性复杂性结果,并将它们分为三个级别。我们确定不同级别之间的支配关系,并提出了主导现有的第四个实例依赖性界限。然后,我们提供了足够的条件,根据该条件,具有时刻估计的自适应算法可以在不知道噪声水平的情况下达到拟议的结合。我们提出的算法及其分析为矩估计的成功提供了理论上的理由,因为它可以提高实例复杂性。
translated by 谷歌翻译
随着时间的推移,状态优化者维持梯度统计数据,例如,过去梯度值的指数平滑总和(具有动量)或平方和平方和。与普通的随机梯度下降相比,该状态可用于加速优化,但使用否则可能会分配给模型参数的内存,从而限制了在实践中训练的模型的最大尺寸。在本文中,我们开发了使用8位统计数据的第一批优化器,同时保持使用32位优化器状态的性能水平。为了克服最终的计算,量化和稳定性挑战,我们开发了稳固的动态量化。块量化将输入张量分为独立量化的较小块。每个块跨核并行处理,得出更快的优化和高精度量化。为了维持稳定性和性能,我们将块量化与其他两个更改相结合:(1)动态量化,一种非线性优化的形式,对于大小的小幅度值都是精确的,(2)稳定的嵌入层到减少来自语言模型中输入令牌的高度不均匀分布所带来的梯度差异。结果,我们的8位优化器在一系列任务上保持了32位的性能,其中包括1.5B参数语言建模,胶水芬特,Imagenet分类,WMT'14机器翻译,Moco V2对比相比, ImageNet预训练+芬太尼和罗伯塔训练,而没有更改原始优化器超参数。我们开放我们的8位优化器作为一个仅需要两行代码更改的置换式替换。
translated by 谷歌翻译