SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2208.06193 · ICLR · 2023

Diffusion Policies as an Expressive Policy Class for Offline Reinforcement Learning

Mingyuan Zhou, Zhendong Wang, Jonathan Hunt

arXiv · PDF · Open in the Atlas

Code that ran

11 of 18 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 10 have no contract verdict; 0 failures of our instrument; 7 no recorded run), measured 2026-11-23; 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/2208.06193.json · badge: /api/ran/2208.06193.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
zhendong-wang/diffusion-policies-for-offline-rl canonical (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
zzmtsvv/rl_task community
Papers with Code archive
8 ran · 2 no recorded run
quantumiracle/consistency_model_for_reinforcement_learning community
Papers with Code archive
2 ran · 3 no recorded run
FunctionStatusWhere it lives
DDPM Ran
ran on a synthesized input · constructed an object; no result was computed
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("08e51c2d2c41c81f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

EMA Ran
ran on a synthesized input
zhendong-wang/diffusion-policies-for-offline-rl/agents/ql_diffusion.py
code served (permissive licence) · get_code("cb039993bd16f94c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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

class EMA:
    """
        empirical moving average
    """

    def __init__(self, beta):
        super().__init__()
        self.beta = beta

    def update_model_average(self, ma_model, current_model):
        for current_params, ma_params in zip(current_model.parameters(), ma_model.parameters()):
            old_weight, up_weight = (ma_params.data, current_params.data)
            ma_params.data = self.update_average(old_weight, up_weight)

    def update_average(self, old, new):
        if old is None:
            return new
        return old * self.beta + (1 - self.beta) * new


# Create simple models for testing
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)


INIT_ARGS = {
    'beta': 0.99
}

ARGS = {
    'ma_model': SimpleModel(),
    'current_model': SimpleModel()
}

METHOD = 'update_model_average'

if __name__ == '__main__':
    ema = EMA(**INIT_ARGS)
    ema.update_model_average(ARGS['ma_model'], ARGS['current_model'])
    print("EMA update completed successfully")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
EMA Ran
ran on a synthesized input
quantumiracle/consistency_model_for_reinforcement_learning/agents/ql_diffusion.py
code served (permissive licence) · get_code("19732228c46fa1ba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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

class EMA:
    """
        empirical moving average
    """

    def __init__(self, beta):
        super().__init__()
        self.beta = beta

    def update_model_average(self, ma_model, current_model):
        for current_params, ma_params in zip(current_model.parameters(), ma_model.parameters()):
            old_weight, up_weight = (ma_params.data, current_params.data)
            ma_params.data = self.update_average(old_weight, up_weight)

    def update_average(self, old, new):
        if old is None:
            return new
        return old * self.beta + (1 - self.beta) * new

    def set(self, ema):
        self.beta = ema


class SimpleModel(nn.Module):
    def __init__(self, in_features, out_features):
        super().__init__()
        self.linear1 = nn.Linear(in_features, 8)
        self.linear2 = nn.Linear(8, out_features)
    
    def forward(self, x):
        return self.linear2(self.linear1(x))


INIT_ARGS = {
    'beta': 0.99
}

ARGS = {
    'ma_model': SimpleModel(4, 3),
    'current_model': SimpleModel(4, 3)
}

METHOD = 'update_model_average'

if __name__ == '__main__':
    ema = EMA(**INIT_ARGS)
    ema.update_model_average(ARGS['ma_model'], ARGS['current_model'])
    print("EMA update completed successfully")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
EnsembledCritic Ran
ran on a synthesized input · constructed an object; no result was computed
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("d6fcbdadf8cb4e3f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

EnsembledLinear Ran
ran on a synthesized input · constructed an object; no result was computed
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("ac150cae89f0e687")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

MLP Ran
ran on a synthesized input
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("911033f1c5373d15")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

MLP Ran
ran on a synthesized input
quantumiracle/consistency_model_for_reinforcement_learning/agents/ql_diffusion.py
code served (permissive licence) · get_code("6a06af32e9295cda")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 3) 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 torch.nn as nn
import math

class SinusoidalPosEmb(nn.Module):

    def __init__(self, dim):
        super().__init__()
        self.dim = dim

    def forward(self, x):
        device = x.device
        half_dim = self.dim // 2
        emb = math.log(10000) / (half_dim - 1)
        emb = torch.exp(torch.arange(half_dim, device=device) * -emb)
        emb = x[:, None] * emb[None, :]
        emb = torch.cat((emb.sin(), emb.cos()), dim=-1)
        return emb

class MLP(nn.Module):
    """
    MLP Model
    """

    def __init__(self, state_dim, action_dim, device, t_dim=16):
        super(MLP, self).__init__()
        self.device = device
        self.time_mlp = nn.Sequential(SinusoidalPosEmb(t_dim), nn.Linear(t_dim, t_dim * 2), nn.Mish(), nn.Linear(t_dim * 2, t_dim))
        input_dim = state_dim + action_dim + t_dim
        self.mid_layer = nn.Sequential(nn.Linear(input_dim, 256), nn.Mish(), nn.Linear(256, 256), nn.Mish(), nn.Linear(256, 256), nn.Mish())
        self.final_layer = nn.Linear(256, action_dim)

    def forward(self, x, time, state):
        if len(time.shape) > 1:
            time = time.squeeze(1)
        t = self.time_mlp(time)
        x = torch.cat([x, t, state], dim=1)
        x = self.mid_layer(x)
        return self.final_layer(x)


INIT_ARGS = {
    'state_dim': 5,
    'action_dim': 3,
    'device': 'cpu',
    't_dim': 16
}

ARGS = {
    'x': torch.randn(2, 3),
    'time': torch.randn(2, 1),
    'state': torch.randn(2, 5)
}

if __name__ == '__main__':
    model = MLP(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 3) — shape (2, 3) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
PositionalEncoding Ran
ran on a synthesized input · constructed an object; no result was computed
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("ef90a18431b489f9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

WeightedL2 Ran
ran on a synthesized input
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("480e0c2c2219727e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

dql_config Ran
ran on a synthesized input · constructed an object; no result was computed
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("9cbe616246577b15")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

vp_beta_schedule Ran
ran, honoured the contract we drafted
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("25a711883c5a59fe")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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.

Diffusion Not yet run
unverified (harvested, no recorded run)
zhendong-wang/diffusion-policies-for-offline-rl/agents/ql_diffusion.py
code served (permissive licence) · get_code("a8e86dce13aa99a1")
How it ran

no invocation recorded.

Diffusion Not yet run
unverified (harvested, no recorded run)
quantumiracle/consistency_model_for_reinforcement_learning/agents/ql_diffusion.py
code served (permissive licence) · get_code("49c674376f6d739f")
How it ran

no invocation recorded.

DiffusionQL Not yet run
unverified (harvested, no recorded run)
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("8136ea50760183ad")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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. No invocation recorded.

Diffusion_QL Not yet run
unverified (harvested, no recorded run)
zhendong-wang/diffusion-policies-for-offline-rl/agents/ql_diffusion.py
code served (permissive licence) · get_code("56d3224268de9651")
How it ran

no invocation recorded.

Diffusion_QL Not yet run
unverified (harvested, no recorded run)
quantumiracle/consistency_model_for_reinforcement_learning/agents/ql_diffusion.py
code served (permissive licence) · get_code("f3e8db467ebcdc65")
How it ran

no invocation recorded.

WeightedHuber Not yet run
unverified (harvested, no recorded run)
quantumiracle/consistency_model_for_reinforcement_learning/agents/ql_diffusion.py
code served (permissive licence) · get_code("a193aa42d45269f9")
How it ran

no invocation recorded.

extract Not yet run
unverified (harvested, no recorded run)
zzmtsvv/rl_task/diffusion_ql/dql.py
pointer only (licence: NONE) · get_code("ba56ef20ff6743ce")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zzmtsvv/rl_task 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. No invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 5 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 5 later) and 13 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
EMA
brick of this paper's assembly: helper
5 other papers
5 later · 3 only as an assembly brick
2310.05333 (2023-10)
DiffCPS: Diffusion-based Constrained Policy Search for Offline Reinforcement Learning
2402.07226 (2024-02)
Stitching Sub-trajectories with Conditional Diffusion Model for Goal-Conditioned Offline RL
2404.01862 (2024-04)
Co-Speech Gesture Video Generation via Motion-Decoupled Diffusion Model
and 2 more not named here
EnsembledLinear
brick of this paper's assembly: helper
4 other papers
2 dated earlier, 2 later · 2 only as an assembly brick
2110.06169 (2021-10)
Offline Reinforcement Learning with Implicit Q-Learning
2206.04745 (2022-06)
Mildly Conservative Q-Learning for Offline Reinforcement Learning
2301.02328 (2023-01)
Extreme Q-Learning: MaxEnt RL without Entropy
and 1 more not named here
WeightedHuber
brick of this paper's assembly: helper
2 other papers
2 later
2309.16984 (2023-09)
Consistency Models as a Rich and Efficient Policy Class for Reinforcement Learning
2510.11499 (2025-10)
Offline Reinforcement Learning with Generative Trajectory Policies
Diffusion
brick of this paper's assembly: helper
1 other paper
1 later
2310.05333 (2023-10)
DiffCPS: Diffusion-based Constrained Policy Search for Offline Reinforcement Learning
Diffusion
brick of this paper's assembly: model
1 other paper
1 later
2510.11499 (2025-10)
Offline Reinforcement Learning with Generative Trajectory Policies

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

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), which aims to learn an optimal policy using a previously collected static dataset, is an important paradigm of RL. Standard RL methods often perform poorly in this regime due to the function approximation errors on out-of-distribution actions. While a variety of regularization methods have been proposed to mitigate this issue, they are often constrained by policy classes with limited expressiveness that can lead to highly suboptimal solutions. In this paper, we propose representing the policy as a diffusion model, a recent class of highly-expressive deep generative models. We introduce Diffusion Qlearning (Diffusion-QL) that utilizes a conditional diffusion model to represent the policy. In our approach, we learn an action-value function and we add a term maximizing action-values into the training loss of the conditional diffusion model, which results in a loss that seeks optimal actions that are near the behavior policy. We show the expressiveness of the diffusion model-based policy, and the coupling of the behavior cloning and policy improvement under the diffusion model both contribute to the outstanding performance of Diffusion-QL. We illustrate the superiority of our method compared to prior works in a simple 2D bandit example with a multimodal behavior policy. We then show that our method can achieve state-of-the-art performance on the majority of the D4RL benchmark tasks.

For agents

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

get_harvested_code_for_paper("2208.06193")
get_code_for_paper("2208.06193")
have("2208.06193")

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

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

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

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

Connect an agent — have() is free.