SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.13846 · 2022

Adaptive Behavior Cloning Regularization for Stable Offline-to-Online Reinforcement Learning

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 3 have no contract verdict; 0 failures of our instrument; 0 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/2210.13846.json · badge: /api/ran/2210.13846.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
zhaoyi11/adaptive_bc canonical (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
eval_policy Ran
ran on a synthesized input
zhaoyi11/adaptive_bc/utils.py
code served (permissive licence) · get_code("9823315d1dac2e28")
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 dict. 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 gym
import numpy as np

torch = None  # not needed for this setup

class MockPolicy:
    """Policy with select_action method that takes state and returns action."""
    def select_action(self, state):
        # Return a dummy action suitable for CartPole
        return 0

class MockEnv:
    """Mock gym environment that mimics CartPole behavior."""
    def __init__(self):
        self.observation_space_shape = (4,)
        self.action_space_n = 2
        self._seed_val = 0
        self._step_count = 0
    
    def seed(self, seed_val):
        self._seed_val = seed_val
        return [seed_val]
    
    def reset(self):
        self._step_count = 0
        return np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32)
    
    def step(self, action):
        self._step_count += 1
        next_state = np.array([0.15, 0.25, 0.35, 0.45], dtype=np.float32)
        reward = 1.0
        done = self._step_count >= 5  # Episode ends after 5 steps
        info = {}
        return next_state, reward, done, info
    
    def get_normalized_score(self, avg_reward):
        # Simple normalization: return a value between 0 and 1
        return min(avg_reward / 500.0, 1.0)

# Monkey-patch gym.make to return our mock environment
_original_gym_make = gym.make
def mock_gym_make(env_name):
    return MockEnv()

gym.make = mock_gym_make

# Define the arguments
ARGS = {
    'policy': MockPolicy(),
    'env_name': 'CartPole-v1',
    'seed': 42,
    'seed_offset': 100,
    'eval_episodes': 10
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
process_sac_data Ran
ran on a synthesized input
zhaoyi11/adaptive_bc/utils.py
code served (permissive licence) · get_code("23f8e2b4b711b632")
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 torch.nn as nn

torch.manual_seed(0)

class SimpleBuffer:
    def __init__(self, num_samples, o_dim, a_dim):
        self.num_samples = num_samples
        self.o_dim = o_dim
        self.a_dim = a_dim
    
    def sample(self, batch_size):
        # Returns tuple of (o, a, r, d, n_o)
        # o: observations
        # a: actions
        # r: rewards (squeezed to 1D)
        # d: dones (squeezed to 1D)
        # n_o: next observations
        o = torch.randn(batch_size, self.o_dim)
        a = torch.randn(batch_size, self.a_dim)
        r = torch.randn(batch_size)  # Already squeezed for SAC
        d = torch.randint(0, 2, (batch_size,)).float()  # Already squeezed for SAC
        n_o = torch.randn(batch_size, self.o_dim)
        return (o, a, r, d, n_o)

env_buffer = SimpleBuffer(num_samples=100, o_dim=4, a_dim=3)
model_buffer = SimpleBuffer(num_samples=100, o_dim=4, a_dim=3)

batch_size = 8
real_ratio = 0.75

ARGS = {
    "env_buffer": env_buffer,
    "model_buffer": model_buffer,
    "batch_size": batch_size,
    "real_ratio": real_ratio,
}
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 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
rollout Ran
ran on a synthesized input
zhaoyi11/adaptive_bc/utils.py
code served (permissive licence) · get_code("5d060ee404dd83a1")
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 dict. 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)

# Build a small policy with an actor method
class SimplePolicy(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.actor_net = nn.Linear(state_dim, action_dim)
    
    def actor(self, states, deterministic=False, with_logprob=False):
        # Returns action tensor same batch size as states
        actions = torch.tanh(self.actor_net(states))
        return actions

policy = SimplePolicy(state_dim=4, action_dim=3)

# Build a transition model (dynamics model)
class SimpleTransition(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.model = nn.Linear(state_dim + action_dim, state_dim + 1)
    
    def step(self, states, actions, use_penalty=False):
        # states: (batch, state_dim)
        # actions: (batch, action_dim)
        # returns: next_states, rewards, done, info
        batch_size = states.shape[0]
        combined = torch.cat([states, actions], dim=-1)
        output = self.model(combined)
        next_states = output[:, :states.shape[1]]
        rewards = output[:, -1:].squeeze(-1)
        done = torch.zeros(batch_size, dtype=torch.bool)
        info = {}
        return next_states, rewards, done, info

transition = SimpleTransition(state_dim=4, action_dim=3)

# Build env_buffer that has a sample method
class SimpleBuffer:
    def __init__(self, state_dim, buffer_size=100):
        self.state_dim = state_dim
        self.buffer_size = buffer_size
        self.states = torch.randn(buffer_size, state_dim)
    
    def sample(self, batch_size):
        # Returns tuple where first element is states tensor
        indices = np.random.randint(0, self.buffer_size, batch_size)
        states = self.states[indices]
        return (states, None)
    
    def add_batch(self, states, actions, next_states, rewards, dones):
        pass

env_buffer = SimpleBuffer(state_dim=4, buffer_size=100)

# Build model_buffer with add_batch method
class ModelBuffer:
    def add_batch(self, states, actions, next_states, rewards, dones):
        pass

model_buffer = ModelBuffer()

ARGS = {
    'rollout_batch_size': 2,
    'rollout_horizon': 5,
    'transition': transition,
    'policy': policy,
    'env_buffer': env_buffer,
    'model_buffer': model_buffer,
    'expl_noise': 0.1,
    'max_action': 1
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 3 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, by learning from a fixed dataset, makes it possible to learn agent behaviors without interacting with the environment. However, depending on the quality of the offline dataset, such pre-trained agents may have limited performance and would further need to be fine-tuned online by interacting with the environment. During online fine-tuning, the performance of the pre-trained agent may collapse quickly due to the sudden distribution shift from offline to online data. While constraints enforced by offline RL methods such as a behaviour cloning loss prevent this to an extent, these constraints also significantly slow down online fine-tuning by forcing the agent to stay close to the behavior policy. We propose to adaptively weigh the behavior cloning loss during online fine-tuning based on the agent's performance and training stability. Moreover, we use a randomized ensemble of Q functions to further increase the sample efficiency of online fine-tuning by performing a large number of learning updates. Experiments show that the proposed method yields state-of-the-art offline-to-online reinforcement learning performance on the popular D4RL benchmark. Code is available: \url{https://github.com/zhaoyi11/adaptive_bc}.

For agents

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

get_harvested_code_for_paper("2210.13846")
get_code_for_paper("2210.13846")
have("2210.13846")

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

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

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

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

Connect an agent — have() is free.