SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.00771 · ICLR · 2024

Pre-training with Synthetic Data Helps Offline Reinforcement Learning

Che Wang, Keith Ross, Zecheng Wang, Zixuan Dong

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 5 failures of our instrument; 0 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/2310.00771.json · badge: /api/ran/2310.00771.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
victor-wang-902/synthetic-pretrain-rl canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
eval Ran
ran, honoured the contract we drafted
victor-wang-902/synthetic-pretrain-rl/syn_pretraining/pretrain/pretrain_dist.py
code served (permissive licence) · get_code("7a02080f88f555ba")
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 torch.nn as nn
from unittest.mock import Mock

torch.manual_seed(0)

# Minimal model that implements the interface used in eval()
class MinimalLanguageModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, input_ids, attention_mask=None, labels=None):
        # Return a mock output with a loss attribute
        loss = torch.tensor(0.5)
        output = Mock()
        output.loss = loss
        return output
    
    def eval(self):
        super().eval()

# Create a minimal dataloader (list of batches with required keys)
dataloader = [
    {
        'input_ids': torch.randint(0, 100, (2, 4)),
        'attention_mask': torch.ones(2, 4)
    },
    {
        'input_ids': torch.randint(0, 100, (2, 4)),
        'attention_mask': torch.ones(2, 4)
    }
]

# Create a minimal accelerator that implements gather and wait_for_everyone
class MinimalAccelerator:
    def wait_for_everyone(self):
        pass
    
    def gather(self, tensor):
        return tensor.unsqueeze(0) if tensor.dim() == 0 else tensor

# Create args dict with minimal config
args = {}

