Safe Streaming Flow Planning by Aligning Sampling Dynamics with Execution Dynamics
Authors: Seunghwan Jang, Jeongyong Yang, Siddharth Ancha, SooJean Han
Organizations: Nanyang Technological University Singapore · KAIST Daejeon, Republic of Korea · University of Washington Seattle, WA, USA · University of California, Berkeley Berkeley, CA, USA
Generative planners based on diffusion/flow matching can learn to synthesize long-horizon trajectories from demonstrations. However, real-world deployment requires (i) enforcing safety constraints during execution and (ii) tight online replanning at fast execution rates. Prior safe diffusion/flow planners generate the agent's full trajectory at once, while repeatedly perturbing intermediate states to satisfy safety constraints. This approach is not only computationally intensive, but also introduces distribution shift since the learned sampling dynamics is distinct from the system's execution dynamics. We propose SafeStreamingFlow, a goal-conditioned planner that aligns flow sampling dynamics with execution dynamics by sequentially integrating a learned state vector field with hierarchical state prediction. Importantly, we need to enforce safety constraints only for the executed step via high order control barrier functions. Across navigation, racing, and locomotion benchmarks, SafeStreamingFlow reduces planning latency and improves safety compared to existing methods, while maintaining competitive goal-reaching success.
Figures & tables
Figure 1: SafeStreamingFlow aligns flow sampling dynamics with execution dynamics. (a) Trajectory-level safe planners denoise an entire trajectory along a sampling process distinct from the system’s execution dynamics (blue and orange arrows misaligned). Because these intermediate sampling states are not physically executed, enforcing safety during sampling disrupts dynamical consistency and requires O(HK) optimization solves. (b) SafeStreamingFlow integrates a learned state vector field in physical time, so each sampling step coincides with an executed step (blue and orange aligned). A safety constraint imposed on the sampling dynamics is therefore a constraint on the executed state under the system model, yielding per-step safety enforcement with O(H) optimization solves (versus O(HK) ), closed-loop execution without architectural or computational change, and dynamically consistent plans whose executed trajectory matches the generated one by construction.
Paradigm
Cost-fn. free
Multimodal
Exec. safety
Real-time
Classical (RRT*, A*)
✗
✗
✓
△
Generative (Diffuser, SafeDiffuser)
✓
✓
△
✗
SafeStreamingFlow (Ours)
✓
✓
✓
✓
Table 1: Conceptual positioning of SafeStreamingFlow against existing planning paradigms.
Figure 2: One step of SafeStreamingFlow , following Eqs. ( 15 )–( 18 ).
Umaze ( H=128 ; K=64 )
Medium ( H=256 ; K=256 )
Large ( H=384 ; K=256 )
Category
Method
Succ.
hˉmin>0
Viol.
Sm.
Trap
Succ.
hˉmin>0
Viol.
Sm.
Trap
Succ.
hˉmin>0
Viol.
Sm.
Trap
Classical
RRT* [ 18 ]
91.0
✓
5.0
1.980±2.582
-
94.0
✓
1.0
0.629±0.678
-
86.0
✓
8.0
0.592±0.548
-
A* [ 10 ]
93.0
✓
7.0
2.613±3.404
-
85.0
✓
14.0
1.377±1.143
-
85.0
✓
6.0
0.689±0.628
-
Diffusion
Diffuser [ 14 ]
94.0†
-
38.0
57.560±19.586
-
94.0†
-
53.0
59.995±11.655
-
74.0†
-
65.0
59.939±8.099
-
Diffuser + CG [ 7 ]
36.0
✓
51.0
302.012±375.947
82.0
2.0
✓
56.0
6.87×103±6.00×104
100.0
1.0
✓
37.0
4.49×104±4.39×105
100.0
SafeDiffuser [ 28 ]
67.0
✓
33.0
107.749±190.770
24.0
49.0
✓
46.0
59.366±9.082
0.0
13.0
✓
71.0
70.873±30.022
18.0
Table 2: Maze2D results across Umaze, Medium, Large maps.
Budapest ( H=696;K=512 )
Catalunya ( H=724;K=512 )
Category
Method
Succ.
hˉmin>0
Viol.
Sm.
tOpt (s)
ttotal (s)
Succ.
hˉmin>0
Viol.
Sm.
tOpt (s)
ttotal (s)
Diffusion
Diffuser [ 14 ]
79.0†
–
80.0
19.22±0.11
–
1.84
69.0†
–
1.0
20.14±0.11
–
1.88
Diffuser + CG [ 7 ]
0.0
✓
86.0
21.02±0.12
0.17
2.07
59.0
✓
0.0
20.15±0.10
0.47
2.40
SafeDiffuser [ 28 ]
0.0
✓
80.0
19.57±0.18
17.88
19.97
0.0
✓
0.0
1.29×104‡
19.59
21.68
Flow Matching
FM [ 30 ]
47.0†
–
30.0
5.89±3.05
–
1.76
68.0†
–
29.0
6.20±4.15
–
1.80
SafeFM [ 30 ]
0.0
✓
0.0
1.93×103‡
17.72
19.72
0.0
✓
0.0
1.50×104‡
19.27
21.28
Table 3: F1TENTH results on the Budapest and Catalunya tracks.
Table 6
Figure 3: Gazebo warehouse executed trajectories. SafeDiffuser (orange) violates the CBF region (red dashed) during execution; SafeStreamingFlow (green) stays clear.
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
Symbol
Meaning
x=(p,v)
state: position and velocity
u , U
control input and admissible input set
f,g ( f~,g~ )
drift and input terms of the dynamics (of the velocity equation)
T , H , Δt=T/H
horizon time, number of steps, sampling time
k , T={0,…,H−1}
discrete step and its index set
K
sampling steps of a trajectory-level baseline
Appendix
Table 6: Notation.
Figure 4: Position prediction loss during training. The FSP quickly reaches near-zero loss by exploiting the kinematic shortcut, whereas HSP converges more slowly to a higher plateau.
Umaze ( H=128 )
Medium ( H=256 )
Large ( H=384 )
Method
Open
Closed
Open
Closed
Open
Closed
FSP
80.2
35.0
51.1
10.8
39.6
5.8
HSP (ours)
94.8
99.7
92.4
91.9
88.6
89.7
Appendix
Table 7: Ablation on HSP and FSP for the kinematic shortcut: goal-reaching success (%) across Maze2D maps, open- and closed-loop, without the safety filter. Evaluated over 1,000 rollouts.
σ0
Goal
Viol.
Succ.
0
81.3±4.2
2.0±1.7
81.3±4.2
0.005
85.0±4.0
3.0±0.0
85.0±4.0
Appendix
Table 8: Training noise σ0 on Maze2D Large (closed loop, safety filter on; mean ± std over three training seeds, 100 rollouts each; violations counted at κ=0 ).
Map
floor ∥r∥2
frac
FSP MSE
HSP MSE
FSP / HSP / floor
Umaze
2.69e−5
2.1e−5
1.31e−5
7.49e−4
0.49 / 27.8
Medium
1.50e−5
3.7e−6
5.81e−6
8.11e−4
0.39 / 53.9
Large
1.27e−5
1.3e−6
4.76e−6
8.99e−4
0.37 / 70.6
Appendix
Table 9: E1/E1b. Data residual floor and per-model next-position MSE (physical units). The shortcut is 5 – 6 orders below Var(pt+Δt) ; FSP sits at the floor, HSP 28 – 71× above it.
Map
analytic slope
measured slope
rel. err
Rmin2
diag. frac
Umaze
(4.696,5.121)
(4.666,5.088)
<0.7%
0.9959
0.9972
Medium
(4.805,4.643)
(4.785,4.643)
<0.5%
0.9959
0.9983
Large
(5.870,4.094)
(5.856,4.080)
<0.4%
0.9967
0.9948
Appendix
Table 10: FSP matches the analytical kinematic-shortcut slope to <1% on every map; the map is essentially linear ( R2≥0.996 , diagonal fraction >0.994 ). HSP ∣J∣max=0 exactly, since its position branch has no v input.
Map
SˉHSP
SˉFSP
SˉFSP/SˉHSP
perm. ratio
Umaze
0.695
1.54e−3
2.2e−3
0.037
Medium
0.173
2.13e−4
1.2e−3
0.026
Large
0.144
1.68e−4
1.2e−3
0.021
Appendix
Table 11: E2. Goal sensitivity, normalized by data-side discriminative variance, and goal-permutation change. FSP is two-to-three orders of magnitude less goal-sensitive than HSP on every map.
closed, filter off
open, filter off
Map
FSP 0→.1
HSP 0→.1
FSP 0→.1
HSP 0→.1
Umaze
.33→.20
1.0→1.0
.87→.93
.93→.93
Medium
.07→.07
1.0→1.0
.47→.53
1.0→1.0
Large
.00→.10
1.0→1.0
.60→.60
.90→.90
Appendix
Table 12: E4. Success@ ε=0.5 at σ=0→0.10 , over 15 / 15 / 10 rollouts per cell (Umaze/Medium/Large). HSP is flat everywhere. FSP collapses in closed loop already at σ=0 , worsening with horizon ( 0.33→0.07→0.00 ); the gap is far smaller open-loop, isolating the failure to closed-loop velocity feedback.
Figure 5: Visual instantiation of E2 on Maze2D Large. For three goal-discriminative probes ( ∙,■,▲ ; deterministic selection from the upper-median- Dvar pool), we sweep the same 64 -goal bank used in Table 11 and plot the unit-direction one-step displacement (p^−p)/∥p^−p∥ , color-matched to goal index. Columns: FSP vs HSP; rows: flow time t∈{0.25,0.5,0.75} (both networks consume t via a sinusoidal step embedding). A tight clump of arrows per probe means the model ignores the goal channel; a multi-color fan means it attends to it. FSP arrows clump regardless of the goal; HSP arrows fan toward their respective goals, with the fan most pronounced as t→1 .
Figure 6: Plans from one start ( ∙ ) to one goal ( ⋆ ) on Maze2D Large; small samples of p0 near ps yield two routes, shown in two colors.
Maze2D
F1TENTH
Warehouse
Umaze
Medium
Large
Budapest
Catalunya
Method
G
S
G
S
G
S
G
S
G
S
G
S
RRT* [ 18 ]
96
91
95
94
92
86
–
–
–
–
56
56
A* [ 10 ]
100
93
96
85
89
85
–
–
–
–
41
41
Diffuser [ 14 ]
94
62
94
46
74
25
79
0
69
69
50
35
Diffuser + CG [ 7 ]
54
36
2
2
4
1
86
0
59
59
44
37
Appendix
Table 13: Goal-reaching rate (G) and safe success (S, goal reached without violation) of every method, in %. Violations use κ=0.01 in Maze2D and F1TENTH and κ=0 in Warehouse. –: not evaluated.
Benchmark
σ0
λ
H
Δt (s)
PD (Kp,Kv)
Input bound
Solved (%)
Failed (%)
At bound (%)
Maze2D Umaze
0.005
0.1
128
0.01
(1,1)
[−1,1]2
12.92
0
19.95
Maze2D Medium
0.005
0.1
256
0.01
(1,1)
[−1,1]2
11.95
0
17.20
Maze2D Large
0.005
0.1
384
0.01
(1,1)
[−1,1]2
10.72
0.125
15.64
Hopper
10−4
2.0
1000
0.008
–
[−1,1]3
0.42
0
3.84
Warehouse
0.005
0.1
512
0.05
(2.0,0.2)
∥v∥≤0.5 m/s
10.31
0
46.06
Appendix
Table 14: Filter settings and closed-loop solver statistics of SafeStreamingFlow . Solved: steps at which the filter solves its optimization problem; Failed: steps at which SLSQP reports failure; At bound: steps at which the applied input reaches the input bound (% of all steps).
Figure 7: Maze2D obstacle layouts for the three D4RL maps. Red regions indicate the safety-barrier obstacles enforced via Eq. ( 31 ); remaining cells form the free space from which start–goal pairs are uniformly sampled.
Figure 8: Plan (left) and rollout (right) on Maze2D Large. ⋆ denotes the goal xg ; the colored line is the trajectory from start (blue) to end (red). Black arrows visualize step-wise HOCBF safety corrections.
Method
NN (ms)
tOpt (ms)
ttotal (ms)
MFLOPs/step
#Opt
Diffuser
921.6
–
921.6
771.1
-
Diffuser + CG
972.8
3865.6
4838.4
771.1
-
SafeDiffuser
972.8
9113.6
10086.4
771.1
H×K
FM
896.0
–
896.0
771.1
-
SafeFM
998.4
9139.2
10137.6
771.1
H×K
FlowMatcher
896.0
–
896.0
771.1
-
Appendix
Table 15: Computational efficiency on Maze2D Large. NN, tOpt , and ttotal are totals for generating one full trajectory; FLOPs are reported per emitted step.
Figure 9: F1TENTH track layouts. Blue: centerline; green: minimum-curvature raceline; black: track walls. Red circles mark the safety-barrier obstacles (radius r in legend); zoom-in panels show each obstacle in the context of the surrounding track walls. The safety filter constrains only these super-ellipse obstacles; track-wall avoidance is encoded implicitly through the demonstration distribution.
Figure 10: Hopper rollout under SafeStreamingFlow with the velocity-augmented ceiling barrier (Eq. 32 ). Red horizontal line: ceiling zmax=1.5 m. The torso remains beneath the ceiling throughout the hopping gait.
Figure 11: Warehouse environment in Gazebo (top-down view). Gray polygons: physical obstacles (shelves, pallets, crates) defined in the Gazebo SDF world. Red dashed circles: abstract safety-filter barriers enforced via Eq. ( 31 ) at (8.5,10.0) and (16.0,11.0) with radius r=1.5 m. The two safety barriers are intentionally inflated relative to the physical shelf geometry to provide a margin and to match the line-density heatmap of training trajectories in the high-traffic central corridor.
Figure 12: Gazebo Fortress 3D view: the mecanum robot among warehouse obstacles, simulated with a physics engine under the ROS2/Nav2 stack.
Recent advances in generative models have shown promise in generating behavior plans for long-horizon, sparse reward tasks. While these approaches have achieved promising results, they often lack a principled framework for hierarchical decomposition and struggle with the computational demands of real-time execution, due to their iterative denoising process. In this work, we introduce Hierarchical Diffusion-Flow (HDFlow), a novel hierarchical planning framework that optimally leverages the strengths of diffusion and rectified flow models to overcome the limitations of single-paradigm generative planners. HDFlow employs a high-level diffusion planner to generate sequences of strategic subgoals in a learned latent space, capitalizing on diffusion's powerful exploratory capabilities. These subgoals then guide a low-level rectified flow planner that generates smooth and dense trajectories, exploiting the speed and efficiency of ordinary differential equation (ODE)-based trajectory generation. We evaluate HDFlow on four challenging furniture assembly tasks in both simulation and real-world, where it significantly outperforms state-of-the-art methods. Furthermore, we also showcase our method's generalizability on two long-horizon benchmarks comprising diverse locomotion and manipulation tasks. Project website: https://hdflow-page.github.io/
Nandiraju Gireesh, Yuanliang Ju, Chaoyi Xu +3
1Peking University · University of Toronto. · 2Galbot
Diffusion models have emerged as powerful tools for planning and control by learning multimodal distributions over actions and trajectories. Yet reliable inference-time safety enforcement remains a key barrier to their deployment in safety-critical tasks. Existing approaches typically project each denoising iterate onto the feasible set, even though constraints are defined only on the final clean trajectory. Enforcing feasibility on noisy intermediate samples can therefore overconstrain the sampling dynamics, substantially degrading sample quality. To address this limitation, we introduce DiRecT (Diffusion-based planning via Receding-horizon denoising with Terminal constraints), a training-free algorithm for constrained sampling from diffusion models via stochastic optimal control (SOC). DiRecT enforces constraints only on the final clean sample, avoiding unnecessary restrictions on the intermediate denoising dynamics. Inspired by model predictive control, we derive a principled receding-horizon surrogate for the otherwise intractable constrained SOC formulation, yielding an efficient algorithm that cleanly separates stochastic denoising from constraint satisfaction, progressively steering samples toward feasible final trajectories without distorting the learned diffusion dynamics. Furthermore, DiRecT is highly flexible: it can leverage off-the-shelf or domain-specific optimizers, incorporate priors over environment dynamics, and optimize additional soft rewards. Extensive experiments on safe planning benchmarks demonstrate that DiRecT substantially improves deployment safety and task performance over existing diffusion-based planning baselines.
While flow-based generative models have demonstrated strong performance across a wide range of domains, deploying them in safety-critical physical systems remains challenging due to strict constraint requirements. Existing approaches typically enforce safety through post-hoc corrections, which incur substantial computational overhead and may distort the learned distribution. We propose PolyFlow, a polytope-constrained flow matching framework that embeds constraints directly into the model and flow dynamics. PolyFlow introduces a discrete-time flow formulation and a projection-free architecture, which eliminate the discretization error and guarantee strict satisfaction of arbitrary polyhedral constraints, without the need for expensive iterative solvers. Experimental results show that PolyFlow achieves zero constraint violation while maintaining high distributional fidelity across a range of planning and control tasks. Compared to state-of-the-art constrained generation baselines, PolyFlow significantly reduces inference latency and demonstrates a favorable trade-off between safety, efficiency, and generative quality. Code is available on https://github.com/MJianM/PolyFlow.
Jianming Ma, Qiyue Yang, Yang Zhang +4
Shanghai Jiao Tong University, Shanghai, China · Shanghai Innovation Institute, Shanghai, China