Introduction
Adaptive learning rate methods, most notably Adam, have revolutionized deep learning by providing efficient optimization with minimal manual tuning of learning rates. Despite their ubiquity, theoretical and empirical evidence has surfaced showing that Adam can fail to converge to an optimal solution even in relatively simple stochastic optimization problems. This paper introduces AdaShift, a novel optimizer that identifies and corrects a fundamental flaw in the Adam update rule: the inappropriate correlation between the current gradient and its adaptive learning rate.
The Problem: Inappropriate Correlation
The authors pinpoint the "smoking gun" behind Adam's non-convergence as the way the second-moment estimate $v_t$ is calculated. In standard Adam, $v_t$ (the denominator that scales the learning rate) is updated using the current gradient $g_t$. This creates a biased step size. Specifically, a large gradient $g_t$ increases the value of $v_t$, effectively "inflating" its own denominator and resulting in a smaller-than-expected step. Conversely, a small gradient might receive a disproportionately large step.
This bias is particularly problematic in non-stationary or specific stochastic environments. As shown in Figure 2, while specific hyperparameter tuning (like increasing $\beta_2$ to 0.9999) might mitigate the issue in some cases, the standard configuration ($\beta_1=0.9, \beta_2=0.999$) fails to move toward the optimum, moving in the positive direction instead of negative.
The AdaShift Solution
AdaShift introduces a simple yet powerful modification to decorrelate the update. The core idea is to ensure that the term used to scale the learning rate is independent of the current gradient being applied.
1. Temporal Shifting
Instead of using the current gradient $g_t$ to update the second moment $v_t$, AdaShift uses a gradient from $n$ steps ago ($g_{t-n}$). In a typical mini-batch training setting, gradients from different time steps are independent. By shifting the gradient used for the second moment, AdaShift ensures that $v_t$ is independent of $g_t$ while still capturing the overall scale of the optimization landscape.
2. Spatial Operations
In addition to temporal shifting, AdaShift introduces spatial operations. Standard Adam adapts the learning rate element-wise for every parameter. AdaShift applies a spatial function $\phi$ (typically a max operation) over parameter blocks, such as an entire layer. This transforms the optimizer into a form of Block-wise Adaptive SGD, which preserves the relative scale of gradients within a layer while adapting the overall layer-wise learning rate.
3. Truncated First Moment
To maintain full decorrelation, the first moment $m_t$ is calculated as a moving average of the "kept-out" $n$ gradients. This ensures that both the numerator ($m_t$) and the denominator ($\sqrt{v_t}$) of the update rule are independent of the current gradient $g_t$.
Experimental Results
The effectiveness of AdaShift was first tested on synthetic counterexamples designed to make Adam fail. Figure 1 illustrates that while Adam moves away from the optimum (increasing $\theta_t$), AdaShift successfully converges in the correct direction. Notably, AdaShift converges significantly faster than AMSGrad, another popular fix for Adam's convergence issues. AMSGrad often slows down training because its learning rate is forced to be monotonically decreasing, potentially getting "trapped" at very small values.
Beyond synthetic tests, AdaShift was evaluated on a wide array of real-world tasks:
- Computer Vision: On CIFAR-10 and Tiny-ImageNet using ResNet and DenseNet architectures, AdaShift matched or slightly exceeded Adam's final test accuracy.
- Generative Modeling: In WGAN-GP, which is notoriously difficult to stabilize, AdaShift showed improved stability and performance.
- Natural Language Processing: For Neural Machine Translation (NMT), AdaShift achieved higher BLEU scores than both Adam and AMSGrad, proving its robustness in complex sequential tasks.
Key Insights
The authors introduce the concept of the "Net Update Factor" to analyze the total influence of a single gradient over the entire optimization process. They prove that in Adam, this factor is biased against large gradients. By decorrelating $v_t$ from $g_t$, AdaShift restores the property that the expected step size for each gradient is identical, similar to vanilla SGD, but with the added benefits of adaptive scaling.
Conclusion
AdaShift represents a significant step forward in understanding and improving adaptive optimizers. By addressing the correlation bias through temporal shifting and spatial operations, it provides a more robust and reliable alternative to Adam and AMSGrad. It maintains the legendary training speed of Adam while offering the convergence guarantees necessary for complex deep learning tasks.
Summary updated