SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2201.09802 · 2022

Constrained Policy Optimization via Bayesian World Models

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 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 9 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-21; 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/2201.09802.json · badge: /api/ran/2201.09802.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
yardenas/la-mbda canonical (classifier label)
classifier basis not recorded on the link
10 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_lambda_values Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/utils.py
code served (permissive licence) · get_code("7c19fbe757803123")
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 EagerTensor, ndim 2, dtype family float, shape (2, 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)

# Create small test tensors
batch_size = 2
horizon = 4

# next_values: shape (batch_size, horizon)
next_values = tf.constant([
    [0.1, 0.2, 0.3, 0.4],
    [0.15, 0.25, 0.35, 0.45]
], dtype=tf.float32)

# rewards: shape (batch_size, horizon)
rewards = tf.constant([
    [1.0, 2.0, 3.0, 4.0],
    [1.5, 2.5, 3.5, 4.5]
], dtype=tf.float32)

# terminals: shape (batch_size, horizon) - binary flags (0 or 1)
terminals = tf.constant([
    [0.0, 0.0, 0.0, 1.0],
    [0.0, 0.0, 1.0, 0.0]
], dtype=tf.float32)

# discount: scalar float
discount = 0.99

# lambda_: scalar float (lambda parameter for GAE)
lambda_ = 0.95

ARGS = {
    "next_values": next_values,
    "rewards": rewards,
    "terminals": terminals,
    "discount": discount,
    "lambda_": lambda_
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
do_episode Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/utils.py
code served (permissive licence) · get_code("8551e6debd395f0f")
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 numpy as np
from collections import defaultdict
from unittest.mock import Mock
import torch

torch.manual_seed(0)

class SimpleAgent:
    def __call__(self, observation, training):
        return np.array([0.5, -0.3], dtype=np.float32)
    
    def observe(self, transition_dict):
        pass

class SimpleEnvironment:
    def __init__(self):
        self.step_count = 0
    
    def reset(self):
        self.step_count = 0
        return np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32)
    
    def step(self, action):
        self.step_count += 1
        next_observation = np.array([0.2, 0.3, 0.4, 0.5], dtype=np.float32)
        reward = 1.0
        done = self.step_count >= 3
        info = {'TimeLimit.truncated': False}
        return next_observation, reward, done, info
    
    def render(self, mode='rgb_array'):
        return np.zeros((64, 64, 3), dtype=np.uint8)

class SimpleConfig:
    def __init__(self):
        self.action_repeat = 1

class SimpleProgressBar:
    def update(self, n):
        pass

agent = SimpleAgent()
training = True
environment = SimpleEnvironment()
config = SimpleConfig()
pbar = SimpleProgressBar()
render = False
reset_function = None

ARGS = {
    'agent': agent,
    'training': training,
    'environment': environment,
    'config': config,
    'pbar': pbar,
    'render': render,
    'reset_function': reset_function
}
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 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
encoder Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/building_blocks.py
code served (permissive licence) · get_code("28cf454f15d83008")
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 ConvEncoder. 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 tensorflow as tf
import numpy as np

