Abstract
The mechanisms by which certain training interventions, such as increasing learning rates and applying batch normalization, improve the generalization of deep networks remains a mystery. Prior works have speculated that "flatter" solutions generalize better than "sharper" solutions to unseen data, motivating several metrics for measuring flatness (particularly $\lambda_{max}$, the largest eigenvalue of the Hessian of the loss); and algorithms, such as Sharpness-Aware Minimization (SAM), that directly optimize for flatness. Other works question the link between $\lambda_{max}$ and generalization. In this paper, we present findings that call $\lambda_{max}$'s influence on generalization further into question. We show that: (1) while larger learning rates reduce $\lambda_{max}$ for all batch sizes, generalization benefits sometimes vanish at larger batch sizes; (2) by scaling batch size and learning rate simultaneously, we can change $\lambda_{max}$ without affecting generalization; (3) while SAM produces smaller $\lambda_{max}$ for all batch sizes, generalization benefits (also) vanish with larger batch sizes; (4) for dropout, excessively high dropout probabilities can degrade generalization, even as they promote smaller $\lambda_{max}$; and (5) while batch-normalization does not consistently produce smaller $\lambda_{max}$, it nevertheless confers generalization benefits. While our experiments affirm the generalization benefits of large learning rates and SAM for minibatch SGD, the GD-SGD discrepancy demonstrates limits to $\lambda_{max}$'s ability to explain generalization in neural networks.
Introduction
A central mystery in deep learning is why specific training interventions—such as small batch sizes, high learning rates, or dropout—enhance a model's ability to generalize to unseen data. A prominent hypothesis suggests these methods guide optimization toward "flat" regions of the loss landscape, where small weight perturbations do not significantly alter the loss. The standard mathematical proxy for this flatness is $\lambda_{max}$, the largest eigenvalue of the Hessian matrix of the loss. A small $\lambda_{max}$ indicates a flat landscape, while a large one indicates sharpness. This paper critically examines whether the link between $\lambda_{max}$ and generalization is causal or merely a correlation that fails under specific conditions.
Methods
We conducted an extensive empirical study using VGG-11, MLPs, and Fixup ResNet32 architectures. We systematically manipulated training parameters to observe their impact on $\lambda_{max}$ and test accuracy:
- Learning Rate ($\eta$) and Batch Size: Investigating the "linear scaling rule" and the "Edge of Stability" phenomenon.
- Sharpness-Aware Minimization (SAM): Evaluating an algorithm designed to explicitly minimize sharpness.
- Dropout: Analyzing the effect of noise-induced regularization.
- Batch Normalization (BN): Assessing a standard stabilization technique.
Experiments were performed on CIFAR-10 (for VGG-11 and ResNet32) and Fashion-MNIST (for MLP experiments). We specifically compared results across small-batch and large-batch regimes.
Results
The Disconnect in Large-Batch Training
Our results confirm the "Edge of Stability" phenomenon: $\lambda_{max}$ at the end of training typically hovers near $2/\eta$. While increasing the learning rate $\eta$ successfully reduces $\lambda_{max}$ across all batch sizes, the corresponding generalization benefits often vanish in large-batch settings. As shown in Figure 1, while $\lambda_{max}$ decreases consistently with higher learning rates, test accuracy for large batches (size 5,000) plateaus and eventually declines, unlike the small-batch case.
SAM and the Limits of Flatness
Sharpness-Aware Minimization (SAM) is designed to improve generalization by penalizing sharpness. However, we found that its benefits are not universal. In large-batch settings, SAM effectively reduces $\lambda_{max}$, yet the expected improvement in test accuracy is absent. For VGG-11 on CIFAR-10, increasing the SAM hyperparameter $\rho$ significantly reduced $\lambda_{max}$, but for a batch size of 5,000, test accuracy remained stagnant or even decreased slightly.
Further Counter-Examples: Dropout and Batch Normalization
- The Dropout Paradox: Increasing dropout probability consistently leads to lower $\lambda_{max}$. However, excessive dropout degrades generalization even as the solution becomes "flatter."
- Batch Normalization (BN): BN is highly effective for generalization but does not consistently produce lower $\lambda_{max}$. BN models often generalize better than non-BN counterparts despite having similar or higher sharpness.
- Linear Scaling: By scaling batch size and learning rate together, we could significantly alter $\lambda_{max}$ while maintaining identical test accuracy, further decoupling the two metrics.
Discussion and Conclusion
Our findings challenge the universality of $\lambda_{max}$ as a predictor of generalization. While interventions like high learning rates and SAM often reduce sharpness, this reduction does not guarantee improved performance, particularly in large-batch regimes. We identified "regions of ambiguity" where models with identical $\lambda_{max}$ values exhibited significantly different test accuracies.
While $\lambda_{max}$ remains a useful heuristic in some contexts, it is not a causal driver of generalization. Future research is required to identify more robust metrics—perhaps involving the Hessian trace or volume-based measures—that can explain generalization across diverse training regimes.
Summary updated