The Likelihood Paradox in VAEs
Deep generative models like Variational Auto-encoders (VAEs) are theoretically well-suited for out-of-distribution (OOD) detection. Intuitively, a model trained exclusively on images of cats should assign a low likelihood to an image of a truck. However, researchers have uncovered a counter-intuitive phenomenon known as the "likelihood paradox": VAEs trained on complex datasets often assign higher likelihoods to simpler, unseen OOD datasets than to their own training data.
For example, a VAE trained on Fashion-MNIST will bizarrely score standard MNIST digits with higher likelihoods. While alternative scores have been developed to address this in flow-based and autoregressive models, they frequently fail when applied to VAEs. This failure stems from the VAE's "bottleneck" structure, which compresses information and narrows the range of likelihoods across different datasets, making OOD samples harder to separate using standard methods.
Introducing Likelihood Regret
To resolve this paradox, the authors propose Likelihood Regret (LR), a novel OOD detection score tailored specifically for VAEs. The core mechanism of LR involves comparing two different methods of calculating the Evidence Lower Bound (ELBO) for a given test sample:
- Standard ELBO: The pre-trained VAE encoder is used to obtain the latent distribution and calculate the baseline likelihood.
- Optimized ELBO: The pre-trained decoder is fixed, but the latent parameters (mean and variance) are individually optimized—or "fine-tuned"—for that specific test image to maximize its likelihood.
The "Regret" is the quantitative difference between these two values.
The underlying intuition is elegant: for an in-distribution sample, the encoder is already highly proficient at finding the optimal latent representation, meaning individual optimization yields diminishing returns (resulting in low regret). Conversely, for an OOD sample, the general-purpose encoder struggles. However, because the decoder remains a powerful generator, a custom-fitted latent representation can drastically improve the likelihood score (resulting in high regret).
Key Insights and the Role of the Bottleneck
The paper highlights that the VAE bottleneck acts as a double-edged sword. While it smooths the likelihood landscape and complicates standard OOD detection, it simultaneously provides a "natural regularization" for Likelihood Regret. This bottleneck prevents the optimized latent parameters from merely overfitting to noise, ensuring the Regret score remains a meaningful metric of OOD status.
Furthermore, VAEs are surprisingly adept at reconstructing OOD data. Likelihood Regret effectively exploits this trait by measuring the "effort" (optimization distance) required to achieve that high-quality reconstruction. This explains why existing methods like "Input Complexity" fail on VAEs: the likelihood gap between complex data (like CIFAR-10) and noise is much smaller in VAEs than in models like Glow or PixelCNN.
Experimental Results
The authors evaluated Likelihood Regret across standard image benchmarks, using Fashion-MNIST and CIFAR-10 as in-distribution datasets, and MNIST, SVHN, LSUN, CelebA, and synthetic noise as OOD targets.
The results demonstrate that Likelihood Regret significantly outperforms standard likelihood and other state-of-the-art OOD scores:
- Fashion-MNIST vs. MNIST: Relying on standard likelihood yields an Area Under the ROC Curve (AUC-ROC) of only 0.165—worse than random guessing. Likelihood Regret corrects this entirely, achieving a near-perfect 0.999.
- CIFAR-10 vs. SVHN: Likelihood Regret improved the AUC-ROC from a failing 0.161 (standard likelihood) to a robust 0.876.
- Consistency: Unlike competing methods (such as Likelihood Ratio or Input Complexity) that may succeed on one dataset but fail on another (e.g., failing to detect pure noise), LR demonstrated robust performance across all tested OOD types.
Limitations and Future Directions
Despite its strong performance, Likelihood Regret has limitations. It struggles to distinguish between highly similar datasets, such as CIFAR-10 and CelebA (achieving an AUC-ROC of ~0.71), as their similar textures make them difficult for unsupervised generative models to separate without class labels.
Additionally, while the per-image optimization takes less than 0.3 seconds, this overhead makes it slower than a single forward pass. For real-time systems processing thousands of images per second, this could act as a computational bottleneck. Future work may explore extending the concept of "Regret" to other generative models, such as GANs or Diffusion models, provided a suitable optimizable configuration can be defined.
Summary updated