SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.03351 · 2023

Uni-O4: Unifying Online and Offline Deep Reinforcement Learning with Multi-Step On-Policy Optimization

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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 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/2311.03351.json · badge: /api/ran/2311.03351.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
Lei-Kun/Uni-O4 canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
MLP Ran
ran; our contract draft was wrong, not the code
Lei-Kun/Uni-O4/net.py
code served (permissive licence) · get_code("55423074898a45ac")
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 Sequential. 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)

ARGS = {
    'input_dim': 4,
    'hidden_dim': 8,
    'depth': 3,
    'output_dim': 2,
    'activation': 'relu',
    'final_activation': None
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
dynamics_eval Ran
ran; our contract draft was wrong, not the code
Lei-Kun/Uni-O4/dynamics_eval.py
code served (permissive licence) · get_code("010405be9f974eca")
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 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 torch.nn as nn
import numpy as np
from collections import defaultdict

torch.manual_seed(0)

# Define minimal nn.Module classes for policy, Q, and dynamics
class MinimalPolicy(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.net = nn.Linear(state_dim, action_dim)
    
    def select_action(self, s, is_sample=False):
        return self.net(s)

class MinimalQ(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.net = nn.Linear(state_dim + action_dim, 1)
    
    def forward(self, s, a):
        return self.net(torch.cat([s, a], dim=-1))

class MinimalDynamics(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.state_dim = state_dim
        self.action_dim = action_dim
        self.net = nn.Linear(state_dim + action_dim, state_dim + 1)
    
    def step(self, observations, actions):
        # observations: (batch, state_dim), actions: (batch, action_dim)
        batch_size = observations.shape[0]
        combined = np.concatenate([observations, actions], axis=-1)
        combined_tensor = torch.FloatTensor(combined)
        output = self.net(combined_tensor).detach().numpy()
        next_obs = output[:, :self.state_dim]
        rewards = output[:, self.state_dim:self.state_dim+1]
        terminals = np.zeros((batch_size, 1), dtype=bool)
        info = {}
        return next_obs, rewards, terminals, info

class MinimalReplayBuffer:
    def __init__(self, state_dim, batch_size):
        self.state_dim = state_dim
        self.batch_size = batch_size
    
    def sample(self, batch_size):
        s = torch.randn(batch_size, self.state_dim)
        return (s, None, None, None, None, None, None, None)

class MinimalEnv:
    pass

class MinimalArgs:
    def __init__(self):
        self.rollout_batch_size = 2
        self.rollout_length = 3
        self.device = 'cpu'
        self.is_eval_state_norm = False
        self.is_state_norm = True

# Create instances
state_dim = 4
action_dim = 3
batch_size = 2

args = MinimalArgs()
policy = MinimalPolicy(state_dim, action_dim)
Q = MinimalQ(state_dim, action_dim)
dynamics = MinimalDynamics(state_dim, action_dim)
replay_buffer = MinimalReplayBuffer(state_dim, batch_size)
env = MinimalEnv()
mean = np.array([0.0, 0.0, 0.0, 0.0])
std = np.array([1.0, 1.0, 1.0, 1.0])

ARGS = {
    'args': args,
    'policy': policy,
    'Q': Q,
    'dynamics': dynamics,
    'replay_buffer': replay_buffer,
    'env': env,
    'mean': mean,
    'std': std
}
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 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
rollout Ran
ran; our contract draft was wrong, not the code
Lei-Kun/Uni-O4/dynamics_eval.py
code served (permissive licence) · get_code("1c0b96eb357d508b")
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 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
import torch.nn as nn
from collections import defaultdict

torch.manual_seed(0)
np.random.seed(0)

class SimplePolicy(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.fc = nn.Linear(state_dim, action_dim)
    
    def select_action(self, s, is_sample=False):
        return self.fc(s)

class SimpleQ(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.fc = nn.Linear(state_dim + action_dim, 1)
    
    def forward(self, s, a):
        return self.fc(torch.cat([s, a], dim=-1))

class SimpleDynamics(nn.Module):
    def __init__(self, state_dim, action_dim):
        super().__init__()
        self.state_dim = state_dim
        self.action_dim = action_dim
    
    def step(self, observations, actions):
        batch_size = observations.shape[0]
        next_observations = np.random.randn(batch_size, self.state_dim).astype(np.float32)
        rewards = np.random.randn(batch_size, 1).astype(np.float32)
        terminals = np.random.rand(batch_size, 1) > 0.8
        info = {}
        return next_observations, rewards, terminals, info

class Args:
    def __init__(self):
        self.is_eval_state_norm = False
        self.is_state_norm = True
        self.device = 'cpu'

state_dim = 4
action_dim = 3
batch_size = 2

policy = SimplePolicy(state_dim, action_dim)
dynamics = SimpleDynamics(state_dim, action_dim)
q_net = SimpleQ(state_dim, action_dim)

init_obss = torch.FloatTensor(np.random.randn(batch_size, state_dim).astype(np.float32))

mean = np.zeros(state_dim, dtype=np.float32)
std = np.ones(state_dim, dtype=np.float32)

args = Args()

ARGS = {
    'policy': policy,
    'dynamics': dynamics,
    'Q': q_net,
    'init_obss': init_obss,
    'rollout_length': 3,
    'args': args,
    'mean': mean,
    'std': std
}
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 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
soft_clamp Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Lei-Kun/Uni-O4/net.py
code served (permissive licence) · get_code("c8dc65736e6bef1e")
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

torch.manual_seed(0)

# Create a small tensor to pass as x
x = torch.randn(2, 4)

# Create a tuple of bounds (low, high)
bound = (-1.0, 1.0)

ARGS = {
    "x": x,
    "bound": bound,
}
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 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
soft_clamp Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Lei-Kun/Uni-O4/ppo_finetune/net.py
code served (permissive licence) · get_code("109c5738b44665bb")
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

torch.manual_seed(0)

# Construct arguments for soft_clamp function
x = torch.randn(2, 4)  # Small tensor: batch size 2, dimension 4
bound = (-1.0, 1.0)    # Tuple with low and high bounds

ARGS = {
    "x": x,
    "bound": bound
}
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 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
update_mean_var_count_from_moments Ran
ran, honoured the contract we drafted
Lei-Kun/Uni-O4/ppo_finetune/normalization.py
pointer only (licence: MIT); the stored copy get_code serves, from joonleesky/train-procgen-pytorch, is pointer only (licence: NONE) · get_code("3ebb420a5d10cc64")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from joonleesky/train-procgen-pytorch, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is 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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 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.

FunctionAlso present inEarliest-datedOthers named
update_mean_var_count_from_moments 8 other papers
7 dated earlier, 1 later · 1 only as an assembly brick
1901.09184 (2019-01)
Action Robust Reinforcement Learning and Applications in Continuous Control
1912.01588 (2019-12)
Leveraging Procedural Generation to Benchmark Reinforcement Learning
2006.14171 (2020-06)
A Closer Look at Invalid Action Masking in Policy Gradient Algorithms
and 5 more not named here
soft_clamp 2 other papers
1 dated earlier, 1 later
2302.11312 (2023-02)
Behavior Proximal Policy Optimization
2407.06494 (2024-07)
DiffPhyCon: A Generative Approach to Control Complex Physical Systems

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

Combining offline and online reinforcement learning (RL) is crucial for efficient and safe learning. However, previous approaches treat offline and online learning as separate procedures, resulting in redundant designs and limited performance. We ask: Can we achieve straightforward yet effective offline and online learning without introducing extra conservatism or regularization? In this study, we propose Uni-o4, which utilizes an on-policy objective for both offline and online learning. Owning to the alignment of objectives in two phases, the RL agent can transfer between offline and online learning seamlessly. This property enhances the flexibility of the learning paradigm, allowing for arbitrary combinations of pretraining, fine-tuning, offline, and online learning. In the offline phase, specifically, Uni-o4 leverages diverse ensemble policies to address the mismatch issues between the estimated behavior policy and the offline dataset. Through a simple offline policy evaluation (OPE) approach, Uni-o4 can achieve multi-step policy improvement safely. We demonstrate that by employing the method above, the fusion of these two paradigms can yield superior offline initialization as well as stable and rapid online fine-tuning capabilities. Through real-world robot tasks, we highlight the benefits of this paradigm for rapid deployment in challenging, previously unseen real-world environments. Additionally, through comprehensive evaluations using numerous simulated benchmarks, we substantiate that our method achieves state-of-the-art performance in both offline and offline-to-online fine-tuning learning. Our website: https://lei-kun.github.io/uni-o4/ .

For agents

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

get_harvested_code_for_paper("2311.03351")
get_code_for_paper("2311.03351")
have("2311.03351")

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

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

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

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

Connect an agent — have() is free.