SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2007.02863 · NeurIPS · 2020

Counterfactual Data Augmentation using Locally Factored Dynamics

Silviu Pitis, Animesh Garg, Elliot Creager

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 6 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/2007.02863.json · badge: /api/ran/2007.02863.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
spitis/mrl named in the paper
Papers with Code archive
6 ran · 0 no recorded run
FunctionStatusWhere it lives
disentangled_components Ran
ran; our contract draft was wrong, not the code
spitis/mrl/experiments/coda/coda_generic.py
code served (permissive licence) · get_code("f6088e3b8c2a14bd")
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 set. 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 functools import reduce
from itertools import combinations, chain

def powerset(n):
    xs = list(range(n))
    return list(chain.from_iterable((combinations(xs, n) for n in range(n + 1))))

def disentangled_components(cc_lst):
    """Converts connected component list into a list of disentangled subsets
  of the indices.
  """
    subsets = powerset(len(cc_lst))
    res = []
    for subset in subsets:
        res.append(reduce(np.union1d, [cc_lst[i] for i in subset], np.array([])).astype(np.int64))
    return set(map(tuple, res))

# Create a valid cc_lst argument
# cc_lst should be a list of numpy arrays representing connected components
cc_lst = [
    np.array([0, 1], dtype=np.int64),
    np.array([2, 3], dtype=np.int64),
    np.array([4], dtype=np.int64)
]

ARGS = {
    "cc_lst": cc_lst
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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_cc_from_mask Ran
ran; our contract draft was wrong, not the code
spitis/mrl/experiments/coda/coda_generic.py
code served (permissive licence) · get_code("62a66cf24d4188c6")
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 list. 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 scipy.sparse import csr_matrix

# Create a simple sparse adjacency matrix for testing
# This represents a graph with connected components
# We'll create a 4x4 sparse matrix with two connected components:
# Component 0: node 0
# Component 1: node 1
# Component 2: nodes 2 and 3 (connected)

data = [1, 1, 1, 1, 1]
row = [0, 1, 2, 2, 3]
col = [0, 1, 2, 3, 2]
mask = csr_matrix((data, (row, col)), shape=(4, 4))

ARGS = {
    "mask": mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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
get_dcs_from_mask Ran
ran; our contract draft was wrong, not the code
spitis/mrl/experiments/coda/coda_generic.py
code served (permissive licence) · get_code("f6921d8bcbb23184")
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 set. 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 scipy.sparse import csr_matrix

# Create a simple mask that represents a sparse adjacency/connectivity matrix
# The function get_cc_from_mask converts this into connected components
# We need a square matrix for the mask

# Create a 4x4 sparse matrix with some connected components
# Component 0: index 0
# Component 1: index 1
# Component 2: indices 2, 3 (connected to each other)
mask_data = np.array([1, 1, 1, 1])
mask_row = np.array([0, 1, 2, 3])
mask_col = np.array([0, 1, 2, 3])

# Add connection between indices 2 and 3
mask_row_ext = np.append(mask_row, [2])
mask_col_ext = np.append(mask_col, [3])
mask_data_ext = np.append(mask_data, [1])

mask = csr_matrix((mask_data_ext, (mask_row_ext, mask_col_ext)), shape=(4, 4))

ARGS = {
    "mask": mask,
    "max_ccs": 6
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
powerset Ran
ran; our contract draft was wrong, not the code
spitis/mrl/experiments/coda/coda_generic.py
code served (permissive licence) · get_code("04039e3271a013fe")
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 list. 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 torch
import numpy as np
from itertools import combinations, chain

# The function powerset(n) takes a single parameter: n (an integer)
# It creates a list of range(n), then generates all combinations of that list
# for each size from 0 to n (inclusive), and returns them as a flat list.

# The parameter n should be a non-negative integer
n = 3

ARGS = {
    "n": n
}
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 list — a list 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
reduce_cc_list_by_union Ran
ran; our contract draft was wrong, not the code
spitis/mrl/experiments/coda/coda_generic.py
code served (permissive licence) · get_code("d71eb24af229ef04")
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 list. 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

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

# Create a cc_list (list of connected components)
# Each component is a numpy array of indices
cc_list = [
    np.array([0, 1, 2]),
    np.array([3, 4]),
    np.array([5, 6, 7]),
    np.array([8, 9]),
    np.array([10, 11, 12, 13]),
    np.array([14])
]

# Set max_ccs to be less than current length to trigger merging
max_ccs = 3

ARGS = {
    "cc_list": cc_list,
    "max_ccs": max_ccs
}
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 list — a list 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
transitions_and_masks_to_proposals Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
spitis/mrl/experiments/coda/coda_generic.py
code served (permissive licence) · get_code("ae7321e51002bfa7")
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) and returned list. 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 random

random.seed(0)
np.random.seed(0)

# Create small numpy arrays for transitions and masks
# t1 = (sa1, s21) where sa1 is state-action and s21 is next state
# t2 = (sa2, s22) where sa2 is state-action and s22 is next state
# Each should have shape (n_components, *component_shape)

# Let's use shape (4, 3) for sa and s2 arrays
# This represents 4 components with 3-dimensional features each

sa1 = np.random.randn(4, 3).astype(np.float32)
s21 = np.random.randn(4, 3).astype(np.float32)
t1 = (sa1, s21)

sa2 = np.random.randn(4, 3).astype(np.float32)
s22 = np.random.randn(4, 3).astype(np.float32)
t2 = (sa2, s22)

# Create masks - these should be square matrices for connected_components
# Shape (4, 4) to match the 4 components
# Create a sparse adjacency-like matrix
m1 = np.array([
    [1, 1, 0, 0],
    [1, 1, 0, 0],
    [0, 0, 1, 1],
    [0, 0, 1, 1]
], dtype=np.float32)

m2 = np.array([
    [1, 0, 0, 0],
    [0, 1, 1, 0],
    [0, 1, 1, 0],
    [0, 0, 0, 1]
], dtype=np.float32)

ARGS = {
    "t1": t1,
    "t2": t2,
    "m1": m1,
    "m2": m2,
    "max_samples": 10,
    "max_ccs": 6
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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-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

Many dynamic processes, including common scenarios in robotic control and reinforcement learning (RL), involve a set of interacting subprocesses. Though the subprocesses are not independent, their interactions are often sparse, and the dynamics at any given time step can often be decomposed into locally independent causal mechanisms. Such local causal structures can be leveraged to improve the sample efficiency of sequence prediction and off-policy reinforcement learning. We formalize this by introducing local causal models (LCMs), which are induced from a global causal model by conditioning on a subset of the state space. We propose an approach to inferring these structures given an object-oriented state representation, as well as a novel algorithm for Counterfactual Data Augmentation (CoDA). CoDA uses local structures and an experience replay to generate counterfactual experiences that are causally valid in the global model. We find that CoDA significantly improves the performance of RL agents in locally factored tasks, including the batch-constrained and goal-conditioned settings. 1

For agents

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

get_harvested_code_for_paper("2007.02863")
get_code_for_paper("2007.02863")
have("2007.02863")

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

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

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

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

Connect an agent — have() is free.