SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.06831 · 2021

Safe Driving via Expert Guided Policy Optimization

arXiv · PDF · Open in the Atlas

Code that ran

7 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 7 have no contract verdict; 0 failures of our instrument; 1 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/2110.06831.json · badge: /api/ran/2110.06831.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
decisionforce/EGPO canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
evaluation Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/dagger/utils.py
code served (permissive licence) · get_code("af575f58b460350e")
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. 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
import numpy as np

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(5, 2)
    
    def forward(self, x):
        return self.linear(x)

class SimpleEnv:
    def __init__(self):
        self.step_count = 0
        self.max_steps = 5
    
    def reset(self):
        self.step_count = 0
        return np.array([0.1, 0.2, 0.3, 0.4, 0.5], dtype=np.float32)
    
    def step(self, action):
        self.step_count += 1
        next_state = np.array([0.1, 0.2, 0.3, 0.4, 0.5], dtype=np.float32)
        reward = 1.0
        done = self.step_count >= self.max_steps
        info = {
            'native_cost': 0.5,
            'velocity': 2.5,
            'overtake_vehicle_num': 1,
            'arrive_dest': done
        }
        return next_state, reward, done, info

model = SimpleModel()
env = SimpleEnv()

ARGS = {
    'env': env,
    'model': model,
    'evaluation_episode_num': 2,
    'device': 'cpu'
}
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 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
expert_action_prob Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/common.py
code served (permissive licence) · get_code("4d895703e220b5c7")
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
import math

# Set random seed for reproducibility
np.random.seed(0)

# Create a small observation vector (4 dimensions)
obs = np.array([0.1, 0.2, 0.3, 0.4])

# Create an action vector (2 dimensions for mean and std)
action = np.array([0.5, -0.3])

# Create weights dictionary with network layers
# Network architecture: input(4) -> fc_1(3) -> fc_2(2) -> fc_out(4)
# fc_out outputs 4 values: mean[0], mean[1], log_std[0], log_std[1]
weights = {
    'default_policy/fc_1/kernel': np.random.randn(4, 3).astype(np.float32),
    'default_policy/fc_1/bias': np.random.randn(3).astype(np.float32),
    'default_policy/fc_2/kernel': np.random.randn(3, 2).astype(np.float32),
    'default_policy/fc_2/bias': np.random.randn(2).astype(np.float32),
    'default_policy/fc_out/kernel': np.random.randn(2, 4).astype(np.float32),
    'default_policy/fc_out/bias': np.random.randn(4).astype(np.float32),
}

ARGS = {
    'action': action,
    'obs': obs,
    'weights': weights,
    'deterministic': False
}
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 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_weights Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/common.py
code served (permissive licence) · get_code("ba9866d5ca98b347")
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 2, dtype family float, shape (4, 3) 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
import tempfile
import os

# Create a temporary directory and a temporary weights file
temp_dir = tempfile.mkdtemp()
weights_path = os.path.join(temp_dir, "weights.npy")

# Create sample weights and save them
sample_weights = np.random.randn(4, 3).astype(np.float32)
np.save(weights_path, sample_weights)

ARGS = {
    "path": weights_path
}
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 2, dtype family float, shape (4, 3) — shape (4, 3) 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
normpdf Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/common.py
code served (permissive licence) · get_code("8de92459dc204a33")
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 float, 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 math

# The function normpdf computes the probability density of a normal distribution
# It takes three numeric parameters: x, mean, and sd
# All parameters are converted to float internally

ARGS = {
    "x": 1.5,
    "mean": 0.0,
    "sd": 1.0
}
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 float, 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
q_values_repeat Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/cql/cql_torch_policy.py
code served (permissive licence) · get_code("9f3d7ae1afa48207")
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 3, dtype family float, shape (2, 2, 1) 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
import torch.nn as nn

torch.manual_seed(0)

class DummyQModel(nn.Module):
    def __init__(self, obs_dim, action_dim):
        super().__init__()
        self.obs_dim = obs_dim
        self.action_dim = action_dim
        self.fc = nn.Linear(obs_dim + action_dim, 1)
    
    def get_q_values(self, obs, actions):
        """Returns Q-values given observations and actions"""
        x = torch.cat([obs, actions], dim=1)
        return self.fc(x)
    
    def get_twin_q_values(self, obs, actions):
        """Returns twin Q-values given observations and actions"""
        x = torch.cat([obs, actions], dim=1)
        return self.fc(x)

