SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.04682 · ICLR · 2024

Compositional Conservatism: A Transductive Approach in Offline Reinforcement Learning

Gunhee Kim, Yeda Song, Dongwook Lee

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 2 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/2404.04682.json · badge: /api/ran/2404.04682.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
runamu/compositional-conservatism canonical (classifier label)
classifier basis: classifier_2025
4 ran · 4 no recorded run
FunctionStatusWhere it lives
BasePolicy Ran
ran on a synthesized input · constructed an object; no result was computed
runamu/compositional-conservatism/offlinerlkit/policy/model_free/divergent_policy.py
code served (permissive licence) · get_code("416a8b3131d89f0e")
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 an instance of its own class, BasePolicy: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn
import numpy as np
from typing import Dict

torch.manual_seed(0)

# Since BasePolicy is an abstract base class with no __init__ parameters,
# ARGS should be an empty dict mapping all parameters (there are none)

ARGS = {}
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 BasePolicy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BasePolicy 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
DivergentPolicy Ran
ran on a synthesized input · constructed an object; no result was computed
runamu/compositional-conservatism/offlinerlkit/policy/model_free/divergent_policy.py
code served (permissive licence) · get_code("9156724b660d605a")
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 an instance of its own class, DivergentPolicy: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn
import numpy as np
from collections import defaultdict

torch.manual_seed(0)

# Create a minimal environment mock
class MockEnv:
    def __init__(self):
        self.observation_space = type('obj', (object,), {'shape': (4,)})()
        self.action_space = type('obj', (object,), {'shape': (3,)})()
    
    def set_state(self, qpos, qvel):
        pass

# Create a minimal dynamics model
class MockDynamics(nn.Module):
    def __init__(self, obs_dim, action_dim):
        super().__init__()
        self.linear = nn.Linear(obs_dim + action_dim, obs_dim)
    
    def forward(self, obs, action):
        x = torch.cat([obs, action], dim=-1)
        return self.linear(x)

# Create a minimal reverse dynamics model
class MockReverseDynamics(nn.Module):
    def __init__(self, obs_dim, action_dim):
        super().__init__()
        self.linear = nn.Linear(obs_dim * 2, action_dim)
    
    def forward(self, obs1, obs2):
        x = torch.cat([obs1, obs2], dim=-1)
        return self.linear(x)

# Create a minimal buffer
class MockBuffer:
    def __init__(self, action_dim):
        self.action_dim = action_dim
        self.data = {
            'actions': torch.randn(100, action_dim),
            'observations': torch.randn(100, 4),
            'rewards': torch.randn(100),
            'next_observations': torch.randn(100, 4),
        }
    
    def sample(self, batch_size, keys=None):
        if keys is None:
            keys = list(self.data.keys())
        indices = torch.randint(0, 100, (batch_size,))
        result = {}
        for key in keys:
            result[key] = self.data[key][indices]
        return result

# Create minimal args
class Args:
    def __init__(self):
        self.task = 'halfcheetah'

obs_dim = 4
action_dim = 3
max_action = 1.0

