SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.18929 · NeurIPS · 2025

Trajectory Balance with Asynchrony: Decoupling Exploration and Learning for Fast, Scalable LLM Post-Training

Yoshua Bengio, Moksh Jain, Bhavya Kailkhura, Johan Obando-Ceron, Seanie Lee, Minsu Kim, Brian Bartoldson, James Diffenderfer, Siddarth Venkatraman, Tal Ben-Nun

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 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 7 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2503.18929.json · badge: /api/ran/2503.18929.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
bbartoldson/TBA canonical (classifier label)
classifier basis not recorded on the link
7 ran · 3 no recorded run
FunctionStatusWhere it lives
build_example_dataloader Ran
ran on a synthesized input
bbartoldson/TBA/src/dist_data_utils.py
code served (permissive licence) · get_code("d0b3a48ae72ccfc4")
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 DataLoader. 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
from torch.utils.data import DataLoader, Dataset
from transformers import AutoTokenizer, DataCollatorWithPadding

torch.manual_seed(0)

class MinimalDataset(Dataset):
    def __init__(self, size=2):
        self.size = size
        self.texts = ["hello world", "foo bar"][:size]
    
    def __len__(self):
        return self.size
    
    def __getitem__(self, idx):
        return {"text": self.texts[idx], "label": idx}

class MinimalTokenizer:
    def __init__(self):
        self.pad_token_id = 0
        self.model_max_length = 512
    
    def __call__(self, text, padding=False, truncation=False, max_length=None, return_tensors=None):
        # Simulate tokenization: return dict with input_ids and attention_mask
        tokens = [1, 2, 3] + [0] * (4 - 3)  # Pad to length 4
        result = {
            "input_ids": torch.tensor([tokens], dtype=torch.long),
            "attention_mask": torch.tensor([[1, 1, 1, 0]], dtype=torch.long),
        }
        if return_tensors == "pt":
            return result
        return result

dataset = MinimalDataset(size=2)
tokenizer = MinimalTokenizer()
batch_size = 2

