SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1206.1901 · 2012

MCMC using Hamiltonian dynamics

arXiv · PDF · Open in the Atlas

Code that ran

16 of 17 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, 1 violated it and 15 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/1206.1901.json · badge: /api/ran/1206.1901.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
ricvalp/aisampler community (classifier label)
classifier basis not recorded on the link
16 ran · 1 no recorded run
FunctionStatusWhere it lives
U Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/logistic_regression/densities.py
code served (permissive licence) · get_code("c3e338a6c8c2e3c4")
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, 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
import numpy as np

# Set seed for reproducibility
np.random.seed(0)

# Define dimensions
n_samples = 2  # batch size
n_features = 4  # feature dimension
n_outputs = 3  # output dimension

# Create sample data
X = jnp.array(np.random.randn(n_samples, n_features), dtype=jnp.float32)

# Create binary targets
t = jnp.array(np.random.randint(0, 2, size=(n_samples, 1)), dtype=jnp.float32)

# Create coefficient matrix b (n_outputs x n_features)
b = jnp.array(np.random.randn(n_outputs, n_features), dtype=jnp.float32)

# Create inverse covariance matrix (n_features x n_features, symmetric positive definite)
inv_sigma = jnp.array(np.eye(n_features) * 2.0, dtype=jnp.float32)

# Small epsilon for numerical stability
eps = 1e-8

