Explicit Regularisation, Sharpness and Calibration

Israel Mason-Williams, Fredrik Ekholm, Ferenc HuszárSciForDL @ NeurIPS 2024

TL;DR

This paper investigates the long-held belief that "flat" neural network minima lead to better generalization and calibration. Surprisingly, they found that explicit regularizers, while improving generalization, often lead to sharper minima. Furthermore, well-calibrated models were found to reside in sharper regions of the loss landscape, contradicting common hypotheses.

What Problem Does This Paper Address?

For years, a cornerstone of deep learning theory has been the idea that neural networks trained to converge to "flat" minima in their loss landscape generalize better to unseen data. This intuition stems from the notion that a flat minimum is less sensitive to small perturbations in the model's parameters, making it more robust. Additionally, some researchers have hypothesized that flatter minima might also lead to better model calibration (i.e., the model's predicted probabilities accurately reflect the true likelihood of the outcome).

However, the precise relationship between flatness, generalization, and calibration, especially when using explicit regularization techniques (like dropout or weight decay), has not been thoroughly explored. This paper aims to fill this gap by systematically investigating how different explicit regularization methods affect these properties, using a variety of sharpness metrics and calibration measures.

Methods

The researchers employed a controlled experimental setup to probe the relationship between explicit regularization, loss landscape sharpness, and model calibration. They trained three popular neural network architectures (VGG-19, ResNet-20, and ViT) on CIFAR-10 and CIFAR-100 datasets.

The core of their methodology involved:

  • Explicit Regularization as a Control: They used dropout, weight decay, and data augmentation as explicit regularizers. These were applied individually to a baseline model.
  • Sharpness Metrics: To quantify the "flatness" or "sharpness" of the loss landscape, they employed five different metrics: L2-norm, Fisher-Rao norm, Relative Flatness, SAM-sharpness, and Information Geometric Sharpness (IGS). These metrics capture different aspects of the loss landscape's curvature and sensitivity to parameter changes.
  • Calibration Metric: Expected Calibration Error (ECE) was used to measure how well the model's predicted probabilities align with its accuracy.
  • Temperature Scaling: To further investigate calibration, they applied temperature scaling, a post-hoc technique that adjusts the model's output logits to improve calibration.
  • Loss Landscape Visualization: They used contour plots to visualize the loss landscapes for selected models, providing a qualitative understanding of their geometry.

Datasets

The study utilized the following standard image classification datasets:

  • CIFAR-10: A dataset containing 60,000 images in 10 classes.
  • CIFAR-100: A dataset containing 60,000 images in 100 classes.

The researchers used standard splits for training, validation, and testing, with a portion of the training data used for validation and early stopping. They specifically noted that they did not normalize the images using ImageNet statistics, hypothesizing that this might accentuate the differences observed with explicit regularization.

Key Insights and Ideas

  • Sharpness, Not Flatness, for Generalization: Contrary to popular belief, explicit regularizers that improve generalization (like augmentation and weight decay) often lead to sharper loss landscapes, not flatter ones. This suggests that the intuition linking flatness directly to generalization might be oversimplified or only applicable under specific conditions.
  • Calibrated Models Prefer Sharper Minima: The most surprising finding is that better-calibrated models tend to reside in sharper regions of the loss landscape. This directly contradicts the hypothesis that flatter minima are inherently more calibrated.
  • Temperature Scaling's Interaction with Regularization: While temperature scaling generally improves calibration, its effectiveness is significantly enhanced by augmentation and weight decay. These regularizers seem to prepare the model for temperature scaling by guiding it towards regions of the landscape more receptive to such adjustments.
  • Regularization Alters the Landscape: The paper posits that explicit regularizers might fundamentally alter the loss function or guide the model to different regions of the landscape, making direct comparisons of sharpness across different regularization schemes potentially misleading.

Key Results

  • Augmentation and Weight Decay: These regularizers significantly improved generalization (reduced test error) and calibration (reduced ECE) across both CIFAR-10 and CIFAR-100. For instance, augmentation reduced ECE by 40% on CIFAR-10 and 48% on CIFAR-100 compared to the baseline.
  • Sharpness Increase: For augmentation and weight decay, sharpness measures were consistently higher than the baseline, indicating sharper loss landscapes.
  • No Consistent Correlation: The study found no consistent positive correlation between sharpness measures and generalization across the various regularization methods. In many cases, the correlation was either absent or even negative.
  • Calibration and Sharpness Correlation: A clear trend emerged: better-calibrated models were often found at sharper minima. This correlation was further strengthened when temperature scaling was applied.
  • ViT Behavior: While the general trends held for Vision Transformers (ViTs), the effect of regularization on weight norm and SAM sharpness was less pronounced compared to CNNs.

Limitations and Future Work

  • Limited Architectures and Datasets: The study focused on VGG-19, ResNet-20, and ViT on CIFAR datasets. Future work could explore a wider range of architectures and datasets to confirm the generality of these findings.
  • Sharpness Metric Limitations: The paper acknowledges that current sharpness measures might not be sufficient descriptors of sharpness, especially when regularization alters the loss function. The authors suggest that further investigation into the interplay between loss landscape geometry, calibration, and explicit regularization is needed.
  • Theoretical Understanding: While empirical results are presented, a deeper theoretical understanding of why sharper minima lead to better calibration and generalization under certain regularization schemes is still an open question. The authors suggest exploring the connection between train loss and sharpness, and how altered loss functions impact sharpness comparisons.
  • Exploration of Other Regularizers: The study focused on a few common explicit regularizers. Investigating other techniques could provide a more comprehensive picture.

Summary updated

BibTeX
@inproceedings{masonwilliams2024explicit,
  author = {Israel Mason-Williams and Fredrik Ekholm and Ferenc Huszár},
  title = {{Explicit Regularisation, Sharpness and Calibration}},
  booktitle = {SciForDL @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=ZQTiGcykl6},
}
Figure