Safe Flow Matching: Robot Motion Planning with Control Barrier Functions

Xiaobing Dai, Dian Yu, Shanshan Zhang, Zewen YangarXiv 2025 · DOI

Introduction

Generative models, particularly diffusion models, have emerged as powerful tools for robot motion planning, enabling agents to learn complex, multi-modal behaviors from expert demonstrations. However, these models face two significant hurdles for real-world deployment: computational latency and a lack of formal safety guarantees. Diffusion models typically require numerous iterative denoising steps, making them slow for real-time applications. Furthermore, as black-box models, they cannot guarantee that generated trajectories will remain collision-free in novel environments.

To address these challenges, the SafeFlow framework introduces a deterministic approach to generative motion planning. By leveraging Flow Matching (FM) and integrating Control Barrier Functions (CBFs), SafeFlow provides a method that is both significantly faster than diffusion-based alternatives and mathematically guaranteed to be safe.

The SafeFlow Framework

SafeFlow shifts the paradigm from stochastic diffusion to deterministic Flow Matching. FM learns a vector field that maps a simple prior distribution (noise) to the target data distribution (expert trajectories) over a fixed time interval $t \in [0, 1]$.

Extracted figure from page 1 of Safe Flow Matching: Robot Motion Planning with Control Barrier Functions

The core innovation is the Flow Matching Barrier Function (FMBF). Unlike traditional safety filters that operate on the robot's physical state, FMBF operates directly on the generative vector field. At each step of the generation process:

  1. Nominal Flow: The model predicts a nominal velocity $v_t$ based on the learned task distribution.
  2. Safety Constraint: The system evaluates the trajectory against barrier functions representing obstacles.
  3. Quadratic Programming (QP): If the nominal path risks entering an unsafe region, SafeFlow solves a small-scale QP problem to find the minimal correction $u_t$. This ensures the resulting vector field satisfies the safety conditions.
  4. Prescribed-time Safety: To ensure the trajectory reaches a safe terminal state by $t=1$, the authors utilize "blow-up" functions that provide increasingly strong corrective forces as the planning horizon approaches.

Experimental Evaluation

The researchers tested SafeFlow across two distinct domains designed to challenge both its generative capabilities and its safety mechanisms:

  1. 2D Maze Navigation: A robot must navigate a complex maze. While the model was trained on "clean" expert data, three elliptical obstacles were introduced during testing to evaluate zero-shot safety adaptation.
  2. 7-DoF Manipulation: A Franka Research 3 robot arm was tasked with reaching a target in joint space. Spherical obstacles were placed in the workspace during inference to test the model's ability to modify high-dimensional joint trajectories.

Results and Insights

SafeFlow demonstrated superior performance across safety, speed, and trajectory quality metrics compared to state-of-the-art baselines like SafeDiffuser and CoBL.

  • Guaranteed Safety: SafeFlow achieved a 100% safety rate in all test scenarios. In contrast, standard Flow Matching and Diffusion models often failed completely when faced with new obstacles, showing safety rates as low as 0%.
  • Computational Efficiency: SafeFlow is an order of magnitude faster than iterative diffusion methods. In the navigation task, it generated safe paths in 0.38s, whereas some safe diffusion variants required nearly 30s.
  • Zero-Shot Adaptation: A key advantage of this approach is that it requires no retraining. The safety constraints are applied at inference time, allowing a model trained on obstacle-free data to navigate cluttered environments successfully.
Extracted figure from page 8 of Safe Flow Matching: Robot Motion Planning with Control Barrier Functions

Conclusion and Future Work

SafeFlow represents a significant step toward deploying generative motion planners in safety-critical environments. By combining the deterministic efficiency of Flow Matching with the rigorous guarantees of Control Barrier Functions, it overcomes the primary limitations of diffusion-based planning. Future research will focus on extending FMBFs to dynamic environments with moving obstacles and integrating the framework with raw sensory inputs like point clouds to remove the dependency on predefined mathematical obstacle shapes.

BibTeX
@misc{dai2025safe,
  author = {Xiaobing Dai and Dian Yu and Shanshan Zhang and Zewen Yang},
  title = {{Safe Flow Matching: Robot Motion Planning with Control Barrier Functions}},
  year = {2025},
  eprint = {2504.08661},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.08661},
}