Skip to main content
QUICK REVIEW

[Paper Review] Penalizing Gradient Norm for Efficiently Improving Generalization in Deep Learning

Yang Zhao, Hao Zhang|arXiv (Cornell University)|Feb 8, 2022
Advanced Neural Network ApplicationsComputer Science16 citations
TL;DR

This paper proposes a novel optimization method that improves deep learning generalization by penalizing the gradient norm of the loss function, using a first-order approximation to avoid costly Hessian computations. The approach outperforms both standard SGD and Sharpness-Aware Minimization (SAM), achieving state-of-the-art results with up to 70% greater improvement on CIFAR and ImageNet benchmarks.

ABSTRACT

How to train deep neural networks (DNNs) to generalize well is a central concern in deep learning, especially for severely overparameterized networks nowadays. In this paper, we propose an effective method to improve the model generalization by additionally penalizing the gradient norm of loss function during optimization. We demonstrate that confining the gradient norm of loss function could help lead the optimizers towards finding flat minima. We leverage the first-order approximation to efficiently implement the corresponding gradient to fit well in the gradient descent framework. In our experiments, we confirm that when using our methods, generalization performance of various models could be improved on different datasets. Also, we show that the recent sharpness-aware minimization method (Foret et al., 2021) is a special, but not the best, case of our method, where the best case of our method could give new state-of-art performance on these tasks. Code is available at {https://github.com/zhaoyang-0204/gnp}.

Motivation & Objective

  • Address the challenge of poor generalization in overparameterized deep neural networks by explicitly guiding optimization toward flatter minima.
  • Overcome the computational infeasibility of directly minimizing gradient norm via Hessian computation by introducing an efficient first-order approximation.
  • Demonstrate that penalizing gradient norm leads to flatter minima, which are known to generalize better than sharp minima.
  • Show that the recent SAM method is a special case of the proposed framework, and that the proposed method can achieve better performance with optimal hyperparameter tuning.
  • Provide a practical guide for hyperparameter selection to maximize generalization gains in real-world training scenarios.

Proposed method

  • Propose a new training objective that adds a penalty term on the L2 norm of the gradient of the loss function with respect to network parameters.
  • Use a first-order approximation to compute the gradient of the gradient norm, avoiding second-order derivatives and enabling efficient implementation in standard SGD frameworks.
  • Formulate the optimization as a minimax problem similar to SAM, but with a more general and flexible penalty structure.
  • Introduce two hyperparameters: α (controls the magnitude of the penalty) and r (controls the radius of the perturbation in the minimax formulation).
  • Implement the method using standard deep learning frameworks by computing the gradient norm penalty via backpropagation through the first-order approximation.
  • Enable stable training by carefully selecting hyperparameters to avoid over-penalization that could collapse the gradient norm to zero too early.

Experimental results

Research questions

  • RQ1Can penalizing the gradient norm of the loss function lead to flatter minima and improved generalization in deep neural networks?
  • RQ2How can the gradient norm penalty be efficiently implemented without computing the Hessian matrix?
  • RQ3Is the Sharpness-Aware Minimization (SAM) method a special case of the proposed general framework?
  • RQ4What hyperparameter settings (α and r) yield optimal generalization performance across different architectures and datasets?
  • RQ5Does the proposed method consistently outperform both standard SGD and SAM on diverse benchmarks like CIFAR-10, CIFAR-100, and ImageNet?

Key findings

  • The proposed method achieves state-of-the-art performance on CIFAR-10 and CIFAR-100, with improvements up to 70% greater than those of SAM.
  • On ImageNet, the method reduces top-1 error rates by 0.37% on VGG16-BN, 0.29% on ResNet50, and 0.45% on ResNet101 compared to standard training, and further improves upon SAM.
  • For WideResNet-28-10 on CIFAR-10, the best hyperparameters (α=0.8, r∈{0.05,0.1}) yield the highest performance, while larger α values (e.g., α=2.0) cause premature collapse of the gradient norm and degrade test accuracy.
  • The method improves training stability compared to SAM in some settings, particularly when hyperparameters are carefully tuned.
  • The gradient norm penalty effectively encourages the optimizer to converge to flatter minima, which correlates with better generalization.
  • The method is broadly applicable across architectures, including convolutional networks and vision transformers, and works effectively on both small-scale (CIFAR) and large-scale (ImageNet) datasets.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.