ARGS = {
    'args': Args(),
    'env': MockEnv(),
    'dynamics': MockDynamics(obs_dim, action_dim),
    'reverse_dynamics': MockReverseDynamics(obs_dim, action_dim),
    'buffer': MockBuffer(action_dim),
    'action_dim': action_dim,
    'max_action': max_action,
    'scale_coef': 0.1,
    'noise_coef': 0.01,
    'device': 'cpu',
    'seed': 42,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
faiss, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DivergentPolicy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DivergentPolicy 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_args Ran
ran; our contract draft was wrong, not the code
runamu/compositional-conservatism/run_example/run_anchor_seeker.py
code served (permissive licence) · get_code("8cb94a14fe720302")
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 Namespace. 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 argparse
from distutils.util import strtobool

torch.manual_seed(0)

# The function get_args takes argv as an optional parameter
# When argv is provided, it parses those arguments and returns the result
# When argv is None, it calls parser.parse_args(None) which reads from sys.argv

# To construct valid arguments, we need to provide argv as a list of strings
# that would be passed to the argument parser

ARGS = {
    'argv': [
        '--exp_name', 'test_experiment',
        '--algo_name', 'reverse',
        '--task', 'walker2d-medium-expert-v2',
        '--seed', '42',
        '--load_policy_path', None,
        '--hidden_dims', '256', '256',
        '--policy_train', 'False',
        '--split_validation', 'False',
        '--split_k_means', 'False',
        '--split_n_clusters', '5',
        '--max_holdout_size', '1000',
        '--reverse_policy_mode', 'cvae',
        '--action_mode', 'cvae',
        '--scale_coef', '1.0',
        '--noise_coef', '0.1',
        '--anchor_seeker_hidden_dims', '100', '100',
        '--asp_layernorm', 'True',
        '--dynamics_lr', '0.001',
        '--policy_lr', '0.001',
        '--dynamics_hidden_dims', '200', '200', '200', '200',
        '--dynamics_weight_decay', '2.5e-05', '5e-05', '7.5e-05', '7.5e-05', '0.0001',
        '--n_ensemble', '7',
        '--n_elites', '5',
        '--rollout_epoch', '100',
        '--rollout_batch_size', '3000',
        '--rollout_length', '5',
        '--model_retain_epochs', '5',
        '--real_ratio', '0.05',
        '--load_dynamics_path', None,
        '--load_reverse_dynamics_path', None,
        '--rollout_augmentation', 'False',
        '--holdout_ratio', '0.1',
        '--logvar_loss_coef', '0.01',
        '--step_loss_coef', '0.0',
        '--max_epochs_since_update', '5',
        '--epoch', '1000',
        '--step_per_epoch', '1000',
        '--eval_episodes', '10',
        '--batch_size', '256',
        '--asp_epoch', '50',
        '--asp_lr', '0.001',
        '--asp_batch_size', '256',
        '--device', 'cpu',
        '--track', 'False',
        '--wandb_project_name', 'oos-debug',
        '--wandb_entity', 'rloos_',
        '--wandb_tags', 'test', 'debug',
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
distutils, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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_set_state_fn Ran
ran; our contract draft was wrong, not the code
runamu/compositional-conservatism/offlinerlkit/policy/model_free/divergent_policy.py
code served (permissive licence) · get_code("285b4eaa97d1b74e")
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 function. 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

class MockEnv:
    """Mock environment that supports set_state method"""
    def __init__(self):
        self.qpos = None
        self.qvel = None
    
    def set_state(self, qpos, qvel):
        self.qpos = qpos
        self.qvel = qvel

def get_set_state_fn(task):
    if 'halfcheetah' in task:
        return set_state_fn_halfcheetah
    elif 'hopper' in task:
        return set_state_fn_hopper
    elif 'walker2d' in task:
        return set_state_fn_walker2d
    elif 'HalfCheetah' in task:
        return set_state_fn_halfcheetah
    elif 'Hopper' in task:
        return set_state_fn_hopper
    elif 'Walker2d' in task:
        return set_state_fn_walker2d
    else:
        return None

def set_state_fn_halfcheetah(env, state):
    qpos = state[:9]
    qvel = state[9:]
    env.set_state(qpos, qvel)

def set_state_fn_hopper(env, state):
    qpos = state[:6]
    qvel = state[6:]
    env.set_state(qpos, qvel)

def set_state_fn_walker2d(env, state):
    qpos = state[:9]
    qvel = state[9:]
    env.set_state(qpos, qvel)

# Create a mock environment
env = MockEnv()

# Test with 'halfcheetah' task - state has 9 qpos + 9 qvel = 18 dims
task = 'halfcheetah'

ARGS = {
    'task': task
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
set_state_fn_halfcheetah Not yet run
unverified (harvested, no recorded run)
runamu/compositional-conservatism/offlinerlkit/policy/model_free/divergent_policy.py
code served (permissive licence) · get_code("0ad94e6e9f41a4e4")
How it ran

no invocation recorded.

set_state_fn_hopper Not yet run
unverified (harvested, no recorded run)
runamu/compositional-conservatism/offlinerlkit/policy/model_free/divergent_policy.py
code served (permissive licence) · get_code("60b054fbe703ea98")
How it ran

no invocation recorded.

set_state_fn_walker2d Not yet run
unverified (harvested, no recorded run)
runamu/compositional-conservatism/offlinerlkit/policy/model_free/divergent_policy.py
code served (permissive licence) · get_code("e053c9eccc0c8e13")
How it ran

no invocation recorded.

train Not yet run
unverified (harvested, no recorded run)
runamu/compositional-conservatism/run_example/run_anchor_seeker.py
code served (permissive licence) · get_code("2d4b279bdac1d9df")
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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 7 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
BasePolicy
brick of this paper's assembly: helper
9 other papers
7 dated earlier, 2 later · 6 only as an assembly brick
2005.13239 (2020-05)
MOPO: Model-based Offline Policy Optimization
2006.04779 (2020-06)
Conservative Q-Learning for Offline Reinforcement Learning
2102.08363 (2021-02)
COMBO: Conservative Offline Model-Based Policy Optimization
and 6 more not named here

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

Repositories linked to this paper

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

Abstract

Offline reinforcement learning (RL) is a compelling framework for learning optimal policies from past experiences without additional interaction with the environment. Nevertheless, offline RL inevitably faces the problem of distributional shifts, where the states and actions encountered during policy execution may not be in the training dataset distribution. A common solution involves incorporating conservatism into the policy or the value function to safeguard against uncertainties and unknowns. In this work, we focus on achieving the same objectives of conservatism but from a different perspective. We propose COmpositional COnservatism with Anchor-seeking (COCOA) for offline RL, an approach that pursues conservatism in a compositional manner on top of the transductive reparameterization (Netanyahu et al., 2023), which decomposes the input variable (the state in our case) into an anchor and its difference from the original input. Our COCOA seeks both in-distribution anchors and differences by utilizing the learned reverse dynamics model, encouraging conservatism in the compositional input space for the policy or value function. Such compositional conservatism is independent of and agnostic to the prevalent behavioral conservatism in offline RL. We apply COCOA to four state-of-the-art offline RL algorithms and evaluate them on the D4RL benchmark, where COCOA generally improves the performance of each algorithm. The code is available at https://github.com/runamu/compositionalconservatism.

For agents

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

get_harvested_code_for_paper("2404.04682")
get_code_for_paper("2404.04682")
have("2404.04682")

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

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

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

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

Connect an agent — have() is free.