SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.01687 · ICML · 2023

Better Training of GFlowNets with Local Credit and Incomplete Trajectories

Yoshua Bengio, Dinghuai Zhang, Ling Pan, Nikolay Malkin

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 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; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 4 failures of our instrument; 4 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.01687.json · badge: /api/ran/2302.01687.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
gfnorg/gflownet canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
ling-pan/fl-gfn canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 3 no recorded run
tristandeleu/gfn-maxent-rl community
Papers with Code archive
1 ran · 1 no recorded run
FunctionStatusWhere it lives
ForwardLookingDetailedBalance Ran
ran on a synthesized input · constructed an object; no result was computed
tristandeleu/gfn-maxent-rl/gfn_maxent_rl/algos/forward_looking_detailed_balance.py
code served (permissive licence) · get_code("7e0e4a02a27a4cc2")
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, ForwardLookingDetailedBalance: 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 jax
import jax.numpy as jnp
import haiku as hk
import optax
import numpy as np
from collections import namedtuple

# Create a minimal environment mock
class MockEnv:
    def __init__(self):
        self.observation_dtype = np.float32
        self.num_actions = 4
        self.num_parents_val = 2
    
    def decode(self, observation):
        return observation
    
    def uniform_log_policy(self, observations):
        batch_size = observations.shape[0]
        return jnp.ones((batch_size, self.num_actions)) / self.num_actions
    
    def num_parents(self, observation):
        return self.num_parents_val

# Create minimal network functions
def policy_network(observations):
    batch_size = observations.shape[0]
    logits = hk.Linear(4)(observations)
    log_probs = jax.nn.log_softmax(logits)
    return log_probs, {}

def flow_network(observations):
    batch_size = observations.shape[0]
    flow_values = hk.Linear(1)(observations)
    log_flow = jnp.squeeze(flow_values, axis=-1)
    return log_flow, {}

# Create sample batch
def create_sample_batch():
    batch_size = 2
    obs_dim = 4
    
    samples = {
        'observation': jnp.ones((batch_size, obs_dim), dtype=jnp.float32),
        'next_observation': jnp.ones((batch_size, obs_dim), dtype=jnp.float32),
        'action': jnp.array([[0], [2]], dtype=jnp.int32),
        'reward': jnp.array([[1.0], [0.5]], dtype=jnp.float32),
    }
    return samples

# Build the ARGS dict
env = MockEnv()
policy_network_fn = policy_network
flow_network_fn = flow_network

ARGS = {
    'env': env,
    'policy_network': policy_network_fn,
    'flow_network': flow_network_fn,
    'target': None,
    'target_kwargs': {}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
haiku, jax, numpy, optax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ForwardLookingDetailedBalance — 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 ForwardLookingDetailedBalance 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
branin Ran
ran, honoured the contract we drafted
gfnorg/gflownet/grid/cond_grid_dag.py
code served (permissive licence) · get_code("b8e02a8995424b4e")
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) and returned ndarray, 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)

# The function takes x as input
# x is indexed with [..., 0] and [..., 1], so it needs at least 2 dimensions on the last axis
# x should be a numpy array or similar that supports advanced indexing

# Create a small batch of 2D points in the normalized space [-1, 1] x [-1, 1]
x = np.array([
    [0.3, -0.2],
    [-0.5, 0.7]
], dtype=np.float32)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (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
currin Ran
ran, honoured the contract we drafted
gfnorg/gflownet/grid/cond_grid_dag.py
code served (permissive licence) · get_code("54dafc6a55c42deb")
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) and returned ndarray, 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 numpy as np

# The function takes a single parameter 'x' which should be a numpy array
# with shape (..., 2) since it indexes x[..., 0] and x[..., 1]
# Let's create a small batch of 2D input points