ARGS = {
    "dataset": dataset,
    "tokenizer": tokenizer,
    "batch_size": batch_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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
extract_prediction Ran
ran on a synthesized input
bbartoldson/TBA/src/gsm8k_utils.py
code served (permissive licence) · get_code("a26a4bc2f82b9ec2")
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 float, ndim 0, dtype family float, 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 re

FIND_NUMBERS_REGEX = re.compile('(?:[+-]?\\d+\\.\\d*|[+-]?\\.\\d+|[+-]?\\d+e[-+]?\\d+|[+-]?\\d+)')

NO_NUMBER_FOUND_NUMBER = -999999.222222

def parse_number(text):
    """Strip whitespace/commas and convert a string to float (or return None if it fails)."""
    try:
        return float(text.strip().replace(',', '').lower())
    except Exception:
        return NO_NUMBER_FOUND_NUMBER

def extract_prediction(text):
    numbers = FIND_NUMBERS_REGEX.findall(text.replace(',', ''))
    return parse_number(numbers[-1]) if numbers else NO_NUMBER_FOUND_NUMBER


# Setup code to construct valid arguments for extract_prediction
ARGS = {
    'text': 'The answer is 42.5 with some noise, 123, and finally 99.99'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, 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
format_and_tokenize Ran
ran on a synthesized input
bbartoldson/TBA/src/gsm8k_utils.py
code served (permissive licence) · get_code("150dea51d807fbaa")
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 dict. 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
from transformers import AutoTokenizer

# Define a minimal stand-in tokenizer class
class MinimalTokenizer:
    def __call__(self, text, padding=False, return_attention_mask=True):
        # Simulate tokenization by creating fake token IDs
        # Split text into words and create IDs for each
        words = text.split()
        input_ids = [i + 100 for i in range(len(words))]  # Fake token IDs
        attention_mask = [1] * len(input_ids)
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask
        }

# Create example data
example = {
    'question': 'What is 2 + 2?',
    'answer': 'The answer is 4.5'
}

# Create tokenizer
tokenizer = MinimalTokenizer()

# Construct ARGS dictionary
ARGS = {
    'example': example,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
ignore_prompt_labels Ran
ran on a synthesized input
bbartoldson/TBA/src/kl.py
code served (permissive licence) · get_code("d70961db4cf293ba")
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 dict. 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 warnings

torch.manual_seed(0)

# Create a batch dict with labels tensor
# Labels should contain the response_token_ids sequence somewhere in it
batch = {
    'labels': torch.tensor([
        [1, 2, 3, 5, 6, 7, 8, 9],
        [10, 11, 3, 5, 6, 12, 13, 14]
    ])
}

# Define response_token_ids that exist in the batch labels
response_token_ids = torch.tensor([3, 5, 6])

# Optional tokenizer (not used in function body, but parameter exists)
tokenizer = None

# ignore_index parameter
ignore_index = -100

ARGS = {
    'batch': batch,
    'response_token_ids': response_token_ids,
    'ignore_index': ignore_index,
    'tokenizer': tokenizer
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
next_free_port Ran
ran on a synthesized input
bbartoldson/TBA/src/dist_utils.py
code served (permissive licence) · get_code("5503c179cc4b29b0")
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 socket

# Analyze the function:
# next_free_port takes two optional parameters:
# - port: starting port number (default 1024)
# - max_port: maximum port to check (default 65535)
# The function doesn't use these in complex ways, just iterates through them.
# We can pass reasonable integer values.

ARGS = {
    'port': 1024,
    'max_port': 65535,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
parse_number Ran
ran on a synthesized input
bbartoldson/TBA/src/gsm8k_utils.py
code served (permissive licence) · get_code("cd83783cc6325cf1")
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 float, ndim 0, dtype family float, 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 numpy as np

# The function parse_number takes a single parameter: text
# It expects a string, strips whitespace/commas, converts to float
# If conversion fails, returns NO_NUMBER_FOUND_NUMBER

ARGS = {
    "text": "  1,234.56  "
}
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 float, ndim 0, dtype family float, 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
split_dataset_indices Ran
ran on a synthesized input
bbartoldson/TBA/src/dist_data_utils.py
code served (permissive licence) · get_code("9860770ecc9b4ebe")
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. 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

torch.manual_seed(0)

# The function split_dataset_indices takes:
# - total_size: an integer representing the total number of indices
# - K: an integer representing the number of processes

# Based on the function body, it:
# 1. Creates a list of indices from 0 to total_size-1
# 2. Distributes them round-robin among K processes
# 3. Returns a list of lists, one for each process

# Simple test values
total_size = 10
K = 3

ARGS = {
    "total_size": total_size,
    "K": K
}
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 — a list 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
example_prepare_dataset Not yet run
unverified (harvested, no recorded run)
bbartoldson/TBA/src/dist_data_utils.py
code served (permissive licence) · get_code("2ed37256b49d8561")
How it ran

no invocation recorded.

prepare_dataset Not yet run
unverified (harvested, no recorded run)
bbartoldson/TBA/tba_tldr.py
code served (permissive licence) · get_code("a2e246bb45f45630")
How it ran

no invocation recorded.

prepare_deepspeed Not yet run
unverified (harvested, no recorded run)
bbartoldson/TBA/src/utils.py
code served (permissive licence) · get_code("e0030346eb43e3a2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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
prepare_dataset 1 other paper
1 dated earlier
2410.18252 (2024-10)
Asynchronous RLHF: Faster and More Efficient Off-Policy RL for Language Models

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-24.

Repositories linked to this paper

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

Abstract

Reinforcement learning (RL) is a critical component of large language model (LLM) post-training. However, on-policy algorithms used for post-training are not naturally robust to a diversified content of experience replay buffers, which asynchronous off-policy actors can efficiently populate in parallel to training. We propose efficiently learning on such off-policy data via Trajectory Balance with Asynchrony (TBA), an approach to asynchronous RL for LLMs that leverages the principled off-policy TB objective. On math, preference-tuning, and automated red-teaming tasks, we post-train models ranging from Pythia 410M to Qwen 2.5 7B, finding TBA offers speed and performance boosts over strong baselines like Online DPO and Dr. GRPO. Beyond TBA's performance benefits (high accuracy even as asynchrony grows) and speedups (4× or more), we show its reward-and recency-prioritizing sampling enable further gains as data generation is scaled. Our code is available at https://github.com/bbartoldson/TBA.

For agents

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

get_harvested_code_for_paper("2503.18929")
get_code_for_paper("2503.18929")
have("2503.18929")

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

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

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

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

Connect an agent — have() is free.