- The paper presents D-SafeMPC, a framework that integrates denoising diffusion models with discrete-time CBF/CLF constraints to robustly enforce safety and task success.
- It employs a reverse diffusion process combined with MPC projection to generate feasible, safe trajectories in dynamic environments with both static and moving obstacles.
- Experimental results show improved safety success rates and reduced computation times compared to baseline methods, highlighting the methodโs practical potential.
D-SafeMPC: Diffusion-Driven Safe Model Predictive Control with Discrete-Time Control Barrier Functions
Introduction
The paper presents D-SafeMPC, a trajectory planning framework that tightly integrates denoising diffusion probabilistic models (DDPMs) with Model Predictive Control (MPC) under discrete-time Control Barrier Function (CBF) and Control Lyapunov Function (CLF) constraints. The objective is to guarantee safety and goal-directedness during both the planning and execution phases, especially in environments with static and dynamic obstacles. Unlike approaches that use diffusion models for policy synthesis but lack hard constraint enforcement, D-SafeMPC combines soft constraint guidance in diffusion with explicit constraint enforcement in real-time via MPC, leveraging the CBF and CLF structures for fine-grained control throughout the planning horizon.

Figure 1: Overview of the D-SafeMPC framework, showing the interleaved reverse diffusion process, CBF/CLF-guidance, and MPC-based projection in trajectory planning.
Framework and Methodology
The diffusion component of D-SafeMPC is built on a conditional DDPM, trained on demonstration data to model the distribution of state-action trajectories. During inference, an iterative reverse diffusion process denoises an initial trajectory corrupted with Gaussian noise. To enforce safety and goal convergence, gradients derived from discrete-time CBFs (for obstacle avoidance) and CLFs (for stabilization to the goal) are injected into the denoising process. This classifier-guidance approach shifts the mean of the diffusionโs denoising distribution toward safe and goal-seeking regions, but does not guarantee satisfaction of hard state or input constraints.
To close this gap, after the burn-in period of the reverse diffusion, the trajectory at each denoising step is projected using an MPC. The MPC solves a finite-horizon constrained optimal control problem, initialized with the CBF/CLF-guided trajectory, and enforces explicit safety and dynamic constraints as hard inequalities. The corrected trajectory from the MPC is then used as input for the next denoising iteration, thus maintaining a tight feedback loop between the generative and optimization modules.
This interleaving of guidance and projection at each denoising step ensures that initializations for the MPC are close to feasible, leading to improved convergence and planning robustness even in the presence of highly nonconvex constraints or challenging dynamic environments.
D-SafeMPC generalizes the discrete-time CBF framework for obstacle avoidance, formulating the safe set C as the superlevel set of a smooth, possibly soft-min aggregated, CBF. The forward invariance of the safe set is certified at each time step using these barrier conditions. CLF constraints are similarly treated for ensuring convergence toward a goal state or set.
The guidance in the denoising step is handled by a local linear expansion of the CBF and CLF log-probabilities, resulting in a Gaussian mean shift that is computable using only gradient information evaluated at the denoiserโs predicted mean. Adaptive weights on the guidance term account for conflicting requirements between safety and goal-reaching, allowing dynamic emphasis as the robot nears obstacles or the target region.
Empirical Validation
The framework is experimentally validated in both simulated and sim-to-real settings using a Franka Emika Panda manipulator, with static and dynamic obstacle avoidance scenarios. The D3IL dataset provides diverse human demonstration trajectories in a MuJoCo environment. The experiments highlight several key findings:
- Safe-Success Rate: D-SafeMPC achieves the highest or near-highest safety-compliant goal-reaching rates in all dynamic environments, robustly outperforming baseline diffusion-only, soft-guidance, pure MPC, and hybrid DPCC planners across a range of settings.
- Stability in Hybrid Integration: Unlike methods where poor diffusion initializations can cause the MPC solver to diverge or fail, the CBF/CLF-guided denoising in D-SafeMPC ensures that the majority of candidate trajectories are feasible, leading to stable and efficient projections.
- Computation Time: The guidance mechanism yields better warm-starts for MPC, reducing computation times compared to standard DPCC and post-processing baselines, making the system suitable for real-time applications in moderate-dimensional continuous control.

Figure 2: Average computation time for each planner per action in the static obstacle environment, illustrating the improved computational footprint of D-SafeMPC relative to other MPC-based baselines.
Practical and Theoretical Implications
D-SafeMPC provides a principled mechanism for combining the sample diversity and multi-modal behavior generation of diffusion models with the hard-constrained optimal control capabilities of MPC. The use of discrete-time CBFs enables formal safety certificates in sample-and-hold digital implementation settings typical of modern robots. Integrating CLFs allows for high-level task specification within the same framework.
From a practical standpoint, the proposed approach simplifies the incorporation of new environment constraints without requiring retraining of the generative model. In sim-to-real experiments, the architecture demonstrates transferability of safety-critical behaviorsโprovided the sim-to-real mismatch is managed in the low-level control and environment modeling.
Limitations and Future Directions
While the method demonstrates strong empirical safety and success rates in moderate-dimensional robotic systems (such as articulated manipulators), its reliance on efficient MPC solvers limits scalability to high-dimensional, partially observed, or vision-input domains where real-time optimization remains a bottleneck. The recursive conditioning of diffusion rollouts on the robotโs state exacerbates error propagation if earlier predictions are inaccurate.
Potential avenues for progress include approximate or learning-based MPC surrogates, differentiable constraint handling for the denoising process natively, and extending the CBF/CLF framework to broader classes of hybrid systems or high-dimensional observation spaces. Additionally, the theoretical analysis of convergence and global safety guarantees under stochastic, multi-modal generative policies remains open for future investigation.
Conclusion
D-SafeMPC constitutes a rigorously designed hybrid planning framework where diffusion models and constrained optimization cooperate at each iterative planning step to achieve both safety and task success under dynamic and uncertain environments. By leveraging discrete-time CBF and CLF guidance inside the generative model as well as explicit MPC-based projection, it addresses limitations of prior approaches relying solely on diffusion-based soft guidance or uninitialized optimization. The experimental evidence corroborates the benefits in both task performance and computational efficiency. This framework provides a compelling path for future work on scalable, safe, and flexible planning and control in robotics and related continuous control domains.