NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

On the Overlooked Pitfalls of Weight Decay and How to Mitigate Them: A Gradient-Norm Perspective

Zeke Xie, zhiqiang xu, Jingzhao Zhang, Issei Sato, Masashi Sugiyama

Introduction

Weight decay is a simple yet powerful regularization technique widely used in training deep neural networks (DNNs). While it is meant to regularize and improve generalization, researchers have discovered a counter-intuitive "pitfall": traditional weight decay often causes large gradient norms at the end of training, leading to poor convergence and "sharp" minima. To fix this, a new approach called Scheduled Weight Decay (SWD) has been introduced. SWD acts as a gradient-norm-aware scheduler that dynamically adjusts regularization strength to ensure smoother convergence and better generalization, effectively bridging the performance gap between Adam and SGD.

The Overlooked Pitfall of Weight Decay

Weight decay is a staple of deep learning, used to prevent overfitting by penalizing large weights. However, there is a significant oversight in how it is traditionally implemented, especially in adaptive optimizers like Adam.

The core issue is a conflict between the weight decay penalty and the learning rate scheduler. As the learning rate decays or adapts, the "effective" training objective shifts. This instability can prevent the model from ever reaching a true stationary point. Instead of settling into a flat, well-generalizing minimum, the model gets "pushed" by the constant weight decay, resulting in large gradient norms at the final stages of training.

Gradient norm dynamics for Adam with varying weight decay (WD) values. Larger WD leads to significantly higher gradient norms at the end of training.

These large gradients are a red flag: they usually correlate with "sharp" minima, which are notorious for poor generalization on unseen data. We usually think of weight decay as a tool for simplicity and flatness. However, constant weight decay can actually lead to sharper minima because it prevents the optimizer from settling into the bottom of a flat valley. The authors even provide a formal proof showing that under common learning rate schedules, vanilla weight decay can make it mathematically impossible for the model to converge to a non-zero stationary point.

Scheduled Weight Decay (SWD) and AdamS

To mitigate these gradient-norm-centered pitfalls, the authors propose Scheduled Weight Decay (SWD). Unlike standard weight decay, which uses a constant hyperparameter ($\lambda$), SWD is gradient-norm-aware.

Algorithm for AdamS, showcasing the Scheduled Weight Decay (SWD) integration where the decay term is scaled by the mean of the preconditioner state.

The key innovation is a scheduler that scales the weight decay strength based on the moving average of the squared gradients. In the context of Adam (resulting in the AdamS optimizer), the weight decay term is adjusted by the mean of the preconditioner state ($\bar{v}_t$).

Essentially, SWD creates a negative feedback loop:

  1. High Gradient Norm: If the gradient norm becomes too large (indicating instability or a sharp region), the scheduler increases the penalty to "slow down" and regularize more heavily.
  2. Low Gradient Norm: If the gradient norm is small, it reduces the penalty, allowing the optimizer to achieve more precise convergence.

This differs fundamentally from standard AdamW (Decoupled Weight Decay), which couples the decay only to the vanilla learning rate, failing to account for the actual landscape of the gradient norm during the final phase of training.

Key Results and Insights

By acting as a stabilizer, SWD ensures that regularization doesn't overpower the optimization at the very end of training. The authors validated their approach across diverse benchmarks, including CIFAR-10, CIFAR-100, and ImageNet, using architectures like ResNet, VGG16, and DenseNet.

  • Superior Generalization: On CIFAR-100 with ResNet34, AdamS achieved a test error of 21.76%, significantly beating AdamW (22.99%) and standard Adam (27.16%), and even outperforming SGD (21.52%).
  • ImageNet Gains: On the massive ImageNet dataset, AdamS (ResNet50) reached a Top-1 error of 24.19%, outperforming both AdamW (24.29%) and vanilla Adam (30.07%).
  • Bridging the Adam-SGD Gap: It is a well-known "folk theorem" in ML that SGD often generalizes better than Adam for computer vision. The authors suggest a major reason for this is Adam's poor interaction with weight decay. By using SWD, AdamS can match or exceed SGD's generalization performance.
  • Flatter Minima: Using Hessian eigenvalue analysis, the authors showed that AdamS consistently finds solutions with much lower "sharpness" compared to AdamW.
  • Robustness: SWD proved to be more robust to hyperparameter choices than AdamW, which often requires tedious re-tuning of the weight decay rate when the learning rate changes.

Limitations and Future Work

The primary limitation noted is in Language Modeling. In experiments with LSTMs on the Penn TreeBank dataset, standard $L_2$ regularization still outperformed both weight decay and SWD. This suggests that the identified "pitfalls" might be more specific to the loss landscapes of Convolutional Neural Networks (CNNs) rather than Recurrent Neural Networks (RNNs).

Future work remains open on how to apply similar scheduling principles to $L_2$ regularization itself, and whether these gradient-norm-aware perspectives can be integrated into other types of regularizers beyond weight decay.

Summary updated

BibTeX
@inproceedings{xie2023overlooked,
  author = {Zeke Xie and zhiqiang xu and Jingzhao Zhang and Issei Sato and Masashi Sugiyama},
  title = {{On the Overlooked Pitfalls of Weight Decay and How to Mitigate Them: A Gradient-Norm Perspective}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=vnGcubtzR1},
}
Figure