Entropy-MCMC: Sampling from Flat Basins with Ease

Bolian Li, Ruqi Zhang

The Challenge: Navigating the Energy Landscape

In deep learning, the "energy landscape"—the loss function relative to model parameters—is incredibly complex and multi-modal. Not all "good" solutions with low loss are created equal. Some reside in "sharp" valleys, which are narrow regions where a tiny change in parameters causes a huge spike in error, often leading to overfitting. Others reside in "flat" basins, wide regions where the model remains accurate even with small perturbations. These flat regions are the holy grail for model generalization.

While optimization techniques like Sharpness-Aware Minimization (SAM) try to find a single point in these flat basins, Bayesian Deep Learning (BDL) aims to sample the entire posterior distribution. However, standard sampling methods like Stochastic Gradient Langevin Dynamics (SGLD) are "flatness-blind." They strictly follow the energy gradient and frequently get trapped in sharp, poorly-generalizing modes. Previous attempts to fix this were computationally expensive, often requiring nested loops (running a whole sub-simulation at every step) that made them impractical for large-scale neural networks.

The Solution: Entropy-MCMC (EMCMC)

To address this, researchers have proposed Entropy-MCMC (EMCMC), a novel Bayesian sampling framework that biases neural network training toward flat regions of the loss landscape with nearly the same computational efficiency as standard stochastic gradient methods.

The core idea leverages "Local Entropy," which mathematically favors regions with high volume (flatness). Instead of the traditional, expensive approach of approximating local entropy through nested simulations, EMCMC introduces a mathematical "coupling" trick.

The authors define a joint distribution consisting of the model parameters ($\theta$) and an auxiliary guiding variable ($\theta_a$).

  • The Guiding Variable ($\theta_a$): Its stationary distribution acts as a "smoothed" version of the original posterior, effectively erasing sharp peaks and highlighting flat basins.
  • The Interaction: The two variables are linked by a simple quadratic distance term. In practice, $\theta_a$ acts like a scout, finding wide valleys and "pulling" the model parameters $\theta$ toward them.
Illustration of EMCMC smoothing the posterior and guiding gradients toward flat basins.

Crucially, because the joint distribution has a simple analytical form, the gradient for the auxiliary variable is trivial to compute. This means EMCMC has roughly the same computational overhead as standard SGLD, despite technically sampling in a $2d$-dimensional space.

Key Insights

  • Coupling over Integration: The most significant breakthrough is replacing a difficult integral (marginalization) with a joint sampling problem. This bypasses the need for the nested Markov chains used in previous methods like Entropy-SGD.
  • Volume Matters: The paper reinforces the Bayesian perspective that flat basins are valuable not just for their "flatness," but because they occupy more volume in the parameter space, contributing more significantly to the final predictive distribution.
  • Efficiency: By utilizing an analytical expression for the guiding variable's gradient, the authors maintain $O(d)$ complexity, making flatness-aware Bayesian inference practical for ResNet-scale architectures.

Key Results

The authors evaluated EMCMC across a variety of standard benchmarks, including CIFAR-10, CIFAR-100, and ImageNet, as well as robustness datasets like CIFAR-C and SVHN for Out-of-Distribution (OOD) detection.

EMCMC consistently outperformed baselines like SGLD, SAM, and Entropy-SGD:

  • Accuracy: On CIFAR-100, EMCMC achieved 79.16% accuracy, surpassing SGLD (78.79%) and the flatness-aware bSAM (78.92%).
  • Calibration: It showed significantly better Expected Calibration Error (ECE), meaning the model's confidence scores more accurately reflected its actual probability of being correct.
  • OOD Detection: In the CIFAR100-SVHN task, EMCMC achieved an AUROC of 81.14%, a massive jump over standard SGLD (72.51%) and Entropy-SGLD (71.83%).
  • Robustness: It maintained higher accuracy across all severity levels of data corruption (CIFAR-C) compared to other methods.
Training Negative Log-Likelihood (NLL) and Testing Accuracy over iterations, showing EMCMC's faster convergence and superior performance.

Theoretically, the authors also prove that EMCMC converges faster than existing flatness-aware methods in strongly convex settings because it avoids the approximation errors inherent in nested-loop strategies.

Limitations and Future Work

While highly effective, the method has a few open challenges:

  • Theoretical Gap: The convergence proofs are currently limited to the strongly convex setting. While empirical results on non-convex deep networks are excellent, a theoretical guarantee for the non-convex case remains an open challenge.
  • Hyperparameter Tuning: The method introduces a variance term ($\eta$) that controls the "pull" toward flatness. The optimal $\eta$ varies between datasets (e.g., $10^{-3}$ for CIFAR-10 vs $10^{-2}$ for CIFAR-100), suggesting a need for automated tuning.
  • Scaling to Even Larger Models: While tested on ResNet-50 and ImageNet, further exploration into massive Transformer architectures would be a logical next step to validate the framework's scalability.

Summary updated

BibTeX
@inproceedings{li2024entropy,
  author = {Bolian Li and Ruqi Zhang},
  title = {{Entropy-MCMC: Sampling from Flat Basins with Ease}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=oGNdBvymod},
}
Figure