Diffusion beyond pictures: DiffDock and Diffusion Policy
Diffusion models can generate a molecule's pose or a robot's next moves. DiffDock diffuses over position, orientation and bond angles, where angles wrap around. Diffusion Policy denoises a chunk of actions and runs only its start.
What runs in CodeSplash
- SEQ013DiffDock Explained here
- SEQ010Diffusion Policy Explained here
You will be able to
- Describe DiffDock's pose space and why angles need periodic differences
- Compute a wrapped angle difference
- Explain Diffusion Policy's action chunks and receding-horizon execution
- Say what a docking confidence score and a cloned policy do not establish
Diffusion on other spaces
ReadA denoising diffusionDenoising diffusionAdds noise to data in many small steps and trains a network to undo one step; sampling starts from noise and denoises step by step. model learns to remove noise step by step, so it can turn random noise into a sample. The training loss is the same wherever it is used: predict the noise that was added,
where is the noised sample at level and is what the sample is conditioned on. Here is no longer an image: it is a molecule's pose, or a short sequence of robot actions.
How a diffusion sampler turns noise into samples, step by step.
DExplorable · Diffusion: noise schedule, sampler steps, guidance
How does a diffusion model turn noise back into data, and what do the schedule, the steps and guidance change?
With this sampler and number of steps, will the samples match the data?
β schedule
The forward process at this step: how much signal is left.
Sampler
DDPM adds fresh noise every step; DDIM is deterministic.
0 = unconditional, 1 = plain conditional, above 1 = guided.
Class to guide toward
- Noised samples
- Exact q(xₜ)
- Samples
- Data
Commit your prediction above to see the result
Make your prediction to see the result.
DiffDock: where does the ligand sit?
ReadDocking asks how a small molecule (the ligand) sits in a protein pocket. DiffDockDiffDockA docking model that samples a ligand's pose by diffusion over its position, orientation and bond angles, then ranks the samples. samples poses by diffusion over the pose's real degrees of freedom: a translation in , a rotation in , and torsion anglesTorsion angleThe twist around a rotatable bond. It is periodic, so 179° and −179° are 2° apart, not 358°. on a torus . Each part gets its own noise and score, suited to its space.
A separate confidence model ranks the sampled poses. Its score orders candidates; it is not a calibrated probability of binding, and a good pose is not a measured affinity or a biological effect.
Reference · SEQ013 · Explained hereDiffDockA generative docking method sampling ligand poses relative to a protein using diffusion over translation, rotation, and rotatable-bond torsions. A separate confidence model ranks candidate poses.Angles wrap around
ExploreA torsion angle of 179° and one of −179° are 2° apart, not 358°. The reference computes both: the naive difference is −358° and the wrapped one 2°. Noise, scores and errors on angles must use the wrapped version, or the model learns to move the long way round.
import numpy as np
a, b = np.deg2rad(179.), np.deg2rad(-179.)
print(np.rad2deg(b - a), np.rad2deg(np.arctan2(np.sin(b - a), np.cos(b - a)))) # naive, wrappeda <- 179 * pi / 180; b <- -179 * pi / 180
print(c((b - a) * 180 / pi, atan2(sin(b - a), cos(b - a)) * 180 / pi)) # naive, wrappedThe same wrap breaks ordinary averages of directions. Put the true direction near the 0° seam and compare the two means:
AExplorable · The mean of an angle
What is the average of 350° and 10°?
What does the ordinary arithmetic mean of these angles come to?
Solid arrow: the circular mean, 344.3°, with length R̄ = 0.89. Dashed red: the arithmetic mean, 236.5°, which can point away from every observation.
Commit your prediction above to see the result
Make your prediction to see the result.
Diffusion Policy: a chunk of actions
ReadDiffusion PolicyDiffusion PolicyA robot policy learned from demonstrations that denoises a short sequence of future actions, conditioned on recent observations. learns robot control from demonstrations, a form of behavior cloningBehavior cloningLearns to copy the logged actions from the states (here a multinomial logistic regression): a baseline every learned policy should beat.. Given recent observations , it denoises a whole action chunkAction chunkA block of future actions predicted at once; the controller runs only the first few, then observes and predicts again. , a short sequence of future actions:
The robot executes only the first few actions, observes again and predicts a new chunk. Predicting a chunk keeps motions smooth, and diffusion can represent several valid ways to do a task instead of averaging them into an invalid one.
Reference · SEQ010 · Explained hereDiffusion PolicyA 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.The reference's two pieces
ReadThe reference shows two components on a four-step, two-joint chunk. A denoiser that predicts 0.8 times the true noise scores a noise error of 0.00105. With a two-step execution horizon, the robot runs the first two actions, (0.1, 0.0) then (0.2, 0.1), and replans.
A longer executed prefix replans less often, but it acts longer without feedback.
What cloning doesn't promise
PredictPredict first
A cloned policy imitates demonstrations closely on held-out demo frames. What happens when it runs on the robot?
Reveal
It can drift. Each small error changes the next observation, and the robot can end up in states no demonstration covered, where the policy has no guidance. Evaluate success on the real or simulated task from varied starting states; low denoising loss shows neither safety nor success.
What runs here
ReadCheck: diffusion beyond pictures
CheckpointCheck yourself
Over which degrees of freedom does DiffDock diffuse a ligand's pose?
Show the answer
Answer: b
The pose lives in , and each part gets noise suited to its space.
Check yourself
How many degrees apart are torsion angles of 179° and −179°, going the short way?
Show the answer
Answer: 1.9999999999999918
Angles wrap at ±180°, so the short way round is 2°, not 358°.
Check yourself
DiffDock's confidence model gives a pose a high score. What does that tell you?
Show the answer
Answer: c
Pose ranking is not affinity, and neither is a biological claim. Related proteins in train and test also inflate random-split scores.
Check yourself
Diffusion Policy predicts eight future actions and executes two. Why not execute all eight?
Show the answer
Answer: a
Receding-horizon execution trades fewer replanning calls against acting longer without feedback.
Check yourself
Demonstrators sometimes go left around an obstacle and sometimes right. Why does a diffusion policy handle this better than a model trained by mean squared error on single actions?
Show the answer
Answer: b
A generative policy represents several modes. Regression to the mean picks the average of the modes.
Check yourself
What evidence shows a cloned policy works?
Show the answer
Answer: b
Imitation error compounds when the policy acts. Only task-level evaluation shows success, and safety needs its own checks.
Recap
Recap- Diffusion's noise-prediction loss carries over to poses and action sequences.
- DiffDock diffuses over translation, rotation and torsion angles; angles need wrapped differences.
- Diffusion Policy denoises action chunks and executes only their start before replanning.
- Confidence isn't affinity; imitation loss isn't task success. Both are explained here only.
Concepts in this lesson