# Create model
obs_dim = 4
action_dim = 3
model = DummyQModel(obs_dim, action_dim)

# Create observations and actions
# obs shape: (2, 4) - 2 observations, each with 4 dimensions
obs = torch.randn(2, obs_dim)

# actions shape: (4, 3) - 4 actions, each with 3 dimensions
# This means num_repeat = 4 / 2 = 2
actions = torch.randn(4, action_dim)

# Test with twin=False
twin_flag = False

ARGS = {
    "model": model,
    "obs": obs,
    "actions": actions,
    "twin": twin_flag
}
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 3, dtype family float, shape (2, 2, 1) — shape (2, 2, 1) 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
read_data Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/dagger/utils.py
code served (permissive licence) · get_code("6b4634f434ef937f")
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 gzip
import os
import pickle
import numpy as np
import tempfile

# Create a temporary directory for test data
temp_dir = tempfile.mkdtemp()

# Create a mock gzipped pickle file with the expected data structure
test_data = {
    'state': [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]],
    'action': [[0.1, 0.2], [0.3, 0.4]]
}

test_file_path = os.path.join(temp_dir, 'data.pkl.gzip')
with gzip.open(test_file_path, 'wb') as f:
    pickle.dump(test_data, f)

ARGS = {
    'datasets_dir': temp_dir,
    'path': 'data.pkl.gzip',
    'frac': 0.1
}
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 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
train_model Ran
ran on a synthesized input
decisionforce/EGPO/egpo_utils/dagger/utils.py
code served (permissive licence) · get_code("bed0ee7da33e108c")
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. 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 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
import torch
import torch.nn as nn
import tempfile

torch.manual_seed(0)
np.random.seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)
    
    def save(self, path):
        torch.save(self.state_dict(), path)

# Create a temporary file path for model saving
temp_dir = tempfile.gettempdir()
model_path = f"{temp_dir}/test_model.pt"

# Create small training data
X_train = np.random.randn(8, 4).astype(np.float32)
y_train = np.random.randn(8, 3).astype(np.float32)

# Create model
model = SimpleModel()

ARGS = {
    'model': model,
    'X_train': X_train,
    'y_train': y_train,
    'path': model_path,
    'num_epochs': 2,
    'learning_rate': 0.001,
    'lambda_l2': 1e-05,
    'early_terminate_loss_threshold': 0.2,
    'batch_size': 2,
    'device': 'cpu'
}
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
policy_actions_repeat Not yet run
unverified (harvested, no recorded run)
decisionforce/EGPO/egpo_utils/cql/cql_torch_policy.py
code served (permissive licence) · get_code("772021ac4a5f7410")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

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

When learning common skills like driving, beginners usually have domain experts standing by to ensure the safety of the learning process. We formulate such learning scheme under the Expert-in-the-loop Reinforcement Learning where a guardian is introduced to safeguard the exploration of the learning agent. While allowing the sufficient exploration in the uncertain environment, the guardian intervenes under dangerous situations and demonstrates the correct actions to avoid potential accidents. Thus ERL enables both exploration and expert's partial demonstration as two training sources. Following such a setting, we develop a novel Expert Guided Policy Optimization (EGPO) method which integrates the guardian in the loop of reinforcement learning. The guardian is composed of an expert policy to generate demonstration and a switch function to decide when to intervene. Particularly, a constrained optimization technique is used to tackle the trivial solution that the agent deliberately behaves dangerously to deceive the expert into taking over. Offline RL technique is further used to learn from the partial demonstration generated by the expert. Safe driving experiments show that our method achieves superior training and test-time safety, outperforms baselines with a substantial margin in sample efficiency, and preserves the generalizabiliy to unseen environments in test-time. Demo video and source code are available at: https://decisionforce.github.io/EGPO/

For agents

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

get_harvested_code_for_paper("2110.06831")
get_code_for_paper("2110.06831")
have("2110.06831")

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

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

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

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

Connect an agent — have() is free.