SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.08584 · 2026

Conditional Sequence Modeling for Safe Reinforcement Learning

Chao Zhang, Hui Qian, Wensong Bai, Qihang Xu, Chufan Chen, Chenhao Zhou

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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 0 have no contract verdict; 6 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2602.08584.json · badge: /api/ran/2602.08584.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
liuzuxin/OSRL canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
discounted_cumsum Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
liuzuxin/OSRL/osrl/common/dataset.py
code served (permissive licence) · get_code("3d80249559d28c07")
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 (5,) 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

# Create a simple numpy array of rewards/costs
x = np.array([1.0, 2.0, 3.0, 4.0, 5.0])

# Create a discount factor
gamma = 0.99

ARGS = {
    "x": x,
    "gamma": gamma,
}
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 float, shape (5,) — shape (5,) 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_cfg_value Ran
ran; our contract draft was wrong, not the code
liuzuxin/OSRL/osrl/common/exp_util.py
code served (permissive licence) · get_code("604ea5fcc35f7233")
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 str. 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

# Construct valid arguments for get_cfg_value

# Test case 1: key exists at top level with string value
config_1 = {
    'model_name': 'resnet50',
    'batch_size': 32,
    'nested': {
        'learning_rate': 0.001
    }
}

# Test case 2: key exists with list value
config_2 = {
    'layers': [1, 2, 3, 4],
    'hidden_dims': [64, 128, 256],
    'model': {
        'activation': 'relu'
    }
}

# Test case 3: key in nested dict
config_3 = {
    'training': {
        'optimizer': 'adam',
        'hyperparams': {
            'weight_decay': 0.0001
        }
    },
    'data': {
        'split': 0.8
    }
}

# Test case 4: key not found
config_4 = {
    'param1': 'value1',
    'nested_1': {
        'param2': 'value2'
    }
}

ARGS = [
    # Scenario 1: key exists at top level with string value
    {'config': config_1, 'key': 'model_name'},
    
    # Scenario 2: key exists at top level with numeric value
    {'config': config_1, 'key': 'batch_size'},
    
    # Scenario 3: key exists with list value
    {'config': config_2, 'key': 'layers'},
    
    # Scenario 4: key in nested dict
    {'config': config_3, 'key': 'weight_decay'},
    
    # Scenario 5: key not found
    {'config': config_4, 'key': 'nonexistent'},
]

# Use the first valid case
ARGS = {'config': config_1, 'key': 'model_name'}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_f_div_fn Ran
ran; our contract draft was wrong, not the code
liuzuxin/OSRL/osrl/algorithms/coptidice.py
code served (permissive licence) · get_code("6d200a807b429394")
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, ndim 1, dtype family float; 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

torch.manual_seed(0)

ARGS = {
    'f_type': 'chi2'
}
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, ndim 1, dtype family float — a tuple 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
get_nearest_point Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
liuzuxin/OSRL/osrl/common/dataset.py
code served (permissive licence) · get_code("4263c895e26503ba")
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 numpy as np

# Create small 2D numpy arrays for testing
# original_data: shape (5, 2) - 5 points with x and y coordinates
original_data = np.array([
    [1.0, 2.0],
    [2.0, 3.0],
    [3.0, 1.5],
    [4.0, 4.0],
    [5.0, 2.5]
], dtype=np.float32)

# sampled_data: shape (3, 2) - 3 sampled points
sampled_data = np.array([
    [1.5, 2.5],
    [3.5, 2.0],
    [4.5, 3.5]
], dtype=np.float32)

# Parameters for the function
max_rew_decrease = 1.0
beta = 1.0

ARGS = {
    "original_data": original_data,
    "sampled_data": sampled_data,
    "max_rew_decrease": max_rew_decrease,
    "beta": beta
}
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 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
mlp Ran
ran; our contract draft was wrong, not the code
liuzuxin/OSRL/osrl/common/net.py
code served (permissive licence) · get_code("cb1929149ecc4471")
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)