ARGS = {
    "b": b,
    "t": t,
    "X": X,
    "inv_sigma": inv_sigma,
    "eps": eps
}
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, 3) — shape (2, 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
create_henon_flow Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/kernels/HenonFlow.py
code served (permissive licence) · get_code("69a7db05762d9394")
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 FlowModel. 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
from flax import linen as nn

default_init = nn.initializers.glorot_normal()

class FlowModel(nn.Module):
    d: int
    flows: list

    def setup(self):
        self.R = jax.numpy.array([1.0 for i in range(self.d)] + [-1.0 for i in range(self.d)])

    def __call__(self, x):
        z = x
        for flow in self.flows:
            z = flow(z, reverse=False)
        z = z * self.R
        for flow in reversed(self.flows):
            z = flow(z, reverse=True)
        z = z * self.R
        return z

class HenonLayer(nn.Module):
    V: nn.Module
    d: int

    def setup(self):
        self.eta = self.param('eta', nn.initializers.zeros, (1, self.d * 2))
        self.i1 = jnp.block([[jnp.zeros((self.d, self.d)), jnp.eye(self.d)], [jnp.zeros((self.d, self.d)), jnp.zeros((self.d, self.d))]])
        self.i2 = jnp.block([[jnp.zeros((self.d, self.d)), jnp.zeros((self.d, self.d))], [jnp.eye(self.d), jnp.zeros((self.d, self.d))]])
        self.i3 = jnp.block([[jnp.eye(self.d), jnp.zeros((self.d, self.d))], [jnp.zeros((self.d, self.d)), jnp.zeros((self.d, self.d))]])
        self.i4 = jnp.block([[jnp.zeros((self.d, self.d)), jnp.zeros((self.d, self.d))], [jnp.zeros((self.d, self.d)), jnp.eye(self.d)]])

    def __call__(self, z, reverse=False):
        if not reverse:
            X = jnp.matmul(z, self.i1)
            Y = jnp.matmul(z, self.i2)
            ETA = jnp.matmul(self.eta, self.i3)
            V = jnp.matmul(self.V(Y), self.i4)
            return -X + Y + ETA + V
        else:
            X = jnp.matmul(z, self.i1)
            Y = jnp.matmul(z, self.i2)
            ETA = jnp.matmul(self.eta, self.i4)
            Xbar = jnp.matmul(X - ETA, self.i2)
            V = jnp.matmul(self.V(Xbar), self.i2)
            return X - Y - ETA + V

class SimpleMLP(nn.Module):
    num_hidden: int
    num_layers: int
    num_outputs: int

    def setup(self):
        self.linears = [nn.Dense(features=self.num_hidden, kernel_init=default_init) for i in range(self.num_layers - 1)] + [nn.Dense(features=self.num_outputs, kernel_init=default_init)]

    def __call__(self, x):
        for linear in self.linears[:-1]:
            x = linear(x)
            x = nn.relu(x)
        x = self.linears[-1](x)
        return x

def create_henon_flow(num_flow_layers: int, num_layers: int, num_hidden: int, d: int) -> FlowModel:
    """
    Args:
        num_flow_layers: int
        num_layers: int
        num_hidden: int
        d: int
    Returns:
        FlowModel
    """
    flow_layers = []
    flow_layers += [HenonLayer(SimpleMLP(num_layers=num_layers, num_hidden=num_hidden, num_outputs=2 * d), d=d) for _ in range(num_flow_layers)]
    flow_model = FlowModel(d, flow_layers)
    return flow_model

ARGS = {
    "num_flow_layers": 2,
    "num_layers": 3,
    "num_hidden": 8,
    "d": 4,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FlowModel — a FlowModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FlowModel 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
create_simple_discriminator_without_kernel Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/discriminators/utils.py
code served (permissive licence) · get_code("4646bb82ede9bc1e")
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 DiscriminatorWithoutL. 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
from flax import linen as nn

# Define ARGS dict with all parameters for create_simple_discriminator_without_kernel
ARGS = {
    "num_layers_psi": 2,
    "num_hidden_psi": 8,
    "num_layers_eta": 2,
    "num_hidden_eta": 8,
    "activation": "relu",
    "d": 4,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DiscriminatorWithoutL — a DiscriminatorWithoutL output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DiscriminatorWithoutL 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
ess Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/sampling/metrics.py
code served (permissive licence) · get_code("022942a1868fa9bb")
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

# Set random seed for reproducibility
np.random.seed(0)

# Create sample data for the function
# The function expects:
# - samples: array-like object that supports .shape[0] and indexing
# - mu: mean value (scalar)
# - sigma: standard deviation (scalar, non-zero)

samples = np.array([1.0, 2.1, 1.9, 3.0, 2.8, 3.2, 2.9, 3.1, 3.0, 2.95], dtype=np.float64)
mu = np.mean(samples)
sigma = np.std(samples)

ARGS = {
    "samples": samples,
    "mu": mu,
    "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
gelman_rubin_r Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/sampling/metrics.py
code served (permissive licence) · get_code("e4c7f98ecfb16a0c")
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

# Construct valid arguments for gelman_rubin_r
# The function expects chains as a 3D numpy array with shape (m, n, ...)
# where m is the number of chains and n is the number of iterations

# Create a small sample chains array
# Shape: (m=2 chains, n=4 iterations, 3 dimensions)
chains = np.random.randn(2, 4, 3)

ARGS = {
    "chains": chains
}
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
get_discriminator_function Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/discriminators/utils.py
code served (permissive licence) · get_code("46871977f6995869")
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 function. 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
from flax import linen as nn

# Initialize discriminator parameters
def init_discriminator_params():
    """Initialize discriminator parameters using Flax."""
    from flax import linen as nn
    
    # Create the discriminator model
    discriminator = nn.Sequential([nn.Dense(8), nn.relu, nn.Dense(1)])
    
    # Initialize with dummy input
    key = jax.random.PRNGKey(0)
    dummy_x = jnp.ones((2, 4))
    params = discriminator.init(key, dummy_x)
    
    return params

# Create discriminator parameters - this is a nested dict structure
# We need to build proper Flax parameters
key = jax.random.PRNGKey(0)

# Build psi network
psi_net = nn.Sequential([nn.Dense(8), nn.relu, nn.Dense(8), nn.relu, nn.Dense(1)])
dummy_input = jnp.ones((2, 4))
psi_params = psi_net.init(key, dummy_input)

# Build eta network
eta_net = nn.Sequential([nn.Dense(6), nn.relu, nn.Dense(6), nn.relu, nn.Dense(1)])
eta_params = eta_net.init(key, dummy_input)

# Construct the discriminator_parameters as a nested dict
discriminator_parameters = {
    'D': {
        'psi': psi_params,
        'eta': eta_params
    }
}

ARGS = {
    'discriminator_parameters': discriminator_parameters,
    'num_layers_psi': 2,
    'num_hidden_psi': 8,
    'num_layers_eta': 2,
    'num_hidden_eta': 6,
    'activation': 'relu',
    'd': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
hmc_kernel Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/sampling/hamiltonian_monte_carlo.py
code served (permissive licence) · get_code("7cfa38bfca9e0f43")
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

# Set random seed for reproducibility
key = jax.random.PRNGKey(0)

# Parameters
parallel_chains = 2
dim_q = 4  # dimension of position variables
dim_p = 4  # dimension of momentum variables (should equal dim_q)
total_dim = dim_q + dim_p  # concatenated dimension

# Create initial state x: shape (parallel_chains, dim_q + dim_p)
x = jnp.ones((parallel_chains, total_dim))

# Define a simple potential function and its gradient
def potential_fn(q):
    """Simple quadratic potential: U(q) = 0.5 * sum(q^2)"""
    return 0.5 * jnp.sum(q**2, axis=1, keepdims=True)

def grad_potential_fn(q):
    """Gradient of quadratic potential: grad_U(q) = q"""
    return q

# Define a simple density function (log probability)
def density(x_full):
    """Log probability: -U(q) - 0.5 * sum(p^2)"""
    q = x_full[:, :x_full.shape[1] // 2]
    p = x_full[:, x_full.shape[1] // 2:]
    return -potential_fn(q).squeeze() - 0.5 * jnp.sum(p**2, axis=1)

# Covariance matrix for momentum (identity for simplicity)
cov_p = jnp.eye(dim_p)

# HMC parameters
num_steps = 3
step_size = 0.1

ARGS = {
    'x': x,
    'key': key,
    'cov_p': cov_p,
    'density': density,
    'num_steps': num_steps,
    'step_size': step_size,
    'grad_potential_fn': grad_potential_fn,
    'parallel_chains': parallel_chains,
}
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
hmc_proposal Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/sampling/hamiltonian_monte_carlo.py
code served (permissive licence) · get_code("9e160366deb59347")
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, 8) 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 jax

def grad_potential_fn(q):
    """Simple quadratic potential gradient: U(q) = 0.5 * sum(q^2), so grad_U = q"""
    return q

# Create initial state: batch_size=2, total_dim=8 (4 position + 4 momentum)
x = jnp.array([
    [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
    [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
], dtype=jnp.float32)

ARGS = {
    "x": x,
    "grad_potential_fn": grad_potential_fn,
    "num_steps": 3,
    "step_size": 0.01
}
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 (2, 8) — shape (2, 8) 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
lag_s_autocorrelation Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/sampling/metrics.py
code served (permissive licence) · get_code("f5d2f37f8001b5d1")
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

np.random.seed(0)

# The function expects:
# - samples: a numpy array with shape (N,) where N is the number of samples
# - s: an integer representing the lag
# - mu: a scalar (float) representing the mean
# - sigma: a scalar (float) representing the standard deviation

samples = np.random.randn(10)
s = 2
mu = 0.0
sigma = 1.0

ARGS = {
    "samples": samples,
    "s": s,
    "mu": mu,
    "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
leapfrog_step Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/sampling/hamiltonian_monte_carlo.py
code served (permissive licence) · get_code("85bd9d4d7c767644")
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, 8) 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

# Define a simple potential energy gradient function
def grad_U(q):
    """Simple quadratic potential gradient: U(q) = 0.5 * sum(q^2), so grad_U = q"""
    return q

# Create input state x with shape (batch_size, 2 * dim)
# Split into q and p, each of dimension 4, so total dimension is 8
batch_size = 2
dim = 4
x = jnp.array(np.random.randn(batch_size, 2 * dim), dtype=jnp.float32)

# Define epsilon (step size)
epsilon = 0.1

ARGS = {
    "x": x,
    "epsilon": epsilon,
    "grad_U": grad_U,
}
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, 8) — shape (2, 8) 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
normal Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/logistic_regression/densities.py
code served (permissive licence) · get_code("0bd227a6783875bd")
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 numpy as np

torch.manual_seed(0)

# x is a 2D tensor that will be used in matrix multiplication: x @ inv_sigma @ x.T
# For x @ inv_sigma @ x.T to work:
# - x should be shape (batch, dim) = (2, 4)
# - inv_sigma should be shape (dim, dim) = (4, 4)
# - x.T will be shape (4, batch) = (4, 2)
# - x @ inv_sigma gives (2, 4), then @ x.T gives (2, 2)

x = torch.randn(2, 4)
inv_sigma = torch.randn(4, 4)

ARGS = {
    "x": x,
    "inv_sigma": inv_sigma,
}
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 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
plot_discriminator Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/discriminators/utils.py
code served (permissive licence) · get_code("3d60559d8ce91f43")
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 Figure. 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 jax
import matplotlib.pyplot as plt

# Create a simple discriminator function
def mock_discriminator(x_0, z_q):
    """
    Mock discriminator that takes two inputs and returns a score.
    x_0: shape (n**2, 4) - concatenated position and momentum
    z_q: shape (n**2, 4) - query points with zero momentum
    Returns: shape (n**2,) - discriminator scores
    """
    # Simple linear combination as a mock discriminator
    return jnp.sum(x_0 * z_q, axis=1)

# Define parameters
n = 5  # small grid size to keep computation light
xlim_q = 2.0
ylim_q = 2.0
xlim_p = 1.5
ylim_p = 1.5

# x_0 is initial position (2D), so shape (2,)
x_0 = jnp.array([0.5, -0.3])

# p_0 and p_1 are scalar momentum components
p_0 = 0.1
p_1 = -0.2

ARGS = {
    "discriminator": mock_discriminator,
    "xlim_q": xlim_q,
    "ylim_q": ylim_q,
    "xlim_p": xlim_p,
    "ylim_p": ylim_p,
    "x_0": x_0,
    "p_0": p_0,
    "p_1": p_1,
    "n": n,
    "name": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, matplotlib — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
plot_histograms2d_logistic_regression Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/logistic_regression/utils.py
code served (permissive licence) · get_code("6f27316046641935")
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 Figure. 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
import matplotlib.pyplot as plt

torch.manual_seed(0)

# Create sample data with shape (n_samples, n_features)
# We need at least 5 features (indices 0-4) to access samples[:, 4 + index]
# With index=0, we access columns 0,1,2,3,4
n_samples = 100
n_features = 5
samples = torch.randn(n_samples, n_features)

ARGS = {
    "samples": samples,
    "index": 0,
    "name": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
plot_histograms_logistic_regression Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/logistic_regression/utils.py
code served (permissive licence) · get_code("278f5bed5e830df4")
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 Figure. 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
import matplotlib.pyplot as plt

torch.manual_seed(0)

# Create sample data: 2 samples, each with 4 parameters (for logistic regression)
samples = torch.randn(2, 4, dtype=torch.float32)

ARGS = {
    "samples": samples,
    "index": 0,
    "name": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
plot_logistic_regression_samples Ran
ran on a synthesized input
ricvalp/aisampler/aisampler/logistic_regression/utils.py
code served (permissive licence) · get_code("0bc0f66d15c19a63")
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 Figure. 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
import matplotlib.pyplot as plt

torch.manual_seed(0)

# Create sample data with shape (num_samples, 5)
# The function accesses columns at indices [0+index], [1+index], [2+index], [3+index], [4+index]
# So we need at least 5 columns (indices 0-4)
samples = torch.randn(100, 5).numpy()

ARGS = {
    "samples": samples,
    "plot": plt.scatter,
    "index": 0,
    "name": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
sigma Ran
ran, violated the contract we drafted
ricvalp/aisampler/aisampler/logistic_regression/densities.py
code served (permissive licence) · get_code("543ac1fdfab44708")
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 1, dtype family float, shape (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 numpy as np
from jax.scipy.special import expit

torch.manual_seed(0)

# The function sigma(x) simply applies the expit (logistic sigmoid) function to x.
# expit expects a numpy array or a JAX array-like input.
# We'll pass a small numpy array as the argument.

x = np.array([0.0, 1.0, -1.0, 0.5], dtype=np.float32)

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, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 1, dtype family float, shape (4,) — shape (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
get_params_from_checkpoint Not yet run
unverified (harvested, no recorded run)
ricvalp/aisampler/aisampler/kernels/utils.py
code served (permissive licence) · get_code("90fddff06eaaf1ba")
How it ran

no invocation recorded.

Also present in other papers' code

Of 17 samples lifted from this paper's linked repositories, 17 carry a function identity and 0 do not. Of the 17 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 16 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.

FunctionAlso present inEarliest-datedOthers named
sigma 1 other paper
1 later
1610.00161 (2016-10)
Towards deep learning with segregated dendrites

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

Hamiltonian dynamics can be used to produce distant proposals for the Metropolis algorithm, thereby avoiding the slow exploration of the state space that results from the diffusive behaviour of simple random-walk proposals. Though originating in physics, Hamiltonian dynamics can be applied to most problems with continuous state spaces by simply introducing fictitious "momentum" variables. A key to its usefulness is that Hamiltonian dynamics preserves volume, and its trajectories can thus be used to define complex mappings without the need to account for a hard-to-compute Jacobian factor - a property that can be exactly maintained even when the dynamics is approximated by discretizing time. In this review, I discuss theoretical and practical aspects of Hamiltonian Monte Carlo, and present some of its variations, including using windows of states for deciding on acceptance or rejection, computing trajectories using fast approximations, tempering during the course of a trajectory to handle isolated modes, and short-cut methods that prevent useless trajectories from taking much computation time.

For agents

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

get_harvested_code_for_paper("1206.1901")
get_code_for_paper("1206.1901")
have("1206.1901")

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

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

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

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

Connect an agent — have() is free.