SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1710.11198 · 2017

Action-depedent Control Variates for Policy Optimization via Stein's Identity

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 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 1 has no contract verdict; 4 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/1710.11198.json · badge: /api/ran/1710.11198.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
DartML/PPO-Stein-Control-Variate community (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
FunctionStatusWhere it lives
gen_index Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
DartML/PPO-Stein-Control-Variate/evaluation/traj_visualize.py
code served (permissive licence) · get_code("f397f62536003e67")
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 1, dtype family int, shape (15,) 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

# Construct arguments for gen_index function
# The function takes:
# - indices: an iterable of integers used as multipliers
# - max_length: an integer representing the length of each range

ARGS = {
    "indices": [0, 1, 2],
    "max_length": 5
}
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 1, dtype family int, shape (15,) — shape (15,) 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
load_sample_grads Ran
ran; our contract draft was wrong, not the code
DartML/PPO-Stein-Control-Variate/evaluation/traj_visualize.py
code served (permissive licence) · get_code("ec6862dc1b375e0c")
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 pickle
import os
import tempfile
import shutil

# Create a temporary directory for pickle files
temp_dir = tempfile.mkdtemp()

# Create sample pickle files for batch indices 0 and 1
batch_indices = [0, 1]

for i in batch_indices:
    # MC pickle file
    mc_data = {
        'mu_grad': np.random.randn(2, 3),  # 2 samples, 3 dims for mu
        'sigma_grad': np.random.randn(2, 4),  # 2 samples, 4 dims for sigma
        'phi_loss': np.random.randn(2)  # loss values
    }
    mc_path = os.path.join(temp_dir, f'mc_num_episode={i}.pkl')
    with open(mc_path, 'wb') as f:
        pickle.dump(mc_data, f)
    
    # Stein pickle file
    stein_data = {
        'mu_grad': np.random.randn(2, 3),  # 2 samples, 3 dims for mu
        'sigma_grad': np.random.randn(2, 4),  # 2 samples, 4 dims for sigma
        'phi_loss': np.random.randn(2)  # loss values
    }
    stein_path = os.path.join(temp_dir, f'stein_num_episode={i}.pkl')
    with open(stein_path, 'wb') as f:
        pickle.dump(stein_data, f)

ARGS = {
    'batch_range': batch_indices,
    'prefix_dir': temp_dir
}
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
make_output_format Ran
ran on a synthesized input
DartML/PPO-Stein-Control-Variate/evaluation/tb_logger.py
code served (permissive licence) · get_code("071e746ec3f03d74")
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 HumanOutputFormat. 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 sys
import tempfile
import os

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

ARGS = {
    'format': 'stdout',
    'ev_dir': temp_dir
}
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 HumanOutputFormat — a HumanOutputFormat output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a HumanOutputFormat 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
run_episode Ran
ran; our contract draft was wrong, not the code
DartML/PPO-Stein-Control-Variate/evaluation/main_algo.py
code served (permissive licence) · get_code("fe515a034e675f33")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal environment stand-in
class MinimalEnv:
    def __init__(self):
        self.obs_dim = 4
        self.action_dim = 3
        self.step_count = 0
    
    def reset(self):
        self.step_count = 0
        return np.random.randn(self.obs_dim).astype(np.float32)
    
    def step(self, action):
        self.step_count += 1
        obs = np.random.randn(self.obs_dim).astype(np.float32)
        reward = float(np.random.randn())
        done = self.step_count >= 5
        info = {}
        return obs, reward, done, info
    
    def render(self):
        pass

# Create a minimal policy that has a sample method
class MinimalPolicy(nn.Module):
    def __init__(self, obs_dim, action_dim):
        super().__init__()
        self.linear = nn.Linear(obs_dim, action_dim)
    
    def sample(self, obs):
        # obs shape: (1, obs_dim + 1) where +1 is for timestep
        obs_tensor = torch.from_numpy(obs).float()
        action = self.linear(obs_tensor)
        return action.detach().numpy()

# Create a minimal scaler that has a get method
class MinimalScaler:
    def __init__(self, obs_dim):
        self.obs_dim = obs_dim
    
    def get(self):
        # Returns (scale, offset) where scale and offset are arrays
        scale = np.ones(self.obs_dim + 1)
        offset = np.zeros(self.obs_dim + 1)
        return scale, offset

# Construct arguments
env = MinimalEnv()
policy = MinimalPolicy(obs_dim=5, action_dim=3)  # 5 = 4 obs dims + 1 timestep
scaler = MinimalScaler(obs_dim=4)
max_timesteps = 10
animate = False

ARGS = {
    'env': env,
    'policy': policy,
    'scaler': scaler,
    'max_timesteps': max_timesteps,
    'animate': animate
}
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 — 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
run_episode Ran
ran; our contract draft was wrong, not the code
DartML/PPO-Stein-Control-Variate/optimization/main_algo.py
code served (permissive licence) · get_code("d65e0044847c6ca7")
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 gym
from gym import spaces


class DummyEnvironment:
    """Minimal gym-like environment for testing"""
    def __init__(self, obs_dim=4, act_dim=3):
        self.obs_dim = obs_dim
        self.act_dim = act_dim
        self.observation_space = spaces.Box(low=-1, high=1, shape=(obs_dim,), dtype=np.float32)
        self.action_space = spaces.Box(low=-1, high=1, shape=(act_dim,), dtype=np.float32)
        self._step_count = 0
    
    def reset(self):
        self._step_count = 0
        return np.random.randn(self.obs_dim).astype(np.float32)
    
    def step(self, action):
        self._step_count += 1
        obs = np.random.randn(self.obs_dim).astype(np.float32)
        reward = float(np.random.randn())
        done = self._step_count >= 5
        info = {}
        return obs, reward, done, info
    
    def render(self):
        pass


class DummyPolicy:
    """Minimal policy object with sample() method"""
    def __init__(self, act_dim=3):
        self.act_dim = act_dim
    
    def sample(self, obs):
        # obs shape is (1, obs_dim+1) where last dim is time step
        batch_size = obs.shape[0]
        return np.random.randn(batch_size, self.act_dim).astype(np.float32)


class DummyScaler:
    """Minimal scaler object with get() method"""
    def __init__(self, obs_dim=4):
        self.obs_dim = obs_dim
    
    def get(self):
        # Returns (scale, offset) for obs_dim+1 dimensions (obs + time)
        scale = np.ones(self.obs_dim + 1, dtype=np.float32)
        offset = np.zeros(self.obs_dim + 1, dtype=np.float32)
        return scale, offset


env = DummyEnvironment(obs_dim=4, act_dim=3)
policy = DummyPolicy(act_dim=3)
scaler = DummyScaler(obs_dim=4)

ARGS = {
    "env": env,
    "policy": policy,
    "scaler": scaler,
    "max_timesteps": 10,
    "animate": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
gym, 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
init_gym Not yet run
unverified (harvested, no recorded run)
DartML/PPO-Stein-Control-Variate/evaluation/main_algo.py
code served (permissive licence) · get_code("ff04b3ceca88b830")
How it ran

no invocation recorded.

init_gym Not yet run
unverified (harvested, no recorded run)
DartML/PPO-Stein-Control-Variate/optimization/main_algo.py
code served (permissive licence) · get_code("11dad5a70711db44")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 0 later) and 4 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
make_output_format 2 other papers
1 dated earlier, 1 the same month
1606.03476 (2016-06)
Generative Adversarial Imitation Learning
1710.11417 (2017-10)
TreeQN and ATreeC: Differentiable Tree-Structured Models for Deep 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-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

Policy gradient methods have achieved remarkable successes in solving challenging reinforcement learning problems. However, it still often suffers from the large variance issue on policy gradient estimation, which leads to poor sample efficiency during training. In this work, we propose a control variate method to effectively reduce variance for policy gradient methods. Motivated by the Stein's identity, our method extends the previous control variate methods used in REINFORCE and advantage actor-critic by introducing more general action-dependent baseline functions. Empirical studies show that our method significantly improves the sample efficiency of the state-of-the-art policy gradient approaches.

For agents

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

get_harvested_code_for_paper("1710.11198")
get_code_for_paper("1710.11198")
have("1710.11198")

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

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

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

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

Connect an agent — have() is free.