# Define the arguments for the mlp function
ARGS = {
    "sizes": [4, 8, 6, 2],
    "activation": nn.ReLU,
    "output_activation": nn.Tanh
}
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
process_sequence_dataset Ran
ran; our contract draft was wrong, not the code
liuzuxin/OSRL/osrl/common/dataset.py
code served (permissive licence) · get_code("af0a43523ffdd06b")
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 numpy as np
from collections import defaultdict

np.random.seed(0)

# Create a small synthetic dataset
num_steps = 10
obs_dim = 4
action_dim = 2

# Generate synthetic data with clear episode boundaries
observations = np.random.randn(num_steps, obs_dim).astype(np.float32)
actions = np.random.randn(num_steps, action_dim).astype(np.float32)
rewards = np.random.randn(num_steps).astype(np.float32)
costs = np.random.uniform(0, 1, num_steps).astype(np.float32)
terminals = np.zeros(num_steps, dtype=bool)
timeouts = np.zeros(num_steps, dtype=bool)

# Mark episode boundaries
terminals[4] = True  # First episode ends at step 4
timeouts[9] = True   # Second episode ends at step 9

dataset = {
    'observations': observations,
    'actions': actions,
    'rewards': rewards,
    'costs': costs,
    'terminals': terminals,
    'timeouts': timeouts,
}

ARGS = {
    'dataset': dataset,
    'cost_reverse': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tqdm — 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
load_config_and_model Not yet run
unverified (harvested, no recorded run)
liuzuxin/OSRL/osrl/common/exp_util.py
code served (permissive licence) · get_code("1b5bb302e151348b")
How it ran

no invocation recorded.

seed_all Not yet run
unverified (harvested, no recorded run)
liuzuxin/OSRL/osrl/common/exp_util.py
code served (permissive licence) · get_code("0c10e9e1b7b8279c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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
mlp 3 other papers
3 dated earlier · 1 only as an assembly brick
2302.07351 (2023-02)
Constrained Decision Transformer for Offline Safe Reinforcement Learning
2407.14653 (2024-07)
OASIS: Conditional Distribution Shaping for Offline Safe Reinforcement Learning
2510.22027 (2025-10)
Online Optimization for Offline Safe Reinforcement Learning
discounted_cumsum 2 other papers
2 dated earlier
2305.09836 (2023-05)
Revisiting the Minimalist Approach to Offline Reinforcement Learning
2405.16907 (2024-05)
GTA: Generative Trajectory Augmentation with Guidance for Offline Reinforcement Learning
get_cfg_value 1 other paper
1 dated earlier
2205.14691 (2022-05)
On the Robustness of Safe Reinforcement Learning under Observational Perturbations

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

Offline safe reinforcement learning (RL) aims to learn policies from a fixed dataset while maximizing performance under cumulative cost constraints. In practice, deployment requirements often vary across scenarios, necessitating a single policy that can adapt zero-shot to different cost thresholds. However, most existing offline safe RL methods are trained under a pre-specified threshold, yielding policies with limited generalization and deployment flexibility across cost thresholds. Motivated by recent progress in conditional sequence modeling (CSM), which enables flexible goal-conditioned control by specifying target returns, we propose RCDT, a CSM-based method that supports zero-shot deployment across multiple cost thresholds within a single trained policy. RCDT is the first CSM-based offline safe RL algorithm that integrates a Lagrangian-style cost penalty with an auto-adaptive penalty coefficient. To avoid overly conservative behavior and achieve a more favorable return-cost trade-off, a reward-cost-aware trajectory reweighting mechanism and Q-value regularization are further incorporated. Extensive experiments on the DSRL benchmark demonstrate that RCDT consistently improves return-cost trade-offs over representative baselines, advancing the state-of-the-art in offline safe RL.

For agents

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

get_harvested_code_for_paper("2602.08584")
get_code_for_paper("2602.08584")
have("2602.08584")

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

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

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

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

Connect an agent — have() is free.