PTENES
← Track 1 MODULE 1.5

🌫️ Diffusion Policy and Flow Matching

The math that generates multimodal actions from noise. Diffusion Policy made trajectory denoising the baseline for fine manipulation; flow matching simplified training and takes π0 to 50Hz. Here you'll understand the reverse process, conditioning, and inference cost.

6
Topics
~50
Minutes
Advanced
Level
Theory
Type

Detailed content

pure noise step k step 1 clean action reverse process: each step predicts and removes a little noise (conditioned on the observation)

Generate action as denoising: starts with Gaussian noise and refines it into an executable trajectory.

1

🎲 Why diffusion for action

In Module 1.4, we saw that MSE collapses modes. Diffusion solves this by modeling the action as a sampling from a conditional distribution: instead of predicting a value, it learns to transform Gaussian noise into a valid trajectory through denoising. As a sample, it naturally captures multimodal distributions — chooses one coherent mode instead of the average. And by generating the entire trajectory (chunk), it produces smooth, consistent movements.

💡 Three advantages of diffusion

Multimodal: represents “left OR right” without averaging. Trajectory: generates smooth chunks of future actions. Stable during training: the denoising objective is well-behaved, without GAN instability.

Denoising

Refine noise into action.

Multimodal

Captures multiple modes.

Trajectory generation

Generates an entire chunk.

Sampling

Action as a sample, not an average.

2

🌊 Diffusion Policy (2023)

Diffusion Policy (Chi et al., 2023) applied DDPM to control: a network (1D U-Net or transformer) denoises a sequence of future actions conditioned on the observation. Combines action chunking (predict H steps) with receding horizon (execute part, re-predict). It beat baselines in fine manipulation and became the gold standard for dexterous tasks—including Octo's action head.

# Diffusion Policy — inferência (esboço)
A = torch.randn(H, action_dim)          # ruído inicial
for k in reversed(range(K)):            # K passos de denoising
    eps = net(A, k, obs_cond)           # prevê o ruído
    A = ddpm_step(A, eps, k)            # remove um pouco
execute(A[:exec_horizon])               # receding horizon

📊 Why it worked

  • Multimodal — solves tasks with alternative solutions.
  • Stable — robust training across hyperparameters.
  • Chunking — smooth trajectories, less jitter.

DDPM

Denoising diffusion model.

Receding horizon

Execute part of it, re-predict.

1D U-Net

Common denoiser backbone.

Gold standard

Fine manipulation baseline.

3

📐 Score matching and the reverse process

Under the hood, diffusion has a forward process that adds Gaussian noise to the action over K steps until it becomes pure noise, and a reverse process learned to undo it. The network learns the score — the log-density gradient ∇log p(a) — equivalent to predicting the added noise. The conditioning the observation enters via FiLM or cross-attention, making generation depend on what the robot sees.

1

Forward: add noise

The clean action becomes Gaussian noise in K steps (defined by a schedule).

2

Learn the score

The network predicts the noise (≈ score), minimizing a simple regression error.

3

Reverse: sampling

Starting from noise, applies the score K times, conditioned on the observation.

⚡ Practical tip

Conditioning is what makes the policy reactive: without it, you sample plausible actions disconnected from the scene. FiLM is lightweight; cross-attention is more expressive. Choose based on your budget.

Score function

Log-density gradient.

Reverse process

Undo the noise step by step.

Conditioning

FiLM / cross-attention in the obs.

Noise schedule

How noise grows with K.

4

➡️ Flow Matching and its use in π0

Flow Matching generalizes diffusion: instead of a stochastic denoising process, it learns a vector field that transports noise→action through a Continuous ODE. With conditional flow matching, the training target is simply the velocity along a path (often straight) between noise and data—a simpler, more stable objective. The π0 uses exactly this in its action expert to generate smooth continuous actions at 50Hz.

✓ Advantages of flow matching

  • ✓Simpler and more stable training than DDPM.
  • ✓Straight paths require fewer inference steps.
  • ✓High-frequency continuous action (π0 at 50Hz).

✗ Precautions

  • ✗Still requires integrating the ODE (multiple NFEs).
  • ✗Sensitive to path parameterization.
  • ✗Requires a well-conditioned action expert.

Flow matching

Noise-to-action transport via ODE.

Vector field

Learned velocity along the path.

ODE

Continuous deterministic process.

π0 action expert

Flow matching at 50Hz.

5

⚡ Inference cost and distillation

The central cost of generative policies is number of function evaluations (NFE) — Each denoising/integration step is a forward pass. Classic DDPM uses tens to hundreds of steps, impractical at 50Hz. Solutions: fast samplers (DDIM), consistency models (generate in 1-2 steps) and distillation from a slow model to a fast one. Flow matching with straight paths already reduces NFE naturally.

📊 Step budget

  • 50-100 NFE — Naive DDPM; high quality, high latency.
  • ~10 NFE — DDIM / flow with a straight path; a good balance.
  • 1-2 NFE — distilled consistency models; real time.

💡 Latency vs. quality

Combine few NFEs with action chunking: generate a chunk with 5-10 steps and execute it while resampling. This lets you retain diffusion’s expressiveness within the real-time budget.

NFE

Sample-based evaluations.

Consistency model

Generates in 1-2 steps.

Distillation

Slow → fast.

DDIM

Fast deterministic sampler.

6

⚖️ Diffusion vs. autoregressive

The key design choice for the action head: diffusion/flow generation versus autoregressive tokens. Diffusion is more expressive (continuous multimodal output) but requires multiple steps. Autoregressive methods (RT-2, OpenVLA, FAST) reuse the LLM backbone and are simple to train, but generate one token at a time, and discretization can limit fidelity. There is no universal winner—the trade-off is expressiveness × latency × ease of integration.

Eixo            Difusão/Flow        Autoregressivo (tokens)
expressividade  alta (multimodal)   média (depende da disc.)
latência        K passos por chunk  1 forward, N tokens
integração      action expert extra reusa o backbone LLM
exemplos        Diffusion Policy,π0 RT-2, OpenVLA, FAST

⚡ Practical tip

Dexterous, continuous task → diffusion/flow. Simple integration on top of a VLM and unified autoregressive training → tokens (and Module 1.6 shows how FAST makes this competitive).

Expressiveness

Capture rich distributions.

Latency

Steps vs tokens per action.

AR vs. diffusion

Two head paradigms.

Integration

Whether to reuse the backbone.

✅ Module summary

✓
Diffusion for action — denoising captures multimodality that MSE misses.
✓
Diffusion Policy — DDPM + chunking + receding horizon, the fine-tuned baseline.
✓
Flow matching — ODE with a straight path, stable training, π0 at 50Hz.
✓
Cost and trade-off — NFE/distillation control latency; diffusion vs. AR has no single winner.

Next module

1.6 — Action tokenization: discrete, continuous, and FAST, wrapping up Track 1.