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

Understanding and Scheduling Weight Decay

Zeke Xie, Issei Sato, Masashi Sugiyama

Abstract

Weight decay is a popular and even necessary regularization technique for training deep neural networks that generalize well. Previous work usually interpreted weight decay as a Gaussian prior from the Bayesian perspective. However, weight decay sometimes shows mysterious behaviors beyond the conventional understanding. For example, the optimal weight decay value tends to be zero given long enough training time. Moreover, existing work typically failed to recognize the importance of scheduling weight decay during training. Our work aims at theoretically understanding novel behaviors of weight decay and designing schedulers for weight decay in deep learning. This paper mainly has three contributions. First, we propose a novel theoretical interpretation of weight decay from the perspective of learning dynamics. Second, we propose a novel weight-decay linear scaling rule for large-batch training that proportionally increases weight decay rather than the learning rate as the batch size increases. Third, we provide an effective learning-rate-aware scheduler for weight decay, called the Stable Weight Decay (SWD) method, which, to the best of our knowledge, is the first practical design for weight decay scheduling. In our various experiments, the SWD method often makes improvements over $L_{2}$ Regularization and Decoupled Weight Decay.

Introduction

In deep learning, $L_2$ regularization and weight decay are often treated as interchangeable, but they behave very differently inside adaptive optimizers like Adam. This realization previously led to the creation of AdamW, which decouples weight decay from the gradient update. However, this paper identifies a hidden flaw in how decoupled weight decay operates.

The authors discover that applying standard weight decay creates a dynamic training objective with unstable stationary points. Because the model can never truly settle, this instability manifests as unusually large gradient norms during the final phases of training. In optimization theory, large gradient norms at convergence are a red flag—they correlate with sharp minima and poor generalization. This research aims to mitigate this gradient-norm explosion without losing the regularizing benefits of weight decay.

Methods: The AdamS Optimizer

To solve the instability caused by static weight decay, the authors propose Scheduled Weight Decay (SWD). Instead of applying a constant weight decay parameter ($\lambda$), SWD dynamically scales the weight decay strength inversely to the gradient norm. The authors implement this in a modified optimizer called AdamS.

Algorithm 2: The AdamS optimizer implements gradient-norm-aware weight decay scheduling.

As shown in the algorithm above, AdamS tracks the exponential moving average of squared gradients ($\hat{v}_t$). It then calculates the mean of this vector across all parameters ($\bar{v}_t$) to scale the weight decay step. If the gradient norm starts to explode, the denominator grows, and the weight decay strength is automatically reduced. This acts as a negative feedback loop, actively penalizing large gradient norms and stabilizing the training dynamics without requiring complex new hyperparameters.

Key Insights and Empirical Observations

Theoretical proofs and empirical observations show that standard weight decay forces the gradient norm to increase monotonically with the weight decay strength. This phenomenon is clearly visible in baseline optimizers like AdamW.

Empirical evidence showing that higher weight decay (WD) leads to significantly larger gradient norms in AdamW.

This "Sharp Minima Paradox" challenges the conventional belief that weight decay always encourages simpler models. Hessian eigenvalue analysis reveals that the large gradient norms induced by static weight decay actually push the model into sharper minima, which hurts generalization. By tying the weight decay penalty to the gradient norm, SWD effectively suppresses these gradient spikes, leading to flatter minima and wider loss basins.

Key Results

  • Superior Accuracy: AdamS consistently outperforms Adam, AdamW, and other variants like AMSGrad and RAdam across standard CNN architectures on CIFAR and ImageNet.
  • Closing the SGD Gap: AdamS effectively closes the generalization gap between Adam and SGD on vision tasks. For example, on ResNet18 (CIFAR-10), AdamS achieved a 4.91% test error, surpassing both standard SGD (5.01%) and AdamW (5.08%).
  • Hyperparameter Robustness: AdamS is significantly less sensitive to the initial weight decay setting than AdamW, carving out a wider basin of optimal performance and reducing tuning time.

Conclusion

While SWD provides a powerful mechanism for stabilizing decoupled weight decay, it is not a universal solution. On language modeling tasks using LSTMs, standard $L_2$ regularization still tends to outperform both decoupled weight decay and SWD. Future work will explore how to properly schedule standard $L_2$ regularization to achieve similar stability gains in the NLP domain.

Summary updated

BibTeX
@inproceedings{xie2023understanding,
  author = {Zeke Xie and Issei Sato and Masashi Sugiyama},
  title = {{Understanding and Scheduling Weight Decay}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=vnGcubtzR1},
}
Figure