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
11/23/2020
cs.LGcs.AI

Official code: zeke-xie/stable-weight-decay-regularization (61 stars, Python, MIT, PyTorch, last commit 2024-02-03).

Abstract

Weight decay is a simple yet powerful regularization technique that has been very widely used in training of deep neural networks (DNNs). While weight decay has attracted much attention, previous studies fail to discover some overlooked pitfalls on large gradient norms resulted by weight decay.

Show full abstract

In this paper, we discover that, weight decay can unfortunately lead to large gradient norms at the final phase (or the terminated solution) of training, which often indicates bad convergence and poor generalization. To mitigate the gradient-norm-centered pitfalls, we present the first practical scheduler for weight decay, called the Scheduled Weight Decay (SWD) method that can dynamically adjust the weight decay strength according to the gradient norm and significantly penalize large gradient norms during training. Our experiments also support that SWD indeed mitigates large gradient norms and often significantly outperforms the conventional constant weight decay strategy for Adaptive Moment Estimation (Adam).

View on arXivView PDF

Code Implementations(1)

PyTorchMIT

[NeurIPS 2023] The PyTorch Implementation of Scheduled (Stable) Weight Decay.

615Python, Jupyter NotebookJul 30, 20202 years agoMIT
deep-learningoptimizerpytorchregularizationstochastic-optimization+1 more

Similar Papers

Cite this paper

@article{xie2020overlooked,
  title  = {On the Overlooked Pitfalls of Weight Decay and How to Mitigate Them: A Gradient-Norm Perspective},
  author = {Zeke Xie and Zhiqiang Xu and Jingzhao Zhang and Issei Sato and Masashi Sugiyama},
  year   = {2020},
  eprint = {2011.11152},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2011.11152}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2011.11152.svg)](https://codeofpaper.com/paper/2011.11152)

Discussion