SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.15058 · ICML · 2023

BatchGFN: Generative Flow Networks for Batch Active Learning

Yoshua Bengio, Moksh Jain, Yarin Gal, Andrew Jesson, Nikolay Malkin, Salem Lahlou, Tristan Deleu, Shreshth Malik

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 0 failures of our instrument; 2 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/2306.15058.json · badge: /api/ran/2306.15058.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
s-a-malik/batchgfn canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
bald_gp Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/acquisitions/topk.py
code served (permissive licence) · get_code("63867a6cb73957ca")
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 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 torch import nn

torch.manual_seed(0)

class MockGPModel(nn.Module):
    """Mock GP model that returns predictions with variance attribute."""
    def __init__(self, output_dim=1):
        super().__init__()
        self.output_dim = output_dim
    
    def predict(self, x):
        """Return mock predictions with variance for regression or classification."""
        batch_size = x.shape[0]
        if self.output_dim == 1:
            # Regression case: variance shape (batch_size,)
            variance = torch.randn(batch_size).abs()
        else:
            # Classification case: variance shape (batch_size, num_classes)
            variance = torch.randn(batch_size, self.output_dim).abs()
        
        class PredictionOutput:
            pass
        
        output = PredictionOutput()
        output.variance = variance
        return output

# Create test data
x_pool = torch.randn(10, 4)  # 10 samples, 4 features
batch_size = 3

# Test for regression task
model_reg = MockGPModel(output_dim=1)

ARGS = {
    'x_pool': x_pool,
    'batch_size': batch_size,
    'model': model_reg,
    'task': 'reg'
}
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 list, ndim 1, dtype family int — 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
batch_bald_cov_gp Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/acquisitions/batch.py
code served (permissive licence) · get_code("1875bd5b1d33cc98")
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 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 torch import nn

torch.manual_seed(0)

class SimpleGPModel(nn.Module):
    def __init__(self, n_pool, n_features):
        super().__init__()
        self.n_pool = n_pool
        self.n_features = n_features
        self.likelihood = nn.Module()
        self.likelihood.noise = torch.tensor(0.1)
        self.model = self
    
    def predict(self, x_pool):
        n = x_pool.shape[0]
        # Create a covariance matrix that is positive definite
        cov_matrix = torch.eye(n) + 0.5 * torch.ones(n, n)
        # Make symmetric positive definite
        cov_matrix = (cov_matrix + cov_matrix.T) / 2
        cov_matrix = cov_matrix + torch.eye(n) * 0.1
        
        prediction = type('Prediction', (), {})()
        prediction.covariance_matrix = cov_matrix
        return prediction

n_pool = 5
batch_size = 2
n_features = 4

x_pool = torch.randn(n_pool, n_features)
model = SimpleGPModel(n_pool, n_features)
task = 'reg'

ARGS = {
    'x_pool': x_pool,
    'batch_size': batch_size,
    'model': model,
    'task': task
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, 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 int — 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
compute_conv_output_size Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/models/cnn.py
code served (permissive licence) · get_code("fe0600be139265b3")
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 int, ndim 0, dtype family int, shape () 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 math
from typing import Sequence

torch.manual_seed(0)

# Setup for compute_conv_output_size function
# Parameters:
# - input_width: int
# - kernel_sizes: Sequence[int]
# - strides: Sequence[int]
# - n_output_channels: int
# - padding: int (default=0)
# - dilation: int (default=1)

ARGS = {
    "input_width": 32,
    "kernel_sizes": [3, 3],
    "strides": [1, 1],
    "n_output_channels": 64,
    "padding": 0,
    "dilation": 1,
}
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 int, ndim 0, dtype family int, shape () — shape () 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
compute_conv_output_width Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/models/cnn.py
code served (permissive licence) · get_code("1d5704b89450d8d8")
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 int, ndim 0, dtype family int, shape () 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 math
from typing import Sequence

torch.manual_seed(0)

# Simple valid arguments for compute_conv_output_width
ARGS = {
    "input_width": 32,
    "kernel_sizes": [3, 3],
    "strides": [1, 1],
    "padding": 0,
    "dilation": 1
}
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 int, ndim 0, dtype family int, shape () — shape () 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
f Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/datasets/simulated_reg.py
code served (permissive licence) · get_code("3092e8e91236224b")
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)

# Analyze the function signature and body
# Parameters: x, w, a, b, c, d, sigma
# The function expects:
# - x: something that can be used in arithmetic operations, indexed with len(x), and supports ** operator
# - w: default is a list of floats
# - a, b, c, d, sigma: numeric values (defaults provided)

# x is used as:
# - x ** i (powers)
# - len(x) is called on the output of randn
# - x - b, x - d (arithmetic)
# So x should be a tensor that supports these operations

# Create a small tensor for x
x = torch.randn(2)

# w is already provided as default, but we can pass it explicitly
w = [-0.6667, -0.6012, -1.0172, -0.7687, 1.468, -0.1678]

# Other parameters with their defaults
a = np.pi
b = 0
c = 0.5
d = 0
sigma = 0.1

