SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.08819 · ICLR · 2024

Learning from Sparse Offline Datasets via Conservative Density Estimation

Ding Zhao, Henry Lam, Zuxin Liu, Zhepeng Cen, Yihang Yao, Zitong Wang

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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; 1 failure of our instrument; 1 no recorded run), measured 2026-11-22; 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/2401.08819.json · badge: /api/ran/2401.08819.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
czp16/cde-offline-rl canonical (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
FunctionStatusWhere it lives
CDELearner Ran
ran on a synthesized input · constructed an object; no result was computed
czp16/cde-offline-rl/cde.py
code served (permissive licence) · get_code("1df7301b0c11658e")
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, CDELearner: 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

torch.manual_seed(0)

# Simple policy network
class SimplePolicy(nn.Module):
    def __init__(self, input_dim=4, output_dim=3):
        super().__init__()
        self.net = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.net(x)

# Simple value network
class SimpleVNetwork(nn.Module):
    def __init__(self, input_dim=4, output_dim=1):
        super().__init__()
        self.net = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.net(x)

# Simple energy network
class SimpleENetwork(nn.Module):
    def __init__(self, input_dim=4, output_dim=1):
        super().__init__()
        self.net = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.net(x)

# Create device
device = torch.device('cpu')

# Create networks
policy = SimplePolicy(input_dim=4, output_dim=3)
data_policy = SimplePolicy(input_dim=4, output_dim=3)
v_network = SimpleVNetwork(input_dim=4, output_dim=1)
e_network = SimpleENetwork(input_dim=4, output_dim=1)

# Create optimizers
policy_optim = torch.optim.Adam(policy.parameters(), lr=0.001)
data_policy_optim = torch.optim.Adam(data_policy.parameters(), lr=0.001)
v_optim = torch.optim.Adam(v_network.parameters(), lr=0.001)
e_optim = torch.optim.Adam(e_network.parameters(), lr=0.001)

# Create simple distribution for zeta_mix_dist
class SimpleDist:
    def sample(self, size):
        return np.random.uniform(0, 1, size=size)

ARGS = {
    'gamma': 0.99,
    'alpha': 0.2,
    'policy': policy,
    'policy_optim': policy_optim,
    'data_policy': data_policy,
    'data_policy_optim': data_policy_optim,
    'v_network': v_network,
    'v_optim': v_optim,
    'e_network': e_network,
    'e_optim': e_optim,
    'n_step_per_episode': 100,
    'num_repeat_actions': 4,
    'zeta_mix_dist': SimpleDist(),
    'ood_eps': 0.1,
    'mix_data_policy': False,
    'e_value_type': 'q',
    'IS_ratio_normalize': True,
    'policy_ent_reg': False,
    'data_policy_ent_reg': False,
    'target_ent': None,
    'device': device,
    'policy_extract_mode': 'info_proj',
    'normalize_obs': True,
    'normalize_rew': True,
    'rew_scale': 1.0,
    'eval_policy_fn': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm, wandb, yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CDELearner — 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 CDELearner 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_f_div_fn Ran
ran; our contract draft was wrong, not the code
czp16/cde-offline-rl/cde.py
code served (permissive licence) · get_code("e06c8c099e9fd7f4")
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 tuple, ndim 1, 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 torch
import numpy as np

torch.manual_seed(0)

# The function takes a single parameter: f_name (a string)
# It returns a tuple of 6 functions based on the f_name value
# Valid f_name values are: 'chi2', 'softchi', 'kl'

ARGS = {
    'f_name': 'chi2'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, ndim 1, 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
to_tensor Ran
ran, honoured the contract we drafted
czp16/cde-offline-rl/cde.py
code served (permissive licence) · get_code("cb62199e8e3037a1")
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. 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 numpy as np

torch.manual_seed(0)

class Config:
    DEVICE = torch.device('cpu')

# Test case 1: torch.Tensor input
tensor_input = torch.randn(2, 4)

# Test case 2: numpy array input
numpy_input = np.random.randn(2, 4).astype(float)

# Test case 3: list input
list_input = [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]

ARGS = {
    'x': tensor_input
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, yaml — 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
Config Not yet run
unverified (harvested, no recorded run)
czp16/cde-offline-rl/cde.py
code served (permissive licence) · get_code("731a435187750caf")
How it ran

no invocation recorded.

Also present in other papers' code

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

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) offers a promising direction for learning policies from pre-collected datasets without requiring further interactions with the environment. However, existing methods struggle to handle out-of-distribution (OOD) extrapolation errors, especially in sparse reward or scarce data settings. In this paper, we propose a novel training algorithm called Conservative Density Estimation (CDE), which addresses this challenge by explicitly imposing constraints on the state-action occupancy stationary distribution. CDE overcomes the limitations of existing approaches, such as the stationary distribution correction method, by addressing the support mismatch issue in marginal importance sampling. Our method achieves state-of-the-art performance on the D4RL benchmark. Notably, CDE consistently outperforms baselines in challenging tasks with sparse rewards or insufficient data, demonstrating the advantages of our approach in addressing the extrapolation error problem in offline RL. Code is available at https://github.com/czp16/cde-offline-rl.

For agents

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

get_harvested_code_for_paper("2401.08819")
get_code_for_paper("2401.08819")
have("2401.08819")

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

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

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

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

Connect an agent — have() is free.