SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.06912 · 2023

Regret-Based Defense in Adversarial Reinforcement Learning

arXiv · PDF · Open in the Atlas

Code that ran

10 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; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2302.06912.json · badge: /api/ran/2302.06912.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
romanbelaire/robust-ccer canonical (classifier label)
classifier basis not recorded on the link
10 ran · 1 no recorded run
FunctionStatusWhere it lives
consolidate_experiment Ran
ran on a synthesized input
romanbelaire/robust-ccer/code_mujoco/ccer/cox/generator.py
code served (permissive licence) · get_code("075dfe30db346a5d")
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 pandas as pd
import json
import tempfile
import os

# Create temporary directory and files for testing
temp_dir = tempfile.mkdtemp()

# Create a sample experiment CSV file
exp_data = {
    'cox_experiment_path': [
        os.path.join(temp_dir, 'exp_0.json'),
        os.path.join(temp_dir, 'exp_1.json'),
        os.path.join(temp_dir, 'exp_2.json'),
    ]
}
exp_df = pd.DataFrame(exp_data)
exp_csv_path = os.path.join(temp_dir, 'experiments.csv')
exp_df.to_csv(exp_csv_path, index=False)

# Create sample experiment JSON files
for i in range(3):
    params = {
        'learning_rate': 0.001 + i * 0.0001,
        'batch_size': 32 + i,
        'epochs': 10 + i,
        'model_name': f'model_{i}'
    }
    with open(os.path.join(temp_dir, f'exp_{i}.json'), 'w') as f:
        json.dump(params, f)

# Define command_maker function
def command_maker(idx, params):
    """Creates a command string from experiment index and parameters."""
    cmd = f"python train.py --lr {params['learning_rate']} --batch_size {params['batch_size']}"
    return cmd

