Sharpness-diversity tradeoff: improving flat ensembles with SharpBalance

Haiquan Lu, Xiaotian Liu, Yefan Zhou, Qunli Li, Kurt Keutzer, Michael W. Mahoney, Yujun Yan, Huanrui Yang, Yaoqing Yang

Abstract

Deep ensembles are a cornerstone of robust machine learning, relying on both the generalization of individual "flat" models and the diversity of the collective. However, recent findings reveal a fundamental conflict: techniques that minimize sharpness often inadvertently reduce model diversity. This paper introduces SharpBalance, a novel training strategy that resolves this trade-off by targeting distinct "sharp" data points for each ensemble member. SharpBalance significantly improves out-of-distribution (OOD) robustness with negligible computational overhead.

The Sharpness-Diversity Trade-off

Deep ensembles achieve state-of-the-art performance by combining multiple neural networks. Their success is traditionally attributed to two factors:

  1. Sharpness (Flatness): Models in "flat" minima generalize better.
  2. Diversity: Ensemble members must make independent errors to provide a collective benefit.

Standard techniques like Sharpness-Aware Minimization (SAM) effectively find flat minima but act as a "magnet," pulling all models toward similar solutions. This paper formalizes the sharpness-diversity trade-off: as individual models become flatter, they become more similar, sabotaging the ensemble's collective strength.

Overview of the sharpness-diversity trade-off and the proposed SharpBalance method.

SharpBalance: Diversifying Flatness

To overcome this trade-off, the authors propose SharpBalance. Unlike standard SAM-based ensembles that minimize sharpness across the entire dataset for every model, SharpBalance employs a data-centric approach to diversity:

  • Sharpness-Aware Sets: Each model focuses on reducing sharpness for a specific subset of training data.
  • Adaptive Strategy: To ensure diversity, the "sharp" set for a given model consists of data points identified as high-curvature (sharp) by other models in the ensemble.
  • Efficient Approximation: Instead of expensive Hessian calculations, SharpBalance uses the trace of the Fisher Information Matrix (approximated by the squared $\ell_2$ norm of the gradient) to identify rugged parts of the loss landscape.

By forcing different models to "flatten" different regions of the data manifold, SharpBalance ensures that individual models remain flat while maintaining the diversity necessary for a strong ensemble.

Theoretical and Empirical Foundations

The researchers used random matrix theory to prove that the perturbation radius in SAM directly reduces ensemble variance (diversity). Empirically, they demonstrated that while flatter models are generally better, the "Ensemble Improvement Rate" (EIR) drops if all models are flat in the same way.

Empirical results showing the relationship between sharpness, diversity, and ensemble OOD accuracy. SharpBalance (triangles) maintains higher diversity than SAM (circles) for similar sharpness levels.

Experimental Performance

SharpBalance was evaluated on standard benchmarks including CIFAR-10, CIFAR-100, and TinyImageNet, along with their corrupted (OOD) counterparts.

  • Superior OOD Robustness: On CIFAR-10-C, SharpBalance outperformed standard SAM ensembles by 2.01% and vanilla deep ensembles by over 2.1%.
  • Consistent Gains: The method consistently improved the "ensemble bonus" across various architectures like ResNet18 and WideResNet.
  • Efficiency: SharpBalance adds only about 1% to training time, requiring just one additional forward and backward pass to calculate per-sample sharpness.

Conclusion

SharpBalance addresses a critical bottleneck in ensemble training. By recognizing that diversity can be actively managed through the objective function rather than just random initialization, it provides a practical and efficient path toward more robust deep learning systems. Future work will look to extend these theoretical insights to non-Gaussian data and more complex architectures like Vision Transformers.

Summary updated

BibTeX
@inproceedings{lu2024sharpness,
  author = {Haiquan Lu and Xiaotian Liu and Yefan Zhou and Qunli Li and Kurt Keutzer and Michael W. Mahoney and Yujun Yan and Huanrui Yang and Yaoqing Yang},
  title = {{Sharpness-diversity tradeoff: improving flat ensembles with SharpBalance}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=wJaCsnT9UE},
}
Figure