SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1910.09056 · 2019

Amortized Rejection Sampling in Universal Probabilistic Programming

arXiv · PDF · Open in the Atlas

Code that ran

9 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; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/1910.09056.json · badge: /api/ran/1910.09056.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
plai-group/amortized-rejection-sampling canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
GUMEvidence Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/exp_marsaglia/model.py
code served (permissive licence) · get_code("ff7f44ddd1530cb8")
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 float64, ndim 0, 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 numpy as np

# Analyze the function to understand what arguments it needs:
# D: numpy array of observations
# mu_0: scalar (prior mean)
# sigma_0: scalar (prior standard deviation)
# sigma: scalar (likelihood standard deviation)

# Create small but valid test data
np.random.seed(0)

# D: observations as a numpy array
D = np.array([1.2, 2.3, 1.8, 2.1, 1.9])

# mu_0: prior mean (scalar)
mu_0 = 2.0

# sigma_0: prior standard deviation (scalar, positive)
sigma_0 = 0.5

# sigma: likelihood standard deviation (scalar, positive)
sigma = 1.0

ARGS = {
    "D": D,
    "mu_0": mu_0,
    "sigma_0": sigma_0,
    "sigma": sigma
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
GUMPosteriorParameters Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/exp_marsaglia/model.py
code served (permissive licence) · get_code("46fa2815061ee868")
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 numpy as np

# Construct arguments for GUMPosteriorParameters
# The function expects:
# - mu_0: prior mean (scalar)
# - sigma_0: prior standard deviation (scalar)
# - sigma: likelihood standard deviation (scalar)
# - observed_list: list of observations

mu_0 = 0.0
sigma_0 = 1.0
sigma = 0.5
observed_list = [1.2, 0.8, 1.5, 0.9, 1.1]

ARGS = {
    "mu_0": mu_0,
    "sigma_0": sigma_0,
    "sigma": sigma,
    "observed_list": observed_list
}
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, 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
M Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/exp_mini_sherpa/model.py
code served (permissive licence) · get_code("4295c0ac7b3c6ae4")
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 ndarray, ndim 2, dtype family float, shape (3, 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 numpy as np
import scipy.linalg as la

# Construct arguments for M(axis, theta)
# The function expects:
# - axis: a 3D vector (numpy array or similar) representing an axis of rotation
# - theta: a scalar value representing the angle of rotation

# axis should be a 3D vector
axis = np.array([1.0, 0.0, 0.0])

# theta should be a scalar (angle in radians)
theta = np.pi / 4

ARGS = {
    'axis': axis,
    'theta': theta
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 3) — shape (3, 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
get_evidence_estimate Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/plotting/utils.py
code served (permissive licence) · get_code("66193dd6816135ec")
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
import numpy as np

torch.manual_seed(0)

# Create log_weights tensor of shape TxN
# T=2 (trials), N=4 (samples)
log_weights = torch.randn(2, 4)

# dx is an integer step size
dx = 2

ARGS = {
    "log_weights": log_weights,
    "dx": dx,
}
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 — 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
get_trace_text Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/exp_mini_sherpa/utils.py
code served (permissive licence) · get_code("28175f98b50328ec")
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 str. 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
from collections import namedtuple

torch.manual_seed(0)

# Create a mock Variable class
class MockVariable:
    def __init__(self, name, value):
        self.name = name
        self.value = value

# Create a mock trace object
class MockTrace:
    def __init__(self):
        # Create named_variables dict with calorimeter_n_deposits
        calorimeter_tensor = torch.randn(1, 400)  # 20*20 = 400
        self.named_variables = {
            'calorimeter_n_deposits': MockVariable('calorimeter_n_deposits', calorimeter_tensor)
        }
        
        # Create variables list with named variables
        self.variables = [
            MockVariable('mother_momentum_x', torch.tensor(1.5)),
            MockVariable('mother_momentum_y', torch.tensor(2.5)),
            MockVariable('mother_momentum_z', torch.tensor(3.5)),
            MockVariable('channel_index', torch.tensor(1)),
        ]
        
        # result[2] should be final state momenta (batch of 3D momentum vectors)
        # Create 5 particles with 3 momentum components each
        final_state_momenta = torch.randn(5, 3)
        self.result = [None, None, final_state_momenta]
        
        # Create rs_entries (for rejected samples count)
        RSEntry = namedtuple('RSEntry', ['iteration'])
        self.rs_entries = [RSEntry(iteration=0), RSEntry(iteration=1), RSEntry(iteration=0)]
    
    def __str__(self):
        return "MockTrace(event_data)"

# Create the trace instance
trace = MockTrace()

ARGS = {
    'trace': trace
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not 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
load_log_weights Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/plotting/utils.py
code served (permissive licence) · get_code("4e16347fa6329047")
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 ndarray, ndim 1, dtype family float, shape (9,) 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 numpy as np
import tempfile
from pathlib import Path

# Create a temporary directory structure for testing
temp_dir = tempfile.TemporaryDirectory()
log_weights_root = Path(temp_dir.name)

# Create iw_mode subdirectory with some .npy files
iw_mode = "test_mode"
weights_dir = log_weights_root / iw_mode
weights_dir.mkdir(parents=True, exist_ok=True)

# Create multiple .npy files to be concatenated
weight_file_1 = weights_dir / "weights_1.npy"
weight_file_2 = weights_dir / "weights_2.npy"
weight_file_3 = weights_dir / "weights_3.npy"

np.save(weight_file_1, np.array([1.0, 2.0, 3.0]))
np.save(weight_file_2, np.array([4.0, 5.0]))
np.save(weight_file_3, np.array([6.0, 7.0, 8.0, 9.0]))

ARGS = {
    "log_weights_root": log_weights_root,
    "iw_mode": iw_mode,
}
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 ndarray, ndim 1, dtype family float, shape (9,) — shape (9,) 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
rotations Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/exp_mini_sherpa/model.py
code served (permissive licence) · get_code("67b641f6d06913d0")
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 numpy as np
import scipy.linalg as la

def M(axis, theta):
    return la.expm(np.cross(np.eye(3), axis / la.norm(axis) * theta))

def rotations(phi, theta):
    M1 = M([0, 0, 1], phi)
    M2 = M([0, 1, 0], theta)
    return (lambda v: np.dot(M2, np.dot(M1, v)), lambda v: np.dot(la.inv(M1), np.dot(la.inv(M2), v)))

# Set up test arguments
phi = 0.5  # scalar angle in radians
theta = 1.2  # scalar angle in radians

ARGS = {
    "phi": phi,
    "theta": theta
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
set_size Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/plotting/utils.py
code served (permissive licence) · get_code("58957ba935f8204c")
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.

ARGS = {
    'width': 426.79135,
    'fraction': 0.8,
    'subplots': (2, 3)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
to_polar Ran
ran on a synthesized input
plai-group/amortized-rejection-sampling/exp_mini_sherpa/model.py
code served (permissive licence) · get_code("e837e0b3fe75d232")
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 numpy as np
import scipy.linalg as la

# The function to_polar takes a vector v with 3 components (x, y, z)
# and converts it to spherical coordinates (r, phi, theta)
# We need to provide a valid 3-element vector

v = np.array([1.0, 1.0, 1.0])

ARGS = {
    "v": v
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
dispatch_model Not yet run
unverified (harvested, no recorded run)
plai-group/amortized-rejection-sampling/utils.py
code served (permissive licence) · get_code("d5c7e8c1c3cbedaa")
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-22.

Repositories linked to this paper

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

Abstract

Naive approaches to amortized inference in probabilistic programs with unbounded loops can produce estimators with infinite variance. This is particularly true of importance sampling inference in programs that explicitly include rejection sampling as part of the user-programmed generative procedure. In this paper we develop a new and efficient amortized importance sampling estimator. We prove finite variance of our estimator and empirically demonstrate our method's correctness and efficiency compared to existing alternatives on generative programs containing rejection sampling loops and discuss how to implement our method in a generic probabilistic programming framework.

For agents

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

get_harvested_code_for_paper("1910.09056")
get_code_for_paper("1910.09056")
have("1910.09056")

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

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

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

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

Connect an agent — have() is free.