SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1710.11417 · 2017

TreeQN and ATreeC: Differentiable Tree-Structured Models for Deep Reinforcement Learning

arXiv · PDF · Open in the Atlas

Code that ran

7 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; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 1 failure of our instrument; 5 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.11417.json · badge: /api/ran/1710.11417.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
oxwhirl/treeqn canonical (classifier label)
classifier basis: census
7 ran · 5 no recorded run
FunctionStatusWhere it lives
count_parameters Ran
ran on a synthesized input
oxwhirl/treeqn/treeqn/utils/pytorch_utils.py
code served (permissive licence) · get_code("3f9e5f1793b4c159")
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 int, ndim 0, dtype family int, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Build a small model with a few parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

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 int, ndim 0, dtype family int, 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
linear_interpolation Ran
ran, honoured the contract we drafted
oxwhirl/treeqn/treeqn/utils/schedule.py
pointer only (licence: MIT); the stored copy get_code serves, from rrmenon10/Bootstrapped-DQN, is pointer only (licence: MIT) · get_code("5908b0de70ae8316")
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 rrmenon10/Bootstrapped-DQN, and MIT, as GitHub detects it on that repository, is in the permissive set, but a licence decision keeps the body a pointer: its licence file names an outside party, so it may cover vendored code rather than the repository owner's files (recorded as pointer:licence_names_third_party_corporation). 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.

logsumexp Ran
ran; our contract draft was wrong, not the code
oxwhirl/treeqn/treeqn/utils/pytorch_utils.py
code served (permissive licence) · get_code("3c619fbfa4f66965")
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 1, dtype family float, shape (2,) 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 math

torch.manual_seed(0)

# Test case 1: with dim and keepdim specified
value_with_dim = torch.randn(2, 4)
dim_value = 1
keepdim_value = False

# Test case 2: without dim (scalar result path)
value_no_dim = torch.randn(2, 4)

# Create ARGS dict with all parameters
ARGS = {
    "value": value_with_dim,
    "dim": dim_value,
    "keepdim": keepdim_value
}
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 1, dtype family float, shape (2,) — shape (2,) 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
make_output_format Ran
ran on a synthesized input
oxwhirl/treeqn/treeqn/utils/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
make_variable Ran
ran on a synthesized input
oxwhirl/treeqn/treeqn/nstep_learn.py
code served (permissive licence) · get_code("24a2e66a88ded2ef")
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 2, dtype family float, shape (2, 4) as a later run recorded it. 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, 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.autograd as autograd

torch.manual_seed(0)

# The function make_variable takes:
# - data: a tensor or array-like object
# - *args: additional positional arguments passed to autograd.Variable
# - **kwargs: additional keyword arguments passed to autograd.Variable

# Create a small tensor for the data parameter
data = torch.randn(2, 4)

# Create ARGS dict with all parameters
ARGS = {
    "data": data,
}
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 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
wrap_deepmind Ran
ran on a synthesized input
oxwhirl/treeqn/treeqn/utils/atari_wrapper.py
code served (permissive licence) · get_code("98926491a0b85ec4")
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 ClippedRewardsWrapper. 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

# Create a minimal mock Atari environment that satisfies the requirements
class MockAtariEnv(gym.Env):
    def __init__(self):
        self.action_space = spaces.Discrete(6)
        self.observation_space = spaces.Box(low=0, high=255, shape=(210, 160, 3), dtype=np.uint8)
        self.spec = type('spec', (), {'id': 'PongNoFrameskip-v4'})()
        self._step_count = 0
        self._lives = 5
    
    def get_action_meanings(self):
        return ['NOOP', 'FIRE', 'RIGHT', 'LEFT', 'RIGHTFIRE', 'LEFTFIRE']
    
    def reset(self):
        self._step_count = 0
        self._lives = 5
        return np.random.randint(0, 256, size=(210, 160, 3), dtype=np.uint8)
    
    def step(self, action):
        self._step_count += 1
        obs = np.random.randint(0, 256, size=(210, 160, 3), dtype=np.uint8)
        reward = 1.0 if np.random.random() > 0.5 else 0.0
        done = self._step_count > 100
        info = {}
        return obs, reward, done, info
    
    @property
    def unwrapped(self):
        return self
    
    @property
    def ale(self):
        return self
    
    def lives(self):
        return self._lives

# Create the base environment
base_env = MockAtariEnv()

