TL;DR
This paper introduces Torque-Aware Momentum (TAM), a novel optimizer that enhances deep learning by intelligently damping gradients that are misaligned with previous momentum. TAM improves generalization, robustness to distribution shifts, and exploration, outperforming standard optimizers like SGDM and Adam on various tasks, including image classification and LLM fine-tuning.
What Problem Does This Paper Address?
Deep neural networks often struggle to navigate complex loss landscapes, especially when encountering large, misaligned gradients. These "torqued" gradients, often arising from noisy data or abrupt changes in curvature, can cause optimizers like standard SGD with momentum (SGDM) to oscillate and get stuck in suboptimal regions, hindering generalization and exploration. While optimizers like Adam offer adaptive learning rates, they don't specifically address this gradient misalignment issue. The authors aim to improve the stability and exploration capabilities of momentum-based optimizers by directly tackling the problem of misaligned gradients.
Methods
The core innovation is Torque-Aware Momentum (TAM). It modifies the standard momentum update by introducing a damping factor that depends on the cosine similarity (correlation) between the current gradient and the previous momentum direction. This damping factor effectively reduces the influence of "torqued" gradients, preventing abrupt shifts in the update direction.
Here's a breakdown:
- Correlation Calculation: TAM first computes the cosine similarity ($s_t$) between the previous momentum ($m_{t-1}$) and the current gradient ($g_t$).
- Smoothing: This correlation is then smoothed over time ($\hat{s}_t$) to account for stochasticity.
- Damping Factor: A damping factor ($d_t$) is derived from the smoothed correlation, normalized to the range [0, 1]. This factor is designed such that when the gradient aligns well with momentum, the damping is minimal, and when they are misaligned, the damping is stronger.
- Modified Momentum Update: The momentum update rule becomes $m_t = \beta m_{t-1} + (\epsilon + d_t) g_t$, where $\epsilon$ is a small constant to ensure gradients always have some influence.
TAM can be combined with both SGD and Adam, leading to an adaptive variant called AdaTAM. The paper also proposes a heuristic for transferring learning rates from SGDM to TAM to ensure fair comparison.
Datasets
The paper uses a variety of datasets for evaluation:
- Image Classification: CIFAR10, CIFAR100, and ImageNet.
- LLM Fine-Tuning: The Massive Text Embedding Benchmark (MTEB), which covers 7 task categories and 56 datasets. Models fine-tuned include BERT-base, BERT-large, DeBERTa-base, DeBERTa-large, RoBERTa-base, and RoBERTa-large.
- Online Learning: Custom setups involving MLPs trained on CIFAR10 with label flipping to simulate distribution shifts.
- Graph Neural Networks (GNNs): A link prediction task on the MovieLens dataset.
- Continual Learning: The CLEAR benchmark, consisting of 10 sequential image recognition tasks.
Key Insights and Ideas
- Gradient Alignment is Key: The paper strongly suggests that the alignment between the momentum vector and the current gradient is a critical factor for stable and effective optimization, more so than just the magnitude of the gradient itself.
- Damping as "Anisotropic Friction": The analogy to mechanical systems is insightful. TAM acts like a friction that selectively opposes "torques" (misaligned gradients) rather than just slowing down all motion.
- Early Exploration Matters: TAM's ability to maintain stable directions early in training seems to guide the optimizer towards more generalizable basins in the loss landscape.
- Robustness to Distribution Shifts: TAM shows a significant advantage in online learning scenarios with drastic label flipping, where it maintains better accuracy than SGDM. This highlights its ability to adapt to changing data distributions.
- Warm-up Potential: Using TAM as a warm-up strategy can lead to faster convergence and lower loss barriers, suggesting it helps find better initial regions of the loss landscape.
Key Results
- Image Classification: TAM and AdaTAM generally outperform SGDM, SGD, Adam, and AngularGrad in terms of validation accuracy across CIFAR10, CIFAR100, and ImageNet. For example, on CIFAR10 with ResNet18, TAM achieved 94.2% accuracy compared to SGDM's 93.6%.
- LLM Fine-Tuning: AdaTAMW (AdaTAM with weight decay) shows significant improvements over AdamW on various MTEB tasks and model sizes, particularly for DeBERTa models and in scenarios with fewer fine-tuning epochs. It achieved higher scores on more than two-thirds of MTEB datasets for BERT-large and DeBERTa-base in 3- and 5-epoch settings.
- Online Learning: TAM demonstrates superior performance to SGDM and SGD in online learning with significant label flipping (80% and 100%), maintaining higher accuracy and stability.
- Continual Learning: TAM consistently outperforms SGDM on the CLEAR benchmark under both Naive and LwF setups, indicating better stability and plasticity.
- Warm-up: TAM warmup leads to higher validation accuracy and faster convergence compared to SGDM warmup on ResNet18 and GNNs.
Limitations and Future Work
- Hyperparameter Tuning: While TAM introduces only two hyperparameters ($\gamma$ and $\epsilon$) which are fixed by default, the paper notes that their values might need tuning in some cases.
- Challenging Non-Stationary Environments: The authors suggest further work is needed to test TAM's capabilities in more challenging non-stationary environments, such as continual learning, although preliminary results in Appendix A.2.3 are promising.
- Other Paradigms: Exploring TAM's potential in other training paradigms like self-supervised learning and reinforcement learning is suggested as a future direction.
- Catastrophic Forgetting: While preliminary results show TAM's potential to address catastrophic forgetting, a thorough investigation is required.
Summary updated