SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.05439 · NeurIPS · 2023

Metropolis Sampling for Constrained Diffusion Models

Emile Mathieu, Valentin De Bortoli, Michael Hutchinson, Nic Fishman, Leo Klarner

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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 0 have no contract verdict; 8 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2307.05439.json · badge: /api/ran/2307.05439.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
oxcsml/geomstats canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
autograd_only Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/tests.py
code served (permissive licence) · get_code("16247bca6040a5c1")
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 os
import unittest

# Set up the environment variable that autograd_only checks
os.environ['GEOMSTATS_BACKEND'] = 'autograd'

# Create a simple test item (a function or class)
def sample_test():
    """A sample test function."""
    pass

class SampleTestClass:
    """A sample test class."""
    pass

# The function autograd_only takes a test_item parameter
# which can be a function, method, or class
# It either returns the test_item as-is or decorates it with unittest.skip

# Create valid arguments
ARGS = {
    'test_item': sample_test
}
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 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
check_tf_error Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/errors.py
code served (permissive licence) · get_code("a471d46b2ce2d0ad")
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 type. 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 os

# Set up the backend environment variable
os.environ['GEOMSTATS_BACKEND'] = 'tensorflow'

# Create a simple exception class to pass as the first argument
class CustomException(Exception):
    pass

test_exception = CustomException("Test exception")

# The function checks if backend is 'tensorflow' and returns a tensorflow error class
# Otherwise returns the exception passed in
# The 'name' parameter is used to getattr on the errors module

ARGS = {
    'exception': test_exception,
    'name': 'InvalidArgumentError'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type 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
euler_step Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/integrator.py
code served (permissive licence) · get_code("01c0388601d634d0")
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, 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

torch.manual_seed(0)

# Define a simple force callable that takes state and time
# and returns derivatives with the same shape as state
def force_field(state, time):
    """Simple vector field for testing Euler integration."""
    # state has shape [2, dim] representing [position, velocity]
    # Return derivatives of same shape
    return torch.randn_like(state) * 0.1

# Create state: [2, 4] representing position and velocity in 4D space
state = torch.randn(2, 4)

# Time parameter
time = 0.0

# Time step
dt = 0.01

ARGS = {
    "force": force_field,
    "state": state,
    "time": time,
    "dt": dt,
}
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, 4) — shape (2, 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_types Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/vectorization.py
code served (permissive licence) · get_code("ee344cd6f0c3eb6b")
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)

# Analyze the function:
# - input_types: list of strings representing types
# - args: tuple of arguments
# - kwargs: dict of keyword arguments
# The function extracts type information based on the lengths of args and kwargs
# It checks if 'output_' is in type strings and specifically looks for 'output_scalar'

ARGS = {
    "input_types": [
        "int",
        "float",
        "str",
        "bool",
        "output_scalar"
    ],
    "args": (1, 2.5),
    "kwargs": {"key1": "value1"}
}
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
np_and_tf_only Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/tests.py
code served (permissive licence) · get_code("9e48b1ad1875e44a")
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 os
import unittest

# Set up environment for testing
os.environ['GEOMSTATS_BACKEND'] = 'numpy'

# Create a simple test class to decorate
class SimpleTest:
    """A simple test class for demonstration."""
    def test_example(self):
        pass

# The function np_and_tf_only takes a test_item as parameter
# It returns either the test_item itself or a skipped version of it
# We need to provide a valid test_item (which can be a function or class)

def dummy_test():
    """A dummy test function."""
    pass

# Create ARGS dict with the test_item parameter
ARGS = {
    'test_item': dummy_test
}
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 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
np_only Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/tests.py
code served (permissive licence) · get_code("63c5721f63f69b20")
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 type. 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 os
import unittest

# Set up environment variable for the backend check
os.environ['GEOMSTATS_BACKEND'] = 'numpy'

# Create a simple test item (function or class) to decorate
class SimpleTestClass:
    def test_method(self):
        pass

def simple_test_function():
    pass

# ARGS dict mapping the parameter 'test_item' to a value
ARGS = {
    'test_item': SimpleTestClass
}
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 type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type 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
rk2_step Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/integrator.py
code served (permissive licence) · get_code("b8eefd4ae398de2b")
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, 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

torch.manual_seed(0)

# Define a simple force function that takes state and time
# and returns derivatives of the state
def force(state, time):
    """
    Simple harmonic oscillator-like force.
    state has shape [2, dim] where state[0] is position and state[1] is velocity
    Returns derivatives with same shape as state
    """
    # For a simple system, velocity derivative is force, position derivative is velocity
    derivatives = torch.zeros_like(state)
    derivatives[0] = state[1]  # dposition/dt = velocity
    derivatives[1] = -state[0]  # dvelocity/dt = -position (harmonic oscillator)
    return derivatives

# Create initial state: [position, velocity] both with dim=4
state = torch.randn(2, 4)

# Time and timestep
time = 0.0
dt = 0.01

ARGS = {
    "force": force,
    "state": state,
    "time": time,
    "dt": dt
}
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, 4) — shape (2, 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
rk4_step Ran
ran; our contract draft was wrong, not the code
oxcsml/geomstats/geomstats/integrator.py
code served (permissive licence) · get_code("f67e779882c85537")
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, 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

torch.manual_seed(0)

# Define a simple force function that takes (state, time) and returns derivatives
def force_function(state, time):
    """Simple harmonic oscillator-like force."""
    # state has shape [2, dim] where dim=4
    # First row is position, second row is velocity
    # Returns derivative of state (same shape)
    position = state[0]  # shape [4]
    velocity = state[1]  # shape [4]
    
    # d(position)/dt = velocity
    # d(velocity)/dt = -position (simple harmonic)
    derivative_position = velocity
    derivative_velocity = -position
    
    result = torch.stack([derivative_position, derivative_velocity], dim=0)
    return result

# Create initial state: [2, 4] tensor
# First row: position, second row: velocity
state = torch.randn(2, 4)

# Time parameter
time = 0.0

# Time step
dt = 0.01

ARGS = {
    "force": force_function,
    "state": state,
    "time": time,
    "dt": dt,
}
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, 4) — shape (2, 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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 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.

FunctionAlso present inEarliest-datedOthers named
euler_step 1 other paper
1 dated earlier
2206.09048 (2022-06)
ICLR 2022 Challenge for Computational Geometry and Topology: Design and Results
rk2_step 1 other paper
1 dated earlier
2206.09048 (2022-06)
ICLR 2022 Challenge for Computational Geometry and Topology: Design and Results

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

Denoising diffusion models have recently emerged as the predominant paradigm for generative modelling on image domains. In addition, their extension to Riemannian manifolds has facilitated a range of applications across the natural sciences. While many of these problems stand to benefit from the ability to specify arbitrary, domaininformed constraints, this setting is not covered by the existing (Riemannian) diffusion model methodology. Recent work has attempted to address this issue by constructing novel noising processes based on the reflected Brownian motion and logarithmic barrier methods. However, the associated samplers are either computationally burdensome or only apply to convex subsets of Euclidean space. In this paper, we introduce an alternative, simple noising scheme based on Metropolis sampling that affords substantial gains in computational efficiency and empirical performance compared to the earlier samplers. Of independent interest, we prove that this new process corresponds to a valid discretisation of the reflected Brownian motion. We demonstrate the scalability and flexibility of our approach on a range of problem settings with convex and non-convex constraints, including applications from geospatial modelling, robotics and protein design.

For agents

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

get_harvested_code_for_paper("2307.05439")
get_code_for_paper("2307.05439")
have("2307.05439")

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

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

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

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

Connect an agent — have() is free.