SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.11552 · ICML · 2023

Reduce, Reuse, Recycle: Compositional Generation with Energy-Based Diffusion Models and MCMC

Joshua Tenenbaum, Conor Durkan, Will Grathwohl, Yilun Du, Rob Fergus, Sander Dieleman, Jascha Sohl-Dickstein, Arnaud Doucet, Robin Strudel

arXiv · PDF · Open in the Atlas

Code that ran

19 of 24 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 16 have no contract verdict; 3 failures of our instrument; 5 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/2302.11552.json · badge: /api/ran/2302.11552.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
yilundu/reduce_reuse_recycle canonical (classifier label)
classifier basis not recorded on the link
11 ran · 0 no recorded run
FraunhoferChalmersCentre/mcmc_corr_score_diffusion community
Papers with Code archive
4 ran · 3 no recorded run
jackonelli/mcmc_corr_score_diffusion community (classifier label)
classifier basis not recorded on the link
4 ran · 2 no recorded run
FunctionStatusWhere it lives
AnnealedLAEnergySampler Ran
ran on a synthesized input · constructed an object; no result was computed
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("d4078a78835278a9")
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 an instance of its own class, AnnealedLAEnergySampler: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn
from typing import Callable, Dict, Optional
from pathlib import Path

torch.manual_seed(0)

# Define a simple gradient function
def gradient_function(x, t, t_idx, classes):
    """Returns (gradient, auxiliary) tuple"""
    grad = -x * 0.1  # Simple gradient
    aux = torch.zeros(1)
    return (grad, aux)

# Define a simple energy function
def energy_function(x, t, t_idx, classes):
    """Returns energy value"""
    return torch.sum(x ** 2, dim=tuple(range(1, x.dim())))

# Create step sizes dict for a few timesteps
step_sizes = {
    0: 0.01,
    1: 0.01,
    2: 0.01,
}

# Number of samples per step
num_samples_per_step = 2

