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

An Adaptive Gradient Regularization Method

Huixiu Jiang, Ling Yang, Yu Bao, Rutong SiarXiv 2024

Abstract

Stochastic optimization plays a crucial role in the advancement of deep learning technologies. Over the decades, significant effort has been dedicated to improving the training efficiency and robustness of deep neural networks, via various strategies including gradient normalization (GN) and gradient centralization (GC). Nevertheless, to the best of our knowledge, no one has considered to capture the optimal gradient descent trajectory, by adaptively controlling gradient descent direction. To address this concern, this paper is the first attempt to study a new optimization technique for deep neural networks, using the sum normalization of a gradient vector as coefficients, to dynamically regularize gradients and thus to effectively control optimization direction. The proposed technique is hence named as the adaptive gradient regularization (AGR). It can be viewed as an adaptive gradient clipping method. The theoretical analysis reveals that the AGR can effectively smooth the loss landscape, and hence can significantly improve the training efficiency and model generalization performance. We note that AGR can greatly improve the training efficiency of vanilla optimizers' including Adan and AdamW, by adding only three lines of code. The final experiments conducted on image generation, image classification, and language representation, demonstrate that the AGR method can not only improve the training efficiency but also enhance the model generalization performance.

Introduction

Training deep neural networks (DNNs) involves navigating complex, high-dimensional loss landscapes to find optimal parameter configurations. While standard optimizers like AdamW and SGD with Momentum are widely used, they often encounter "sharp" minima or erratic gradient directions that can impede generalization and slow down convergence. Existing techniques such as Batch Normalization (BN) or Gradient Centralization (GC) address these issues by normalizing activations or weights. However, they typically do not account for the relative importance of individual gradient elements within a layer during the update step. This omission can lead to updates that are either too aggressive or poorly directed.

This paper introduces Adaptive Gradient Regularization (AGR), a novel "plug-and-play" optimization enhancement designed to capture optimal gradient descent trajectories by adaptively controlling the descent direction.

Methodology

AGR modifies the gradient before it is processed by the optimizer. The core innovation lies in an adaptive coefficient, $\alpha_{i,j}$, calculated for every element in a weight matrix. This coefficient represents the ratio of the absolute value of a specific gradient element to the sum of the absolute values of all gradients within that layer:

$$\alpha_{i,j} = \frac{|\nabla w_{i,j} \mathcal{L}|}{\sum_{k,l} |\nabla w_{k,l} \mathcal{L}|}$$

The "regularized" gradient, $\Psi(\nabla w_{i,j} \mathcal{L})$, is then computed by subtracting a portion of the original gradient from itself based on this coefficient:

$$\Psi(\nabla w_{i,j} \mathcal{L}) = \nabla w_{i,j} \mathcal{L} - \alpha_{i,j} \nabla w_{i,j} \mathcal{L}$$

Overview of the AGR framework showing (a) standard gradient flow, (b) AGR flow, and (c) the calculation of the regularization coefficient alpha.

As illustrated in the framework overview, AGR acts as a dynamic, element-wise clipping mechanism. If a specific gradient is disproportionately large compared to its peers in the same layer, AGR dampens it more significantly. This prevents any single weight update from dominating the trajectory, leading to a more balanced and stable descent. Theoretical analysis suggests that this process effectively reduces the Lipschitz constant of the loss function, smoothing the optimization terrain.

Experimental Setup

The effectiveness of AGR was evaluated across three distinct domains:

  • Image Generation: CIFAR-10 using the Denoising Diffusion Probabilistic Model (DDPM) framework.
  • Image Classification: CIFAR-100 and Tiny-ImageNet using architectures including ResNet (18, 50, 101), VGG11, ConvNext, and Vision Transformers (ViT, Swin, TinyViT).
  • Language Representation: WikiText-2 for training the ALBERT model on masked language modeling and sentence order prediction tasks.

Results and Discussion

AGR consistently outperformed baseline optimizers across all benchmarks. In generative modeling, Adan with AGR achieved a state-of-the-art FID score of 7.44 on CIFAR-10. In vision tasks, AGR improved the Top-1 accuracy of ResNet-18 on Tiny-ImageNet by nearly 1% and boosted TinyViT variants by up to 1.7%.

Training loss and accuracy curves for ResNet18 on CIFAR-100, comparing AdamW with and without AGR.

As shown in the training curves, AGR-enabled models reach lower loss values faster and exhibit smoother test accuracy curves compared to their baseline counterparts. This empirical evidence supports the theoretical claim that AGR improves training efficiency and model generalization. Furthermore, AGR requires no additional hyperparameter tuning and adds negligible computational overhead, requiring only three lines of code to implement.

Conclusion

Adaptive Gradient Regularization (AGR) provides a simple yet effective way to improve DNN training by dynamically regularizing gradients. By smoothing the loss landscape and preventing erratic updates, it enhances both convergence speed and final performance. Future work includes exploring the optimal timing for suspending AGR during late-stage training and evaluating its impact on emerging architectures like Mamba and large-scale video generation models.

Summary updated

BibTeX
@misc{jiang2024adaptive,
  author = {Huixiu Jiang and Ling Yang and Yu Bao and Rutong Si},
  title = {{An Adaptive Gradient Regularization Method}},
  year = {2024},
  eprint = {2407.16944},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.16944},
}
Figure