Deep learning models are notoriously over-confident, often assigning high certainty to inputs they have never seen before. This poses significant safety risks in critical applications like autonomous driving or medical diagnosis. A common mitigation strategy involves using generative models to estimate training data density; samples with low density are flagged as out-of-distribution (OOD). While Normalizing Flows often fail by assigning higher likelihoods to simple OOD data (e.g., SVHN) than to complex training data (e.g., CIFAR-10), Energy-Based Models (EBMs) have been proposed as a more flexible alternative. This paper investigates whether EBMs truly overcome these limitations.
The Pitfalls of Unsupervised EBMs
The study reveals that unsupervised EBMs are not a "silver bullet." Without specific constraints, they suffer from the same "likelihood flip" as Normalizing Flows, tending to assign high density to "smooth" or "simple" images regardless of semantic content. This suggests that these models often focus on low-level pixel statistics rather than high-level features.
As shown in the figure above, the performance (AUPR) of various EBM training methods—Sliced Score Matching (SSM), Contrastive Divergence (MCMC), and VERA—varies significantly depending on the OOD dataset type and the hyperparameter $\gamma$. Notably, the rightmost plot illustrates how the log-density $\log \tilde{p}_\theta(x)$ can scale linearly with the input norm $||x||_2$, explaining why high-norm noise can be erroneously assigned high likelihood.
Enhancing EBMs: Supervision and Bottlenecks
To address these issues, the authors propose and evaluate two key interventions:
- Supervision: By incorporating a classification loss (as in Joint Energy Models or JEM), the energy function is forced to focus on features that define a class (e.g., the shape of an object) rather than background noise. Supervision acts as a strong prior, improving OOD detection on "natural" datasets by an average of 29.6%.
- Architectural Bottlenecks: Introducing $1 \times 1$ convolutions reduces dimensionality, forcing the model to discard noisy low-level details and compress the input. This "pruning" of non-semantic dimensions led to massive gains, up to 67.9% for certain configurations.
Key Results and Insights
The experimental evaluation across tabular and image datasets (CIFAR-10, Fashion-MNIST) yielded several critical insights:
- Feature-Space Density: Training EBMs on the embeddings of a pre-trained classifier, rather than raw pixels, improved results on natural datasets by 53.65%.
- General Performance: While EBMs outperformed simple classifier baselines by 36% to 63%, they did not consistently beat Normalizing Flows across all scenarios.
- The Trade-off of Supervision: While labels help with "natural" OOD samples, they can sometimes degrade performance on "non-natural" samples like pure noise, as the model becomes over-confident in its specific feature space.
Conclusion
EBMs offer a promising path for OOD detection but require careful architectural and objective design to avoid focusing on low-level statistics. Future work should focus on balancing generative and discriminative objectives to ensure robustness against both semantic and non-semantic anomalies, while also addressing the high computational cost of MCMC-based training.
Summary updated