Skip to main content
QUICK REVIEW

[Paper Review] Bayesian Autoencoders: Analysing and Fixing the Bernoulli likelihood for Out-of-Distribution Detection

Bang Xiang Yong, Tim Pearce|arXiv (Cornell University)|Jul 28, 2021
Anomaly Detection Techniques and ApplicationsComputer Science15 references5 citations
TL;DR

This paper identifies the Bernoulli likelihood in variational autoencoders as a key cause of unreliable out-of-distribution (OOD) detection due to confounding by high zero proportions in images. It proposes two fixes: using epistemic uncertainty of the log-likelihood estimate via Bayesian autoencoders (BAE) and switching to Gaussian likelihood, both of which achieve AUROC >0.98 on MNIST vs FashionMNIST, outperforming standard likelihood-based methods.

ABSTRACT

After an autoencoder (AE) has learnt to reconstruct one dataset, it might be expected that the likelihood on an out-of-distribution (OOD) input would be low. This has been studied as an approach to detect OOD inputs. Recent work showed this intuitive approach can fail for the dataset pairs FashionMNIST vs MNIST. This paper suggests this is due to the use of Bernoulli likelihood and analyses why this is the case, proposing two fixes: 1) Compute the uncertainty of likelihood estimate by using a Bayesian version of the AE. 2) Use alternative distributions to model the likelihood.

Motivation & Objective

  • To investigate why standard variational autoencoders fail at OOD detection on image datasets like MNIST vs FashionMNIST.
  • To identify the Bernoulli likelihood as a root cause due to its incompatibility with pixel data distributions, especially high zero proportions.
  • To propose two practical fixes: estimating epistemic uncertainty of the log-likelihood and using alternative likelihoods like Gaussian.
  • To evaluate Bayesian inference methods (e.g., MC-Dropout, Bayes-by-Backprop, anchored ensembling) for uncertainty estimation in autoencoders.
  • To demonstrate that combining uncertainty with likelihood estimation significantly improves OOD detection AUROC.

Proposed method

  • Proposes Bayesian Autoencoders (BAE) by applying Bayes' rule to autoencoder parameters, enabling posterior inference over weights.
  • Uses approximate inference techniques—MC-Dropout, Bayes-by-Backprop, SGHMC, and anchored ensembling—to sample from the posterior distribution.
  • Introduces the uncertainty of the log-likelihood estimate, Var_θ(LL), as a new OOD score, computed via Monte Carlo sampling over posterior weights.
  • Replaces the Bernoulli likelihood with Gaussian likelihood (N(𝐱̂*,1)) and Continuous Bernoulli (C-Ber) to test robustness to pixel domain mismatch.
  • Employs importance sampling from a single model to estimate epistemic uncertainty, avoiding the need for ensemble models.
  • Evaluates OOD detection using AUROC on standard benchmarks: MNIST vs FashionMNIST and SVHN vs CIFAR10.

Experimental results

Research questions

  • RQ1Why does the Bernoulli likelihood fail for OOD detection in autoencoders, especially on MNIST vs FashionMNIST?
  • RQ2Does the proportion of zero pixels in images confound the Bernoulli likelihood's ability to distinguish in-distribution and out-of-distribution samples?
  • RQ3Can epistemic uncertainty of the log-likelihood estimate (Var_θ(LL)) serve as a reliable OOD detection score?
  • RQ4Does switching to a Gaussian likelihood improve OOD detection performance despite its support not matching pixel values?
  • RQ5Can uncertainty estimation via Bayesian inference methods (e.g., anchored ensembling) outperform standard likelihood-based scores?

Key findings

  • The Bernoulli likelihood fails for OOD detection on MNIST vs FashionMNIST, achieving AUROC < 0.5, due to confounding by high zero proportions in images.
  • The Continuous Bernoulli likelihood also fails to resolve this issue, showing similar poor performance (AUROC ≈ 0.31).
  • Using Gaussian likelihood instead of Bernoulli increases AUROC from ~0.30 to 0.98 across all models, demonstrating robustness despite domain mismatch.
  • The uncertainty of the log-likelihood estimate, Var_θ(LL), achieves AUROC > 0.98 on all models, including those with Bernoulli likelihood, outperforming mean likelihood (𝔼_θ(LL)).
  • Anchored ensembling combined with Var_θ(LL) achieves the highest AUROC of 0.995 on MNIST vs FashionMNIST, significantly outperforming standard likelihood-based methods.
  • Importance sampling from a single model is sufficient to estimate epistemic uncertainty, making the method scalable without requiring full ensembles.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.