SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2112.00195 · 2021

Efficient Online Bayesian Inference for Neural Bandits

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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 6 have no contract verdict; 0 failures of our instrument; 0 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/2112.00195.json · badge: /api/ran/2112.00195.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
probml/bandits canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
NIGupdate Ran
ran on a synthesized input
probml/bandits/bandits/agents/agent_utils.py
code served (permissive licence) · get_code("e48ca70bef31aa38")
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 jax.numpy as jnp
import numpy as np

# Construct arguments for NIGupdate function
# bel is a tuple of (mu, Sigma, a, b)
# mu: mean vector (dimension 4)
# Sigma: covariance matrix (4x4)
# a: shape parameter (scalar)
# b: rate parameter (scalar)
# phi: feature vector (dimension 4)
# reward: scalar reward value

dim = 4

# mu: mean vector
mu = jnp.array([0.5, -0.3, 0.2, 0.1])

# Sigma: covariance matrix (positive definite)
sigma_base = np.random.randn(dim, dim)
Sigma = jnp.array(sigma_base @ sigma_base.T + np.eye(dim))

# a: shape parameter (scalar, positive)
a = jnp.array(2.0)

# b: rate parameter (scalar, positive)
b = jnp.array(1.5)

# Construct belief tuple
bel = (mu, Sigma, a, b)

# phi: feature vector (dimension 4)
phi = jnp.array([0.1, 0.2, -0.1, 0.3])

# reward: scalar reward
reward = jnp.array(1.2)

ARGS = {
    "bel": bel,
    "phi": phi,
    "reward": reward
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, 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
convert_params_from_subspace_to_full Ran
ran on a synthesized input
probml/bandits/bandits/agents/agent_utils.py
code served (permissive licence) · get_code("8ea84f5af0eafc6d")
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 ArrayImpl, 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 jax.numpy as jnp
import numpy as np

# Create small test arrays for the function
# params_subspace: shape (batch_size, subspace_dim)
params_subspace = jnp.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])

# projection_matrix: shape (subspace_dim, full_dim)
# This projects from subspace to full parameter space
projection_matrix = jnp.array([[1.0, 0.5], [0.2, 0.8], [0.3, 0.7]])

# params_full: shape (full_dim,) or broadcastable shape
# This is the offset/bias term added after projection
params_full = jnp.array([0.1, 0.2])

ARGS = {
    "params_subspace": params_subspace,
    "projection_matrix": projection_matrix,
    "params_full": params_full,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, 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
generate_random_basis Ran
ran on a synthesized input
probml/bandits/bandits/agents/agent_utils.py
code served (permissive licence) · get_code("f3a7d8f5832c6ebd")
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 ArrayImpl, ndim 2, dtype family float, shape (4, 3) 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 jax
import jax.numpy as jnp
from jax.random import normal

# Create a JAX random key
key = jax.random.PRNGKey(0)

# Define dimensions
d = 4  # input dimension
D = 3  # output/projection dimension

# Construct ARGS dict with all parameters
ARGS = {
    "key": key,
    "d": d,
    "D": D
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (4, 3) — shape (4, 3) 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
reshape_vvmap Ran
ran on a synthesized input
probml/bandits/bandits/training.py
code served (permissive licence) · get_code("a3eda0a5c7c90696")
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 ArrayImpl, ndim 3, dtype family int, shape (6, 4, 5) 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 jax.numpy as jnp
import numpy as np

# Create a small 4D array that would be output from double vmap/pmap
# shape: (batch1=2, batch2=3, feature1=4, feature2=5)
x = jnp.arange(2 * 3 * 4 * 5).reshape(2, 3, 4, 5)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 3, dtype family int, shape (6, 4, 5) — shape (6, 4, 5) 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
step Ran
ran on a synthesized input
probml/bandits/bandits/training.py
code served (permissive licence) · get_code("3e45667ba74a8413")
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 jax
import jax.numpy as jnp
import jax.random

torch_import_placeholder = None

class StandInBandit:
    def choose_action(self, key, bel, context):
        return jnp.array(0)
    
    def update_bel(self, bel, context, action, reward):
        return bel + reward

class StandInEnv:
    def get_context(self, t):
        return jnp.array([1.0, 2.0, 3.0, 4.0])
    
    def get_reward(self, t, action):
        return jnp.array(0.5)

key_base = jax.random.PRNGKey(0)
bel = jnp.array([0.1, 0.2, 0.3, 0.4])
t = 0
bandit = StandInBandit()
env = StandInEnv()

ARGS = {
    'bel': bel,
    't': t,
    'key_base': key_base,
    'bandit': bandit,
    'env': env
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — 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
warmup_bandit Ran
ran on a synthesized input
probml/bandits/bandits/training.py
code served (permissive licence) · get_code("02fcee20b423263b")
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 1, 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 torch.nn as nn
from jax import random

torch.manual_seed(0)

class StandInBandit(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 2)
    
    def init_bel(self, key, warmup_contexts, warmup_states, warmup_actions, warmup_rewards):
        # Return a belief state dict
        return {
            'params': {'weight': self.linear.weight.detach().clone()},
            'step': 0
        }

class StandInEnv:
    def __init__(self):
        pass
    
    def warmup(self, npulls):
        # Return (contexts, states, actions, rewards)
        contexts = torch.randn(npulls, 4)
        states = torch.randn(npulls, 3)
        actions = torch.randint(0, 2, (npulls,))
        rewards = torch.randn(npulls)
        return contexts, states, actions, rewards

key = random.PRNGKey(0)
bandit = StandInBandit()
env = StandInEnv()
npulls = 2

ARGS = {
    'key': key,
    'bandit': bandit,
    'env': env,
    'npulls': npulls
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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

In this paper we present a new algorithm for online (sequential) inference in Bayesian neural networks, and show its suitability for tackling contextual bandit problems. The key idea is to combine the extended Kalman filter (which locally linearizes the likelihood function at each time step) with a (learned or random) low-dimensional affine subspace for the parameters; the use of a subspace enables us to scale our algorithm to models with $\sim 1M$ parameters. While most other neural bandit methods need to store the entire past dataset in order to avoid the problem of "catastrophic forgetting", our approach uses constant memory. This is possible because we represent uncertainty about all the parameters in the model, not just the final linear layer. We show good results on the "Deep Bayesian Bandit Showdown" benchmark, as well as MNIST and a recommender system.

For agents

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

get_harvested_code_for_paper("2112.00195")
get_code_for_paper("2112.00195")
have("2112.00195")

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

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

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

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

Connect an agent — have() is free.