Stochastic Gradient Methods with Layer-wise Adaptive Moments for Training of Deep Networks

Boris Ginsburg, Patrice Castonguay, Oleksii Hrinchuk, Oleksii Kuchaiev, Vitaly Lavrukhin, Ryan Leary, Jason Li, Huyen Nguyen, Jonathan M. CohenarXiv 2019

Introduction

Deep learning practitioners often face a difficult choice when selecting an optimizer. Stochastic Gradient Descent (SGD) with momentum remains the gold standard for computer vision due to its superior generalization, yet it is notoriously sensitive to learning rate (LR) and weight initialization. Conversely, Adam is the preferred choice for NLP and speech tasks because of its robustness and ease of tuning; however, it often generalizes poorly and requires double the memory of SGD to store "second moments" (moving averages of squared gradients) for every parameter.

Furthermore, training with very large batch sizes—essential for scaling across multiple GPUs—often destabilizes standard optimizers. This typically necessitates a "bag of tricks," such as LARS or complex learning rate warmups, to maintain stability. NovoGrad is introduced as a novel optimizer that combines the generalization power of SGD with the stability of Adam, while significantly reducing the memory footprint.

The NovoGrad Algorithm

NovoGrad stands for "Stochastic Gradient Normalized by Layerwise Adaptive Second Moments." Its architecture is built on three key pillars:

  1. Layer-wise Normalization: Unlike Adam, which computes a second moment for every individual weight, NovoGrad computes a single scalar second moment for an entire layer based on the squared norm of the layer's gradient.
  2. Momentum on Normalized Gradients: NovoGrad calculates the first moment (momentum) after the gradients have been normalized by the layer-wise second moment. This prevents noisy or exploding gradients from derailing training in the early stages.
  3. Decoupled Weight Decay: Following the methodology of AdamW, NovoGrad separates weight decay from the gradient update itself. This improves regularization and prevents weight decay from being inadvertently scaled by adaptive moments.

Key Insights and Efficiency

Memory Optimization

Because NovoGrad stores only one second-moment scalar per layer instead of one per parameter, it effectively has half the memory footprint of Adam. For massive models like GPT-3 or Megatron-LM, this VRAM saving is critical for fitting larger models or batches into hardware.

Robustness and Scaling

NovoGrad’s safe learning rates typically fall between those of SGD (large LRs) and Adam (small LRs), providing a predictable middle ground. Additionally, the layer-wise normalization makes the optimizer less sensitive to weight initialization. Notably, NovoGrad performs exceptionally well in large-batch settings (up to 32K) without requiring the specialized heuristics usually needed to stabilize SGD at that scale.

Key Results

NovoGrad was evaluated across diverse benchmarks, including ImageNet (ResNet-50v2), LibriSpeech (Jasper-10x5), and WikiText-103 (Transformer-XL). It consistently performed on par with or better than tuned SGD and AdamW.

Computer Vision (ImageNet)

On ImageNet, NovoGrad achieved a 77.74% top-1 accuracy, outperforming both SGD (76.38%) and AdamW (76.48%). It demonstrated superior regularization, maintaining high accuracy over longer training durations without overfitting.

Table 1: Performance comparison of SGD, AdamW, and NovoGrad on ImageNet.

Speech Recognition (LibriSpeech)

In speech recognition tasks using the LibriSpeech dataset, NovoGrad achieved a Word Error Rate (WER) of 3.71% on the dev-clean set. This represents a significant improvement over both Adam (5.06%) and SGD (4.08%).

Table 2: Comparison of Word Error Rate (WER) on LibriSpeech for Adam, SGD, and NovoGrad.

Language Modeling

On WikiText-103, NovoGrad reached a validation perplexity of 20.53, outperforming AdamW (23.64). In large-batch experiments (32K) on ImageNet, it maintained a high accuracy of 75.78%, proving its efficacy for massive distributed training runs.

Limitations and Future Work

While NovoGrad is highly robust, it still requires a learning rate warmup in certain extreme large-batch scenarios to reach peak performance. Additionally, while it offers significant memory savings over Adam, it still requires more memory than basic SGD. Future research may explore the specific regularization properties of layer-wise normalization and test the optimizer on even larger-scale models where memory constraints are the primary bottleneck.

Summary updated

BibTeX
@misc{ginsburg2019stochastic,
  author = {Boris Ginsburg and Patrice Castonguay and Oleksii Hrinchuk and Oleksii Kuchaiev and Vitaly Lavrukhin and Ryan Leary and Jason Li and Huyen Nguyen and Jonathan M. Cohen},
  title = {{Stochastic Gradient Methods with Layer-wise Adaptive Moments for Training of Deep Networks}},
  year = {2019},
  eprint = {1905.11286},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.11286},
}
Figure