ARGS = {
    "x": x,
    "w": w,
    "a": a,
    "b": b,
    "c": c,
    "d": d,
    "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_data Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/datasets/mnist.py
code served (permissive licence) · get_code("ec55ece28b1426d0")
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
from torch.utils.data import Dataset

torch.manual_seed(0)

class SimpleDataset(Dataset):
    def __init__(self, num_samples=2, input_dim=4, output_dim=3):
        self.num_samples = num_samples
        self.input_dim = input_dim
        self.output_dim = output_dim
        self.data = torch.randn(num_samples, input_dim)
        self.targets = torch.randint(0, output_dim, (num_samples,))
    
    def __len__(self):
        return self.num_samples
    
    def __getitem__(self, idx):
        return (self.data[idx], self.targets[idx])

dataset = SimpleDataset(num_samples=2, input_dim=4, output_dim=3)

ARGS = {
    "dataset": dataset
}
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
plot_acquisition Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/evaluation/plotting.py
code served (permissive licence) · get_code("3c67c417b22467c5")
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 Figure. 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
import matplotlib.pyplot as plt

torch.manual_seed(0)

# Create small tensors for x values
x = torch.linspace(0, 1, 20)

# Create sample function samples (3 samples)
f_samples = [
    torch.sin(x * np.pi) + torch.randn(20) * 0.1,
    torch.cos(x * np.pi) + torch.randn(20) * 0.1,
    torch.sin(x * np.pi * 2) + torch.randn(20) * 0.1,
]

# Create lower and upper bounds
lower = torch.sin(x * np.pi) - 0.3
upper = torch.sin(x * np.pi) + 0.3

# Training data
x_train = torch.tensor([0.2, 0.5, 0.8])
y_train = torch.tensor([0.5, 0.1, -0.3])

# Acquired data
x_acquired = torch.tensor([0.35, 0.75])
y_acquired = torch.tensor([0.3, -0.1])

# Metrics
loss = 0.042
mi = 0.156
step = 5
title = "Acquisition Function"

ARGS = {
    "x": x,
    "f_samples": f_samples,
    "lower": lower,
    "upper": upper,
    "x_train": x_train,
    "y_train": y_train,
    "x_acquired": x_acquired,
    "y_acquired": y_acquired,
    "loss": loss,
    "mi": mi,
    "step": step,
    "title": title,
    "output_file": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, seaborn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
plot_acquisition_2d_cls Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/evaluation/plotting.py
code served (permissive licence) · get_code("75033c8b7ef1f00c")
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 Figure. 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 MockModel(nn.Module):
    """Minimal model that implements predict() method returning a distribution with mean attribute."""
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(2, 3)
    
    def predict(self, x):
        """Return a mock distribution object with mean attribute."""
        # x shape: (N, 2)
        logits = self.linear(x)  # (N, 3)
        # Create a mock distribution with mean attribute
        class MockDistribution:
            def __init__(self, logits):
                self.mean = logits
        return MockDistribution(logits)

model = MockModel()

# 2D feature data for training
x_train = torch.tensor([[-5.0, -5.0], [5.0, 5.0]], dtype=torch.float32)
y_train = torch.tensor([0, 1], dtype=torch.long)

# 2D feature data for pool
x_pool = torch.tensor([[-3.0, 2.0], [1.0, -4.0]], dtype=torch.float32)

# Recently acquired points
x_acquired = torch.tensor([[0.0, 0.0]], dtype=torch.float32)
y_acquired = torch.tensor([1], dtype=torch.long)

# Metrics
loss = 0.234
acc = 0.876
mi = 0.456
step = 42
title = "Active Learning"

ARGS = {
    'model': model,
    'x_pool': x_pool,
    'x_train': x_train,
    'y_train': y_train,
    'x_acquired': x_acquired,
    'y_acquired': y_acquired,
    'loss': loss,
    'acc': acc,
    'mi': mi,
    'step': step,
    'title': title,
    'output_file': None,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Figure — a Figure output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Figure 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
random Ran
ran on a synthesized input
s-a-malik/batchgfn/batchgfn/acquisitions/topk.py
code served (permissive licence) · get_code("a4f7d78be6c6ca4f")
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 ndarray, ndim 1, dtype family int, shape (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 numpy as np

# The function uses F with len(F), so F must be a sequence-like object
# batch_size is an integer for the number of samples to draw
# task is a string parameter (default 'reg'), not used in the function body

F = list(range(10))  # A list of 10 elements, len(F) = 10
batch_size = 3
task = 'reg'

ARGS = {
    'F': F,
    'batch_size': batch_size,
    'task': task
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 int, shape (3,) — shape (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
get_targets Not yet run
unverified (harvested, no recorded run)
s-a-malik/batchgfn/batchgfn/datasets/mnist.py
code served (permissive licence) · get_code("f2e9f3a12311134e")
How it ran

no invocation recorded.

stochastic_batch_bald_gp Not yet run
unverified (harvested, no recorded run)
s-a-malik/batchgfn/batchgfn/acquisitions/stochastic.py
code served (permissive licence) · get_code("2b3c3e9f45c4af4f")
How it ran

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 11 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 11 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-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

We introduce BatchGFN-a novel approach for pool-based active learning that uses generative flow networks to sample sets of data points proportional to a batch reward. With an appropriate reward function to quantify the utility of acquiring a batch, such as the joint mutual information between the batch and the model parameters, BatchGFN is able to construct highly informative batches for active learning in a principled way. We show our approach enables sampling nearoptimal utility batches at inference time with a single forward pass per point in the batch in toy regression problems. This alleviates the computational complexity of batch-aware algorithms and removes the need for greedy approximations to find maximizers for the batch reward. We also present early results for amortizing training across acquisition steps, which will enable scaling to real-world tasks.

For agents

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

get_harvested_code_for_paper("2306.15058")
get_code_for_paper("2306.15058")
have("2306.15058")

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

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

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

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

Connect an agent — have() is free.