ARGS = {
    'args': args,
    'dataloader': dataloader,
    'model': MinimalLanguageModel(),
    'device': 'cpu',
    'accelerator': MinimalAccelerator()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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
generate_mdp_data Ran
ran; our contract draft was wrong, not the code
victor-wang-902/synthetic-pretrain-rl/syn_pretraining_cql/pretrain_cql.py
code served (permissive licence) · get_code("75c95430710dc5f3")
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 os
import joblib
import numpy as np
import torch
import tempfile
from torch import Tensor
import torch.nn.functional as F

torch.manual_seed(0)
np.random.seed(0)

# Create a temporary directory for saving data
temp_dir = tempfile.mkdtemp()

ARGS = {
    'n_traj': 2,
    'max_length': 3,
    'n_state': 5,
    'n_action': 4,
    'policy_temperature': 1.0,
    'transition_temperature': 2.0,
    'random_start': False,
    'save_dir': temp_dir,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
joblib, numpy, torch, tqdm — 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
get_dataloader Ran
ran; our contract draft was wrong, not the code
victor-wang-902/synthetic-pretrain-rl/syn_pretraining/pretrain/data.py
code served (permissive licence) · get_code("82ccd092debb951c")
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 math
from torch.utils.data import IterableDataset, DataLoader, get_worker_info

torch.manual_seed(0)

# Define a minimal IterableDataset
class MinimalIterableDataset(IterableDataset):
    def __init__(self, size=10):
        self.size = size
        self.start = 0
        self.end = size
    
    def __iter__(self):
        for i in range(self.start, self.end):
            yield (torch.randn(4), torch.tensor(i % 2))

# Define a minimal collator function
def minimal_collator(batch):
    xs = torch.stack([item[0] for item in batch])
    ys = torch.stack([item[1] for item in batch])
    return (xs, ys)

# Define the worker_init_fn as specified
def worker_init_fn(worker_id):
    worker_info = get_worker_info()
    dataset = worker_info.dataset
    overall_start = dataset.start
    overall_end = dataset.end
    per_worker = int(math.ceil((overall_end - overall_start) / float(worker_info.num_workers)))
    worker_id = worker_info.id
    dataset.start = overall_start + worker_id * per_worker
    dataset.end = min(dataset.start + per_worker, overall_end)

# Create instances
dataset = MinimalIterableDataset(size=10)
collator = minimal_collator
batch_size = 2

# Define ARGS dict with all parameters
ARGS = {
    "dataset": dataset,
    "collator": collator,
    "batch_size": batch_size,
    "worker_init_fn": worker_init_fn,
    "num_workers": 0,
    "drop_last": True
}
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 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
load_synthetic_dataset Ran
ran; our contract draft was wrong, not the code
victor-wang-902/synthetic-pretrain-rl/syn_pretraining/pretrain/data.py
code served (permissive licence) · get_code("c75faf5e36f4ca99")
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 csv
import tempfile
import os

# Create a temporary CSV file with synthetic data
temp_dir = tempfile.mkdtemp()
csv_file = os.path.join(temp_dir, "synthetic_data.csv")

# Write synthetic integer data to CSV
with open(csv_file, 'w', newline='') as f:
    writer = csv.writer(f)
    # Create 10000 rows of synthetic data (4000 valid + 4000 test + 2000 train)
    for i in range(10000):
        writer.writerow([i, i*2, i*3, i*4])

ARGS = {
    'data': csv_file,
    'valid': 4000,
    'test': 4000,
}
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 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
set_dt_args Ran
ran; our contract draft was wrong, not the code
victor-wang-902/synthetic-pretrain-rl/syn_pretraining/pretrain/pretrain_dist.py
code served (permissive licence) · get_code("b1521ca072cfd797")
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 Namespace. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 argparse

ARGS = {
    'args_to_parse': [
        '--dataset', 'dummy_dataset',
        '--batch_size', '1024',
        '--model_type', 'dt',
        '--embed_dim', '128',
        '--n_layer', '3',
        '--n_head', '8',
        '--activation_function', 'relu',
        '--dropout', '0.1',
        '--load_checkpoint', None,
        '--learning_rate', '0.0003',
        '--weight_decay', '0.01',
        '--warmup_steps', '10000',
        '--num_steps', '80000',
        '--num_steps_per_save', '10000',
        '--device', 'cpu',
        '--num_workers', '4',
        '--seed', '666',
        '--outdir', '/tmp',
        '--output_fname', 'progress.csv',
        '--data_size', '1.0',
    ]
}
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 Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
softmax_with_torch Ran
ran, violated the contract we drafted
victor-wang-902/synthetic-pretrain-rl/syn_pretraining_cql/pretrain_cql.py
code served (permissive licence) · get_code("7ae90f4ad90c9da4")
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 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 torch
import numpy as np
from torch import Tensor

torch.manual_seed(0)

# Construct arguments for softmax_with_torch
x = np.array([1.0, 2.0, 3.0, 4.0])
temperature = 0.5

ARGS = {
    "x": x,
    "temperature": temperature
}
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 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
subsample_batch Ran
ran; our contract draft was wrong, not the code
victor-wang-902/synthetic-pretrain-rl/syn_pretraining_cql/pretrain_cql.py
code served (permissive licence) · get_code("e4035f8443c3f9ee")
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 numpy as np

# Construct a minimal dataset dict with 'observations' and other keys
# The function indexes dataset['observations'] and all other keys by the same indices
np.random.seed(0)

dataset = {
    'observations': np.random.randn(10, 4),  # 10 samples, 4 dimensions
    'labels': np.arange(10),  # 10 labels
    'actions': np.random.randn(10, 3),  # 10 samples, 3 action dimensions
}

size = 5  # subsample to 5 elements

ARGS = {
    'dataset': dataset,
    'size': size,
}
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 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

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

Recently, it has been shown that for offline deep reinforcement learning (DRL), pre-training Decision Transformer with a large language corpus can improve downstream performance (Reid et al., 2022). A natural question to ask is whether this performance gain can only be achieved with language pre-training, or can be achieved with simpler pre-training schemes which do not involve language. In this paper, we first show that language is not essential for improved performance, and indeed pre-training with synthetic IID data for a small number of updates can match the performance gains from pre-training with a large language corpus; moreover, pre-training with data generated by a one-step Markov chain can further improve the performance. Inspired by these experimental results, we then consider pre-training Conservative Q-Learning (CQL), a popular offline DRL algorithm, which is Q-learning-based and typically employs a Multi-Layer Perceptron (MLP) backbone. Surprisingly, pre-training with simple synthetic data for a small number of updates can also improve CQL, providing consistent performance improvement on D4RL Gym locomotion datasets. The results of this paper not only illustrate the importance of pre-training for offline DRL but also show that the pre-training data can be synthetic and generated with remarkably simple mechanisms 1 .

For agents

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

get_harvested_code_for_paper("2310.00771")
get_code_for_paper("2310.00771")
have("2310.00771")

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

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

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

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

Connect an agent — have() is free.