SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.03226 · 2023

Safe Reinforcement Learning via Probabilistic Logic Shields

arXiv · PDF · Open in the Atlas

Code that ran

3 of 5 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; 3 failures of our instrument; 2 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/2303.03226.json · badge: /api/ran/2303.03226.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
sacktock/ambs community (classifier label)
classifier basis not recorded on the link
3 ran · 2 no recorded run
FunctionStatusWhere it lives
cast_to_compute Ran
ran; our contract draft was wrong, not the code
sacktock/ambs/dreamerV3-base/jaxutils.py
code served (permissive licence) · get_code("24fe13b4f847da6b")
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 jax
import jax.numpy as jnp
import numpy as np

tree_map = jax.tree_util.tree_map

COMPUTE_DTYPE = jnp.float32

def cast_to_compute(values):
    return tree_map(lambda x: x.astype(COMPUTE_DTYPE), values)

# Create test data with various nested structures and data types
# The function uses tree_map to apply astype conversion to all leaves

# Single array
single_array = jnp.array([1.0, 2.0, 3.0, 4.0], dtype=jnp.float64)

# Nested structure: dict of arrays
nested_dict = {
    "tensor1": jnp.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=jnp.int32),
    "tensor2": jnp.array([1.5, 2.5, 3.5, 4.5], dtype=jnp.float64),
    "nested": {
        "tensor3": jnp.array([[1.0, 2.0], [3.0, 4.0]], dtype=jnp.float64)
    }
}

# List of arrays
list_arrays = [
    jnp.array([1, 2, 3, 4], dtype=jnp.int32),
    jnp.array([1.1, 2.2, 3.3, 4.4], dtype=jnp.float64)
]

# Tuple of arrays
tuple_arrays = (
    jnp.array([1.0, 2.0, 3.0, 4.0], dtype=jnp.float64),
    jnp.array([[5.0, 6.0], [7.0, 8.0]], dtype=jnp.float64)
)

ARGS = {
    "values": nested_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, 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
get_act Ran
ran; our contract draft was wrong, not the code
sacktock/ambs/dreamerV3-base/nets.py
code served (permissive licence) · get_code("03dd934385b4d240")
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 custom_jvp. 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 jax
import jax.numpy as jnp

def get_act(name):
    if callable(name):
        return name
    elif name == 'none':
        return lambda x: x
    elif name == 'mish':
        return lambda x: x * jnp.tanh(jax.nn.softplus(x))
    elif hasattr(jax.nn, name):
        return getattr(jax.nn, name)
    else:
        raise NotImplementedError(name)

# Test with string name 'relu'
ARGS = {
    'name': 'relu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type custom_jvp — a custom_jvp output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a custom_jvp 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
pure Ran
ran; our contract draft was wrong, not the code
sacktock/ambs/dreamerV3-base/ninjax.py
code served (permissive licence) · get_code("bbd25fa32893729e")
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 function. 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 jax
import jax.numpy as jnp

# Define a simple impure function that uses the global context
def sample_impure_fn(x, y):
    """A simple impure function that accesses and modifies state."""
    ctx = context()
    
    # Access state
    if 'counter' not in ctx:
        ctx['counter'] = jnp.array(0)
    
    # Modify state
    ctx['counter'] = ctx['counter'] + 1
    
    # Use rng
    key = rng()
    noise = jax.random.normal(key, x.shape)
    
    return x + y + noise

# Create tiny example tensors
x = jnp.ones((2, 3))
y = jnp.ones((2, 3))

# Create initial state dict
initial_state = {
    'weight': jnp.array([1.0, 2.0, 3.0]),
    'bias': jnp.array(0.5)
}

# Create an RNG key
rng_key = jax.random.PRNGKey(42)

# Define ARGS mapping all parameters of pure()
ARGS = {
    'fun': sample_impure_fn,
    'nested': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
grad Not yet run
unverified (harvested, no recorded run)
sacktock/ambs/dreamerV3-base/ninjax.py
code served (permissive licence) · get_code("1ad869363216c281")
How it ran

no invocation recorded.

rng Not yet run
unverified (harvested, no recorded run)
sacktock/ambs/dreamerV3-base/ninjax.py
code served (permissive licence) · get_code("45b97b51433849a7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 0 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_act 9 other papers
9 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 6 more not named here
grad 6 other papers
6 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 3 more not named here
pure 6 other papers
6 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 3 more not named here
rng 6 other papers
6 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 3 more not named here
cast_to_compute 5 other papers
5 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 2 more not named here

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

Safe Reinforcement learning (Safe RL) aims at learning optimal policies while staying safe. A popular solution to Safe RL is shielding, which uses a logical safety specification to prevent an RL agent from taking unsafe actions. However, traditional shielding techniques are difficult to integrate with continuous, end-to-end deep RL methods. To this end, we introduce Probabilistic Logic Policy Gradient (PLPG). PLPG is a model-based Safe RL technique that uses probabilistic logic programming to model logical safety constraints as differentiable functions. Therefore, PLPG can be seamlessly applied to any policy gradient algorithm while still providing the same convergence guarantees. In our experiments, we show that PLPG learns safer and more rewarding policies compared to other state-of-the-art shielding techniques.

For agents

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

get_harvested_code_for_paper("2303.03226")
get_code_for_paper("2303.03226")
have("2303.03226")

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

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

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

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

Connect an agent — have() is free.