Improving Generalization with Flat Hilbert Bayesian Inference

Tuan Truong, Quyen Tran, Ngoc-Quan Pham, Nhat Ho, Dinh Phung, Trung Le

TL;DR

Flat Hilbert Bayesian Inference (FHBI) is a novel algorithm that improves how Bayesian models generalize by seeking "flat" minima in infinite-dimensional function spaces. By combining the diversity of particle-based sampling with the robustness of sharpness-aware optimization, FHBI consistently outperforms state-of-the-art baselines across nearly 20 diverse computer vision tasks.

What Problem Does This Paper Address?

In deep learning, we often struggle with overfitting: a model performs perfectly on training data but fails on new, unseen data. This usually happens because the optimization process gets stuck in "sharp" local minima—narrow pits in the loss landscape where a tiny change in parameters leads to a massive jump in error.

Bayesian inference offers a solution by representing model parameters as a distribution rather than a single point, which helps quantify uncertainty. However, standard Bayesian methods like Stein Variational Gradient Descent (SVGD) don't explicitly look for "flat" regions. Conversely, methods like Sharpness-Aware Minimization (SAM) find flat regions but are typically designed for standard (non-Bayesian) training in finite-dimensional Euclidean spaces. The authors aim to bridge this gap, bringing the benefits of "flatness" to the robust framework of Bayesian inference.

Methods

The authors introduce Flat Hilbert Bayesian Inference (FHBI). Its core innovation is moving the search for flatness from simple weight space to the Reproducing Kernel Hilbert Space (RKHS)—an infinite-dimensional space that describes the functions the neural network can represent.

Illustration of the FHBI two-step procedure: adversarial functional perturbation followed by functional descent.

FHBI uses an iterative two-step procedure:

  1. Adversarial Functional Perturbation: The algorithm identifies the "sharpest" direction in the function space (how the model's output changes, not just its weights).
  2. Functional Descent: It updates a set of "particles" (model instances) to minimize the loss at this perturbed location.

Mathematically, FHBI is a generalization of two famous algorithms:

  • If you use only one particle, it behaves like SAM.
  • If you set the perturbation to zero, it behaves like SVGD.

Datasets

The researchers evaluated FHBI using the VTAB-1K benchmark, a rigorous suite of 19 diverse datasets designed to test how well a pre-trained model (in this case, a Vision Transformer or ViT-B/16) can adapt to new tasks. The datasets are split into three categories:

  • Natural: Standard images like CIFAR-100 and Flowers102.
  • Specialized: Domain-specific data like medical imagery (Camelyon) and satellite photos (EuroSAT).
  • Structured: Tasks requiring geometric understanding, such as counting objects (Clevr-Count) or identifying distances (Clevr-Dist).

Key Insights and Ideas

  • Functional vs. Weight Sharpness: Most "flatness" research looks at the weights ($\theta$). This paper argues that looking at the function ($f_\theta$) in an RKHS is more powerful because it accounts for the complex, non-linear way neural networks actually operate.
  • Angular Diversity: One of the "aha" moments is that FHBI doesn't just push particles away from each other (spatial diversity); it encourages them to move in different directions (angular diversity). This prevents the particles from collapsing into a single mode, a common failure in other Bayesian methods.
  • Theoretical Extension: The authors provide new proofs extending generalization bounds from finite-dimensional spaces to infinite-dimensional functional spaces, providing a solid mathematical floor for why FHBI works.

Key Results

Performance comparison of FHBI against baselines across different dataset categories.
  • Superior Accuracy: FHBI achieved an average Top-1 accuracy of 73.7% across the 19 VTAB datasets, outperforming the next best baseline (BayesTune) at 72.2% and standard SAM at 70.5%.
  • Better Calibration: Beyond just being right, FHBI is "honestly" uncertain. It achieved the lowest Expected Calibration Error (ECE) on average (0.12), meaning its predicted probabilities closely match actual accuracy.
  • Consistency: FHBI was the top performer in all three sub-categories (Natural, Specialized, and Structured), showing it isn't just "overfitting" to a specific type of data.

Limitations and Future Work

  • Memory Overhead: Like all particle-based methods, FHBI requires storing multiple versions of the model (or at least multiple sets of LoRA weights). While the authors used parameter-efficient fine-tuning (LoRA) to mitigate this, it still requires more VRAM than single-point methods.
  • Computational Cost: The two-step "ascent-descent" process effectively doubles the gradient computations per iteration compared to standard SVGD.
  • Future Directions: The authors suggest extending the concept of "functional sharpness" to Variational Inference (VI). This could potentially provide the generalization benefits of FHBI without the need to store and update multiple separate particles, making it more scalable for massive models.

Summary updated

BibTeX
@inproceedings{truong2025improving,
  author = {Tuan Truong and Quyen Tran and Ngoc-Quan Pham and Nhat Ho and Dinh Phung and Trung Le},
  title = {{Improving Generalization with Flat Hilbert Bayesian Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=pzbr7MGzEH},
}
Figure