{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/are-bayesian-neural-networks-intrinsically","title":"Are Bayesian neural networks intrinsically good at out-of-distribution detection?","arxiv_id":"2107.12248","date":"2021-07-26","proceeding":null,"authors":["Christian Henning","Francesco D'Angelo","Benjamin F. Grewe"],"abstract":"The need to avoid confident predictions on unfamiliar data has sparked interest in out-of-distribution (OOD) detection. It is widely assumed that Bayesian neural networks (BNN) are well suited for this task, as the endowed epistemic uncertainty should lead to disagreement in predictions on outliers. In this paper, we question this assumption and provide empirical evidence that proper Bayesian inference with common neural network architectures 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 considering the corresponding Gaussian process. Strikingly, the kernels induced under common architectural choices lead to uncertainties that do not reflect the underlying data generating process and are therefore unsuited for OOD detection. Finally, we study finite-width networks using HMC, and observe OOD behavior that is consistent with the infinite-width case. Overall, our study discloses fundamental problems when naively using BNNs for OOD detection and opens interesting avenues for future research.","url_abs":"https://arxiv.org/abs/2107.12248v1","url_pdf":"https://arxiv.org/pdf/2107.12248v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"are-bayesian-neural-networks-intrinsically","repo_url":"https://github.com/chrhenning/uncertainty_based_ood","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"bayesian-inference","task_name":"Bayesian Inference"},{"task_slug":"ood-detection","task_name":"Out of Distribution (OOD) Detection"},{"task_slug":"out-of-distribution-detection","task_name":"Out-of-Distribution Detection"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2107.12248","atlas_url":"https://app.syntology.ai/?focus=2107.12248","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2107.12248"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/chrhenning/uncertainty_based_ood","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":11,"unverified":1},"by_repo_kind":{"listed":{"samples":12,"ran":11,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"6e378b4df81a058c","entry":"analytic_v_gaussian","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/rbf_net.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/rbf_net.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6e378b4df81a058c"}},{"code_sha256_prefix":"ef6d55e8d0d4a731","entry":"calc_regression_acc","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"utils/misc.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/utils/misc.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ef6d55e8d0d4a731"}},{"code_sha256_prefix":"57d4f077483e5f9e","entry":"cholesky_adaptive_noise","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/nngp.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/nngp.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"57d4f077483e5f9e"}},{"code_sha256_prefix":"d0cf47683cde9160","entry":"cosine_1l_kernel","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/mlp_kernel.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/mlp_kernel.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d0cf47683cde9160"}},{"code_sha256_prefix":"bbd76be30158bd1b","entry":"eval_grid_2d","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"utils/misc.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/utils/misc.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bbd76be30158bd1b"}},{"code_sha256_prefix":"f10a9936b81c32ba","entry":"inference_with_isotropic_gaussian_ll","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/nngp.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/nngp.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f10a9936b81c32ba"}},{"code_sha256_prefix":"64aad04d13588379","entry":"init_kernel","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/mlp_kernel.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/mlp_kernel.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"64aad04d13588379"}},{"code_sha256_prefix":"897640ff43709859","entry":"mc_v_gaussian","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/rbf_net.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/rbf_net.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"897640ff43709859"}},{"code_sha256_prefix":"61768d8e87c1b06d","entry":"rbf","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/standard_kernels.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/standard_kernels.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"61768d8e87c1b06d"}},{"code_sha256_prefix":"3c790a7efb74000c","entry":"regular_grid","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"finite_width/ridgelet_prior.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/finite_width/ridgelet_prior.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3c790a7efb74000c"}},{"code_sha256_prefix":"da5aabdd5b3d3cbe","entry":"relu_recursion_lee","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/mlp_kernel.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/mlp_kernel.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"da5aabdd5b3d3cbe"}},{"code_sha256_prefix":"77214e4c21adc429","entry":"gen_inference_kernels","repo":"chrhenning/uncertainty_based_ood","repo_kind":"listed","path":"nngp/nngp.py","file_url":"https://github.com/chrhenning/uncertainty_based_ood/blob/HEAD/nngp/nngp.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"77214e4c21adc429"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}