On out-of-distribution detection with Bayesian neural networks

Francesco D'Angelo, Christian Henning
10/12/2021
cs.LGcs.AIstat.ML
bayesian

Official code: chrhenning/uncertainty_based_ood (5 stars, Jupyter Notebook, Apache-2.0, PyTorch, last commit 2022-02-25).

Abstract

The question whether inputs are valid for the problem a neural network is trying to solve has sparked interest in out-of-distribution (OOD) detection. It is widely assumed that Bayesian neural networks (BNNs) are well suited for this task, as the endowed epistemic uncertainty should lead to disagreement in predictions on outliers.

Show full abstract

In this paper, we question this assumption and show that proper Bayesian inference with function space priors induced by neural networks does not necessarily lead to good OOD detection. To circumvent the use of approximate inference, we start by studying the infinite-width case, where Bayesian inference can be exact due to the correspondence with Gaussian processes. Strikingly, the kernels derived from common architectural choices lead to function space priors which induce predictive uncertainties that do not reflect the underlying input data distribution and are therefore unsuited for OOD detection. Importantly, we find the OOD behavior in this limiting case to be consistent with the corresponding finite-width case. To overcome this limitation, useful function space properties can also be encoded in the prior in weight space, however, this can currently only be applied to a specified subset of the domain and thus does not inherently extend to OOD data. Finally, we argue that a trade-off between generalization and OOD capabilities might render the application of BNNs for OOD detection undesirable in practice. Overall, our study discloses fundamental problems when naively using BNNs for OOD detection and opens interesting avenues for future research.

View on arXivView PDF

Code Implementations(1)

PyTorchApache-2.0

Exploring the link between uncertainty estimates obtained via "exact" Bayesian inference and out-of-distribution (OOD) detection.

50Jupyter Notebook, PythonOct 12, 20214 years agoApache-2.0
bayesian-inferencebayesian-neural-networksbnndeep-learninggaussian-processes+7 more

Similar Papers

Cite this paper

@article{dangelo2021outofdistribution,
  title  = {On out-of-distribution detection with Bayesian neural networks},
  author = {Francesco D'Angelo and Christian Henning},
  year   = {2021},
  eprint = {2110.06020},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2110.06020}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2110.06020.svg)](https://codeofpaper.com/paper/2110.06020)

Discussion