SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.02679 · ICLR · 2024

Diffusion Generative Flow Samplers: Improving learning signals through partial trajectory optimization

Yoshua Bengio, Dinghuai Zhang, Ricky Chen, Aaron Courville, Cheng-Hao Liu

arXiv · PDF · Open in the Atlas

Code that ran

10 of 18 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 4 have no contract verdict; 3 failures of our instrument; 8 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/2310.02679.json · badge: /api/ran/2310.02679.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
zdhNarsil/Diffusion-Generative-Flow-Samplers canonical (classifier label)
classifier basis: classifier_2025
7 ran · 7 no recorded run
lollcat/fab-torch community (classifier label)
classifier basis not recorded on the link
2 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
FourierMLP Ran
ran on a synthesized input · constructed an object; no result was computed
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("a201302b402cd6c0")
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, FourierMLP: 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 numpy as np
import torch
from torch import nn

torch.manual_seed(0)

ARGS = {
    'in_shape': 5,
    'out_shape': 3,
    'num_layers': 2,
    'channels': 128,
    'zero_init': True,
    'res': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FourierMLP — 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 FourierMLP 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
TimeConder Ran
ran on a synthesized input · constructed an object; no result was computed
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("d37a1cf88a974ddb")
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, TimeConder: 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
from torch import nn

torch.manual_seed(0)

ARGS = {
    'channel': 4,
    'out_dim': 3,
    'num_layers': 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TimeConder — 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 TimeConder 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
cal_subtb_coef_matrix Ran
ran, honoured the contract we drafted
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("da2a05982956c734")
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 (4, 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)

ARGS = {
    "lamda": 2.0,
    "N": 3
}
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 (4, 4) — shape (4, 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
check_shape Ran
ran, violated the contract we drafted
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("1b8efc311899b36e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; 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 numpy as np
from collections.abc import Iterable

torch.manual_seed(0)

# Test case 1: Iterable (list)
test_iterable = [2, 3, 4]

# Test case 2: int
test_int = 5

ARGS = {
    "cur_shape": test_iterable
}
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, ndim 1, dtype family int — 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
fl_inter_logr Ran
ran; our contract draft was wrong, not the code
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("5a929f917f107757")
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 (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 numpy as np
import torch

torch.manual_seed(0)

# Build a config object with required attributes
class Config:
    def __init__(self):
        self.sigma = 1.0
        self.t_end = 10.0

config = Config()

# Build a logreward_fn that takes x (batch_size, dim) and returns (batch_size,)
def logreward_fn(x):
    # x is shape (batch_size, dim), return shape (batch_size,)
    return torch.sum(x, dim=-1)

# Create x tensor: batch_size=2, dim=4
x = torch.randn(2, 4)

# Create cur_t as a scalar or tensor
cur_t = 5.0

# sigma can be None (will use config.sigma) or a tensor
sigma = None

ARGS = {
    "x": x,
    "logreward_fn": logreward_fn,
    "config": config,
    "cur_t": cur_t,
    "sigma": 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 1, dtype family float, shape (2,) — shape (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
get_intermediate_log_prob Ran
ran on a synthesized input
lollcat/fab-torch/fab/sampling_methods/base.py
code served (permissive licence) · get_code("99eccb5ee7909c68")
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 (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

torch.manual_seed(0)

class Point:
    """Keeps important info on points in the AIS chain. Saves us having to re-evaluate the target
    and base log prob/ score functions."""

    def __init__(self, x: torch.Tensor, log_q: torch.Tensor, log_p: torch.Tensor, grad_log_q=None, grad_log_p=None):
        self.x = x
        self.log_q = log_q
        self.log_p = log_p
        self.grad_log_q = grad_log_q
        self.grad_log_p = grad_log_p

    @property
    def device(self):
        return self.x.device

    def to(self, device):
        self.x = self.x.to(device)
        self.log_q = self.log_q.to(device)
        self.log_p = self.log_p.to(device)
        self.grad_log_q = self.grad_log_q.to(device) if self.grad_log_q is not None else None
        self.grad_log_p = self.grad_log_p.to(device) if self.grad_log_p is not None else None

    def __getitem__(self, indices):
        log_p = self.log_p[indices]
        grad_log_q = self.grad_log_q[indices] if self.grad_log_q is not None else None
        grad_log_p = self.grad_log_p[indices] if self.grad_log_p is not None else None
        return Point(self.x[indices], self.log_q[indices], log_p, grad_log_q, grad_log_p)

    def __setitem__(self, indices, values):
        self.x[indices] = values.x
        self.log_q[indices] = values.log_q
        self.log_p[indices] = values.log_p
        if self.grad_log_q is not None:
            self.grad_log_q[indices] = values.grad_log_q
            self.grad_log_p[indices] = values.grad_log_p


# Create a Point object with batch size 2, dimension 4
batch_size = 2
dim = 4

x_tensor = torch.randn(batch_size, dim)
log_q_tensor = torch.randn(batch_size)
log_p_tensor = torch.randn(batch_size)
grad_log_q_tensor = torch.randn(batch_size, dim)
grad_log_p_tensor = torch.randn(batch_size, dim)

point = Point(
    x=x_tensor,
    log_q=log_q_tensor,
    log_p=log_p_tensor,
    grad_log_q=grad_log_q_tensor,
    grad_log_p=grad_log_p_tensor
)

ARGS = {
    'x': point,
    'beta': 0.5,
    'alpha': 0.3,
    'p_target': False
}
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 (2,) — shape (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
grad_and_value Ran
ran on a synthesized input
lollcat/fab-torch/fab/sampling_methods/base.py
code served (permissive licence) · get_code("2107603dfc4feb0f")
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)

# Define a simple forward function that takes a tensor and returns a scalar or tensor
def simple_forward_fn(x):
    """A simple quadratic function: y = 2 * sum(x^2)"""
    return 2 * torch.sum(x ** 2)

# Create input tensor with requires_grad=False initially
# (the function will set it to True internally)
x_input = torch.randn(2, 4)

ARGS = {
    "x": x_input,
    "forward_fn": simple_forward_fn,
}
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
normal_logp Ran
ran; our contract draft was wrong, not the code
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("2ed606761595e6ff")
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 (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)

# Create a 2D tensor for x (batch_size=2, features=4)
x = torch.randn(2, 4)

# mean can be a float or tensor
mean = 0.0

# sigma can be a float or a 2D tensor
sigma = 1.0

ARGS = {
    "x": x,
    "mean": mean,
    "sigma": 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 1, dtype family float, shape (2,) — shape (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
num_to_groups Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from ykiiiiii/grade_if
pointer only · get_code("4f66ae7f14b3b240")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

sample_traj Ran
ran; our contract draft was wrong, not the code
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("47473fd7a828cef0")
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 torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Define a minimal config class with required attributes
class Config:
    def __init__(self):
        self.batch_size = 2
        self.t_end = 1.0
        self.dt = 0.1
        self.sigma = 0.5

# Define a minimal GFN model that satisfies the interface
class MinimalGFN(nn.Module):
    def __init__(self):
        super().__init__()
        self.device = 'cpu'
        self.linear = nn.Linear(4, 4)
    
    def zero(self, batch_size):
        """Return a zero tensor of shape (batch_size, 4)"""
        return torch.zeros(batch_size, 4)
    
    def step_forward(self, cur_t, x, dt, sigma=None):
        """
        Simulate one forward step.
        Returns: (x_new, uw_term, u2_term)
        """
        # Small perturbation to x
        x_new = x + 0.01 * torch.randn_like(x)
        # Return dummy loss terms
        uw_term = torch.zeros(x.shape[0])
        u2_term = torch.zeros(x.shape[0])
        return x_new, uw_term, u2_term
    
    def nll_prior(self, x):
        """Return negative log likelihood prior. Shape (batch_size,)"""
        return torch.sum(x ** 2, dim=1)

# Define a logreward function
def logreward_fn(x):
    """Return log reward. Shape (batch_size,)"""
    return torch.sum(x, dim=1)

# Construct arguments
config = Config()
gfn = MinimalGFN()

ARGS = {
    'gfn': gfn,
    'config': config,
    'logreward_fn': logreward_fn,
    'batch_size': 2,
    'sigma': None
}
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
DetailedBalance Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("7e440df137ddbc75")
How it ran

no invocation recorded.

GFlowNet Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("394421bec90315ef")
How it ran

no invocation recorded.

SubTrajectoryBalanceTrajectoryBased Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("1577628704e1417d")
How it ran

no invocation recorded.

rejection_sampling Not yet run
unverified (harvested, no recorded run)
lollcat/fab-torch/fab/sampling_methods/rejection_sampling.py
code served (permissive licence) · get_code("a78f6c4029a8dd93")
How it ran

no invocation recorded.

viz_contour_sample2d Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("bd6f8a0574e9cd96")
How it ran

no invocation recorded.

viz_coutour_with_ax Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("309401c5bfc7cbee")
How it ran

no invocation recorded.

viz_kde2d Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("63cdfff03811f45f")
How it ran

no invocation recorded.

viz_sample2d Not yet run
unverified (harvested, no recorded run)
zdhNarsil/Diffusion-Generative-Flow-Samplers/gflownet/gflownet.py
code served (permissive licence) · get_code("660957422c84b3e3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 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
num_to_groups
brick of this paper's assembly: helper
8 other papers
6 dated earlier, 2 later
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2105.06337 (2021-05)
Grad-TTS: A Diffusion Probabilistic Model for Text-to-Speech
2110.07579 (2021-10)
Diffusion Normalizing Flow
and 5 more not named here
cal_subtb_coef_matrix
brick of this paper's assembly: helper
1 other paper
1 later
2402.05098 (2024-02)
Improved off-policy training of diffusion samplers

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

We tackle the problem of sampling from intractable high-dimensional density functions, a fundamental task that often appears in machine learning and statistics. We extend recent sampling-based approaches that leverage controlled stochastic processes to model approximate samples from these target densities. The main drawback of these approaches is that the training objective requires full trajectories to compute, resulting in sluggish credit assignment issues due to use of entire trajectories and a learning signal present only at the terminal time. In this work, we present Diffusion Generative Flow Samplers (DGFS), a sampling-based framework where the learning process can be tractably broken down into short partial trajectory segments, via parameterizing an additional "flow function". Our method takes inspiration from the theory developed for generative flow networks (GFlowNets), allowing us to make use of intermediate learning signals. Through various challenging experiments, we demonstrate that DGFS achieves more accurate estimates of the normalization constant than closely-related prior methods.

For agents

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

get_harvested_code_for_paper("2310.02679")
get_code_for_paper("2310.02679")
have("2310.02679")

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

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

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

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

Connect an agent — have() is free.