Abstract
Deep neural network training often converges to sharp minima that generalize poorly to shifted or out-of-distribution data. We propose a novel regularization method that explicitly penalizes the spectral radius of the Hessian matrix to encourage convergence toward "flat" minima. By leveraging efficient Hessian-vector products and iterative eigenvalue solvers, we demonstrate that this approach significantly improves model robustness across tabular, image, and medical datasets without requiring the computation of the full Hessian.
Introduction
In deep learning, the "generalization gap" remains a significant hurdle: models often achieve near-zero training loss but fail on test sets, particularly when faced with covariate shifts (e.g., changes in lighting or demographics). Theoretical research suggests that flat minima—regions of the loss landscape where curvature is low—generalize better than sharp minima. However, measuring and optimizing for flatness is computationally expensive, as the Hessian matrix for modern networks is too large to store or invert.
Methods
We introduce Spectral Radius Regularization, which modifies the standard objective function $f(w)$ to include a penalty on the spectral radius $\rho(w)$ (the largest absolute eigenvalue) of the Hessian: $$\min_w f(w) + \mu \max\{0, \rho(w) - K\}$$ A smaller spectral radius ensures that the steepest direction in the local loss valley is as shallow as possible. To make this optimization practical, we employ two key techniques:
- Hessian-Vector Products: We utilize the $R$-operator to compute the product of the Hessian and a vector in $O(n)$ time, avoiding explicit Hessian construction.
- Iterative Solvers: We use Power Iteration and LOBPCG (Locally Optimal Block Preconditioned Conjugate Gradient) to approximate the largest eigenvalue and its gradient efficiently within the stochastic gradient descent (SGD) loop.
We provide a formal proof that this algorithm converges almost surely to a critical point, ensuring theoretical stability.
Results and Discussion
Our method was evaluated on diverse tasks, including Forest Cover Type prediction, USPS digit recognition, and Chest X-ray classification (using CheXpert and MIMIC-CXR). To assess generalization, we utilized "Shifted" benchmarks involving image augmentations and transfer learning between hospitals.
As illustrated in Figure 1, our regularization method (various μ configurations) effectively reduces the spectral radius ρ relative to the unregularized baseline. Notably, while methods like KFAC significantly increase the spectral radius, our approach suppresses it, leading to marked improvements in accuracy on shifted test sets (AT1, AT2, MNIST).
Figure 2 confirms these trends across additional model configurations. In the Forest Cover task, the regularized model reduced the performance drop under shift from -2.80% to -0.96%. In medical imaging, spectral radius regularization resulted in the highest reliability when transferring models between different hospital datasets, outperforming specialized baselines like Entropy-SGD.
Conclusion
Spectral Radius Regularization provides a principled and effective means of optimizing for flat minima. By explicitly controlling the curvature of the loss landscape, we produce models that are significantly more robust to real-world data shifts. While the method introduces additional computational overhead during training, the resulting improvements in generalization—particularly in high-stakes fields like healthcare—provide a compelling trade-off. Future work will explore automated hyperparameter tuning to further streamline the training process.
Summary updated