NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Energy-based Hopfield Boosting for Out-of-Distribution Detection

Claus Hofmann, Simon Lucas Schmid, Bernhard Lehner, Daniel Klotz, Sepp Hochreiter

Introduction

Deploying machine learning models in real-world environments necessitates robust Out-of-Distribution (OOD) detection. Standard neural networks often exhibit overconfidence when encountering inputs outside their training distribution, leading to potentially catastrophic failures in critical applications like medical diagnosis or autonomous driving. While Outlier Exposure (OE) techniques attempt to mitigate this by training on auxiliary datasets, they often fail to distinguish "hard" outliers—samples that reside near the decision boundary.

Methodology: Hopfield Boosting

The authors propose Hopfield Boosting, a framework that utilizes the energy functions of Modern Hopfield Networks (MHNs) to refine the decision boundary between in-distribution (ID) and OOD data. Unlike traditional methods, Hopfield Boosting adaptively focuses on the most informative outliers during training.

The Hopfield Boosting framework consists of a three-step cycle: Weighting auxiliary data based on energy, Evaluating the model on hard samples, and Updating parameters.

The process follows a three-step iterative cycle:

  1. Weight: An energy function ($E_b$) evaluates auxiliary outlier data. Samples with high energy—indicating they are close to the decision boundary and difficult for the model to classify—are assigned higher sampling weights.
  2. Evaluate: The model is trained on mini-batches where these "hard" outliers are overrepresented. The loss function integrates standard classification for ID data with an OOD loss that leverages Hopfield energy to push outliers away from the ID manifold.
  3. Update: Model parameters are updated, and sampling weights are periodically refreshed to adapt to the shifting decision boundary.

Key Insights

Energy as a Proxy for Uncertainty

A core theoretical contribution is the proof that Modern Hopfield Energy (MHE) effectively represents the variance of a classification decision. High energy correlates with high uncertainty, providing a differentiable "radar" for identifying the most useful training samples.

Boundary Sharpening

By iteratively focusing on "weak learners" near the boundary, the boosting process "sharpens" the model's envelope around ID data. This creates a distinct "no-man's-land" between ID and OOD clusters, significantly reducing misclassification. This approach shares mathematical roots with Support Vector Machines (SVMs) using RBF kernels but remains fully differentiable and compatible with deep learning architectures.

Experimental Results

The researchers benchmarked Hopfield Boosting against state-of-the-art methods across CIFAR-10, CIFAR-100, and ImageNet-1K. The primary metric was FPR95 (False Positive Rate at 95% true positive rate).

Performance comparison across various benchmarks. Hopfield Boosting (HB) consistently outperforms existing methods, particularly on large-scale datasets.

Key performance gains include:

  • CIFAR-10: FPR95 reduced from 2.28% to 0.92%.
  • CIFAR-100: FPR95 reduced from 11.76% to 7.94%.
  • ImageNet-1K: A significant reduction from 50.74% to 36.60%.

Notably, the method maintains high ID classification accuracy while adding only a marginal inference overhead (approximately 7.5% for a ResNet-18).

Limitations and Future Directions

Despite its success, Hopfield Boosting remains dependent on the quality of the auxiliary dataset. If the auxiliary data lacks diversity or relevance to real-world outliers, the learned boundary may be less robust. Additionally, artifacts in common OOD benchmarks (e.g., LSUN-Resize) may overstate performance. Future research will focus on "natural adversarial examples"—OOD samples semantically similar to training data—to further test the limits of boundary sharpening.

Summary updated

BibTeX
@inproceedings{hofmann2024energy,
  author = {Claus Hofmann and Simon Lucas Schmid and Bernhard Lehner and Daniel Klotz and Sepp Hochreiter},
  title = {{Energy-based Hopfield Boosting for Out-of-Distribution Detection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=VLQYtVMTYz},
}
Figure