SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.12782 · ICML · 2023

Learning GFlowNets From Partial Episodes For Improved Convergence And Stability

Yoshua Bengio, Moksh Jain, Emmanuel Bengio, Maksym Korablyov, Kanika Madan, Nikolay Malkin, Jarrid Rector-Brooks, Andrei Nica, Tom Bosc

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2209.12782.json · badge: /api/ran/2209.12782.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 marked official in Papers with Code
Papers with Code archive
3 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
recursionpharma/gflownet community
Papers with Code archive
1 ran · 0 no recorded run
lazaratan/gflownet-generalization community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
FlowNetAgent Ran
ran on a synthesized input · constructed an object; no result was computed
gfnorg/gflownet/grid/toy_grid_dag.py
code served (permissive licence) · get_code("6ad5334657db8063")
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, FlowNetAgent: 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
from itertools import count

torch.manual_seed(0)

class MockEnv:
    def __init__(self, ndim=4, horizon=5):
        self.ndim = ndim
        self.horizon = horizon
        self.state = np.zeros(ndim, dtype=np.int8)
    
    def reset(self):
        self.state = np.zeros(self.ndim, dtype=np.int8)
        return (self.state, 0, False, self.state)
    
    def step(self, action):
        new_state = self.state.copy()
        if action < self.ndim:
            new_state[action] += 1
        new_state = np.clip(new_state, 0, self.horizon - 1)
        reward = float(new_state.sum())
        done = bool((new_state >= self.horizon - 1).any())
        self.state = new_state
        return (new_state, reward, done, new_state)
    
    def obs(self, s):
        return s.astype(np.float32)
    
    def parent_transitions(self, s, used_stop_action):
        parents = []
        actions = []
        for i in range(self.ndim):
            if s[i] > 0:
                parent = s.copy()
                parent[i] -= 1
                parents.append(self.obs(parent))
                actions.append(i)
        if not used_stop_action:
            parents.append(self.obs(s))
            actions.append(self.ndim)
        return (np.array(parents, dtype=np.float32), np.array(actions, dtype=np.int64))

class Args:
    def __init__(self):
        self.horizon = 5
        self.ndim = 4
        self.n_hid = 8
        self.n_layers = 2
        self.dev = torch.device('cpu')
        self.bootstrap_tau = 0.01
        self.replay_strategy = 'top_k'
        self.replay_sample_size = 2
        self.replay_buf_size = 10

args = Args()
envs = [MockEnv(ndim=args.ndim, horizon=args.horizon) for _ in range(2)]

ARGS = {
    'args': args,
    'envs': envs
}
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 FlowNetAgent — 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 FlowNetAgent 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
ReplayBuffer Ran
ran on a synthesized input · constructed an object; no result was computed
gfnorg/gflownet/grid/toy_grid_dag.py
code served (permissive licence) · get_code("d00f3663f26789a6")
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, ReplayBuffer: 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

torch.manual_seed(0)

class MockEnv:
    def __init__(self):
        self.horizon = 5
    
    def obs(self, s):
        """Return observation from state s"""
        return np.array([s.sum(), s.max()], dtype=np.float32)
    
    def parent_transitions(self, s, used_stop_action):
        """Return parent states and actions for backtracking"""
        # Find positions where s > 0
        positions = np.where(s > 0)[0]
        if len(positions) == 0:
            return [np.zeros_like(s)], [np.array([], dtype=np.int32)]
        
        parents = []
        actions = []
        for pos in positions:
            parent = s.copy()
            parent[pos] -= 1
            parents.append(parent)
            actions.append(np.array([pos], dtype=np.int32))
        
        return parents, actions


class MockArgs:
    def __init__(self):
        self.replay_strategy = 'top_k'
        self.replay_sample_size = 2
        self.replay_buf_size = 3


env = MockEnv()
args = MockArgs()

ARGS = {
    'args': args,
    'env': env
}
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 ReplayBuffer — 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 ReplayBuffer 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
cross Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
this paper's copy was not recorded; identical code first harvested from recursionpharma/gflownet
pointer only · get_code("2a8ed5bf472b7004")
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/toy_grid_dag.py
code served (permissive licence) · get_code("844623be88f76533")
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 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 (nn.Module), default is nn.LeakyReLU()
# - tail: a list of additional modules to append, default is []

