SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.11352 · ICML · 2023

Model-based Offline Reinforcement Learning with Count-based Conservatism

Min-Hwan Oh, Byeongchan Kim

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 2 failures of our instrument; 2 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/2307.11352.json · badge: /api/ran/2307.11352.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
oh-lab/count-morl canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
oh-lab/Count-MORL canonical (classifier label)
classifier basis: census
2 ran · 1 no recorded run
FunctionStatusWhere it lives
FakeEnv Ran
ran on a synthesized input · constructed an object; no result was computed
oh-lab/count-morl/mopo.py
code served (permissive licence) · get_code("7fd5ce1890bac02f")
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, FakeEnv: 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 numpy as np

class FakeModel:
    """Minimal model that satisfies FakeEnv's usage patterns."""
    
    def __init__(self):
        self.scaler = FakeScaler()
    
    def predict(self, inputs, factored=True):
        """
        inputs shape: [batch_size, obs_dim + act_dim]
        returns: (ensemble_means, ensemble_vars)
            ensemble_means: [num_models, batch_size, obs_dim + 1]
            ensemble_vars: [num_models, batch_size, obs_dim + 1]
        """
        batch_size = inputs.shape[0]
        num_models = 3
        obs_act_dim = inputs.shape[1]
        output_dim = obs_act_dim  # reward + next_obs
        
        ensemble_means = np.random.randn(num_models, batch_size, output_dim)
        ensemble_vars = np.abs(np.random.randn(num_models, batch_size, output_dim)) + 0.1
        
        return ensemble_means, ensemble_vars
    
    def predict_latent(self, inputs, factored=True):
        """
        Returns latent representations for counting.
        Shape: [num_models, batch_size, latent_dim]
        """
        batch_size = inputs.shape[0]
        num_models = 3
        latent_dim = 5
        return np.random.randn(num_models, batch_size, latent_dim)
    
    def random_inds(self, batch_size):
        """Return random model indices."""
        return np.random.randint(0, 3, size=batch_size)
    
    def cnt(self, ensemble_latents, cnt_type='mean', cnt_coef=0.5):
        """
        Compute count-based penalty.
        ensemble_latents shape: [num_models, batch_size, latent_dim]
        returns: [batch_size, 1]
        """
        batch_size = ensemble_latents.shape[1]
        penalty = np.ones((batch_size, 1)) * cnt_coef
        return penalty


class FakeScaler:
    """Minimal scaler with cached_sigma attribute."""
    
    def __init__(self):
        # obs_dim is 5, so we need 5 sigma values
        self.cached_sigma = np.ones((1, 5)) * 0.5


class FakeConfig:
    """Minimal config with termination_fn."""
    
    def termination_fn(self, obs, act, next_obs):
        """
        Returns terminal flags.
        obs: [batch_size, obs_dim]
        act: [batch_size, act_dim]
        next_obs: [batch_size, obs_dim]
        returns: [batch_size, 1]
        """
        batch_size = obs.shape[0]
        return np.zeros((batch_size, 1), dtype=bool)


# Construct arguments
model = FakeModel()
config = FakeConfig()

ARGS = {
    'model': model,
    'config': config,
    'penalty_coeff': 0.1,
    'cnt_coef': 0.5,
    'penalty_learned_var': False,
    'penalty_learned_var_random': False,
    'cnt_type': 'mean',
    'use_count': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FakeEnv — 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 FakeEnv 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
csv2numpy Ran
ran, honoured the contract we drafted
oh-lab/Count-MORL/plotter.py
code served (permissive licence) · get_code("abcfbce086a0b85b")
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 2, dtype family float; no output shape is stated. The image it ran in was 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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with the required structure
# The function expects 3 columns: step, mean, std
temp_dir = tempfile.mkdtemp()
csv_file = os.path.join(temp_dir, "test_data.csv")

# Write a small CSV file with step, mean, and std columns
csv_content = """step,mean,std
1000,0.5,0.1
2000,0.6,0.12
3000,0.7,0.15
4000,0.8,0.18
"""

with open(csv_file, 'w') as f:
    f.write(csv_content)

ARGS = {
    'file_path': csv_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
format_samples_for_training Ran
ran; our contract draft was wrong, not the code
oh-lab/count-morl/mopo.py
code served (permissive licence) · get_code("1bb5583dba32f555")
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

# Create sample data with distinct dimensions
batch_size = 2
obs_dim = 4
action_dim = 3
reward_dim = 1

# Create observations: shape (batch_size, obs_dim)
observations = np.random.randn(batch_size, obs_dim).astype(np.float32)

# Create actions: shape (batch_size, action_dim)
actions = np.random.randn(batch_size, action_dim).astype(np.float32)

# Create next_observations: shape (batch_size, obs_dim)
next_observations = np.random.randn(batch_size, obs_dim).astype(np.float32)

# Create rewards: shape (batch_size, reward_dim)
rewards = np.random.randn(batch_size, reward_dim).astype(np.float32)

# Construct the samples dict
samples = {
    'observations': observations,
    'actions': actions,
    'next_observations': next_observations,
    'rewards': rewards
}

ARGS = {
    'samples': samples
}
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
smooth Ran
ran; our contract draft was wrong, not the code
oh-lab/Count-MORL/plotter.py
code served (permissive licence) · get_code("c49583da67f3a0bb")
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 float, shape (5,) 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

# The function `smooth` takes:
# - y: a 1D numpy array (the data to smooth)
# - radius: an integer (the radius of the smoothing kernel, default 0)

# Create a small 1D numpy array to smooth
y = np.array([1.0, 2.0, 3.0, 4.0, 5.0])

# Define the arguments dictionary
ARGS = {
    'y': y,
    'radius': 2
}
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 float, shape (5,) — shape (5,) 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
MOPO Not yet run
unverified (harvested, no recorded run)
oh-lab/count-morl/mopo.py
code served (permissive licence) · get_code("366f950c51e11fe2")
How it ran

no invocation recorded.

convert_tfenvents_to_csv Not yet run
unverified (harvested, no recorded run)
oh-lab/Count-MORL/plotter.py
code served (permissive licence) · get_code("0f2ed05b3f734448")
How it ran

no invocation recorded.

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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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
format_samples_for_training
brick of this paper's assembly: helper
7 other papers
7 dated earlier · 1 only as an assembly brick
2005.13239 (2020-05)
MOPO: Model-based Offline Policy Optimization
2006.13916 (2020-06)
Off-Dynamics Reinforcement Learning: Training for Transfer with Domain Classifiers
2010.09546 (2020-10)
Model-based Policy Optimization with Unsupervised Model Adaptation
and 4 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

In this paper, we propose a model-based offline reinforcement learning method that integrates countbased conservatism, named Count-MORL. Our method utilizes the count estimates of state-action pairs to quantify model estimation error, marking the first algorithm of demonstrating the efficacy of count-based conservatism in model-based offline deep RL to the best of our knowledge. For our proposed method, we first show that the estimation error is inversely proportional to the frequency of state-action pairs. Secondly, we demonstrate that the learned policy under the count-based conservative model offers near-optimality performance guarantees. Through extensive numerical experiments, we validate that Count-MORL with hash code implementation significantly outperforms existing offline RL algorithms on the D4RL benchmark datasets. The code is accessible at https://github.com/oh-lab/Count-MORL.

For agents

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

get_harvested_code_for_paper("2307.11352")
get_code_for_paper("2307.11352")
have("2307.11352")

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

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

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

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

Connect an agent — have() is free.