ARGS = {
    'num_samples_per_step': num_samples_per_step,
    'step_sizes': step_sizes,
    'gradient_function': gradient_function,
    'energy_function': energy_function,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AnnealedLAEnergySampler — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AnnealedLAEnergySampler 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
compute_alpha_bars Ran
ran on a synthesized input
jackonelli/mcmc_corr_score_diffusion/src/diffusion/base.py
code served (permissive licence) · get_code("1d0ffb9417faf1c2")
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 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 as th

th.manual_seed(0)

# alphas should be a 1D tensor of alpha values for the diffusion process
# The function computes cumulative product along dim=0
alphas = th.tensor([0.9, 0.85, 0.8, 0.75], dtype=th.float32)

ARGS = {
    "alphas": alphas
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
convert_images Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/inf_sample.py
code served (permissive licence) · get_code("a590204c5c54b2b7")
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 4, dtype family int, shape (2, 4, 5, 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 torch as th

th.manual_seed(0)

# The function expects a batch tensor with shape (batch_size, channels, height, width)
# It will permute to (batch_size, height, width, channels) at the end
# Input values should be in range [-1, 1] based on the scaling operation
batch = th.randn(2, 3, 4, 5)  # batch=2, channels=3, height=4, width=5

ARGS = {
    "batch": batch
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 4, dtype family int, shape (2, 4, 5, 3) — shape (2, 4, 5, 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
detach_tensor_tuple Ran
ran; our contract draft was wrong, not the code
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("a9b7c8e105920ea7")
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

torch.manual_seed(0)

# Create a tuple of tensors with different shapes to make them distinguishable
tensor1 = torch.randn(2, 4, requires_grad=True)
tensor2 = torch.randn(3, 4, requires_grad=True)
tensor3 = torch.randn(2, 5, requires_grad=True)

tt = (tensor1, tensor2, tensor3)

ARGS = {
    "tt": tt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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_caption_simple Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/inf_sample.py
code served (permissive licence) · get_code("29fdc3d62f50e44c")
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

torch.manual_seed(0)

# The function get_caption_simple takes a 'label' parameter
# Looking at the function body: it accesses label[0] and uses it as an index into shapes list
# So label needs to be indexable with at least one element that is an integer

label = [1, 2, 3]  # A simple list where label[0] = 1, which indexes into shapes list

ARGS = {
    'label': label
}
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
get_mean Ran
ran; our contract draft was wrong, not the code
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("f7a0f2fa7e703b10")
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 torch.nn as nn

torch.manual_seed(0)

# Create a simple gradient function that takes (x, t, t_idx, classes) and returns a tuple
class SimpleGradientModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x, t, t_idx, classes):
        # Compute gradient as a simple linear transformation of x
        # Return (gradient_tensor, dummy_value)
        grad = self.linear(x)
        return (grad, torch.tensor(0.0))

gradient_function = SimpleGradientModel()

# x: input tensor of shape (batch_size, feature_dim)
x = torch.randn(2, 4)

# t: time step (scalar tensor)
t = torch.tensor(0.5)

# t_idx: time step index (scalar int or tensor)
t_idx = 0

# ss: step size (scalar float)
ss = 0.1

# classes: class information (scalar int or tensor)
classes = torch.tensor(1)

ARGS = {
    'gradient_function': gradient_function,
    'x': x,
    't': t,
    't_idx': t_idx,
    'ss': ss,
    'classes': classes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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_shared_stems Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/ebm_finetune/loader.py
code served (permissive licence) · get_code("d3feaecffda22481")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function takes two dictionaries where keys are stems (strings)
# It finds the intersection of keys and returns them as a list

image_files_dict = {
    "stem_001": "path/to/image1.jpg",
    "stem_002": "path/to/image2.jpg",
    "stem_003": "path/to/image3.jpg",
}

text_files_dict = {
    "stem_002": "path/to/text2.txt",
    "stem_003": "path/to/text3.txt",
    "stem_004": "path/to/text4.txt",
}

ARGS = {
    "image_files_dict": image_files_dict,
    "text_files_dict": text_files_dict,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
improved_beta_schedule Ran
ran on a synthesized input
jackonelli/mcmc_corr_score_diffusion/src/diffusion/beta_schedules.py
code served (permissive licence) · get_code("e85431655316894a")
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 1, dtype family float, shape (10,) 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 as th
import math

# Set seed for reproducibility
th.manual_seed(0)

# The function takes num_timesteps, s, and beta_max as parameters
# num_timesteps: int - number of diffusion timesteps
# s: float - schedule parameter (default 0.008)
# beta_max: float - maximum beta value (default 0.999)

ARGS = {
    "num_timesteps": 10,
    "s": 0.008,
    "beta_max": 0.999
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 1, dtype family float, shape (10,) — shape (10,) 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
langevin_step_grad Ran
ran on a synthesized input
jackonelli/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("7cf0cc36ff64fa5f")
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 as th

th.manual_seed(0)

# Define a minimal gradient function that takes (x, t, t_idx, classes)
# and returns a tuple of tensors
def gradient_function(x, t, t_idx, classes):
    # Return a tuple of two tensors (gradient and one for saving)
    grad = th.randn_like(x) * 0.1
    grad_save = th.randn_like(x) * 0.1
    return (grad, grad_save)

# Create small test tensors
x = th.randn(2, 4)  # batch_size=2, feature_dim=4
t = 5  # timestep as scalar
t_idx = 0  # timestep index
classes = th.tensor([0, 1])  # class labels for batch

# step_sizes: dict mapping timestep to step size
step_sizes = {
    5: 0.01,
    10: 0.005,
    15: 0.002
}

ARGS = {
    'x': x,
    't': t,
    't_idx': t_idx,
    'classes': classes,
    'step_sizes': step_sizes,
    'gradient_function': gradient_function
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
leapfrog_step Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/anneal_samplers.py
code served (permissive licence) · get_code("06e0889f95445a4d")
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 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define the gradient_target function
# It takes a tensor x and returns the gradient (a tensor of the same shape)
def gradient_target(x):
    # Simple quadratic function: f(x) = sum(x^2)
    # gradient: df/dx = 2*x
    return 2.0 * x

# Set up parameters
x_0 = torch.randn(2, 4)  # batch size 2, dimension 4
v_0 = torch.randn(2, 4)  # velocity, same shape as x_0
step_size = 0.01
mass_diag_sqrt = torch.ones(2, 4)  # diagonal mass matrix square root
num_steps = 3

ARGS = {
    "x_0": x_0,
    "v_0": v_0,
    "gradient_target": gradient_target,
    "step_size": step_size,
    "mass_diag_sqrt": mass_diag_sqrt,
    "num_steps": num_steps,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, 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
leapfrog_step_c Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/anneal_samplers.py
code served (permissive licence) · get_code("932dcf598e0e8040")
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 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple gradient function that takes x and returns a tuple
# where the second element is the gradient
class GradientTarget(nn.Module):
    def forward(self, x):
        # Return a tuple (loss, gradient)
        # The function expects grad_i = gradient_target(x_k)[1]
        loss = (x ** 2).sum()
        gradient = 2 * x
        return (loss, gradient)

gradient_target = GradientTarget()

# Create tensors with distinct dimensions for clarity
batch_size = 2
dim = 4

x_0 = torch.randn(batch_size, dim)
v_0 = torch.randn(batch_size, dim)
mass_diag_sqrt = torch.ones(batch_size, dim)

# Compute initial gradient
grad_i = gradient_target(x_0)[1]

step_size = 0.01
num_steps = 3

ARGS = {
    'x_0': x_0,
    'v_0': v_0,
    'gradient_target': gradient_target,
    'step_size': step_size,
    'mass_diag_sqrt': mass_diag_sqrt,
    'num_steps': num_steps,
    'grad_i': grad_i,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, 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
linear_beta_schedule Ran
ran on a synthesized input
jackonelli/mcmc_corr_score_diffusion/src/diffusion/beta_schedules.py
code served (permissive licence) · get_code("2d285d148cec3cf9")
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 1, dtype family float, shape (200,) 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 as th

th.manual_seed(0)

ARGS = {
    "beta_start": 0.0001,
    "beta_end": 0.02,
    "num_timesteps": 200,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 1, dtype family float, shape (200,) — shape (200,) 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
pil_image_to_norm_tensor Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/ebm_finetune/train_util.py
code served (permissive licence) · get_code("fd954310721946be")
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 3, dtype family float, shape (3, 3, 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 as th
import numpy as np
from PIL import Image

# Create a small PIL image (3x4 RGB image)
# PIL images are typically in RGB mode with uint8 values (0-255)
image_array = np.random.randint(0, 256, size=(3, 4, 3), dtype=np.uint8)
pil_image = Image.fromarray(image_array, mode='RGB')

ARGS = {
    'pil_image': pil_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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 3, dtype family float, shape (3, 3, 4) — shape (3, 3, 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
pil_image_to_norm_tensor Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/inf_sample.py
code served (permissive licence) · get_code("f21742fc20d71d4e")
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 3, dtype family float, shape (3, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as th
import numpy as np
from PIL import Image

# Create a small PIL image for testing
# Create a numpy array with shape (H, W, C) with values in range [0, 255]
image_array = np.random.randint(0, 256, size=(4, 3, 3), dtype=np.uint8)
pil_image = Image.fromarray(image_array)

ARGS = {
    "pil_image": pil_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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 3, dtype family float, shape (3, 4, 3) — shape (3, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
pred_to_pil Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/ebm_finetune/train_util.py
code served (permissive licence) · get_code("11a2ed9b4eca61ff")
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 Image. 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 as th
import torch.nn as nn
import PIL

th.manual_seed(0)

# Analyze the function:
# - pred: th.Tensor is used with:
#   - arithmetic operations ((pred + 1) * 127.5)
#   - .round(), .clamp(0, 255), .to(th.uint8), .cpu()
#   - .permute(2, 0, 3, 1)
#   - .reshape([pred.shape[2], -1, 3])
#   - .numpy()
#
# From the reshape operation: [pred.shape[2], -1, 3]
# This suggests pred has shape [batch, height, width, channels]
# But permute(2, 0, 3, 1) transforms [batch, height, width, channels] -> [width, batch, channels, height]
# Then reshape to [width, -1, 3] means [pred.shape[2], batch*height, 3]
#
# So pred should be shape [batch, height, width, 3] with values in [-1, 1] range
# Let's use: [2, 4, 5, 3] to have distinct dimensions

pred = th.randn(2, 4, 5, 3) * 0.5  # values roughly in [-1, 1] range

ARGS = {
    'pred': pred
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
random_resized_crop Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/ebm_finetune/loader.py
code served (permissive licence) · get_code("0a9706f9bbe05cab")
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 Image. 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.

from PIL import Image
import numpy as np
import torch

# Create a small PIL Image for testing
# Create a simple RGB image (100x100 pixels)
image_array = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
image = Image.fromarray(image_array, mode='RGB')

# Define the desired output shape (height, width)
shape = (64, 64)

# Define resize ratio
resize_ratio = 0.8

ARGS = {
    'image': image,
    'shape': shape,
    'resize_ratio': resize_ratio
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
read_image Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/ebm_finetune/utils.py
code served (permissive licence) · get_code("57fcd456d5810d3b")
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 4, dtype family float, shape (1, 3, 48, 64) 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 as th
import numpy as np
import PIL.Image
from io import BytesIO

# Create a small dummy image in memory
def create_dummy_image():
    img = PIL.Image.new('RGB', (100, 100), color=(128, 128, 128))
    return img

# Save dummy image to a temporary path
dummy_img = create_dummy_image()
img_bytes = BytesIO()
dummy_img.save(img_bytes, format='PNG')
img_bytes.seek(0)

# Create a temporary file path and write the image
import tempfile
with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as tmp:
    tmp.write(img_bytes.getvalue())
    temp_image_path = tmp.name

ARGS = {
    'path': temp_image_path,
    'shape': (64, 48)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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 4, dtype family float, shape (1, 3, 48, 64) — shape (1, 3, 48, 64) 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
resize_for_upsample Ran
ran on a synthesized input
yilundu/reduce_reuse_recycle/ebm_finetune/train_util.py
code served (permissive licence) · get_code("b07fd9a729a94156")
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
from PIL import Image

torch.manual_seed(0)

# Create a simple PIL image for testing
# Create a 16x12 RGB image with random pixel values
img_array = np.random.randint(0, 256, (12, 16, 3), dtype=np.uint8)
pil_image = Image.fromarray(img_array, mode='RGB')

# Define parameters for the function
original = pil_image
low_res_x = 4
low_res_y = 3
upscale_factor = 4

ARGS = {
    'original': original,
    'low_res_x': low_res_x,
    'low_res_y': low_res_y,
    'upscale_factor': upscale_factor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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
transition_factor Ran
ran; our contract draft was wrong, not the code
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("4a84c669b1fa6720")
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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as th

th.manual_seed(0)

# Construct tensors with distinct batch and feature dimensions
batch_size = 2
feature_dim = 4

# x: input tensor of shape (batch_size, feature_dim)
x = th.randn(batch_size, feature_dim)

# mean_x: mean of x, shape (batch_size, feature_dim)
mean_x = th.randn(batch_size, feature_dim)

# x_hat: reconstructed/predicted x, shape (batch_size, feature_dim)
x_hat = th.randn(batch_size, feature_dim)

# mean_x_hat: mean of x_hat, shape (batch_size, feature_dim)
mean_x_hat = th.randn(batch_size, feature_dim)

# ss: scalar variance parameter
ss = 0.1

# dims: number of dimensions (used to compute which dims to sum over)
# dims should be 2 here since tensors have shape (batch_size, feature_dim)
dims = 2

ARGS = {
    "x": x,
    "mean_x": mean_x,
    "x_hat": x_hat,
    "mean_x_hat": mean_x_hat,
    "ss": ss,
    "dims": dims,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
MCMCMHCorrSampler Not yet run
unverified (harvested, no recorded run)
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("a04752f942c7925d")
How it ran

no invocation recorded.

MCMCSampler Not yet run
unverified (harvested, no recorded run)
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("8f1eb6e3a186e10c")
How it ran

no invocation recorded.

extract Not yet run
unverified (harvested, no recorded run)
jackonelli/mcmc_corr_score_diffusion/src/diffusion/base.py
code served (permissive licence) · get_code("20943558683faaad")
How it ran

no invocation recorded.

langevin_step Not yet run
unverified (harvested, no recorded run)
FraunhoferChalmersCentre/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("e27f4a5a9b47901e")
How it ran

no invocation recorded.

langevin_step Not yet run
unverified (harvested, no recorded run)
jackonelli/mcmc_corr_score_diffusion/src/samplers/mcmc.py
code served (permissive licence) · get_code("44a6120940d4d226")
How it ran

no invocation recorded.

Also present in other papers' code

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

Since their introduction, diffusion models have quickly become the prevailing approach to generative modeling in many domains. They can be interpreted as learning the gradients of a timevarying sequence of log-probability density functions. This interpretation has motivated classifierbased and classifier-free guidance as methods for post-hoc control of diffusion models. In this work, we build upon these ideas using the scorebased interpretation of diffusion models, and explore alternative ways to condition, modify, and reuse diffusion models for tasks involving compositional generation and guidance. In particular, we investigate why certain types of composition fail using current techniques and present a number of solutions. We conclude that the sampler (not the model) is responsible for this failure and propose new samplers, inspired by MCMC, which enable successful compositional generation. Further, we propose an energy-based parameterization of diffusion models which enables the use of new compositional operators and more sophisticated, Metropolis-corrected samplers. Intriguingly we find these samplers lead to notable improvements in compositional generation across a wide set of problems such as classifier-guided ImageNet modeling and compositional text-to-image generation. Project webpage: https://energy-based-model. github.io/reduce-reuse-recycle/.

For agents

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

get_harvested_code_for_paper("2302.11552")
get_code_for_paper("2302.11552")
have("2302.11552")

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

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

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

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

Connect an agent — have() is free.