SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.09452 · 2026

SafeAdapt: Provably Safe Policy Updates in Deep Reinforcement Learning

Matthew Wicker, Francesco Belardinelli, Maksim Anisimov

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/2604.09452.json · badge: /api/ran/2604.09452.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
maxanisimov/provably-safe-policy-updates canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
apply_figure_size Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
maxanisimov/provably-safe-policy-updates/src/plotting_style.py
code served (permissive licence) · get_code("18cc3cc26a80178d")
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 matplotlib.pyplot as plt
from matplotlib.image import imread
from tempfile import NamedTemporaryFile

# Create a simple figure with some content
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1, 2, 3], [1, 2, 3])

# Define arguments for apply_figure_size
ARGS = {
    'fig': fig,
    'size': (4, 3),
    'dpi': 300,
    'eps': 0.01,
    'give_up': 2,
    'min_size_px': 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib — 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
finetune_policy_with_safety_bc Ran
ran; our contract draft was wrong, not the code
maxanisimov/provably-safe-policy-updates/rl_project/experiments/poisoned_apple/train_source_policy.py
code served (permissive licence) · get_code("2f85f93346c4df7e")
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 torch.utils.data import TensorDataset

torch.manual_seed(0)

# Create a simple policy network
# Input: state tensor of dim 4
# Output: logits for 3 actions (for multi-label safety)
class SimplePolicy(nn.Module):
    def __init__(self, state_dim=4, num_actions=3):
        super().__init__()
        self.fc1 = nn.Linear(state_dim, 8)
        self.fc2 = nn.Linear(8, num_actions)
    
    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

# Create tiny dataset
# X: 2 state vectors of dimension 4
# Y: 2 multi-hot safety labels for 3 actions
X = torch.randn(2, 4)
Y = torch.tensor([[1.0, 0.0, 1.0], [0.0, 1.0, 0.0]], dtype=torch.float32)

dataset = TensorDataset(X, Y)
policy = SimplePolicy(state_dim=4, num_actions=3)

ARGS = {
    'policy': policy,
    'dataset': dataset,
    'required_accuracy': 0.8,
    'lr': 0.002,
    'max_epochs': 2000,
    'batch_size': 64,
    'seed': 42,
    'verbose': 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 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_fully_connected_model Ran
ran; our contract draft was wrong, not the code
maxanisimov/provably-safe-policy-updates/src/models.py
code served (permissive licence) · get_code("c0cbd765fc023025")
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. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Define a simple head module for testing
class SimpleHead(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 5)
    
    def forward(self, x):
        return self.linear(x)

head = SimpleHead()

ARGS = {
    'input_dim': 16,
    'seed': 0,
    'device': 'cpu',
    'output_dim': 10,
    'head': head,
    'hidden_dim': 128,
    'dense_layers': 2,
    'final_bias': 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 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
get_mnist_model Ran
ran; our contract draft was wrong, not the code
maxanisimov/provably-safe-policy-updates/src/models.py
code served (permissive licence) · get_code("2ca48f9728ce0cfe")
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)

# Create a small custom head module for testing
class SimpleHead(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 5)
    
    def forward(self, x):
        return self.linear(x)

head_module = SimpleHead()

ARGS = {
    'seed': 42,
    'device': 'cpu',
    'output_dim': 10,
    'head': head_module,
    'hidden_dim': 128,
    'dense_layers': 1,
    'final_bias': 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 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
get_parameters Ran
ran; our contract draft was wrong, not the code
maxanisimov/provably-safe-policy-updates/abstract_gradient_training/model_utils.py
code served (permissive licence) · get_code("d7a1d7a0a22bcfcb")
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
import torch.nn as nn

torch.manual_seed(0)

# Create a model with alternating Linear and ReLU layers
model = nn.Sequential(
    nn.Linear(4, 3),
    nn.ReLU(),
    nn.Linear(3, 2),
    nn.ReLU(),
    nn.Linear(2, 1)
)

ARGS = {
    "model": model
}
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
split_mnist_by_labels Ran
ran; our contract draft was wrong, not the code
maxanisimov/provably-safe-policy-updates/src/data_utils.py
code served (permissive licence) · get_code("a59d5a2e050c4ba0")
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 ConcatDataset. 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, TensorDataset, Subset, ConcatDataset

torch.manual_seed(0)

# Create a simple custom dataset class
class SimpleDataset(Dataset):
    def __init__(self, data, targets):
        self.data = data
        self.targets = targets
    
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        return self.data[idx], self.targets[idx]

# Create sample data
data1 = torch.randn(6, 4)
targets1 = torch.tensor([0, 1, 2, 0, 1, 2])

data2 = torch.randn(4, 4)
targets2 = torch.tensor([1, 2, 3, 1])

# Create a simple dataset with targets attribute
dataset1 = SimpleDataset(data1, targets1)

# Create a ConcatDataset with multiple subdatasets
dataset2 = SimpleDataset(data2, targets2)
concat_dataset = ConcatDataset([dataset1, dataset2])

# Labels to keep for filtering
labels_to_keep = [1, 2]

ARGS = {
    "dataset": concat_dataset,
    "labels_to_keep": labels_to_keep,
}
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 ConcatDataset — a ConcatDataset 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
get_emnist_digits Not yet run
unverified (harvested, no recorded run)
maxanisimov/provably-safe-policy-updates/src/data_utils.py
code served (permissive licence) · get_code("a0acfafc8a8777db")
How it ran

no invocation recorded.

get_mnist Not yet run
unverified (harvested, no recorded run)
maxanisimov/provably-safe-policy-updates/src/data_utils.py
code served (permissive licence) · get_code("bcd17f3fc951f451")
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, 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 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.

FunctionAlso present inEarliest-datedOthers named
get_parameters 1 other paper
1 dated earlier
2406.13433 (2024-06)
Certification for Differentially Private Prediction in Gradient-Based Training

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

Safety guarantees are a prerequisite to the deployment of reinforcement learning (RL) agents in safety-critical tasks. Often, deployment environments exhibit non-stationary dynamics or are subject to changing performance goals, requiring updates to the learned policy. This leads to a fundamental challenge: how to update an RL policy while preserving its safety properties on previously encountered tasks? The majority of current approaches either do not provide formal guarantees or verify policy safety only a posteriori. We propose a novel a priori approach to safe policy updates in continual RL by introducing the Rashomon set: a region in policy parameter space certified to meet safety constraints within the demonstration data distribution. We then show that one can provide formal, provable guarantees for arbitrary RL algorithms used to update a policy by projecting their updates onto the Rashomon set. Empirically, we validate this approach across grid-world navigation environments (Frozen Lake and Poisoned Apple) where we guarantee an a priori provably deterministic safety on the source task during downstream adaptation. In contrast, we observe that regularisation-based baselines experience catastrophic forgetting of safety constraints while our approach enables strong adaptation with provable guarantees that safety is preserved.

For agents

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

get_harvested_code_for_paper("2604.09452")
get_code_for_paper("2604.09452")
have("2604.09452")

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

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

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

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

Connect an agent — have() is free.