Understanding Failures in Out-of-Distribution Detection with Deep Generative Models

Lily H. Zhang, Mark Goldstein, Rajesh Ranganath

Introduction

Deep Generative Models (DGMs), such as Normalizing Flows and Autoregressive models, are designed to learn the probability density of a dataset. Ideally, a model trained on a specific domain (e.g., Fashion-MNIST) should assign high likelihoods to that domain and low likelihoods to unrelated data (e.g., MNIST). However, researchers have frequently observed a "likelihood flip," where models assign higher probabilities to out-of-distribution (OOD) data than to their own training data.

A popular explanation for this phenomenon is the typical set hypothesis, which suggests that in high dimensions, the volume where samples reside (the typical set) is distinct from the regions of highest density. This paper challenges that view, arguing that these failures are primarily due to model misestimation rather than inherent high-dimensional geometry.

Theoretical Framework and Support Overlap

The authors prove that no single OOD detection method can work against all possible alternative distributions without prior assumptions (Proposition 1). Furthermore, they analyze the impact of overlapping support between in-distribution and out-distribution data. They demonstrate that if these distributions overlap, perfect detection is impossible, and counter-intuitively, a "bad" model can sometimes outperform a "perfect" one at OOD detection.

Synthetic distribution analysis showing overlapping support and the resulting likelihood distributions for different models.

The "Worse is Better" Paradox

One of the paper's most striking findings is that a partially trained or misestimated model can have a higher OOD detection AUC than a fully trained "true" model. If a model is slightly "wrong" in a way that happens to penalize OOD data more than in-distribution data, it appears to be a better detector, even if it is a worse generative model overall.

In experiments with the Glow model, a "perfectly" trained version achieved an OOD AUC of 0.96. However, a misestimated version—trained for fewer epochs—achieved a higher AUC of 0.98, despite having a worse bits-per-dimension (BPD) score on the test set.

Comparison of OOD detection performance between a true model and a misestimated DGM, illustrating the 'Worse is Better' paradox.

Key Insights: Why MLE Fails

The authors suggest that Maximum Likelihood Estimation (MLE) is the primary culprit. MLE focuses on placing probability mass where data is, but it lacks a strong incentive to remove mass from regions where data is not. This leads to several critical issues:

  • The Volume Argument: OOD datasets (like MNIST) often occupy a much smaller volume in image space than training sets (like Fashion-MNIST). Even a tiny amount of "leaked" probability mass into these small regions results in massive density (probability divided by volume).
  • Arbitrary Typicality: The authors argue that the typical set is just one of many small-volume, high-probability sets, and choosing it as a gold standard for OOD detection is mathematically arbitrary.
  • Capacity vs. Objective: By using a "Negative Training" (NT) objective that explicitly penalizes OOD likelihood, the authors achieved near-perfect AUC (1.00) with PixelCNN++. This proves that model architectures are capable of representing the correct distribution; the failure lies in the training objective's inability to "push down" OOD density.

Conclusion and Future Directions

This research reframes OOD detection failures as an estimation problem rather than a geometric one. While identifying model misestimation as the cause, the authors note that OOD detection remains unsolved. Future work must explore inductive biases and model architectures that naturally help constrain probability mass, and researchers must be more explicit about the specific out-distributions they aim to guard against.

Summary updated

BibTeX
@inproceedings{zhang2021understanding,
  author = {Lily H. Zhang and Mark Goldstein and Rajesh Ranganath},
  title = {{Understanding Failures in Out-of-Distribution Detection with Deep Generative Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=eEH0GbD3SK},
}
Figure