SafeDiffuser: Safe Planning with Diffusion Probabilistic Models

Wei Xiao, Tsun-Hsuan Wang, Chuang Gan, Daniela Rus

TL;DR

SafeDiffuser is a novel framework that brings formal safety guarantees to trajectory planning using diffusion probabilistic models. By embedding Control Barrier Functions (CBFs) directly into the denoising process, the researchers from MIT ensure that generated robot paths satisfy complex safety constraints without compromising the model's ability to generalize to new environments.

What Problem Does This Paper Address?

Diffusion models have recently revolutionized generative AI, and their application to robotics—specifically for generating planning trajectories—shows immense promise. These "diffusers" can synthesize flexible behaviors that generalize well to novel scenarios. However, they are fundamentally probabilistic and lack formal safety guarantees. In safety-critical applications like autonomous driving or industrial manipulation, a "mostly safe" plan isn't good enough; one collision can be catastrophic.

The core challenge is that standard safety methods, like Control Barrier Functions, are typically designed for real-time control based on physical robot dynamics. Applying them to the generation phase of a diffusion model is difficult because the intermediate, noisy states during the denoising process don't correspond to physical reality. The authors aim to bridge this gap by ensuring that the final, clean trajectory generated by the model is guaranteed to be safe.

Methods

The authors introduce the concept of finite-time diffusion invariance. They treat the denoising process (moving from Gaussian noise to a clean trajectory) as a dynamical system. By applying control-theoretic principles to this "diffusion time," they can steer the generation process toward a safe set of trajectories.

The key technical component is the integration of a Quadratic Program (QP) solver at each denoising step. Instead of just following the model's predicted gradient, SafeDiffuser solves a QP to find the minimal adjustment to the update that satisfies a safety constraint defined by a CBF.

The paper proposes three variants to handle different planning challenges:

  1. Robust-Safe (RoS) Diffuser: Enforces safety constraints strictly throughout the denoising process.
  2. Relaxed-Safe (ReS) Diffuser: Uses relaxation variables to prevent the model from getting stuck in "local traps"—regions where the safety constraints are satisfied but the overall plan is poor.
  3. Time-Varying-Safe (TVS) Diffuser: Gradually tightens safety constraints as the denoising process nears completion, allowing for more exploration in the early, noisier stages.
Fig. 2: The proposed SafeDiffuser workflow. SafeDiffuser performs an additional step of invariance QP solver in the diffusion dynamics to ensure safety. The final control signal is inferred from safe planning trajectories.

Datasets

The researchers evaluated SafeDiffuser on several benchmarks:

  • Maze2D: A path-generation task in a maze with elliptical and super-elliptical obstacles. Training data was sourced from the publicly available Maze2D-large-v1 dataset.
  • MuJoCo Locomotion: Tasks involving the "Walker2D" and "Hopper" robots, where the goal is to move forward while avoiding a "roof" (height constraint).
  • Pybullet Manipulation: A 3D manipulation task where a robot arm must move objects while staying within specific joint angle and speed limits.

Key Insights and Ideas

  • Safety in "Diffusion Time": The most significant insight is treating the denoising steps as a temporal dimension for control. This allows the use of Lyapunov-based methods (like CBFs) in a space that is usually purely probabilistic.
  • Handling Local Traps: The authors identified that strict safety early in generation can be counterproductive. Because the starting point is random noise, it might start in an "unsafe" configuration. The Relaxed and Time-Varying versions allow the model to "drift" into safety gracefully, which is crucial for complex environments like mazes.
  • Performance Preservation: Unlike simple "truncation" (clipping values to stay in bounds), the QP approach makes the smallest possible change to the model's intent. This preserves the high-quality, coherent behavior that makes diffusion models attractive in the first place.

Key Results

SafeDiffuser consistently outperformed vanilla diffusers and other common safety techniques like classifier guidance or truncation.

  • Safety Satisfaction: In maze tasks, SafeDiffuser reduced safety violations to near-zero levels (e.g., a score of $-2.384e^{-7}$ vs. $-0.983$ for the baseline).
  • Qualitative Success: As seen in Figure 1, the baseline diffuser often cuts corners or passes through obstacles, whereas SafeDiffuser generates paths that strictly respect the boundaries.
  • Manipulation Rewards: In the Pybullet manipulation task, SafeDiffuser actually increased the task reward (0.925 vs 0.650 for the baseline). The authors attribute this to the fact that staying within joint limits prevents the physical simulator from encountering errors or collisions that would otherwise lower the score.
Fig. 1: Our proposed SafeDiffuser (lower) generates safe trajectories with guarantees, while the diffuser (upper) fails (from J to N).

Limitations and Future Work

  • Differentiability: The current method requires safety specifications to be expressed as continuously differentiable constraints. Handling non-smooth or discrete obstacles remains a challenge.
  • Known Specifications: The safety constraints must be known at inference time. The authors suggest that future work could involve learning these specifications directly from historical trajectory data.
  • Execution Gap: While the plan is guaranteed safe, there is still a gap between planning and execution. Future research could investigate tighter coupling between the generated safe plans and the low-level controllers of the physical robot.
  • Beyond Planning: The authors note that this "safe generation" logic could be applied to other domains, such as ensuring specific patterns or objects appear in generated images.

Summary updated

BibTeX
@inproceedings{xiao2025safediffuser,
  author = {Wei Xiao and Tsun-Hsuan Wang and Chuang Gan and Daniela Rus},
  title = {{SafeDiffuser: Safe Planning with Diffusion Probabilistic Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=ig2wk7kK9J},
}
Figure