# Diffusion Policy: Generating Robot Action Sequences by Conditional Denoising

> Diffusion Policy (Chi et al., 2023) writes a robot's visuomotor policy as an observation-conditioned diffusion model: it denoises a sequence of future actions from noise, executes the first few, then replans. This post rechecks the 46.9% headline and tests multimodality and horizons on a toy task.

- URL: https://dmxsf.com/en/blog/diffusion-policy-visuomotor-policy-learning-via-action-diffusion/
- [DMXSF](https://dmxsf.com/en/about/)
- Published: 2023-03-17
- Updated: 2026-11-11
- Paper notes
- Paper: [Diffusion Policy: Visuomotor Policy Learning via Action Diffusion](https://arxiv.org/abs/2303.04137) (Cheng Chi, Zhenjia Xu, Siyuan Feng, Eric Cousineau, Yilun Du, Benjamin Burchfiel, Russ Tedrake, Shuran Song · RSS 2023, 2023)

## Why this paper matters

To teach a robot a manipulation skill from demonstrations, the usual starting point is **behavior cloning (BC)**: treat the demonstrator's (observation, action) pairs as supervised data and train a policy to reproduce the actions. It is the same recipe as supervised fine-tuning (SFT) for language models, except that the output is a continuous control signal and errors compound over time. On real manipulation tasks it runs into three difficulties:

1. **One observation, several valid actions (multimodality).** When pushing a block toward a target, going around it on the left or on the right are both fine. Mean-squared-error regression learns the average of the two, which may be blocked on both sides. A Gaussian mixture model (GMM) needs the number of modes in advance, and the paper cites work saying that such models are sensitive to hyperparameters and suffer from mode collapse.
2. **Actions form a correlated sequence.** If each step is sampled independently, neighboring steps can come from different modes and the behavior dithers. Pauses in the demonstrations (idle actions) also push a step-by-step policy toward "stay where you are".
3. **Training has to be stable.** The most expressive earlier policy class, implicit behavioral cloning (IBC; Florence et al., 2021), represents the action distribution with an energy model and has to estimate a normalization constant from negative samples; the paper's Figure 6 shows its evaluation success rate oscillating from checkpoint to checkpoint, which makes checkpoint selection hard.

Diffusion Policy (Cheng Chi, Zhenjia Xu et al.; RSS 2023, arXiv March 2023) writes the policy as an **observation-conditioned denoising diffusion model**: training regresses the noise added to an action sequence, and inference starts from Gaussian noise and denoises a short sequence of future actions in one go. Across 15 tasks from 4 benchmarks the paper summarizes its edge over the strongest baselines as an "average improvement of 46.9%", and it adds real-robot runs on Push-T, mug flipping, sauce pouring and spreading, and three bimanual tasks. Figure and table numbers in this post refer to v5 (March 2024), which the paper describes as the extended journal version of the RSS 2023 paper.

This post does three things: (1) walks through the method and its design choices; (2) recomputes the 46.9% from Tables 1, 2 and 4; (3) uses a 2D obstacle-avoidance toy to see what the claims about multimodality, the action horizon and DDIM look like in the smallest possible setting.

## Method

**Conditional denoising.** Let $O_t$ be the observation at time $t$ and $A_t$ a sequence of actions starting at $t$. Diffusion Policy models $p(A_t\mid O_t)$ with a conditional DDPM, rather than the joint $p(A_t,O_t)$ that planning methods often use. Sampling starts from $A_t^K\sim\mathcal N(0,I)$ and iterates $K$ times; the paper writes one denoising step as (Eq. 4)

$$
A_t^{k-1}=\alpha\Big(A_t^{k}-\gamma\,\epsilon_\theta(O_t,A_t^{k},k)+\mathcal N(0,\sigma^2 I)\Big)
$$

where $\alpha,\gamma,\sigma$ come from the noise schedule. For training, take an action sequence $A_t^0$ from a demonstration, draw a diffusion step $k$ and the matching noise $\epsilon^k$, and have the network predict the noise (Eq. 5):

$$
L=\mathrm{MSE}\big(\epsilon^{k},\ \epsilon_\theta(O_t,\ A_t^{0}+\epsilon^{k},\ k)\big)
$$

$A_t^0+\epsilon^k$ is the paper's shorthand for the action sequence noised according to the schedule. The observation is only a condition and is never denoised, so visual features are computed once, independent of the number of denoising iterations; this is one of the reasons real-time inference is feasible. For DDPM itself see the [post on DDPM](https://dmxsf.com/en/blog/ddpm-denoising-diffusion-probabilistic-models/).

*Figure: Closed-loop action generation in Diffusion Policy: the observation passes through the vision encoder once, the denoiser starts from Gaussian noise and iterates K times to produce 16 actions, only the first 8 are executed, then the policy replans from a new observation. The numbers are the setting of most tasks in the paper's appendix Table 7 (T_o=2, T_p=16, T_a=8).*

**Why learning the score trains stably.** An implicit policy writes $p(a\mid o)=e^{-E_\theta(o,a)}/Z(o,\theta)$ and must estimate the normalization constant $Z$ from negative samples; inaccurate negative sampling destabilizes training. A diffusion model learns the gradient of the log-density with respect to the action, which the paper writes in Eq. (8) as

$$
\nabla_a\log p(a\mid o)=-\nabla_a E_\theta(a,o)-\nabla_a\log Z(o,\theta)\approx-\epsilon_\theta(a,o)
$$

and $\nabla_a\log Z(o,\theta)=0$ because $Z$ does not depend on the action $a$. Neither training nor inference ever needs $Z$.

Sections 3 and 4 of the paper give six design choices:

1. **Closed-loop action sequences (receding horizon).** At time $t$ the policy takes the last $T_o$ observations, predicts $T_p$ actions, executes only the first $T_a$ of them, then replans. Most tasks use $T_o=2$, $T_p=16$, $T_a=8$ (appendix Table 7). A whole chunk comes from one sample, so it stays consistent among several feasible ways of acting, and replanning keeps the policy responsive.
2. **Two denoising networks.** The CNN variant uses a 1D temporal CNN and injects the observation features and the diffusion step $k$ into every layer with FiLM (feature-wise linear modulation). The Transformer variant feeds the noisy actions as decoder tokens, injects the observation embedding by cross-attention, and uses causal attention among the actions. The paper recommends trying the CNN first: CNNs favor low-frequency signals and do poorly when the action sequence changes fast and sharply (velocity commands, for example); the Transformer does better there but is more sensitive to hyperparameters.
3. **Vision encoder.** One ResNet-18 per camera, not pretrained, trained end to end with the policy; global average pooling is replaced by spatial softmax and BatchNorm by GroupNorm, because GroupNorm works with the exponential moving average (EMA) that DDPMs commonly use.
4. **Noise schedule.** The squared cosine schedule of iDDPM (Nichol and Dhariwal, 2021), which the paper found to work best on these tasks; simulation uses 100 steps for both training and inference.
5. **DDIM for speed.** Training uses 100 steps; on real robots DDIM (Song et al., 2021) skips steps at inference. The main text says 10 inference steps and 0.1 s latency on an Nvidia 3080; appendix Table 7 lists 16 inference steps for the real tasks. The two statements disagree.
6. **Position control.** Actions are target end-effector positions, not velocity commands. The paper found that Diffusion Policy improves when switched to position control, while the baselines (BC-RNN, BET) get worse (Figure 4). It offers two guesses: multimodality is more pronounced under position control and Diffusion Policy is good at expressing it, and position control compounds errors less, which suits action-sequence prediction.

## Experiments and findings

**Benchmarks.** Four in simulation: Robomimic (Lift, Can, Square, Transport, ToolHang; demonstrations are either ph, proficient humans, or mh, a mix of proficient and non-proficient humans, each with state and image observations), Push-T (push a T-shaped block to a fixed pose with a circular end effector, adapted from IBC; this one reports target-area coverage, the others report success rate), multimodal Block Pushing (1,000 scripted demonstrations; push two blocks into two squares in any order) and Franka Kitchen (7 objects; each demonstration completes 4 subtasks in any order). Evaluation uses 3 training seeds and 50 initial conditions per seed; each cell in the tables is "best checkpoint / mean of the last 10 checkpoints". Each method uses the action space that suits it: position control for Diffusion Policy, velocity control for the baselines.

**Simulation results.** The table below is taken from the paper's Table 2 (image input); the Push-T row is coverage:

| Task | LSTM-GMM | IBC | DP-C | DP-T |
| --- | --- | --- | --- | --- |
| Square (ph) | 0.82 / 0.59 | 0.03 / 0.00 | 0.98 / 0.92 | 1.00 / 0.90 |
| Transport (ph) | 0.88 / 0.62 | 0.00 / 0.00 | 1.00 / 0.93 | 0.98 / 0.81 |
| Transport (mh) | 0.44 / 0.24 | 0.00 / 0.00 | 0.89 / 0.69 | 0.73 / 0.50 |
| ToolHang (ph) | 0.68 / 0.49 | 0.00 / 0.00 | 0.95 / 0.73 | 0.76 / 0.47 |
| Push-T | 0.69 / 0.54 | 0.75 / 0.64 | 0.91 / 0.84 | 0.78 / 0.66 |

DP-C and DP-T are the CNN and Transformer variants. The gap is widest on the hardest tasks: on Transport with mixed-human data (mh), LSTM-GMM's mean over the last 10 checkpoints is 0.24 and DP-C's is 0.69. "Ahead everywhere" holds only for the better of the two variants, though: on state-input ToolHang (ph), LSTM-GMM scores 0.67 / 0.31 and DP-C only 0.50 / 0.30, and the gap opens only with DP-T's 1.00 / 0.87; on image-input ToolHang it is the other way round, DP-C (0.95 / 0.73) beating DP-T (0.76 / 0.47).

**Multimodality.** In Figure 3, at one Push-T state the end effector can approach the contact point from the left or the right. Diffusion Policy learns both and commits to one per rollout; LSTM-GMM and IBC are biased toward one side, and BET cannot commit to either because it lacks temporal consistency. Long-horizon multimodality (subtasks in no fixed order) is in Table 4: for pushing both blocks in Block Pushing (p2), DP-T reaches 0.94 and BET 0.71, LSTM-GMM and IBC about 0.01 and 0.00, while DP-C manages only 0.11; for Kitchen p4 (interacting with 4 or more objects) DP-C and DP-T reach 0.99 and 0.96 against BET's 0.44.

**Real robots.** The paper's real tasks (demonstration counts in parentheses):

| Task | Diffusion Policy | Comparison |
| --- | --- | --- |
| Push-T (136) | 95% success, IoU 0.80 | human demos IoU 0.84; IBC 0%, best LSTM-GMM variant 20% |
| 6-DoF mug flipping | 90% (20 trials) | LSTM-GMM failed to grasp the mug in all 20 |
| Sauce pouring | IoU 0.74, success 0.79 | human 0.79 and 1.00; LSTM-GMM 0.06 and 0.00 |
| Sauce spreading | coverage 0.77, success 1.00 | human 0.79 and 1.00; LSTM-GMM 0.27 and 0.00 |
| Bimanual egg beater (210) | 55% (20 trials) | no baseline given |
| Bimanual mat unrolling (162) | 75% (20 trials) | no baseline given |
| Bimanual shirt folding (284) | 75% (20 trials) | no baseline given |

On real Push-T, the end-to-end CNN variant reaches 95%, a pretrained R3M encoder 80% (jittery actions, more likely to get stuck), a pretrained ImageNet encoder 15%, and the end-to-end Transformer variant 65% (Table 6). Perturbation tests: waving a hand in front of the camera for 3 seconds causes only slight jitter; moving the T block during pushing is corrected immediately; moving it during the finishing stage makes the policy abandon the trip to the end zone and push the block back to the goal, a behavior that never appeared in the demonstrations.

**Ablations and robustness.**

- **The action-horizon trade-off.** $T_a>1$ makes predictions consistent and compensates for idle portions of the demonstrations; too long reacts too slowly; 8 steps was best for most tasks (Figure 5, left).
- **Latency.** With position control and action sequences, the policy keeps its peak performance with up to 4 steps of latency (Figure 5, right).
- **Vision encoder (Table 5, Square ph, CNN variant).** ResNet-18 (ImageNet-21k) scores 0.94 trained from scratch, 0.58 frozen and 0.92 fine-tuned; ViT-B/16 (CLIP) only 0.22 from scratch, 0.70 frozen and 0.98 fine-tuned with a 10 times smaller learning rate. The paper's reading: frozen pretrained encoders do poorly, fine-tuning does well.
- **Data size.** Diffusion Policy beats LSTM-GMM at every training-set size (appendix Figure 15).
- **Observation horizon.** State input is insensitive to $T_o$; with image input the CNN variant gets worse as $T_o$ grows, and 2 is enough for most tasks.

## Checking it with code

The script below does two things.

**Part 1: recompute the "average improvement of 46.9%".** Appendix B.2 defines it as follows: for each column of Tables 1, 2 and 4 (mh columns ignored), take the better of the two Diffusion Policy variants, compare it with the best baseline as a relative gain, and average over columns. I use the five ph columns plus Push-T from each of Tables 1 and 2, and the Block Pushing p1, p2 and Kitchen p1 to p4 columns of Table 4, 18 columns in all; each cell has two readings, the best checkpoint and the mean of the last 10 checkpoints, and I compute both.

**Part 2: a 2D obstacle-avoidance toy.** A point goes from $(-1,0)$ to $(1,0)$ with a disc of radius 0.3 at the origin in the way; demonstrations pass above or below at random ($y=\pm0.55\sin(\pi\tau)$, with 0.02 of vertical jitter at the start; 100 demonstrations of 40 steps per seed). The observation is the current position; the action is the offsets of the next $T_p=16$ positions from the current one (position control); only the first $T_a$ are executed before replanning, and each executed position gets Gaussian noise with standard deviation 0.005. Two policies: a **regression policy** (an MLP regressing the whole plan) and a **diffusion policy** (an MLP of the same shape predicting noise, squared cosine schedule, $K=100$, sampled with 100-step DDPM or 10-step DDIM). Both get the same training budget (batch 256, 20,000 steps), and the regression policy also gets a 500-step version. Each seed is evaluated on 200 rollouts, 5 seeds in total. A rollout succeeds if it gets within 0.1 of the goal in 60 steps without touching the obstacle; the upper share is the fraction of successful rollouts that went above the obstacle. Randomness is kept apart: demonstrations, initialization, batching, diffusion noise, evaluation starts, denoising noise and execution noise each use their own seed.

Environment: Apple M2 Max, single-threaded CPU, Python 3.14.3, PyTorch 2.10.0; the whole script takes about ten minutes. Individual numbers may differ slightly on other setups.

```python
import math
import statistics as st

import torch
from torch import nn

torch.set_num_threads(1)

# ---- Part 1: recompute the "46.9% average gain" from Tables 1, 2, 4 ----
# Each cell: best checkpoint / mean of the last 10 checkpoints (Table 4 has
# one number). Tables 1, 2: ph columns only (Appendix B.2 ignores mh).
# DP-C and DP-T are the two Diffusion Policy variants.
TABLES = {
    "Tab1": ("Lift Can Square Transport ToolHang Push-T", """
        LSTM-GMM 1/.96 1/.91 .95/.73 .76/.47 .67/.31 .67/.61
        IBC .79/.41 0/0 0/0 0/0 0/0 .90/.84
        BET 1/.96 1/.89 .76/.52 .38/.14 .58/.20 .79/.70
        DP-C 1/.98 1/.96 1/.93 .94/.82 .50/.30 .95/.91
        DP-T 1/1 1/1 1/.89 1/.84 1/.87 .95/.79"""),
    "Tab2": ("Lift Can Square Transport ToolHang Push-T", """
        LSTM-GMM 1/.96 1/.88 .82/.59 .88/.62 .68/.49 .69/.54
        IBC .94/.73 .08/.01 .03/0 0/0 0/0 .75/.64
        DP-C 1/1 1/.97 .98/.92 1/.93 .95/.73 .91/.84
        DP-T 1/1 1/.98 1/.90 .98/.81 .76/.47 .78/.66"""),
    "Tab4": (
        "Block-p1 Block-p2 Kitchen-p1 Kitchen-p2 Kitchen-p3 Kitchen-p4", """
        LSTM-GMM .03 .01 1 .90 .74 .34
        IBC .01 0 .99 .87 .61 .24
        BET .96 .71 .99 .93 .71 .44
        DP-C .36 .11 1 1 1 .99
        DP-T .99 .94 1 .99 .99 .96"""),
}

def parse(text):
    rows = {}
    for line in text.strip().splitlines():
        name, *cells = line.split()
        rows[name] = [(float(c.partition("/")[0]),
                       float(c.partition("/")[2] or c.partition("/")[0]))
                      for c in cells]
    return rows

def gains(rows, w):  # per column: best DP variant vs best baseline (relative)
    out = []
    for c in range(len(rows["IBC"])):
        base = max(v[c][w] for k, v in rows.items() if k[:2] != "DP")
        ours = max(v[c][w] for k, v in rows.items() if k[:2] == "DP")
        out.append(ours / base - 1)
    return out

for w, name in enumerate(("best checkpoint", "mean of last 10")):
    allg = []
    for t, (cols, text) in TABLES.items():
        for col, g in zip(cols.split(), gains(parse(text), w)):
            allg.append((g, f"{t} {col}"))
    top = sorted(allg, reverse=True)
    rest = st.mean(g for g, _ in top[1:])
    print(f"{name}: mean over {len(allg)} columns "
          f"{st.mean(g for g, _ in allg):+.1%}, {rest:+.1%} without the "
          "largest; top three: "
          + ", ".join(f"{n} {g:+.0%}" for g, n in top[:3]))

# ---- Part 2: a toy task of going around an obstacle ----
# A point goes from (-1, 0) to (1, 0); a disc of radius 0.3 at the origin
# is in the way. Demonstrations pass above or below at random. The
# observation is the current position; the action is the next TP positions.
TP, K, STEPS, R_OBS = 16, 100, 40, 0.3
GOAL = torch.tensor([1.0, 0.0])
SEEDS, BUDGET = range(5), 20000

def demos(n, g):  # y = ±0.55 sin(pi*tau); start has 0.02 vertical jitter
    tau = torch.arange(STEPS + 1) / STEPS
    sign = torch.randint(0, 2, (n, 1), generator=g) * 2 - 1
    y0 = 0.02 * torch.randn(n, 1, generator=g)
    x = (-1 + 2 * tau).expand(n, -1)
    y = sign * 0.55 * torch.sin(math.pi * tau) + y0 * (1 - tau)
    return torch.stack([x, y], -1)

def dataset(n, g):  # (position, next TP offsets from it); rest at the goal
    pos = demos(n, g)
    pad = torch.cat([pos, pos[:, -1:].expand(-1, TP, -1)], 1)
    now = pos[:, :STEPS]
    ch = [pad[:, j + 1: j + 1 + STEPS] - now for j in range(TP)]
    return now.reshape(-1, 2), torch.stack(ch, 2).reshape(-1, TP * 2)

def mlp(i, o, h=256, layers=3):
    mods, d = [], i
    for _ in range(layers):
        mods += [nn.Linear(d, h), nn.SiLU()]
        d = h
    return nn.Sequential(*mods, nn.Linear(d, o))

# iDDPM squared-cosine schedule, K=100
f = torch.cos((torch.arange(K + 1) / K + 0.008) / 1.008 * math.pi / 2) ** 2
BETA = (1 - f[1:] / f[:-1]).clamp(max=0.999)
ALPHA = 1 - BETA
ABAR = torch.cumprod(ALPHA, 0)

def temb(k):  # sinusoidal embedding of the diffusion step k
    fr = torch.exp(-math.log(100) * torch.arange(8) / 8)
    a = k.float()[:, None] * fr
    return torch.cat([a.sin(), a.cos()], 1)

def train(kind, seed, steps):
    obs, ch = dataset(100, torch.Generator().manual_seed(1000 + seed))
    torch.manual_seed(2000 + seed)  # init
    gb = torch.Generator().manual_seed(4000 + seed)  # batches
    gn = torch.Generator().manual_seed(5000 + seed)  # diffusion step and noise
    net = mlp(2 if kind == "mse" else 2 + TP * 2 + 16, TP * 2)
    opt = torch.optim.Adam(net.parameters(), lr=1e-3)
    sched = torch.optim.lr_scheduler.LambdaLR(
        opt, lambda i: max(1e-3, 1 - i / steps))
    for _ in range(steps):
        i = torch.randint(0, len(obs), (256,), generator=gb)
        o, a = obs[i], ch[i]
        if kind == "mse":  # regression: predict the whole plan
            loss = ((net(o) - a) ** 2).mean()
        else:  # diffusion: predict the added noise (Eq. 3, conditional)
            k = torch.randint(0, K, (256,), generator=gn)
            e = torch.randn(256, TP * 2, generator=gn)
            ab = ABAR[k][:, None]
            x = ab.sqrt() * a + (1 - ab).sqrt() * e
            loss = ((net(torch.cat([o, x, temb(k)], 1)) - e) ** 2).mean()
        opt.zero_grad()
        loss.backward()
        opt.step()
        sched.step()
    return net

@torch.no_grad()
def plan(kind, net, o, g, stride=1):
    if kind == "mse":
        return net(o)
    x = torch.randn(len(o), TP * 2, generator=g)
    for k in range(K - 1, -1, -stride):
        e = net(torch.cat([o, x, temb(torch.full((len(o),), k))], 1))
        if stride == 1:  # DDPM: 100 stochastic steps
            x = (x - BETA[k] / (1 - ABAR[k]).sqrt() * e) / ALPHA[k].sqrt()
            if k > 0:
                x = x + BETA[k].sqrt() * torch.randn(x.shape, generator=g)
        else:  # DDIM (eta=0): deterministic; clip x0 estimate to [-1, 1]
            x0 = (x - (1 - ABAR[k]).sqrt() * e) / ABAR[k].sqrt()
            x0 = x0.clamp(-1, 1)
            kn = k - stride
            x = x0 if kn < 0 else (
                ABAR[kn].sqrt() * x0 + (1 - ABAR[kn]).sqrt() * e)
    return x

@torch.no_grad()
def rollout(kind, net, ta, seed, stride=1, n=200):
    gi = torch.Generator().manual_seed(3000 + seed)  # start
    gs = torch.Generator().manual_seed(6000 + seed)  # denoising
    ge = torch.Generator().manual_seed(7000 + seed)  # execution noise
    p = torch.stack([-torch.ones(n), 0.02 * torch.randn(n, generator=gi)], 1)
    alive = torch.ones(n, dtype=torch.bool)
    ok = torch.zeros(n, dtype=torch.bool)
    hit = torch.zeros(n, dtype=torch.bool)
    ext = torch.zeros(n)  # y farthest from the axis: which side was taken
    t = 0
    while t < 60 and alive.any():  # at most 60 steps (demos take 40)
        ch = plan(kind, net, p, gs, stride).reshape(n, TP, 2)
        base = p.clone()
        for j in range(ta):  # execute the first ta steps, then replan
            step = base + ch[:, j] + 0.005 * torch.randn(n, 2, generator=ge)
            p = torch.where(alive[:, None], step, p)
            far = alive & (p[:, 1].abs() > ext.abs())
            ext = torch.where(far, p[:, 1], ext)
            crash = p.norm(dim=1) < R_OBS
            done = (p - GOAL).norm(dim=1) < 0.1
            hit |= alive & crash
            ok |= alive & done & ~crash
            alive &= ~crash & ~done
            t += 1
    up = (ext[ok] > 0).float().mean().item() if ok.any() else math.nan
    return ok.float().mean().item(), hit.float().mean().item(), up

def fmt(vals):  # percent: mean ± standard error
    se = 100 * st.stdev(vals) / len(vals) ** 0.5
    return f"{100 * st.mean(vals):5.1f}±{se:3.1f}"

def share(vals):
    return " ".join("  --" if math.isnan(v) else f"{v:.2f}" for v in vals)

NETS = {("mse500", s): train("mse", s, 500) for s in SEEDS}
for s in SEEDS:
    NETS["mse", s] = train("mse", s, BUDGET)
    NETS["dp", s] = train("dp", s, BUDGET)

print("\nAt the start (-1, 0), 400 samples of the first plan: y offset of "
      "its last point")
print("(demos: about ±0.52; share of y>0 per seed; |y|<0.2 means between "
      "the two modes)")
print("source        share y>0 (5 seeds)    mean|y|  |y|<0.2")
o = torch.tensor([[-1.0, 0.0]]).expand(400, 2)
probes = [("demos", None, None, 1), ("MSE-500", "mse", "mse500", 1),
          ("MSE-20000", "mse", "mse", 1), ("DDPM-100", "dp", "dp", 1),
          ("DDIM-10", "dp", "dp", 10)]
for label, kind, key, stride in probes:
    pos, mag, mid = [], [], []
    for s in SEEDS:
        if kind is None:
            obs, ch = dataset(100, torch.Generator().manual_seed(1000 + s))
            y = ch[obs[:, 0] == -1][:, -1]
        else:
            g = torch.Generator().manual_seed(8000 + s)
            y = plan(kind, NETS[key, s], o, g, stride).reshape(400, TP, 2)
            y = y[:, -1, 1]
        pos.append((y > 0).float().mean().item())
        mag.append(y.abs().mean().item())
        mid.append((y.abs() < 0.2).float().mean().item())
    print(f"{label:<12}  {share(pos)}   {st.mean(mag):.2f}     "
          f"{st.mean(mid):.2f}")

print("\n200 rollouts x 5 seeds: success, collision (mean ± s.e.), upper share")
print("policy          Ta   success%     collision%  upper share (5 seeds)")
rows = [("mse500", 8, 1), ("mse", 1, 1), ("mse", 4, 1), ("mse", 8, 1),
        ("dp", 1, 1), ("dp", 4, 1), ("dp", 8, 1),
        ("dp", 1, 10), ("dp", 4, 10), ("dp", 8, 10)]
names = {("mse500", 1): "MSE-500", ("mse", 1): "MSE-20000",
         ("dp", 1): "DDPM-100", ("dp", 10): "DDIM-10"}
for key, ta, stride in rows:
    kind = "mse" if key[:3] == "mse" else "dp"
    r = [rollout(kind, NETS[key, s], ta, s, stride) for s in SEEDS]
    print(f"{names[key, stride]:<14}  {ta:>2}  {fmt([a for a, _, _ in r])}"
          f"  {fmt([b for _, b, _ in r])}   {share([c for _, _, c in r])}")
```

Output:

```text
best checkpoint: mean over 18 columns +21.7%, +15.7% without the largest; top three: Tab4 Kitchen-p4 +125%, Tab1 ToolHang +49%, Tab2 ToolHang +40%
mean of last 10: mean over 18 columns +39.7%, +31.4% without the largest; top three: Tab1 ToolHang +181%, Tab4 Kitchen-p4 +125%, Tab1 Transport +79%

At the start (-1, 0), 400 samples of the first plan: y offset of its last point
(demos: about ±0.52; share of y>0 per seed; |y|<0.2 means between the two modes)
source        share y>0 (5 seeds)    mean|y|  |y|<0.2
demos         0.50 0.45 0.58 0.49 0.54   0.52     0.00
MSE-500       0.00 0.00 1.00 0.00 1.00   0.04     1.00
MSE-20000     0.00 0.00 1.00 0.00 1.00   0.12     1.00
DDPM-100      0.58 0.50 0.61 0.49 0.51   0.49     0.03
DDIM-10       0.46 0.49 0.62 0.45 0.54   0.46     0.09

200 rollouts x 5 seeds: success, collision (mean ± s.e.), upper share
policy          Ta   success%     collision%  upper share (5 seeds)
MSE-500          8    1.0±0.9   99.0±0.9     --   -- 1.00 0.00   --
MSE-20000        1   97.6±1.2    2.4±1.2   0.65 0.36 0.79 0.48 0.44
MSE-20000        4   90.4±5.8    9.6±5.8   1.00 0.00 0.87 0.55 0.41
MSE-20000        8   68.8±12.4   31.2±12.4   1.00 0.00 0.88 0.14 0.69
DDPM-100         1   81.1±3.7   15.4±3.7   0.45 0.45 0.60 0.46 0.24
DDPM-100         4   95.6±1.4    4.4±1.4   0.57 0.43 0.57 0.47 0.51
DDPM-100         8   98.1±0.4    1.9±0.4   0.61 0.43 0.58 0.47 0.53
DDIM-10          1   75.7±3.2   23.6±3.0   0.17 0.59 0.72 0.36 0.19
DDIM-10          4   86.2±3.0   13.7±3.0   0.32 0.56 0.69 0.49 0.39
DDIM-10          8   91.1±2.0    8.9±2.0   0.38 0.53 0.70 0.48 0.47
```

How to read these numbers:

1. **46.9% does not reproduce, and it depends on the reading.** Using the appendix definition on the 18 columns, I get +39.7% for the mean of the last 10 checkpoints and +21.7% for the best checkpoint; the paper says 15 tasks without listing the columns, and I did not try other column subsets. A few columns pull the mean: under the last-10 reading, state-input ToolHang alone is +181% and Kitchen p4 is +125%; without the largest column the mean drops to +31.4%. Under the best-checkpoint reading, columns where the baseline already scores 1.00 (Lift, Can) leave no room for improvement. The conclusion stands, since the advantage shows up mostly on the hardest columns, but "46.9%" is not a stable quantity to quote.
2. **At the start, regression gives a plan close to the "average".** In the demonstrations the last point of the first plan has a $y$ offset of about ±0.52, half above and half below. The 500-step regression policy outputs a mean $|y|$ of only 0.04, 100% of its plans lie between the two modes, and 99.0% of its rollouts hit the obstacle. At 20,000 steps the mean $|y|$ is still only 0.12 and still all between the modes, and from an identical start it gives the same plan every time: across 400 samples the share with $y>0$ is either 0 or 1, and which side it picks is an accident of the seed (2 of the 5 seeds go up, 3 go down).
3. **From the same start, the diffusion policy gives a distribution.** Among its 400 100-step DDPM plans the share with $y>0$ is 0.49 to 0.61 against 0.45 to 0.58 in the demonstrations, the mean $|y|$ is 0.49, and only 3% lie between the modes; for 10-step DDIM the share is 0.45 to 0.62 and 9% lie between the modes.
4. **Whether regression succeeds depends on how fast the loop closes.** The fully trained regression policy succeeds in 97.6% of rollouts at $T_a=1$, and drops to 90.4% and 68.8% at $T_a=4$ and 8, with collisions rising to 9.6% and 31.2%. My reading, which I did not test separately: at $T_a=1$ the policy looks at its position every step, so any small departure from the axis gets amplified and it effectively picks a side as it goes; with a longer horizon it runs a plan close to the "average" open loop and drives straight into the obstacle. Its upper share is erratic too: at $T_a=8$ the five seeds give 1.00, 0.00, 0.88, 0.14 and 0.69, not the 50/50 of the demonstrations.
5. **A longer execution horizon makes the diffusion policy more stable.** Success is 81.1% ($T_a=1$), 95.6% (4) and 98.1% (8), and collisions are 15.4%, 4.4% and 1.9%. My guess: at $T_a=1$ it resamples every step and can flip sides near the start, where the two routes diverge, whereas at $T_a=8$ one sampled plan runs for 8 steps, enough to leave the dividing region. That matches the paper's argument that action sequences give temporal consistency. The toy has no external disturbances, so the other end of the trade-off, a horizon so long that the policy reacts slowly, does not show up.
6. **DDIM with 10 steps is ten times cheaper and costs something.** Success is 75.7%, 86.2% and 91.1%, which is 5.4, 9.4 and 7.0 points below 100-step DDPM, and the share of start-state plans between the modes rises from 3% to 9%. The paper has no simulation ablation on the number of DDIM steps; these numbers only show the trade-off on this small task.
7. **Success rate is not coverage.** Both routes are valid here, so the regression policy at $T_a=1$ (97.6%) beats the diffusion policy (81.1%) on success. The value of modeling multimodality is reproducing the demonstration distribution and staying consistent over longer execution horizons, not winning on this one metric.

**What I changed along the way.** This experiment did not work the first time. (1) In the first version, a diffusion policy trained for 6,000 steps still had 35% of its start-state plans between the two modes (one seed) and a success rate of 45% at $T_a=8$, so I raised both policies to 20,000 steps. The regression policy also has to be trained enough: in a separate run I measured its success at 500, 2,000, 4,000 and 20,000 steps ($T_a=4$, 5 seeds) as 3.1%, 30.1%, 55.2% and 90.4%, so much of "regression policies hit the obstacle" is under-training, which is why the table lists a 500-step version on its own. (2) In the first DDIM implementation I did not clip the estimate of $x_0$ and success was close to 0: with the squared cosine schedule $\bar\alpha\approx0$ at the last step and estimating $x_0$ divides by $\sqrt{\bar\alpha}$, which blows up; clipping to $[-1,1]$ fixed it. (3) All numbers above come from one complete run of the code above (the Chinese and English pages were each run in full and agree).

## Limitations and what to keep in mind

- **"46.9%" is an average of relative gains.** It is very sensitive to columns where the baseline is weak, and the baselines come from different sources: LSTM-GMM is the authors' reproduction, while BET and IBC use the numbers from their original papers (Section 5.2).
- **Evaluation details.** The Robomimic tasks actually use only 22 initial conditions; a footnote attributes this to a bug in the evaluation code and says it does not change the conclusion because all baselines are evaluated the same way. On real Push-T, IBC uses the checkpoint with the lowest action-prediction error on the training set because of its unstable training, while the other methods use the last checkpoint.
- **Few real-robot trials.** Most have 20 trials, so one trial is 5 percentage points; the bimanual tasks have no baseline.
- **The two variants win in different places.** The CNN variant needs little tuning but struggles with fast-changing actions; the Transformer is stronger but more sensitive to hyperparameters, as the paper acknowledges.
- **Cost and data.** The paper lists two limitations itself: it inherits the problems of behavior cloning (poor performance with inadequate demonstrations; it can be combined with paradigms such as reinforcement learning), and inference costs and latency are higher than for simple methods like LSTM-GMM, which action-sequence prediction only partly mitigates and may not suffice for high-rate control.
- **Limits of the toy.** No images; an MLP instead of the paper's CNN or Transformer; no EMA; no external disturbances; both routes are valid, so success cannot measure coverage; only 5 seeds (standard errors of the success rate range from 0.4 to 12 points); the DDIM clipping and the number of training steps were tuned, as disclosed above.

## What to take from this paper

1. **Treat the policy as a conditional generative model.** The observation is only a condition and the output is a whole sequence of actions; training is still regression, with noise as the target.
2. **Multimodality does not come from a different loss function.** At the same observation a diffusion policy can head toward different ways of acting on different samples; a deterministic regression policy, at an ambiguous state, either outputs the average or happens to lean to one side.
3. **Action chunking and a receding horizon go together.** Predicting a chunk gives consistency, executing only part of it gives responsiveness; $T_a$ is the knob between consistency and reaction speed.
4. **Stability comes from learning the score, not the energy.** There is no normalization constant to estimate, so hyperparameters mostly carry over between tasks.
5. **Ask which reading a number uses.** Average improvements, best checkpoints and success rates from a handful of trials all need a trip back to the table.

## Further reading

- Paper: [Diffusion Policy: Visuomotor Policy Learning via Action Diffusion](https://arxiv.org/abs/2303.04137); project page [diffusion-policy.cs.columbia.edu](https://diffusion-policy.cs.columbia.edu).
- The diffusion machinery it builds on: the posts on [DDPM](https://dmxsf.com/en/blog/ddpm-denoising-diffusion-probabilistic-models/) and [Flow Matching](https://dmxsf.com/en/blog/flow-matching-for-generative-modeling/); for another take on "learn a model of the world, then act" see the post on [World Models](https://dmxsf.com/en/blog/world-models-ha-schmidhuber/).
- The original implicit policy paper: Florence et al., Implicit Behavioral Cloning ([arXiv:2109.00137](https://arxiv.org/abs/2109.00137)).
- Related Wiki on this site: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/) (behavior cloning is the same recipe as supervised fine-tuning).
- Glossary: [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning), [Diffusion Policy](https://dmxsf.com/en/glossary/#diffusion-policy), [Action chunking](https://dmxsf.com/en/glossary/#action-chunking), [DDIM](https://dmxsf.com/en/glossary/#ddim), [DDPM](https://dmxsf.com/en/glossary/#ddpm).

## FAQ

### What is Diffusion Policy, and how does it differ from ordinary behavior cloning?

Diffusion Policy (Chi et al., 2023) is a robot policy that conditions on the last 2 observations, starts from Gaussian noise, and uses a conditional DDPM to denoise 16 future actions at once, of which it executes the first 8 before replanning. Ordinary behavior cloning regresses an action, or fits a Gaussian mixture; a regression policy can only output the conditional mean, so several valid ways of acting get averaged. Diffusion Policy is still trained by regression, but the target is the noise added to the action sequence.

### Why predict a sequence of actions and execute only part of it?

One chunk comes from a single sample, so consecutive steps stay within the same way of acting, and replanning lets the policy react to new observations. The paper's ablation found 8 execution steps best for most tasks, with longer ones reacting too slowly, and it tolerates up to 4 steps of latency. In my 2D obstacle toy, a diffusion policy executing 1, 4 and 8 steps succeeds in 81.1%, 95.6% and 98.1% of rollouts; a regression policy goes the other way, at 97.6%, 90.4% and 68.8%.

### Can the paper's 46.9% average improvement be reproduced?

Appendix B.2 defines it: per column, take the better of the two Diffusion Policy variants, compare it with the strongest baseline as a relative gain, and average over columns. Recomputing over 18 columns (the ph and Push-T columns of Tables 1 and 2, the Block Push and Kitchen columns of Table 4) gives +39.7% for the mean of the last 10 checkpoints and +21.7% for the best checkpoint, neither equal to 46.9%; the paper does not list which columns it used. A few columns dominate the mean: without the largest, the first reading drops to +31.4%.

### How many denoising steps does inference need, and does it run in real time?

The paper trains with 100 steps and uses 100 inference steps in simulation. On real robots it uses DDIM to skip steps: the main text says 10 inference steps and 0.1 s latency on an Nvidia 3080, while Table 7 in the appendix lists 16 steps for the real tasks. In my toy, DDIM with 10 steps (a tenth of the network evaluations) succeeds in 75.7%, 86.2% and 91.1% of rollouts at execution horizons 1, 4 and 8, which is 5 to 9 points below 100-step DDPM.
