SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2002.09089 · ICML · 2020

Safe Imitation Learning via Fast Bayesian Reward Inference from Preferences

Daniel Brown, Russell Coleman, Ravi Srinivasan, Scott Niekum

arXiv · PDF · Open in the Atlas

Code that ran

5 of 10 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 5 no recorded run), measured 2026-11-21; 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/2002.09089.json · badge: /api/ran/2002.09089.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
dsbrown1331/bayesianrex canonical (classifier label)
classifier basis: classifier_2025
4 ran · 4 no recorded run
dsbrown1331/brex_gridworld_cpp canonical (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
FunctionStatusWhere it lives
calc_linearized_pairwise_ranking_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
dsbrown1331/brex_gridworld_cpp/python/bayesianREX_basic.py
code served (permissive licence) · get_code("28c2d8ba6dfc0f57")
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) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 numpy as np
import torch.nn as nn

torch.manual_seed(0)

# last_layer: numpy array of weights
last_layer = np.random.randn(4).astype(np.float32)

# pairwise_prefs: list of (i, j) index pairs
pairwise_prefs = [(0, 1), (1, 2), (2, 3)]

# demo_cnts: numpy array of feature counts, shape (4, 4) to multiply with weights
demo_cnts = np.random.randn(4, 4).astype(np.float32)

# confidence: scalar multiplier
confidence = 0.5

ARGS = {
    'last_layer': last_layer,
    'pairwise_prefs': pairwise_prefs,
    'demo_cnts': demo_cnts,
    'confidence': confidence,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
compute_l2 Ran
ran, honoured the contract we drafted
dsbrown1331/bayesianrex/code/LinearFeatureMCMC_auxiliary.py
code served (permissive licence) · get_code("596357f074d947e6")
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 float32, 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
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

class LastLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.weight = nn.Parameter(torch.randn(4, 3))
    
    def forward(self, x):
        return x

last_layer = LastLayer()

ARGS = {
    "last_layer": last_layer
}
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 float32, 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
create_mcmc_likelihood_data Ran
ran; our contract draft was wrong, not the code
dsbrown1331/bayesianrex/code/LinearFeatureMCMC_auxiliary.py
code served (permissive licence) · get_code("d02b4c9f8709dee9")
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) 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
import numpy as np

torch.manual_seed(0)

# Create simple trajectory objects
# A trajectory is just a sequence of states/observations
class Trajectory:
    def __init__(self, data):
        self.data = data
    
    def __repr__(self):
        return f"Trajectory({self.data})"

# Create demonstrations - list of trajectories
# Each trajectory is represented as a tensor or array
traj_1 = Trajectory(torch.randn(2, 4))  # 2 timesteps, 4-dim state
traj_2 = Trajectory(torch.randn(3, 4))  # 3 timesteps, 4-dim state
traj_3 = Trajectory(torch.randn(4, 4))  # 4 timesteps, 4-dim state

demonstrations = [traj_1, traj_2, traj_3]

ARGS = {
    "demonstrations": demonstrations
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 — 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
create_training_data Ran
ran; our contract draft was wrong, not the code
dsbrown1331/bayesianrex/code/LearnAtariRewardLinear.py
code served (permissive licence) · get_code("2c0910a0bc8022d0")
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) 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

np.random.seed(0)

# Create demonstrations structure
# Each demonstration is a tuple of (observations, actions)
# observations: list of observation arrays
# actions: list of action arrays

num_demos = 3
demo_length = 20
obs_dim = 4
action_dim = 2

demonstrations = []
for demo_idx in range(num_demos):
    obs_sequence = [np.random.randn(obs_dim) for _ in range(demo_length)]
    action_sequence = [np.random.randn(action_dim) for _ in range(demo_length)]
    demonstrations.append((obs_sequence, action_sequence))

ARGS = {
    "demonstrations": demonstrations,
    "num_trajs": 5,
    "num_snippets": 3,
    "min_snippet_length": 3,
    "max_snippet_length": 8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
reconstruction_loss Ran
ran; our contract draft was wrong, not the code
dsbrown1331/bayesianrex/code/LearnAtariRewardLinear.py
code served (permissive licence) · get_code("cfe0f494b5c6542d")
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) 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for the function arguments
# decoded: output from decoder, should be probabilities (values between 0 and 1)
decoded = torch.sigmoid(torch.randn(2, 4))

# target: ground truth, should match decoded shape
target = torch.randint(0, 2, (2, 4)).float()

# mu: mean from encoder, latent space representation
mu = torch.randn(2, 3)

# logvar: log variance from encoder, latent space representation
logvar = torch.randn(2, 3)

ARGS = {
    "decoded": decoded,
    "target": target,
    "mu": mu,
    "logvar": logvar,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
calc_linearized_pairwise_ranking_loss Not yet run
unverified (harvested, no recorded run)
dsbrown1331/bayesianrex/code/LinearFeatureMCMC_auxiliary.py
code served (permissive licence) · get_code("58181c5e66390b8d")
How it ran

no invocation recorded.

get_weight_vector Not yet run
unverified (harvested, no recorded run)
dsbrown1331/bayesianrex/code/LinearFeatureMCMC_auxiliary.py
code served (permissive licence) · get_code("b0e91e00b56dcd92")
How it ran

no invocation recorded.

mcmc_map_search Not yet run
unverified (harvested, no recorded run)
dsbrown1331/brex_gridworld_cpp/python/bayesianREX_basic.py
code served (permissive licence) · get_code("9f5cef830fea3e84")
How it ran

no invocation recorded.

mcmc_map_search Not yet run
unverified (harvested, no recorded run)
dsbrown1331/bayesianrex/code/LinearFeatureMCMC_auxiliary.py
code served (permissive licence) · get_code("f3987c649d049ce3")
How it ran

no invocation recorded.

write_weights_likelihood Not yet run
unverified (harvested, no recorded run)
dsbrown1331/bayesianrex/code/LinearFeatureMCMC_auxiliary.py
code served (permissive licence) · get_code("e18e2b6a06d313ad")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

Bayesian reward learning from demonstrations enables rigorous safety and uncertainty analysis when performing imitation learning. However, Bayesian reward learning methods are typically computationally intractable for complex control problems. We propose Bayesian Reward Extrapolation (Bayesian REX), a highly efficient Bayesian reward learning algorithm that scales to high-dimensional imitation learning problems by pre-training a low-dimensional feature encoding via self-supervised tasks and then leveraging preferences over demonstrations to perform fast Bayesian inference. Bayesian REX can learn to play Atari games from demonstrations, without access to the game score and can generate 100,000 samples from the posterior over reward functions in only 5 minutes on a personal laptop. Bayesian REX also results in imitation learning performance that is competitive with or better than stateof-the-art methods that only learn point estimates of the reward function. Finally, Bayesian REX enables efficient high-confidence policy evaluation without having access to samples of the reward function. These high-confidence performance bounds can be used to rank the performance and risk of a variety of evaluation policies and provide a way to detect reward hacking behaviors.

For agents

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

get_harvested_code_for_paper("2002.09089")
get_code_for_paper("2002.09089")
have("2002.09089")

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

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

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

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

Connect an agent — have() is free.