# Test case 1: rgb_image encoder
ARGS = {
    'type_': 'rgb_image',
    'shape': (64, 64, 3),
    'layers': None,
    'units': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ConvEncoder — a ConvEncoder output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ConvEncoder 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
gather_optimistic_pessimistic_sample Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/la_mbda.py
code served (permissive licence) · get_code("2b604df9c4ee01a3")
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 tensorflow as tf

# Set seed for reproducibility
tf.random.set_seed(0)

# Create small test tensors
batch_size = 2
num_samples = 3
value_dim = 4

# posterior is a dict with string keys and tensor values
# The function iterates over posterior.items() and gathers values using gather_nd
# So we need tensors that can be gathered with indices of shape [batch_size, 2]
posterior = {
    'mean': tf.random.normal([batch_size, num_samples, value_dim]),
    'std': tf.random.normal([batch_size, num_samples, value_dim]),
    'logprob': tf.random.normal([batch_size, num_samples])
}

# values has shape [batch_size, num_samples, ...] 
# values_summary = reduce_mean(values, 2) gives shape [batch_size, num_samples]
# optimistic_ids gathers from this summary
values = tf.random.normal([batch_size, num_samples, 5])

ARGS = {
    'posterior': posterior,
    'values': values
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — 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
gather_optimistic_sample Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/la_mbda.py
code served (permissive licence) · get_code("fb06e5e4d7fa71e8")
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 tensorflow as tf
import numpy as np

# Create small tensors for the function
# posterior is a dict of tensors with shape [batch_size, dim1, ...]
# values is a tensor with shape [batch_size, num_samples, ...]

batch_size = 2
num_samples = 3
feature_dim = 4

# Create posterior dict with sample tensors
posterior = {
    'mean': tf.constant(np.random.randn(batch_size, feature_dim).astype(np.float32)),
    'std': tf.constant(np.random.randn(batch_size, feature_dim).astype(np.float32)),
    'logits': tf.constant(np.random.randn(batch_size, 5).astype(np.float32))
}

# Create values tensor with shape [batch_size, num_samples, feature_dim]
values = tf.constant(np.random.randn(batch_size, num_samples, feature_dim).astype(np.float32))

ARGS = {
    'posterior': posterior,
    'values': values
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — 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
make_dm_env Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/env_wrappers.py
code served (permissive licence) · get_code("51ae64821a5fdcd2")
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 TimeLimit. 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 gym
import numpy as np
from unittest.mock import Mock, MagicMock

# Create a mock dm_control environment
mock_time_step = Mock()
mock_time_step.observation = {'observations': np.random.randn(4).astype(np.float32)}
mock_time_step.reward = 1.0
mock_time_step.last.return_value = False

mock_action_spec = Mock()
mock_action_spec.minimum = np.array([-1.0, -1.0, -1.0], dtype=np.float32)
mock_action_spec.maximum = np.array([1.0, 1.0, 1.0], dtype=np.float32)

mock_obs_spec = Mock()
mock_obs_spec.__getitem__ = Mock(return_value=Mock(shape=(4,), dtype=np.float32))

mock_physics = Mock()
mock_physics.render = Mock(return_value=np.zeros((64, 64, 3), dtype=np.uint8))

mock_task = Mock()
mock_task.random = Mock()
mock_task.random.seed = Mock()

mock_env = Mock()
mock_env.step = Mock(return_value=mock_time_step)
mock_env.reset = Mock(return_value=mock_time_step)
mock_env.action_spec = Mock(return_value=mock_action_spec)
mock_env.observation_spec = Mock(return_value={'observations': mock_obs_spec})
mock_env.physics = mock_physics
mock_env.task = mock_task

# Patch dm_control.suite.load to return our mock environment
import sys
from unittest.mock import patch

dm_control_mock = Mock()
suite_mock = Mock()
suite_mock.load = Mock(return_value=mock_env)
dm_control_mock.suite = suite_mock

sys.modules['dm_control'] = dm_control_mock
sys.modules['dm_control.suite'] = suite_mock

ARGS = {
    'name': 'cartpole.swingup',
    'episode_length': 1000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
dm_control, gym, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TimeLimit — a TimeLimit output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TimeLimit 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
make_gym_env Ran
ran on a synthesized input
yardenas/la-mbda/la_mbda/env_wrappers.py
code served (permissive licence) · get_code("e62fa20f2534e99c")
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 TimeLimit. 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 gym

ARGS = {
    "name": "CartPole-v1",
    "episode_length": 500
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
gym — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TimeLimit — a TimeLimit output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TimeLimit 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
make_summary Ran
ran on a synthesized input
yardenas/la-mbda/experiments/train_utils.py
code served (permissive licence) · get_code("0dd6945d470eaed0")
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 valid arguments for make_summary function

# Create sample episode data with required structure
episode_1 = {
    'reward': [1.0, 2.0, 3.0],
    'steps': [10],
    'info': [
        {'cost': 0.5},
        {'cost': 0.3},
        {'cost': 0.2}
    ]
}

episode_2 = {
    'reward': [2.0, 1.0],
    'steps': [8],
    'info': [
        {'cost': 0.4},
        {'cost': 0.6}
    ]
}

summaries = [episode_1, episode_2]
prefix = "train"

ARGS = {
    'summaries': summaries,
    'prefix': prefix
}
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
numerical_sort Ran
ran; our contract draft was wrong, not the code
yardenas/la-mbda/experiments/plot.py
pointer only (licence: MIT); the stored copy get_code serves, from hggforget/PIGDreamer, is pointer only (licence: NONE) · get_code("98a9e65f4e16e687")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from hggforget/PIGDreamer, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

parse Ran
ran on a synthesized input
yardenas/la-mbda/experiments/plot.py
code served (permissive licence) · get_code("d7d477df4bbd828d")
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 2, 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 os
import tempfile
from pathlib import Path
from tensorboard.compat.proto import event_pb2
from tensorboard.compat.proto import summary_pb2
import struct

# Create a temporary directory for test event files
temp_dir = tempfile.mkdtemp()
experiment_path = temp_dir
run_name = "test_run"
run_path = os.path.join(experiment_path, run_name)
os.makedirs(run_path, exist_ok=True)

def write_event_file(filepath, events):
    """Write events to a TensorBoard event file."""
    with open(filepath, 'wb') as f:
        for event in events:
            event_bytes = event.SerializeToString()
            # Write length-prefixed protobuf
            f.write(struct.pack('<Q', len(event_bytes)))
            f.write(event_bytes)
            # Write masked CRC (TensorBoard format)
            f.write(b'\x00\x00\x00\x00')

def create_scalar_event(tag, value, step):
    """Create a scalar summary event."""
    event = event_pb2.Event()
    event.step = step
    summary = event.summary
    value_proto = summary.value.add()
    value_proto.tag = tag
    value_proto.simple_value = value
    return event

# Create event file with required metrics
events = []

# Add evaluation/average_return events
for step in [100, 200, 300]:
    events.append(create_scalar_event('evaluation/average_return', float(step * 10), step))

# Add evaluation/average_cost_return events
for step in [100, 200, 300]:
    events.append(create_scalar_event('evaluation/average_cost_return', float(step * 2), step))

# Add training/episode_cost_return events (many per evaluation point)
for step in range(1, 301):
    events.append(create_scalar_event('training/episode_cost_return', float(step * 0.5), step))

# Write the event file
event_file_path = os.path.join(run_path, 'events.out.tfevents.0')
write_event_file(event_file_path, events)

ARGS = {
    'experiment_path': experiment_path,
    'run': run_name,
    'max_steps': 250
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorboard — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
interact Not yet run
unverified (harvested, no recorded run)
yardenas/la-mbda/la_mbda/utils.py
code served (permissive licence) · get_code("247ea75588da9af8")
How it ran

no invocation recorded.

parse_tf_event_file Not yet run
unverified (harvested, no recorded run)
yardenas/la-mbda/experiments/plot.py
code served (permissive licence) · get_code("5eb0a160c03e94fd")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 11 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
numerical_sort 1 other paper
1 later
2508.02159 (2025-08)
PIGDreamer: Privileged Information Guided World Models for Safe Partially Observable Reinforcement Learning

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-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Improving sample-efficiency and safety are crucial challenges when deploying reinforcement learning in high-stakes real world applications. We propose LAMBDA, a novel model-based approach for policy optimization in safety critical tasks modeled via constrained Markov decision processes. Our approach utilizes Bayesian world models, and harnesses the resulting uncertainty to maximize optimistic upper bounds on the task objective, as well as pessimistic upper bounds on the safety constraints. We demonstrate LAMBDA's state of the art performance on the Safety-Gym benchmark suite in terms of sample efficiency and constraint violation.

For agents

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

get_harvested_code_for_paper("2201.09802")
get_code_for_paper("2201.09802")
have("2201.09802")

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

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

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

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

Connect an agent — have() is free.