SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2201.13259 · NeurIPS · 2022

Trajectory balance: Improved credit assignment in GFlowNets

Yoshua Bengio, Moksh Jain, Emmanuel Bengio, Chen Sun, Nikolay Malkin

arXiv · PDF · Open in the Atlas

Code that ran

3 of 6 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 1 has no contract verdict; 2 failures of our instrument; 3 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/2201.13259.json · badge: /api/ran/2201.13259.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
2 ran · 3 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
FlowNet_TBAgent Ran
ran on a synthesized input · constructed an object; no result was computed
gfnorg/gflownet/grid/cond_grid_dag.py
code served (permissive licence) · get_code("644b5f0c8372a611")
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, FlowNet_TBAgent: 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
import numpy as np

torch.manual_seed(0)

class StandInEnv:
    def __init__(self, num_obs_dim=4, num_cond_dim=3):
        self.num_obs_dim = num_obs_dim
        self.num_cond_dim = num_cond_dim
        self.cond_obs = np.random.randn(num_cond_dim).astype(np.float32)
        self.step_count = 0
    
    def reset(self):
        self.step_count = 0
        obs = np.random.randn(self.num_obs_dim).astype(np.float32)
        return (obs, {})
    
    def step(self, action):
        self.step_count += 1
        obs = np.random.randn(self.num_obs_dim).astype(np.float32)
        reward = float(np.random.randn())
        done = self.step_count >= 3
        info = {}
        return (obs, reward, done, info)
    
    def parent_transitions(self, state, is_terminal):
        num_parents = 2
        return ([np.random.randn(self.num_obs_dim).astype(np.float32) for _ in range(num_parents)], [])

class StandInArgs:
    def __init__(self):
        self.n_hid = 8
        self.n_layers = 2
        self.ndim = 5
        self.dev = torch.device('cpu')

ARGS = {
    'args': StandInArgs(),
    'envs': [StandInEnv(num_obs_dim=4, num_cond_dim=3), StandInEnv(num_obs_dim=4, num_cond_dim=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 FlowNet_TBAgent — 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 FlowNet_TBAgent 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
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("c59313aa188e63c6")
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)

# Analyze the function signature and body:
# def make_mlp(l, act=nn.LeakyReLU, tail=[]):
# - l: a list of integers representing layer dimensions
# - act: an activation function class (default nn.LeakyReLU)
# - tail: a list of modules to append at the end (default [])

# The function creates an MLP by:
# 1. Zipping consecutive pairs from l to get (input_dim, output_dim)
# 2. Creating Linear layers for each pair
# 3. Adding activation functions between layers (but not after the last layer)
# 4. Appending tail modules at the end

# Minimal valid arguments:
ARGS = {
    "l": [4, 8, 3],  # Simple 3-layer network: 4 -> 8 -> 3
    "act": nn.LeakyReLU,  # Activation function class
    "tail": []  # Empty tail (no additional modules)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy, torch, tqdm — 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
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("2b63a9198ca42b4e")
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.

branin Not yet run
unverified (harvested, no recorded run)
gfnorg/gflownet/grid/cond_grid_dag.py
code served (permissive licence) · get_code("e81128bd6b1cab12")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

currin Not yet run
unverified (harvested, no recorded run)
gfnorg/gflownet/grid/cond_grid_dag.py
code served (permissive licence) · get_code("9c972ac9b931bb9e")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

train_model_with_proxy Not yet run
unverified (harvested, no recorded run)
gfnorg/gflownet/mols/gflownet.py
code served (permissive licence) · get_code("df792b9c5dae7a48")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 5 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, 4 later) and 1 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
1 dated earlier, 2 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2302.01687 (2023-02)
Better Training of GFlowNets with Local Credit and Incomplete Trajectories
2310.00386 (2023-10)
Order-Preserving GFlowNets
currin 3 other papers
1 dated earlier, 2 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2302.01687 (2023-02)
Better Training of GFlowNets with Local Credit and Incomplete Trajectories
2310.00386 (2023-10)
Order-Preserving GFlowNets
make_mlp
brick of this paper's assembly: model
2 other papers
1 dated earlier, 1 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2302.01687 (2023-02)
Better Training of GFlowNets with Local Credit and Incomplete Trajectories
train_model_with_proxy 2 other papers
1 dated earlier, 1 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2302.01687 (2023-02)
Better Training of GFlowNets with Local Credit and Incomplete Trajectories

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 (GFlowNets) are a method for learning a stochastic policy for generating compositional objects, such as graphs or strings, from a given unnormalized density by sequences of actions, where many possible action sequences may lead to the same object. We find previously proposed learning objectives for GFlowNets, flow matching and detailed balance, which are analogous to temporal difference learning, to be prone to inefficient credit propagation across long action sequences. We thus propose a new learning objective for GFlowNets, trajectory balance, as a more efficient alternative to previously used objectives. We prove that any global minimizer of the trajectory balance objective can define a policy that samples exactly from the target distribution. In experiments on four distinct domains, we empirically demonstrate the benefits of the trajectory balance objective for GFlowNet convergence, diversity of generated samples, and robustness to long action sequences and large action spaces.

For agents

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

get_harvested_code_for_paper("2201.13259")
get_code_for_paper("2201.13259")
have("2201.13259")

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

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

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

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

Connect an agent — have() is free.