# Construct valid arguments:
# l should be a list of integers representing layer dimensions for an MLP
# For example, [4, 8, 3] would create: Linear(4,8) -> LeakyReLU -> Linear(8,3)
l = [4, 8, 6, 3]

# act is an activation function - LeakyReLU is already the default, but we can specify it
act = nn.LeakyReLU()

# tail is a list of additional modules to append at the end
# For example, we could add a sigmoid or another layer
tail = [nn.Sigmoid()]

ARGS = {
    "l": l,
    "act": act,
    "tail": tail
}
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 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
shift_right Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from recursionpharma/gflownet
pointer only · get_code("a508d01ed77ced0b")
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.

subTB Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
recursionpharma/gflownet/src/gflownet/algo/trajectory_balance.py
code served (permissive licence) · get_code("6d473d96a0e204c8")
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 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

torch.manual_seed(0)

# Create small 1D tensors for the function
# v should be 1D tensor with shape (n,)
# x should be 1D tensor with shape (n-1,) based on how it's used in subTB
# The function computes v[:-1, None] - v[None, 1:] which creates a matrix
# and then adds cross(x) which expects x to have compatible dimensions

v = torch.randn(5)  # 1D tensor of size 5
x = torch.randn(4)  # 1D tensor of size 4 (one less than v)

ARGS = {
    "v": v,
    "x": x,
}
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 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
subTB Not yet run
unverified (harvested, no recorded run)
lazaratan/gflownet-generalization/src/gflownet/algo/trajectory_balance.py
code served (permissive licence) · get_code("82b482612fc30e1f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 4 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 4 later) and 3 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
cross
brick of this paper's assembly: helper
4 other papers
1 dated earlier, 3 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2310.03223 (2023-10)
TacoGFN: Target-conditioned GFlowNet for Structure-based Drug Design
2405.01155 (2024-05)
SynFlowNet: Design of Diverse and Novel Molecules with Synthesis Constraints
and 1 more not named here
shift_right
brick of this paper's assembly: helper
4 other papers
1 dated earlier, 3 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2310.03223 (2023-10)
TacoGFN: Target-conditioned GFlowNet for Structure-based Drug Design
2405.01155 (2024-05)
SynFlowNet: Design of Diverse and Novel Molecules with Synthesis Constraints
and 1 more not named here
subTB
brick of this paper's assembly: entry
2 other papers
1 dated earlier, 1 later
2106.04399 (2021-06)
Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2405.01155 (2024-05)
SynFlowNet: Design of Diverse and Novel Molecules with Synthesis Constraints
subTB
brick of this paper's assembly: entry
2 other papers
2 later
2310.03223 (2023-10)
TacoGFN: Target-conditioned GFlowNet for Structure-based Drug Design
2405.16012 (2024-05)
Pessimistic Backward Policy for 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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Generative flow networks (GFlowNets) are a family of algorithms for training a sequential sampler of discrete objects under an unnormalized target density and have been successfully used for various probabilistic modeling tasks. Existing training objectives for GFlowNets are either local to states or transitions, or propagate a reward signal over an entire sampling trajectory. We argue that these alternatives represent opposite ends of a gradient bias-variance tradeoff and propose a way to exploit this tradeoff to mitigate its harmful effects. Inspired by the TD(𝜆) algorithm in reinforcement learning, we introduce subtrajectory balance or SubTB(𝜆), a GFlowNet training objective that can learn from partial action subsequences of varying lengths. We show that SubTB(𝜆) accelerates sampler convergence in previously studied and new environments and enables training GFlowNets in environments with longer action sequences and sparser reward landscapes than what was possible before. We also perform a comparative analysis of stochastic gradient dynamics, shedding light on the bias-variance tradeoff in GFlowNet training and the advantages of subtrajectory balance.

For agents

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

get_harvested_code_for_paper("2209.12782")
get_code_for_paper("2209.12782")
have("2209.12782")

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

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

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

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

Connect an agent — have() is free.