SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.12248 · ICML · 2021

Are Bayesian neural networks intrinsically good at out-of-distribution detection?

Christian Henning, Benjamin Grewe, Francesco Angelo, Francesco D'angelo

arXiv · PDF · Open in the Atlas

Code that ran

11 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 11 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2107.12248.json · badge: /api/ran/2107.12248.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
chrhenning/uncertainty_based_ood community (classifier label)
classifier basis not recorded on the link
11 ran · 1 no recorded run
FunctionStatusWhere it lives
analytic_v_gaussian Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/rbf_net.py
code served (permissive licence) · get_code("6e378b4df81a058c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# Create a single tensor case: small 2x4 tensor (2 samples, 4 dimensions)
X_single = torch.randn(2, 4)

# Create a tuple case: two tensors for X1 and X2
X_tuple = (torch.randn(2, 4), torch.randn(2, 4))

# Test with single tensor input
ARGS = {
    "X": X_single,
    "sigma2_u": 1.0,
    "bandwidth": 1.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calc_regression_acc Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/utils/misc.py
code served (permissive licence) · get_code("ef6d55e8d0d4a731")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for predictions and targets
# Shape: (2,) - batch size of 2
predictions = torch.randn(2)
targets = torch.randn(2)

# Optional threshold parameter
thld = 0.5

ARGS = {
    "predictions": predictions,
    "targets": targets,
    "thld": thld,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cholesky_adaptive_noise Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/nngp.py
code served (permissive licence) · get_code("57d4f077483e5f9e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small positive semi-definite kernel matrix
# We'll create a 3x3 matrix that is symmetric and positive definite
n = 3
K_train = torch.randn(n, n)
K_train = K_train @ K_train.T  # Make it positive semi-definite

ARGS = {
    "K_train": K_train,
    "var": 1e-10,
    "var_step": 2.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cosine_1l_kernel Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/mlp_kernel.py
code served (permissive licence) · get_code("d0cf47683cde9160")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function accepts either a single tensor X or a tuple (X1, X2)
# It expects tensors with shape (n_samples, d_in) or (n_samples,)
# Let's create a single tensor case

X = torch.randn(2, 4)  # 2 samples, 4 input dimensions

sigma2_w = 1.0
sigma2_b = 1.0

ARGS = {
    "X": X,
    "sigma2_w": sigma2_w,
    "sigma2_b": sigma2_b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_grid_2d Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/utils/misc.py
code served (permissive licence) · get_code("bbd76be30158bd1b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    'x_range': (-10, 10),
    'y_range': (-10, 10),
    'res_per_unit': 10,
    'verbose': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
inference_with_isotropic_gaussian_ll Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/nngp.py
code served (permissive licence) · get_code("f10a9936b81c32ba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create small test tensors
# m = 3 training points, n = 2 test points
m = 3
n = 2

# Y: labels from training set, shape [m]
Y = torch.randn(m)

# K_train: training kernel matrix [m x m]
K_train = torch.randn(m, m)
K_train = (K_train + K_train.T) / 2 + torch.eye(m) * 2  # Make it symmetric positive definite

# K_test: test data kernel values [n] (diagonal entries)
K_test = torch.ones(n) * 2.0

# K_all: kernel values between test and train points [n x m]
K_all = torch.randn(n, m)

# var: likelihood variance
var = 1e-10

# L_mat: optional, we'll leave as None to test the main path
L_mat = None

# return_cov: whether to return full covariance
return_cov = False

ARGS = {
    "Y": Y,
    "K_train": K_train,
    "K_test": K_test,
    "K_all": K_all,
    "var": var,
    "L_mat": L_mat,
    "return_cov": return_cov,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_kernel Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/mlp_kernel.py
code served (permissive licence) · get_code("64aad04d13588379")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Test case 1: Single tensor (1D case - scalar inputs)
X_1d = torch.randn(3)

# Test case 2: Single tensor (2D case - vector inputs)
X_2d = torch.randn(4, 5)

# Test case 3: Tuple of two tensors with identical shape
X_tuple_1d = (torch.randn(3), torch.randn(3))
X_tuple_2d = (torch.randn(4, 5), torch.randn(4, 5))

# Use a small 2D tensor case as the primary test
ARGS = {
    "X": torch.randn(2, 4),
    "sigma2_w": 1.0,
    "sigma2_b": 1.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
mc_v_gaussian Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/rbf_net.py
code served (permissive licence) · get_code("897640ff43709859")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# X can be either a single tensor or a tuple of two tensors
# Based on the function, it reshapes 1D to 2D and handles both cases
# Let's create a simple 2D tensor case
X = torch.randn(2, 4)  # 2 samples, 4 dimensions

# sigma2_u is the variance of u
sigma2_u = 1.0

# bandwidth parameter for the kernel
bandwidth = 1.0

# number of Monte Carlo samples
num_samples = 100

ARGS = {
    "X": X,
    "sigma2_u": sigma2_u,
    "bandwidth": bandwidth,
    "num_samples": num_samples
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rbf Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/standard_kernels.py
code served (permissive licence) · get_code("61768d8e87c1b06d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Test case 1: Single tensor input (symmetric kernel matrix)
X_single = torch.randn(2, 4)

# Test case 2: Tuple of two tensors (kernel values between two datasets)
X1 = torch.randn(2, 4)
X2 = torch.randn(3, 4)
X_pair = (X1, X2)

# Use the single tensor case for ARGS
ARGS = {
    "X": X_single,
    "length_scale": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
regular_grid Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/finite_width/ridgelet_prior.py
code served (permissive licence) · get_code("3c790a7efb74000c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (100, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "cube_size": 5,
    "res_per_dim": 10,
    "grid_dim": 2,
    "device": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (100, 2) — shape (100, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
relu_recursion_lee Ran
ran on a synthesized input
chrhenning/uncertainty_based_ood/nngp/mlp_kernel.py
code served (permissive licence) · get_code("da5aabdd5b3d3cbe")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# Create a small positive semi-definite kernel matrix
# For a kernel matrix, we need it to be symmetric and positive semi-definite
# Start with a simple construction: K = X @ X.T where X is small
X = torch.randn(2, 4, 3)  # batch_size=2, n_points=4, feature_dim=3
K_prev = torch.bmm(X, X.transpose(-2, -1))  # shape: (2, 4, 4)

# Ensure it's positive semi-definite by adding a small diagonal term
K_prev = K_prev + 0.1 * torch.eye(4).unsqueeze(0)

# Normalize to keep values reasonable (kernel values typically in [0, 1] or similar)
K_prev = K_prev / (K_prev.max() + 1e-6)

curr_layer = 1
end_layer = 3
sigma2_w = 1.0
sigma2_b = 1.0

ARGS = {
    "K_prev": K_prev,
    "curr_layer": curr_layer,
    "end_layer": end_layer,
    "sigma2_w": sigma2_w,
    "sigma2_b": sigma2_b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gen_inference_kernels Not yet run
unverified (harvested, no recorded run)
chrhenning/uncertainty_based_ood/nngp/nngp.py
code served (permissive licence) · get_code("77214e4c21adc429")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 12 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The need to avoid confident predictions on unfamiliar data has sparked interest in out-ofdistribution (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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2107.12248")
get_code_for_paper("2107.12248")
have("2107.12248")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2107.12248.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2107.12248.svg)](https://syntology.ai/paper/2107.12248)

Connect an agent — have() is free.