# Define ARGS dictionary with all required parameters
ARGS = {
    'exp_csv': exp_csv_path,
    'command_maker': command_maker,
    'num_sess': 2,
    'delete_after': True,
    'session_prefix': 'sess'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
dict_product Ran
ran; our contract draft was wrong, not the code
romanbelaire/robust-ccer/code_mujoco/ccer/utils.py
code served (permissive licence) · get_code("35b6f17122388f57")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned map. 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 itertools

# The function expects a dictionary where each value is a list of possible values
# It will create all combinations using itertools.product

d = {
    "learning_rate": [0.001, 0.01, 0.1],
    "batch_size": [16, 32],
    "optimizer": ["adam", "sgd"],
    "num_layers": [2, 3, 4]
}

ARGS = {"d": d}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 map — a map output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a map 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_alg_name Ran
ran; our contract draft was wrong, not the code
romanbelaire/robust-ccer/code_mujoco/ccer/get_best_pickle.py
code served (permissive licence) · get_code("85bf3d86b586cab7")
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 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 os

def get_alg_name(name):
    name = os.path.basename(os.path.dirname(name))
    if 'trpo' in name:
        return 'trpo'
    elif 'robust_ppo' in name:
        return 'robust_ppo'
    elif 'adv_sa_ppo' in name:
        return 'adv_sa_ppo'
    elif 'adv_ppo' in name:
        return 'adv_ppo'
    elif 'ppo' in name:
        return 'ppo'
    elif 'adv_pa_ppo' in name:
        return 'adv_pa_ppo'
    return 'unknown'

ARGS = {
    'name': '/path/to/ppo/model.pt'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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_env_name Ran
ran; our contract draft was wrong, not the code
romanbelaire/robust-ccer/code_mujoco/ccer/get_best_pickle.py
code served (permissive licence) · get_code("35a892ade6c313d2")
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 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

ARGS = {
    'name': 'humanoid-v4'
}
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 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
has_tensorboard Ran
ran on a synthesized input
romanbelaire/robust-ccer/code_mujoco/ccer/cox/archive.py
code served (permissive licence) · get_code("cd38a29fe01f4be3")
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 bool, 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 os
import tempfile
import shutil

# Create a temporary directory with 'tensorboard' subdirectory for the True case
temp_dir = tempfile.mkdtemp()
tensorboard_dir = os.path.join(temp_dir, 'tensorboard')
os.makedirs(tensorboard_dir, exist_ok=True)

ARGS = {
    'dirname': temp_dir
}
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 bool, 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
iwt Ran
ran, honoured the contract we drafted
romanbelaire/robust-ccer/code_mujoco/ccer/utils.py
code served (permissive licence) · get_code("942706632c22fc44")
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

ARGS = {
    "start": 0,
    "end": 10,
    "interval": 2,
    "trials": 3
}
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
pack_history Ran
ran on a synthesized input
romanbelaire/robust-ccer/code_mujoco/ccer/policy_gradients/models.py
code served (permissive licence) · get_code("934a0a9624814d4e")
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 PackedSequence. 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 as ch

ch.manual_seed(0)

# features: tensor with shape (sequence_length, feature_dim)
# The function indexes it with [start:end, :] and calls .size(0)
features = ch.randn(10, 4)

# not_dones: tensor indicating done states
# The function calls ch.nonzero(1.0 - not_dones, as_tuple=False)
# Shape should match features along dimension 0
not_dones = ch.tensor([0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0])

ARGS = {
    'features': features,
    'not_dones': not_dones,
}
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 PackedSequence — a PackedSequence 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
partialclass Ran
ran; our contract draft was wrong, not the code
romanbelaire/robust-ccer/code_mujoco/ccer/policy_gradients/models.py
code served (permissive licence) · get_code("61098cd5c9624563")
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 type. 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 functools
import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple base class to demonstrate partialclass
class SimpleModel(nn.Module):
    def __init__(self, input_dim, hidden_dim, output_dim):
        super().__init__()
        self.linear1 = nn.Linear(input_dim, hidden_dim)
        self.linear2 = nn.Linear(hidden_dim, output_dim)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Set up arguments for partialclass
# partialclass takes: cls, *args, **kwds
cls_arg = SimpleModel
args_tuple = (4, 8)  # input_dim, hidden_dim as positional args
kwds_dict = {"output_dim": 3}  # output_dim as keyword arg

ARGS = {
    "cls": cls_arg,
    "args": args_tuple,
    "kwds": kwds_dict
}
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 type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type 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
schema_from_dict Ran
ran on a synthesized input
romanbelaire/robust-ccer/code_mujoco/ccer/cox/store.py
code served (permissive licence) · get_code("cfbb5cb3d22968c8")
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

OBJECT = '__object__'

def schema_from_dict(d, alternative=OBJECT):
    """
    Given a dictionary mapping column names to values, make a corresponding
    schema.

    Args:
        d (dict) : dict of values we are going to infer the schema from
        alternative (self.OBJECT|self.PICKLE|self.PYTORCH_STATE) : how to
            store columns that are python objects.
    """
    natural_types = set([int, str, float, bool])
    schema = {}
    for k, v in d.items():
        t = type(v)
        if t in natural_types:
            schema[k] = t
        else:
            schema[k] = alternative
    return schema


ARGS = {
    'd': {
        'int_col': 42,
        'str_col': 'hello',
        'float_col': 3.14,
        'bool_col': True,
        'list_col': [1, 2, 3],
        'dict_col': {'nested': 'object'},
        'tensor_col': torch.randn(2, 4)
    },
    'alternative': OBJECT
}
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
unpack_history Ran
ran on a synthesized input
romanbelaire/robust-ccer/code_mujoco/ccer/policy_gradients/models.py
code served (permissive licence) · get_code("0c2504cab96329f1")
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 2, dtype family float, shape (7, 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 as ch
import torch.nn as nn

ch.manual_seed(0)

# The function expects:
# - padded_pieces: a 3D tensor of shape (batch_size, max_length, feature_dim)
#   It indexes [i, 0:l, :] for each batch element i with length l
# - lengths: a 1D tensor of integers representing the actual length of each sequence
#   It calls .cpu().numpy() on it

batch_size = 2
max_length = 5
feature_dim = 4

# Create padded_pieces tensor: (batch_size, max_length, feature_dim)
padded_pieces = ch.randn(batch_size, max_length, feature_dim)

# Create lengths tensor with actual lengths for each batch element
# These should be <= max_length
lengths = ch.tensor([3, 4], dtype=ch.long)

ARGS = {
    "padded_pieces": padded_pieces,
    "lengths": lengths
}
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 Tensor, ndim 2, dtype family float, shape (7, 4) — shape (7, 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
generate_experiments Not yet run
unverified (harvested, no recorded run)
romanbelaire/robust-ccer/code_mujoco/ccer/cox/generator.py
code served (permissive licence) · get_code("b0c1eddd4ae7590e")
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, 5 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 5 later) and 6 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
partialclass 5 other papers
4 dated earlier, 1 later · 1 only as an assembly brick
1906.01618 (2019-06)
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Representations
2009.05475 (2020-09)
Adversarial score matching and improved sampling for image generation
2205.09853 (2022-05)
MCVD: Masked Conditional Video Diffusion for Prediction, Generation, and Interpolation
and 2 more not named here
dict_product 4 other papers
2 dated earlier, 2 later
2005.12729 (2020-05)
Implementation Matters in Deep Policy Gradients: A Case Study on PPO and TRPO
2009.10897 (2020-09)
Revisiting Design Choices in Proximal Policy Optimization
2406.04724 (2024-06)
ON MINIMIZING ADVERSARIAL COUNTERFACTUAL ER-ROR IN ADVERSARIAL RL
and 1 more not named here
iwt 3 other papers
2 dated earlier, 1 later
2005.12729 (2020-05)
Implementation Matters in Deep Policy Gradients: A Case Study on PPO and TRPO
2009.10897 (2020-09)
Revisiting Design Choices in Proximal Policy Optimization
2406.04724 (2024-06)
ON MINIMIZING ADVERSARIAL COUNTERFACTUAL ER-ROR IN ADVERSARIAL RL
get_alg_name 1 other paper
1 later
2406.04724 (2024-06)
ON MINIMIZING ADVERSARIAL COUNTERFACTUAL ER-ROR IN ADVERSARIAL RL
get_env_name 1 other paper
1 later
2406.04724 (2024-06)
ON MINIMIZING ADVERSARIAL COUNTERFACTUAL ER-ROR IN ADVERSARIAL RL

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

Deep Reinforcement Learning (DRL) policies have been shown to be vulnerable to small adversarial noise in observations. Such adversarial noise can have disastrous consequences in safety-critical environments. For instance, a self-driving car receiving adversarially perturbed sensory observations about nearby signs (e.g., a stop sign physically altered to be perceived as a speed limit sign) or objects (e.g., cars altered to be recognized as trees) can be fatal. Existing approaches for making RL algorithms robust to an observation-perturbing adversary have focused on reactive approaches that iteratively improve against adversarial examples generated at each iteration. While such approaches have been shown to provide improvements over regular RL methods, they are reactive and can fare significantly worse if certain categories of adversarial examples are not generated during training. To that end, we pursue a more proactive approach that relies on directly optimizing a well-studied robustness measure, regret instead of expected value. We provide a principled approach that minimizes maximum regret over a "neighborhood" of observations to the received "observation". Our regret criterion can be used to modify existing value- and policy-based Deep RL methods. We demonstrate that our approaches provide a significant improvement in performance across a wide variety of benchmarks against leading approaches for robust Deep RL.

For agents

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

get_harvested_code_for_paper("2302.06912")
get_code_for_paper("2302.06912")
have("2302.06912")

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

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

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

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

Connect an agent — have() is free.