x = np.array([
    [-0.5, 0.3],
    [0.2, -0.1],
    [0.8, 0.9],
    [-0.3, 0.5]
], dtype=np.float32)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (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
detailed_balance_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ling-pan/fl-gfn/mols/gflownet.py
pointer only (licence: NONE) · get_code("6a66411ce92ce864")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ling-pan/fl-gfn when it was checked. 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.

forward_looking_detailed_balance_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ling-pan/fl-gfn/mols/gflownet.py
pointer only (licence: NONE) · get_code("5e61f433ec6df3d4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ling-pan/fl-gfn when it was checked. 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.

make_mlp Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from gfnorg/gflownet
pointer only · get_code("c59313aa188e63c6")
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.

make_mlp Ran
ran; our contract draft was wrong, not the code
gfnorg/gflownet/grid/cond_grid_dag.py
code served (permissive licence) · get_code("2b63a9198ca42b4e")
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) and returned Sequential. 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

torch.manual_seed(0)

# The function make_mlp takes:
# - l: a list of layer dimensions (integers)
# - act: an activation function class (default nn.LeakyReLU)
# - tail: a list of additional modules to append (default [])

# Construct valid arguments
ARGS = {
    "l": [4, 8, 6, 3],  # Input dim 4, hidden dims 8 and 6, output dim 3
    "act": nn.LeakyReLU,  # Activation function class
    "tail": []  # Empty tail, or could add modules like [nn.Dropout(0.5)]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
BaseAlgorithm Not yet run
unverified (harvested, no recorded run)
tristandeleu/gfn-maxent-rl/gfn_maxent_rl/algos/forward_looking_detailed_balance.py
code served (permissive licence) · get_code("1ce4fa344cce64f0")
How it ran

no invocation recorded.

branin Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from gfnorg/gflownet
pointer only · get_code("e81128bd6b1cab12")
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. No invocation recorded.

currin Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from gfnorg/gflownet
pointer only · get_code("9c972ac9b931bb9e")
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. No invocation recorded.

train_model_with_proxy Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from gfnorg/gflownet
pointer only · get_code("df792b9c5dae7a48")
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. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 2 later) and 4 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
branin 3 other papers
2 dated earlier, 1 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2201.13259 (2022-01)
Trajectory balance: Improved credit assignment in GFlowNets
2310.00386 (2023-10)
Order-Preserving GFlowNets
currin 3 other papers
2 dated earlier, 1 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2201.13259 (2022-01)
Trajectory balance: Improved credit assignment in GFlowNets
2310.00386 (2023-10)
Order-Preserving GFlowNets
make_mlp 2 other papers
2 dated earlier
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2201.13259 (2022-01)
Trajectory balance: Improved credit assignment in GFlowNets
train_model_with_proxy 2 other papers
2 dated earlier
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2201.13259 (2022-01)
Trajectory balance: Improved credit assignment in GFlowNets

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

Generative Flow Networks or GFlowNets are related to Monte-Carlo Markov chain methods (as they sample from a distribution specified by an energy function), reinforcement learning (as they learn a policy to sample composed objects through a sequence of steps), generative models (as they learn to represent and sample from a distribution) and amortized variational methods (as they can be used to learn to approximate and sample from an otherwise intractable posterior, given a prior and a likelihood). They are trained to generate an object x through a sequence of steps with probability proportional to some reward function R(x) (or exp(-E(x)) with E(x) denoting the energy function), given at the end of the generative trajectory. Like for other RL settings where the reward is only given at the end, the efficiency of training and credit assignment may suffer when those trajectories are longer. With previous GFlowNet work, no learning was possible from incomplete trajectories (lacking a terminal state and the computation of the associated reward). In this paper, we consider the case where the energy function can be applied not just to terminal states but also to intermediate states. This is for example achieved when the energy function is additive, with terms available along the trajectory. We show how to reparameterize the GFlowNet state flow function to take advantage of the partial reward already accrued at each state. This enables a training objective that can be applied to update parameters even with incomplete trajectories. Even when complete trajectories are available, being able to obtain more localized credit and gradients is found to speed up training convergence, as demonstrated across many simulations.

For agents

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

get_harvested_code_for_paper("2302.01687")
get_code_for_paper("2302.01687")
have("2302.01687")

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

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

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

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

Connect an agent — have() is free.