# Define arguments for wrap_deepmind function
ARGS = {
    'env': base_env,
    'skip': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, gym, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ClippedRewardsWrapper — a ClippedRewardsWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ClippedRewardsWrapper 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
wrap_deepmind_ram Ran
ran on a synthesized input
oxwhirl/treeqn/treeqn/utils/atari_wrapper.py
code served (permissive licence) · get_code("4cbafb5ea418c34f")
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 ClippedRewardsWrapper. 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
from collections import deque
import gym

# Create a minimal mock environment that satisfies gym.Env interface
class MockAtari(gym.Env):
    def __init__(self):
        self.observation_space = gym.spaces.Box(low=0, high=255, shape=(84, 84), dtype=np.uint8)
        self.action_space = gym.spaces.Discrete(18)
        self._step_count = 0
        self._lives = 5
        
    def get_action_meanings(self):
        # Must have NOOP at index 0, FIRE at index 1, and at least one more action
        return ['NOOP', 'FIRE', 'UP', 'DOWN', 'LEFT', 'RIGHT'] + ['ACTION_%d' % i for i in range(12)]
    
    def reset(self):
        self._step_count = 0
        self._lives = 5
        return np.random.randint(0, 256, (84, 84), dtype=np.uint8)
    
    def step(self, action):
        self._step_count += 1
        obs = np.random.randint(0, 256, (84, 84), dtype=np.uint8)
        reward = np.float32(np.random.randn())
        done = self._step_count >= 100
        info = {}
        return obs, reward, done, info
    
    @property
    def unwrapped(self):
        return self
    
    @property
    def ale(self):
        return self
    
    def lives(self):
        if self._step_count > 50:
            self._lives = max(0, self._lives - 1)
        return self._lives

# Construct a valid environment
env = MockAtari()

# Define ARGS dictionary with all parameters for wrap_deepmind_ram
ARGS = {
    'env': env,
}
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 ClippedRewardsWrapper — a ClippedRewardsWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ClippedRewardsWrapper 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
build_transition_fn Not yet run
unverified (harvested, no recorded run)
oxwhirl/treeqn/treeqn/models/transitions.py
code served (permissive licence) · get_code("d0898ce39824b805")
How it ran

no invocation recorded.

einsum Not yet run
unverified (harvested, no recorded run)
oxwhirl/treeqn/treeqn/utils/einsum.py
code served (permissive licence) · get_code("f8881023e7c02b13")
How it ran

no invocation recorded.

fetch_parents Not yet run
unverified (harvested, no recorded run)
oxwhirl/treeqn/treeqn/nstep_run.py
code served (permissive licence) · get_code("54c99a12f39dca08")
How it ran

no invocation recorded.

ortho_init Not yet run
unverified (harvested, no recorded run)
oxwhirl/treeqn/treeqn/utils/pytorch_utils.py
code served (permissive licence) · get_code("aec7854e1d8f8fc2")
How it ran

no invocation recorded.

reduce_sum Not yet run
unverified (harvested, no recorded run)
oxwhirl/treeqn/treeqn/utils/einsum.py
code served (permissive licence) · get_code("72f7be00854ce2c7")
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, 4 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 2 the same month, 3 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.

FunctionAlso present inEarliest-datedOthers named
logsumexp 5 other papers
5 later
1802.04942 (2018-02)
Isolating Sources of Disentanglement in Variational Autoencoders
1809.10341 (2018-09)
Deep Graph Infomax
1906.02735 (2019-06)
Residual Flows for Invertible Generative Modeling
and 2 more not named here
linear_interpolation 4 other papers
1 the same month, 3 later
1710.00814 (2017-10)
Detecting Adversarial Attacks on Neural Network Policies with Visual Foresight
1906.02341 (2019-06)
How to Initialize your Network? Robust Initialization for WeightNorm & ResNets
1909.05398 (2019-09)
Interactive Fiction Games: A Colossal Adventure
and 1 more not named here
make_output_format 2 other papers
1 dated earlier, 1 the same month
1606.03476 (2016-06)
Generative Adversarial Imitation Learning
1710.11198 (2017-10)
Action-depedent Control Variates for Policy Optimization via Stein's Identity
wrap_deepmind_ram 1 other paper
1 later
1904.07482 (2019-04)
Object-Oriented Dynamics Learning through Multi-Level Abstraction

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

Combining deep model-free reinforcement learning with on-line planning is a promising approach to building on the successes of deep RL. On-line planning with look-ahead trees has proven successful in environments where transition models are known a priori. However, in complex environments where transition models need to be learned from data, the deficiencies of learned models have limited their utility for planning. To address these challenges, we propose TreeQN, a differentiable, recursive, tree-structured model that serves as a drop-in replacement for any value function network in deep RL with discrete actions. TreeQN dynamically constructs a tree by recursively applying a transition model in a learned abstract state space and then aggregating predicted rewards and state-values using a tree backup to estimate Q-values. We also propose ATreeC, an actor-critic variant that augments TreeQN with a softmax layer to form a stochastic policy network. Both approaches are trained end-to-end, such that the learned model is optimised for its actual use in the tree. We show that TreeQN and ATreeC outperform n-step DQN and A2C on a box-pushing task, as well as n-step DQN and value prediction networks (Oh et al. 2017) on multiple Atari games. Furthermore, we present ablation studies that demonstrate the effect of different auxiliary losses on learning transition models.

For agents

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

get_harvested_code_for_paper("1710.11417")
get_code_for_paper("1710.11417")
have("1710.11417")

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

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

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

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

Connect an agent — have() is free.