08 Diffusion and flow matching

Home | Previous: 07 ACT and Action Sequences | Next: 09 Reinforcement Learning

When two action sequences are both valid, their average need not be valid. A robot can go around an obstacle on the left or right, but averaging those trajectories can hit it. Generative policies learn a distribution over candidate actions.

action_modes.png

Toy mixture of two Gaussian action modes. The conditional mean falls between them.

Denoising intuition

Let be a demonstrated action chunk and . A common diffusion training construction adds noise:

is a noise level, not robot time; controls retained signal. The model learns to predict noise conditioned on observation . A chosen reverse sampler then generates actions through multiple denoising steps. Different parameterizations and schedulers give different implementations.

The Diffusion Policy paper brings diffusion-based action generation into visuomotor control with repeated replanning. Link it to Diffusion Policy - 2303.04137 and UMI - 2402.10329.

Flow matching intuition

A simple conditional flow-matching teaching construction pairs noise with a data action and interpolates:

The learned velocity field moves a sample according to

is generation time, separate from the physical controller’s time. The endpoint at is the generated action. This straight-path formulation is an instructional example; a particular model may use different paths, weighting, or parameterizations. The original Flow Matching paper develops the general framework.

flow_paths.png

Synthetic paired paths show the training construction, not the learned trajectories of pi0.

Demonstrations pass an obstacle on the left () or right (). Samples follow the exact velocity field that minimises for this data, standing in for a perfectly trained model. With 32 Euler steps they split into the two modes and 0.07% of 20,000 samples hit the obstacle. Regression predicts the mean, 0, which hits it. Fewer steps drift toward that mean: one step lands every sample at 0, two steps send 33% into the obstacle, four steps 4.6%. Source: Tools/animations/ch08_flow_two_modes.py.

What matters on your robot

More sampling steps can improve generation but increase latency. A model that represents multiple action modes can still choose the wrong one under perceptual ambiguity. Evaluate controller timing, action bounds, and closed-loop success rather than judging generated trajectories by appearance alone.

Exercise: why should an experiment compare methods under both fixed training data and measured inference cost?

Next connect to 13 Vision Language Action Models.