Neglected Hessian component explains mysteries in Sharpness regularization

Yann N. Dauphin, Atish Agarwala, Hossein Mobahi · DOI

Abstract

Sharpness-aware methods like SAM improve generalization by finding flat minima. However, the success of these methods is inconsistent across architectures and activation functions. This paper identifies the "Nonlinear Modeling Error" (NME) component of the Hessian as the key factor. We show that while the Gauss-Newton (GN) matrix represents feature exploitation, the NME encodes feature exploration. Our findings explain why gradient penalties are sensitive to activations like ReLU versus GELU and provide a path toward more robust regularizers.

Introduction

In deep learning, "sharpness-aware" methods like SAM have become popular because they encourage the model to find flat minima, which generally leads to better generalization. However, researchers have long been puzzled by a contradiction: while SAM works remarkably well, seemingly similar methods like gradient penalties or weight noise often fail or provide inconsistent benefits.

The authors argue that the root of this mystery lies in how we approximate the Hessian (the matrix of second-order derivatives of the loss). Most researchers simplify the Hessian by focusing only on the Gauss-Newton (GN) part, which is mathematically convenient and always positive semi-definite. They neglect the remaining part, which the authors call the Nonlinear Modeling Error (NME) matrix. This paper investigates whether this "neglected" component is actually doing something important.

The Role of the NME

The authors decompose the Hessian into two distinct parts:

  1. Gauss-Newton (GN) Matrix: Represents "feature exploitation"—how the loss changes if the features are fixed.
  2. Nonlinear Modeling Error (NME) Matrix: Represents "feature exploration"—how the model's features themselves change as parameters move.

In networks with saturating activations, the NME acts as an "edge detector." It is only non-zero near the boundaries where neurons switch on or off. It essentially tells the optimizer about the utility of switching between different linear regions of the model.

The NME norm is concentrated at the boundaries of the loss landscape's linear regions, acting as an edge detector for feature exploration.

Activation Functions and the Hessian Mystery

A key insight of the paper is that ReLU "hides" the Hessian. Because ReLU's second derivative is zero almost everywhere, the NME for ReLU networks is "spiky" and high-variance. This explains why gradient penalties (which rely on Hessian-vector products) often fail with ReLU but work with GELU.

SAM's secret to success is its robustness; it uses a discrete step to calculate gradients, which effectively "integrates" over the NME rather than relying on a single, potentially noisy pointwise measurement. When using smooth activations like GELU, the NME becomes more informative for the optimizer.

Comparison of accuracy on ImageNet and CIFAR-10 for ReLU vs GELU as the regularization parameter increases. GELU benefits from the regularization while ReLU performance degrades.

Key Results

  • Rescuing ReLU: By using "Augmented ReLU" (manually adding NME information back into the gradient calculation), the authors made gradient penalties perform as well as they do on GELU networks.
  • GN Penalty Superiority: On ImageNet, a penalty that only targets the Gauss-Newton part of the Hessian (ignoring the NME in the loss function) improved accuracy by 1.6% over standard weight noise or full Hessian penalties.
  • NME Sensitivity: The study found that while NME information is beneficial when it appears in the update rule (helping the optimizer navigate), it is actually detrimental when penalized directly in the loss function (which suppresses feature exploration).

Conclusion

This research reveals that the NME is the secret sauce behind why certain sharpness regularization methods work while others fail. By showing that the NME encodes "feature exploration," the authors explain the sensitivity to activation functions and how to design better regularizers by isolating specific parts of the Hessian. Future work may focus on designing activation functions specifically optimized for "second-order compatibility" rather than just first-order gradient flow.

Summary updated

BibTeX
@inproceedings{dauphin2024neglected,
  author = {Yann N. Dauphin and Atish Agarwala and Hossein Mobahi},
  title = {{Neglected Hessian component explains mysteries in Sharpness regularization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=m6pVpdIN0y},
}
Figure