Sequences, streaming data, robotics, and scientific extensions · Entry index · SEQ010 · Model
Diffusion Policy
A behavior-cloning approach modeling observation-conditioned sequences of robot actions with diffusion. It generates an action chunk and executes a prefix before replanning with new observations.
In CodeSplash
Documented in the Academy only. There's no Set up button.
- Availability
- Explained here
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's own run
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review, but on a different version of the code. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
A behavior-cloning approach modeling observation-conditioned sequences of robot actions with diffusion. It generates an action chunk and executes a prefix before replanning with new observations. This brings multimodal conditional generation to control, but demonstration imitation alone does not establish stability or optimality.
Question / hypotheses
Which action trajectories are plausible under the observed state and demonstration distribution, and do their executed prefixes accomplish the task? There is no intrinsic H0; task success, closed-loop behavior, latency, and robustness are the relevant evaluation targets.
Architecture / computational structure
Visual or low-dimensional observations condition a denoiser over action sequences. The paper studies suitable convolutional and Transformer-based policy structures; temporal action consistency is handled jointly across a chunk. Receding-horizon execution is part of the deployed system, separate from the training loss.
Assumptions
Demonstrations must have synchronized observations/actions, consistent coordinates, and an adequate range of task states. Deployment feedback and actuation timing must match the training convention. Small imitation errors can change visited states; observational similarity does not imply safe or successful out-of-distribution control.
Formula / computational definition
For action chunk and observation history , and . After reverse diffusion, execute the first actions of a longer predicted horizon and replan. Action constraints require an explicit implementation.
Parameters and notation
Learned parameters: observation encoder, action-denoising network, and conditioning projections. Hyperparameters: observation/prediction/execution horizons, diffusion schedule/steps, control frequency, image augmentation, and action normalization. Longer executed prefixes reduce replanning cost while postponing feedback and increasing open-loop exposure.
Fitting, fine-tuning, and adaptation
Fit on demonstration trajectories with episode-level splits. During transfer, freeze or slowly adapt a pretrained visual encoder while fitting policy layers, then unfreeze selectively if domain shift warrants it. Keep action scaling fixed or recalibrate it deliberately. Tune using closed-loop simulation episodes, including recovery states and changed initial conditions.
How to use and calibrate
Evaluate success rates over many independent episodes, completion time, action smoothness, constraint violations, and end-to-end latency. Compare equal observation/action budgets and planning frequencies. Report confidence intervals over episodes; low denoising or action error by itself is insufficient evidence of reliable control.
Example application
Use a simulated planar reaching task with bounded coordinates to inspect whether sampled trajectories go around an obstacle and how replanning reacts to a shifted target.
Interpretation / pitfalls
Watch out
Python: the authors’ Diffusion Policy implementation or custom conditional denoising controller; R: reticulate plus trajectory analysis. The example merely illustrates chunk slicing and noise loss, with no trained policy, simulator, or control guarantee.
Python and R code examples (dependencies/validation)
Python uses NumPy and the shared mse helper when called; base R uses the shared helper when called. Validation: Python component executed; R companion reviewed, not executed. Scope: the specific component described above, not the full model or its training.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — synthetic mathematical component, not a full-model implementation
Shared setup for this chapter
import numpy as np
def mse(a,b):
a,b=np.asarray(a),np.asarray(b)
if a.shape!=b.shape or a.size==0:
raise ValueError("MSE needs nonempty equal shapes")
return float(np.mean((a-b)**2))
chunk=np.array([[.1,.0],[.2,.1],[.2,.2],[.3,.2]])
noise=np.array([[.1,-.1],[.2,.1],[-.1,.3],[.0,-.2]])
result={"noise_mse":mse(.8*noise,noise),"executed_prefix":chunk[:2].tolist()}
print(result)
Component demo, not a trained model — synthetic mathematical component, not a full-model implementation
Shared setup for this chapter
mse <- function(a,b) {
stopifnot(length(a)>0L, identical(dim(a),dim(b)), length(a)==length(b))
mean((a-b)^2)
}
chunk <- rbind(c(.1,0),c(.2,.1),c(.2,.2),c(.3,.2))
noise <- rbind(c(.1,-.1),c(.2,.1),c(-.1,.3),c(0,-.2))
result <- list(noise_mse=mse(.8*noise,noise),executed_prefix=chunk[1:2,,drop=FALSE])
print(result)
Sources
- Source 1arxiv.org
From the CodeSplash reference, entry SEQ010.