Manuscript Offprint
arXiv:2610.03132Safe Streaming Flow Planning by Aligning Sampling Dynamics with Execution Dynamics
Seunghwan Jang
Nanyang Technological University
Singapore
Siddharth Ancha
University of California, Berkeley
Berkeley, CA, USA
Jeongyong Yang
University of Washington
Seattle, WA, USA
SooJean Han
KAIST
Daejeon, Republic of Korea
Abstract: 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. Code is available on our project page: https://jang-seunghwan.github.io/SafeStreamingFlowPlanning/.
Keywords: Safe Planning, Flow Matching, Control Barrier Functions
1 Introduction
Generative models [1, 2] that have driven rapid progress in image and language generation are increasingly being adapted to robotic tasks, particularly diffusion [3, 4, 5] and flow matching [6]. Deploying such models for robot planning, however, requires more than producing a plausible trajectory. Most diffusion/flow planners typically generate an entire horizon as a single object in trajectory space and refine it through K denoising/sampling steps, where each step updates all H states in the trajectory [3]. In a closed-loop setting, this full-horizon procedure must be repeated at every control cycle to incorporate state feedback and new observations, generating intermediate states per cycle [7, 8].
Another key challenge is enforcing safety constraints imposed at inference time, possibly never seen during training, in a manner that is both reliable and compatible with closed-loop execution. Many
Corresponding authors.
Work done at KAIST.

(a) Trajectory-level safe planner
Properties
✓ Safety filtering = execution-time constraint
✓ Per-step CBF:
✓ Closed-loop extension at no extra cost
✓ Dynamically consistent

(b) Safe Streaming Flow (ours)
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 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 optimization solves (versus ), closed-loop execution without architectural or computational change, and dynamically consistent plans whose executed trajectory matches the generated one by construction.
generative methods promote safety through guidance [9, 10], injecting heuristic costs, penalties, or constraint-related scores into the generation process to steer samples away from unsafe regions; such guidance either requires the constraint to be learned in advance or imposes it only softly, without formal guarantees [11, 12]. An especially promising approach to certified safety is to incorporate control barrier functions (CBFs) [13, 14] into the sampling procedure by solving quadratic programs (QPs) at inference time; the constraints then hold whenever each QP is feasible. However, because intermediate sampling states are not physically executed, enforcing safety during sampling can disrupt dynamical consistency of the generated trajectories and induce local-traps, discontinuous trajectories that remain safe but infeasible to execute [6, 15].
In addition, safety enforcement further increases the computational burden because CBF-based corrections are applied across both the horizon length H and sampling iterations K, resulting in QP solves to generate a single trajectory. Streaming-based formulations [8, 7] have been introduced for real-time execution by aligning sampling time with execution time. However, existing streaming approaches are developed primarily as policies for action imitation, leaving both the system's execution dynamics and start-goal-conditioned planning unaddressed.
We propose SafeStreamingFlow, a safe streaming planner that aligns the generative process with execution (Figure 1). Instead of sampling at the full trajectory level, SafeStreamingFlow integrates a learned state vector field in physical time and produces a one-step-ahead reference. In this one-step prediction, however, the learned field tends to become a local inertial extrapolator rather than a goal-conditioned planner; we suppress this with a hierarchical state predictor that sequentially updates position then velocity. The one-step-ahead reference is then tracked by a PD controller, and the resulting nominal control input is filtered through high order control barrier functions that minimally modify the executed input to satisfy safety constraints that were never seen during training.
Table 1 positions SafeStreamingFlow along four properties that classical and generative planners typically trade off: a cost-function-free formulation, multimodal trajectory generation, execution-time safety, and real-time streaming. Classical planners (RRT*, A*) satisfy safety constraints by construction but require engineered costs and produce a single non-streaming plan; generative planners (Diffuser, SafeDiffuser) gain cost-function-free multimodality but offer only partial, non-streaming safety. SafeStreamingFlow is the only paradigm attaining all four.
Table 1: Conceptual positioning of SafeStreamingFlow against existing planning paradigms.
| Paradigm | Cost-fn. free | Multimodal | Exec. safety | Real-time |
|---|---|---|---|---|
| Classical (RRT*, A*) | ✕ | ✕ | ✓ | △ |
| Generative (Diffuser, SafeDiffuser) | ✓ | ✓ | △ | ✕ |
| SafeStreamingFlow (Ours) | ✓ | ✓ | ✓ | ✓ |
Safety in generative planning is commonly incorporated either through guidance [11, 12, 20], such as classifier/classifier-free guidance [9, 10] and CBF-shaped objectives [21], or through CBF-based safety filters embedded in the sampling pipeline [6, 15]. While guidance-based methods generally lack formal guarantees, safety filters provide them under their modeling assumptions: Hamilton–Jacobi reachability [22] scales exponentially with the state dimension and model predictive safety filters [23] solve a horizon-length problem at every step, whereas CBF filters [13, 14] need a single optimization per control cycle. However, trajectory-level CBF correction can introduce computational overhead, local traps, and dynamical inconsistency. In contrast, SafeStreamingFlow extends streaming flow to start–goal-conditioned state space planning and enforces safety constraints only at the executed step, aligning generation, execution, and safety filtering in physical time.
3 Problem Formulation
3.1 Setup
We consider a control-affine dynamical system of the form
where denotes the system state ( is the feasible state space), and are position and velocity, respectively, and is the control input ( is the admissible control space). The functions and denote the full state drift and control vector fields, respectively. We use and to denote their acceleration-level components. All functions are assumed to be locally Lipschitz continuous. This formulation captures a broad class of second-order systems, including point-mass and mass–spring–damper dynamics, and is widely used as a tractable approximation of more complex robotic and mechanical systems, where the control input acts directly on the acceleration dynamics (i.e., has full column rank).
Let denote the planning horizon time. A trajectory is defined as , i.e., . We are given a dataset of expert demonstrations , where each demonstration starts at and terminates at a goal state . In addition, we define the sampling time and the discrete time , corresponding to time (). Our safety filter and its guarantee are stated for the Euler discretization of (1):
Safety constraints are specified by twice continuously differentiable barrier functions , where is a finite index set of constraints. The safe set is defined as the intersection
Here, we focus on constraints of relative degree two with respect to the system (1), i.e., and on . Under (2), does not involve , so the input first affects at step and a first-order condition on alone cannot be enforced through .
Problem 1 (Safe planning from demonstrations). Given the system dynamics (2), demonstration dataset , start state , goal state , planning horizon , and a safe set defined in (3), design a planner that generates a state trajectory such that , for some goal tolerance , and for all , and the state trajectory satisfies the system dynamics (2).
3.2 Preliminaries: Discrete-Time High Order Control Barrier Functions
We review discrete-time high order control barrier functions (HOCBFs) [24], focusing on relative degree two constraints for the discretized dynamics (2). For each , define the discrete-time barrier sequence
where follows (2). By the relative-degree-two structure, is a function of the state alone, so the sets below are well defined, and enters only , through (explicit form in Appendix E). and are class- functions satisfying for .
We also define the associated sets
and their augmented set .
Definition 1 (Discrete-Time HOCBFs with Relative Degree Two). A twice continuously differentiable function is a discrete-time HOCBF of relative degree two for system (2) if there exist class- functions and such that for every there exists with
Theorem 1. Consider the discrete-time system (2). If and the applied input satisfies (6) for all at every , then is forward invariant along the resulting trajectory[24], i.e., for all .
In contrast to continuous-time CBF constraints [13], the discrete-time HOCBF constraint (6) is not necessarily affine in the control input. We can find a safe control input by solving the following optimization problem that minimally modifies a nominal input :
When is quadratic in x, the optimization problem can be formulated as a quadratically constrained quadratic program (QCQP). Theorem 1 (proof in Appendix C) requires (7) to be feasible at every step, and we do not establish this recursive feasibility for our hand-specified barriers.
4 Safe Streaming Flow Planning
SafeStreamingFlow has two components (Figure 2). The first is a streaming generator of state trajectories from a learned start–goal-conditioned vector field: Section 4.1 extends streaming flow—developed in prior work as an action policy [7]—to start–goal-conditioned state space planning, and Section 4.2 introduces a hierarchical architecture for that suppresses a kinematic shortcut emerging during training on second-order systems. The second is a safety filter applied to the executed control input, which Section 4.3 formulates using a discrete-time HOCBF filter.

next step:
Figure 2: One step of SafeStreamingFlow, following Eqs. (15)–(18).
4.1 Streaming Flow Planning
We formulate planning as streaming generation by integrating a learned start–goal-conditioned vector field in physical time
where is a neural vector field and . Nominal trajectories are generated by integrating (8) forward over the sampling time . Unlike trajectory-level diffusion/flow planners that generate an entire horizon through an inner sampling process, SafeStreamingFlow identifies generation (sampling) time with planning time. In discrete time, a one-step forward state is generated by Euler integration
For multimodal plans, the initial position can be sampled near (Appendix H).
We train the vector field by constructing contracting conditional flows [7] around expert demonstrations. Let denote the kinematic lift mapping a position-space perturbation to a state space perturbation. For a demonstration , we define the target field
where is a contracting gain. This construction embodies two design choices. (i) To learn a vector field consistent with the kinematic dynamics , perturbations are confined to the kinematically coupled subspace via , which maps a position perturbation to the induced velocity perturbation . (ii) The resulting model is a state-reference planner, explicitly conditioned on and horizon and emitting a state trajectory tracked by a low-level controller—not a reactive policy over abstract action setpoints as in [7].
Since the planner must end at (Problem 1); we therefore show that the minimizer of the training objective below matches the per-timestep marginals of the conditional paths (Theorem 2), which yields terminal goal-reaching at . For , define the trajectory-conditioned state sample
and denote its induced distribution by . Then, we train using conditional flow matching loss:
Thus, learns a start–goal-conditioned vector field by regressing onto trajectory-conditioned fields sampled along the prescribed conditional paths.
Theorem 2. Let denote the c-conditional distribution induced by the dataset , and let be the minimizer of the conditional flow matching loss (12). Then, for every and a fixed start–goal condition , the flow induced by transports to the target per-timestep marginal distribution \mu_t^c = \mathbb{E}_{\boldsymbol{\tau} \sim p_{\mathcal{D}}(\cdot \mid c)}[\mu_t^\boldsymbol{\tau}].
Most flow matching formulations use a normalized time variable . Instead, we treat flow sampling time as identical to physical time . This is an equivalent re-parameterization corresponding to , which yields .
The detailed proof of Theorem 2 is provided in Appendix D.
As an immediate consequence, suppose that every demonstration in satisfies . Substituting this into (11) at yields \mathbf{x}_T^\boldsymbol{\tau} = \mathbf{x}_g + \sigma_T A_{\Delta t} \boldsymbol{\xi}, independent of . The matched terminal marginal is therefore the pushforward of under this affine map,
whose position component is (since ), giving position error . Hence, step-wise marginal matching (Theorem 2) implies terminal goal-reaching at scale under goal-curated demonstrations, although it leaves the joint law of the path undetermined.
4.2 Hierarchical State Predictor (HSP)
We now specify the parametric form of from (8). Exposing the full state to a single network admits a kinematic shortcut: for locally bounded acceleration,
so a predictor can drive training loss down by carrying over rather than learning goal-conditioned progress from (ablated in Appendices F and G). The resulting field becomes a local inertial extrapolator rather than a goal-conditioned planner: predicting where the trajectory inertially will be one-step ahead, not where it should be under the start–goal plan.
To suppress this, we factorize and sequentially update position then velocity (Figure 2):
Both branches are trained by (12) applied componentwise to : regresses onto its position component, onto its velocity component.
HSP is thus a structured parameterization of the same as in Section 4.1, not a new objective. The only change is that is denied , forcing it to infer from the geometric planning context while restores local dynamic consistency conditioned on the predicted next position. This separation is what restores goal sensitivity and closed-loop robustness, isolated causally in Appendix G. We note that (15)–(16) specify the predictor parameterization, not the physical state transition law; a first-order local update is used since the exact coupled one-step map is unavailable in closed form.
4.3 Safe Planning via HOCBFs
We couple streaming state generation with a PD controller and safety filter to form a complete planning and execution loop. At each execution cycle, the generative model produces a one-step-ahead state reference via (15)–(16). This reference is tracked by a PD controller, whose nominal control input is
where and are proportional and derivative gains, respectively.
We compute the safe control input by solving the following optimization problem similar to (7):
This optimization returns a control input that minimally deviates from the PD input while satisfying the safety constraints. Since (18) is generally a nonlinear programming problem, we consider quadratic barrier functions in our experiments. We evaluate the relative-degree-two discrete-time HOCBF using the two-step local Euler prediction derived in Appendix E.
Finally, we propagate the model (2) by using to obtain the next state , naturally maintaining dynamical consistency. This safe state is then fed back into the vector field for the next streaming update; in closed-loop mode, the measured state is fed back instead. Since SafeStreamingFlow generates trajectories in a streaming manner, it can be used in both open-loop and closed-loop (online) modes; the full procedure is summarized in Appendix B, with the mode selected by .
5 Experiments
We compare SafeStreamingFlow against safe generative planners in both nominal and safe variants: guidance-based (classifier guidance, CG [9]), diffusion-based (Diffuser/SafeDiffuser [3, 15]), and flow-matching-based (FM/FlowMatcher and SafeFM/SafeFlowMatcher [6]). We evaluate open- and closed-loop planning on four environments: Maze2D [25] (Section 5.1), F1TENTH [26] (Section 5.2), MuJoCo Hopper [25] (Section 5.3), and a ROS2/Gazebo warehouse navigation [27] (Section 5.4).
Throughout, denotes the discrete horizon length (i.e., the number of transitions) and the number of sampling steps a trajectory-level baseline used to generate a full trajectory. We note that SafeFlowMatcher uses because of its two-phase structure [6]; the specific values of and used per task are listed in each results table. In contrast, SafeStreamingFlow emits one state per sampling step, requiring sequential forward passes irrespective of . We report success rate (Succ.), the plan-level indicator , the execution-level violation rate (Viol.), acceleration smoothness (Sm.), trap rate (Trap.), and timing (, ; per trajectory, and per action in Hopper). All metrics are averaged over 100 rollouts; see Appendix I.
5.1 Maze2D
Table 2: Maze2D results across Umaze, Medium, Large maps.
| Category | Method | Umaze (H = 128; K = 64) | Medium (H = 256; K = 256) | Large (H = 384; K = 256) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Succ. | Viol. | Sm. | Trap | Succ. | Viol. | Sm. | Trap | Succ. | Viol. | Sm. | Trap | |||||
| Classical | RRT* [28] | 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* [29] | 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 [3] | 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 [9] | 36.0 | ✓ | 51.0 | 302.012±375.947 | 82.0 | 2.0 | ✓ | 56.0 | 6.87×10±6.00×10 | 100.0 | 1.0 | ✓ | 37.0 | 4.49×10±4.39×10 | 100.0 | |
| SafeDiffuser [15] | 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 | |
| Flow Matching | FM [6] | 97.0 | - | 47.0 | 47.356±21.188 | - | 88.0 | - | 61.0 | 43.229±22.993 | - | 62.0 | - | 61.0 | 36.489±22.204 | - |
| SafeFM [6] | 80.0 | ✓ | 20.0 | 50.885±24.197 | 0.0 | 46.0 | ✓ | 51.0 | 54.196±42.148 | 1.0 | 23.0 | ✓ | 57.0 | 148.792±181.809 | 38.0 | |
| FlowMatcher [6] | 95.0 | - | 40.0 | 84.885±15.125 | - | 90.0 | - | 70.0 | 60.688±9.721 | - | 67.0 | - | 52.0 | 55.324±8.650 | - | |
| SafeFlowMatcher [6] | 66.0 | ✓ | 34.0 | 90.772±20.488 | 1.0 | 25.0 | ✓ | 70.0 | 61.578±10.628 | 0.0 | 24.0 | ✓ | 56.0 | 54.889±8.634 | 2.0 | |
| Streaming Flow (Ours) | StreamingFlow (open-loop) | 94.0 | - | 48.0 | 13.880±2.623 | - | 93.0 | - | 36.0 | 6.426±1.060 | - | 89.0 | - | 46.0 | 3.923±0.875 | - |
| StreamingFlow (closed-loop) | 100.0 | - | 45.0 | 12.019±2.303 | - | 94.0 | - | 41.0 | 5.321±1.215 | - | 91.0 | - | 50.0 | 3.119±0.699 | - | |
| SafeStreamingFlow (open-loop) | 98.0 | ✓ | 0.0 | 11.259±1.744 | 0.0 | 93.0 | ✓ | 1.0 | 5.049±0.688 | 0.0 | 76.0 | ✓ | 18.0 | 3.119±0.658 | 0.0 | |
| SafeStreamingFlow (closed-loop) | 98.0 | ✓ | 0.0 | 11.504±2.000 | 0.0 | 95.0 | ✓ | 0.0 | 5.070±0.967 | 0.0 | 88.0 | ✓ | 4.0 | 3.253±0.703 | 0.0 | |
For methods without active safety, the Succ. is computed without the safety condition.
Table 2 reports Maze2D performance across the three maps. Among methods without a safety mechanism, StreamingFlow (closed-loop) is the strongest on Succ. and Sm. across all three maps. Enforcing safety whenever a solution exists leaves SafeStreamingFlow at essentially the same Succ. and Sm. as StreamingFlow, with positive , zero traps, and zero or near-zero violations in execution, whereas the trajectory-level safe variants drop sharply in Succ., fail to ensure safety in execution, and incur trap discontinuities. The classical planners, which search the known map, reach a comparable Succ. (85–94%). A qualitative visualization of the actual trajectories on the map layout is shown in Appendix I.2 (Fig. 8).
Additionally, by enforcing safety only at the executed step, SafeStreamingFlow reduces the number of optimization solves from to , cutting optimization-solve time by and end-to-end latency well below the trajectory-level safe baselines. A full computational breakdown on Maze2D Large is given in Appendix I.2.
5.2 Autonomous Racing: F1TENTH
To evaluate scalability beyond navigation tasks, we test on the F1TENTH autonomous racing simulator with nonholonomic bicycle dynamics [26], using two tracks—Budapest and Catalunya—with substantially longer horizons than Maze2D (Table 3).
Table 3: F1TENTH results on the Budapest and Catalunya tracks.
| Category | Method | Budapest (; ) | Catalunya (; ) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Succ. | Viol. | Sm. | Succ. | Viol. | Sm. | ||||||||
| Diffusion | Diffuser [3] | - | 80.0 | - | 1.84 | - | 1.0 | - | 1.88 | ||||
| Diffuser + CG [9] | 0.0 | ✓ | 86.0 | 0.17 | 2.07 | 59.0 | ✓ | 0.0 | 0.47 | 2.40 | |||
| SafeDiffuser [15] | 0.0 | ✓ | 80.0 | 17.88 | 19.97 | 0.0 | ✓ | 0.0 | 1.29\times10^{4}^{\ddagger} | 19.59 | 21.68 | ||
| Flow Matching | FM [6] | - | 30.0 | - | 1.76 | - | 29.0 | - | 1.80 | ||||
| SafeFM [6] | 0.0 | ✓ | 0.0 | 1.93\times10^{3}^{\ddagger} | 17.72 | 19.72 | 0.0 | ✓ | 0.0 | 1.50\times10^{4}^{\ddagger} | 19.27 | 21.28 | |
| FlowMatcher [6] | - | 0.0 | - | 1.77 | - | 2.0 | - | 1.84 | |||||
| SafeFlowMatcher [6] | 0.0 | ✓ | 0.0 | 18.16 | 20.19 | 0.0 | ✓ | 1.0 | 5.49\times10^{3}^{\ddagger} | 19.73 | 21.78 | ||
| Streaming Flow (Ours) | StreamingFlow (open-loop) | - | 97.0 | - | 3.23 | - | 0.0 | - | 3.36 | ||||
| SafeStreamingFlow (open-loop) | 73.0 | ✓ | 20.0 | 0.71 | 3.96 | 99.0 | ✓ | 0.0 | 0.49 | 3.99 | |||
For methods without active safety, the Succ. is computed without the safety condition.
The plans do not follow the track; their waypoints are scattered over the data range.
Table 3 reports the F1TENTH results. The baselines struggle at these horizon lengths: most flow matching and FlowMatcher variants achieve 0% goal-reaching success on Budapest, and SafeDiffuser attains 0% Succ. on both tracks. Diffuser reaches 88% on Budapest but violates every barrier constraint (). In contrast, StreamingFlow achieves 77% and 99% success on the two tracks with the smoothest plans under long-horizon streaming generation. SafeStreamingFlow further lowers the violation rate on Budapest from 97% to 20% ( on every rollout across both tracks) while preserving the goal-reaching of StreamingFlow and comparable smoothness.
5.3 Locomotion: Hopper
To assess SafeStreamingFlow beyond navigation-style tasks, we evaluate on MuJoCo Hopper [25], a single-leg locomotion system. Unlike the finite-horizon, goal-reaching tasks of Maze2D and F1TENTH, Hopper is a receding-horizon locomotion task with no terminal goal state, so the height constraint must be enforced continually throughout the rollout. Here, we encoded it as a velocity-augmented ceiling barrier; because the barrier itself carries velocity, its relative degree collapses to 1, requiring only a single class- condition. The reduction to a single class- condition, together with metrics and experimental details, is given in Appendix I.4.
Table 4: Hopper with a torso-height constraint.
| Hopper (, ) | |||||
|---|---|---|---|---|---|
| Method | Score | Viol. (%) | |||
| Diffuser [3] | - | - | 393.8 | - | |
| Diffuser + CG [9] | ✕ | 176.9 | 591.6 | 80.0 | |
| SafeDiffuser [15] | ✓ | 597.8 | 1012.4 | 85.0 | |
| FM [6] | - | - | 244.3 | - | |
| SafeFM [6] | ✓ | 561.3 | 817.7 | 60.0 | |
| FlowMatcher [6] | - | - | 245.2 | - | |
| SafeFlowMatcher [6] | ✓ | 570.9 | 829.5 | 99.0 | |
| StreamingFlow | - | - | 7.54 | - | |
| SafeStreamingFlow | ✓ | 0.013 | 7.30 | 0.0 | |
For methods without active safety, the Score and Succ. are computed without the safety condition.
Table 4 reports score, two layers of safety, and per-action latency. All trajectory-level CBF variants achieve plan-level safety () yet incur high execution-level violation rates (46–85%); a certified plan does not survive the closed-loop deviations of underactuated, contact-rich dynamics. SafeStreamingFlow is the only method attaining safety at both layers simultaneously—zero execution-time violations at score 51.4 (90% of its unsafe counterpart StreamingFlow's 57.4) and 7.54 ms latency, versus SafeDiffuser's 1012.4 ms (134× slower) at a far worse score (16.6). By acting at every emission step, rather than once on the full horizon, the per-step HOCBF-QP filter compensates for closed-loop drift in real time.
5.4 Warehouse Navigation in Gazebo
Table 5 reports the static warehouse benchmark, a ROS2/Gazebo environment that runs the full Nav2 deployment stack and a physics engine; this exercises every method under the closed-loop
Table 5: Warehouse navigation.
| Warehouse Navigation (, ) | ||||||
|---|---|---|---|---|---|---|
| Method | Succ. | Viol. | Sm. | |||
| 56.0 | ✓ | 0.0 | - | |||
| 41.0 | ✓ | 0.0 | - | |||
| Diffuser [3] | - | 25.0 | - | |||
| Diffuser + CG [9] | 37.0 | ✕ | 12.0 | 0.10 | ||
| SafeDiffuser [15] | 34.0 | ✓ | 19.0 | 6.91 | ||
| FM [6] | - | 18.0 | - | |||
| SafeFM [6] | 37.0 | ✓ | 19.0 | 7.78 | ||
| FlowMatcher [6] | - | 13.0 | - | |||
| SafeFlowMatcher [6] | 38.0 | ✓ | 11.0 | 3.28 | ||
| StreamingFlow (open-loop) | - | 15.0 | - | |||
| StreamingFlow (closed-loop) | - | 17.0 | - | |||
| SafeStreamingFlow (open-loop) | 51.0 | ✓ | 7.0 | 0.09 | ||
| SafeStreamingFlow (closed-loop) | 51.0 | ✓ | 1.0 | 0.07 | ||

Figure 3: Gazebo warehouse executed trajectories. SafeDiffuser (orange) violates the CBF region (red dashed) during execution; SafeStreamingFlow (green) stays clear.
control loop a physical robot would impose. All learned methods share a single PD controller and the classical baselines use Nav2 (setup in Appendix I.5). As in Hopper, a plan that satisfies the constraint need not survive closed-loop execution: SafeDiffuser drifts into the safety region during rollout while SafeStreamingFlow stays clear (Figure 3). Among safe generative planners, the streaming family is the strongest on goal-reaching, and in closed-loop execution produces markedly smoother trajectories than the others. Crucially, SafeStreamingFlow enforces safety whenever a solution exists, almost for free. In closed loop, it has no violation while executing its plan; the single violation in Table 5 occurs after the planned horizon (Appendix I.5). Its optimization-solve time is more than an order of magnitude below the trajectory-level safe baselines, giving a lower end-to-end latency than these baselines together with the highest safe success among generative methods. Against RRT* and A* run within Nav2, a navigation-specialized stack with an explicit cost map, SafeStreamingFlow stays competitive in success with a plain PD controller and no cost map, while running faster than RRT*.
6 Conclusion and Limitations
We presented SafeStreamingFlow, a start–goal-conditioned planner that streams one-step state updates by integrating a learned vector field in physical time. Because sampling unfolds in physical time, a constraint on the sampling dynamics is a constraint on the executed state under the system model, making safety enforcement dynamically consistent for a generative planner. A naive streaming predictor exploits a kinematic shortcut in second-order systems, which we resolve with hierarchical state prediction. This formulation yields three benefits: discrete-time HOCBFs reduce the number of optimization solves from to , extend to closed-loop execution for free, and avoid local-trap artifacts. Across four environments (Maze2D, F1TENTH, Hopper, Warehouse Navigation), SafeStreamingFlow improves execution-time safety, smoothness, and latency over safe baselines while remaining competitive on goal-reaching.
Limitations: Several limitations remain. First, because SafeStreamingFlow transports data to data rather than noise to data as in conventional flow matching, it fundamentally requires richer demonstration data; our contracting conditional flows alleviate this requirement but do not remove it. Second, by enforcing safety through CBFs, SafeStreamingFlow inherits their classical limitations: the quadratic barrier restricts the obstacle geometries handled efficiently, and valid barrier functions and their gains must be specified in advance. Third, as noted after Theorem 1, we do not establish recursive feasibility, and feasibility is lost even in a simple setting: on Maze2D Large, the filter occasionally finds no solution, and a few closed-loop rollouts violate the barrier. Finally, all evaluations are in simulation; real-robot deployment is needed to validate practicality and may expose further sim-to-real gaps.
Acknowledgments
This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (RS-2026-25504174).
References
[1] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840–6851, 2020.
[2] Y. Lipman, R. T. Q. Chen, H. Ben-Hamu, M. Nickel, and M. Le. Flow matching for generative modeling. In The Eleventh International Conference on Learning Representations, 2023.
[3] M. Janner, Y. Du, J. Tenenbaum, and S. Levine. Planning with diffusion for flexible behavior synthesis. In International Conference on Machine Learning, pages 9902–9915. PMLR, 2022.
[4] E. Fahnestock, E. Fuentes, P. R. Osteen, S. Ancha, and N. Roy. Learning semantic traversability priors using diffusion models for uncertainty-aware global path planning. In ICRA 2024 Workshop on Resilient Off-road Autonomy. IEEE, 2024.
[5] S. Jiang, S. Ancha, T. Manderson, L. Brandt, Y. Du, P. R. Osteen, and N. Roy. Anomalies-by-synthesis: Anomaly detection using generative diffusion models for off-road navigation. In 2025 IEEE International Conference on Robotics and Automation (ICRA), pages 13320–13329. IEEE, 2025.
[6] J. Yang, S. Jang, and S. Han. SafeFlowMatcher: Safe and fast planning using flow matching with control barrier functions. In The Fourteenth International Conference on Learning Representations, 2026.
[7] S. Jiang, X. Fang, N. Roy, T. Lozano-Pérez, L. P. Kaelbling, and S. Ancha. Streaming flow policy: Simplifying diffusion/flow-matching policies by treating action trajectories as flow trajectories. In 9th Annual Conference on Robot Learning, 2025. URL https://openreview.net/forum?id=jnpILGz9gQ.
[8] S. H. Høeg, Y. Du, and O. Egeland. Fast policy synthesis with variable noise diffusion models. In 2025 IEEE International Conference on Robotics and Automation (ICRA), pages 4821–4828, 2025. doi:10.1109/ICRA55743.2025.11127858.
[9] P. Dhariwal and A. Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780–8794, 2021.
[10] J. Ho and T. Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
[11] W. Jung, U. A. Mishra, N. R. Arachchige, Y. Chen, D. Xu, and S. Kousik. Joint model-based model-free diffusion for planning with constraints. In 9th Annual Conference on Robot Learning, 2025.
[12] H. Ma, S. Bodmer, A. Carron, M. Zeilinger, and M. Muehlebach. Constraint-aware diffusion guidance for robotics: Real-time obstacle avoidance for autonomous racing. In 9th Annual Conference on Robot Learning, 2025.
[13] A. D. Ames, X. Xu, J. W. Grizzle, and P. Tabuada. Control barrier function based quadratic programs for safety critical systems. IEEE Transactions on Automatic Control, 62(8):3861–3876, 2016.
[14] A. D. Ames, S. Coogan, M. Egerstedt, G. Notomista, K. Sreenath, and P. Tabuada. Control barrier functions: Theory and applications. In 2019 18th European control conference (ECC), pages 3420–3431. IEEE, 2019.
[15] W. Xiao, T.-H. Wang, C. Gan, R. Hasani, M. Lechner, and D. Rus. Safediffuser: Safe planning with diffusion probabilistic models. In The Thirteenth International Conference on Learning Representations, 2025.
[16] C. Chi, Z. Xu, S. Feng, E. Cousineau, Y. Du, B. Burchfiel, R. Tedrake, and S. Song. Diffusion policy: Visuomotor policy learning via action diffusion. The International Journal of Robotics Research, 2024.
[17] J. Carvalho, A. T. Le, M. Baierl, D. Koert, and J. Peters. Motion planning diffusion: Learning and planning of robot motions with diffusion models. In 2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 1916–1923. IEEE, 2023.
[18] S. Ye and M. C. Gombolay. Efficient trajectory forecasting and generation with conditional flow matching. In 2024 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 2816–2823. IEEE, 2024.
[19] A. Prasad, K. Lin, J. Wu, L. Zhou, and J. Bohg. Consistency policy: Accelerated visuomotor policies via consistency distillation. In Robotics: Science and Systems, 2024.
[20] S. Bodmer, R. Zurbrügg, T. Portela, H. Ma, A. Didier, M. Hutter, C. Jones, and M. Zeilinger. Grounding generative policies in physics: Optimization-guided diffusion for robot control. arXiv preprint arXiv:2606.24208, 2026.
[21] K. Mizuta and K. Leung. Cobl-diffusion: Diffusion-based conditional robot planning in dynamic environments using control barrier and lyapunov functions. In 2024 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 13801–13808. IEEE, 2024.
[22] S. Bansal, M. Chen, S. Herbert, and C. J. Tomlin. Hamilton-Jacobi reachability: A brief overview and recent advances. In IEEE Conference on Decision and Control, 2017.
[23] K. P. Wabersich and M. N. Zeilinger. A predictive safety filter for learning-based control of constrained nonlinear dynamical systems. Automatica, 129:109597, 2021.
[24] Y. Xiong, D.-H. Zhai, M. Tavakoli, and Y. Xia. Discrete-time control barrier function: High-order case and adaptive case. IEEE Transactions on Cybernetics, 53(5):3231–3239, 2023.
[25] J. Fu, A. Kumar, O. Nachum, G. Tucker, and S. Levine. D4RL: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020.
[26] M. O'Kelly, H. Zheng, D. Karthik, and R. Mangharam. F1TENTH: An open-source evaluation environment for continuous control and reinforcement learning. In NeurIPS 2019 Competition and Demonstration Track, 2020.
[27] N. Koenig and A. Howard. Design and use paradigms for gazebo, an open-source multi-robot simulator. In 2004 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) (IEEE Cat. No.04CH37566), volume 3, pages 2149–2154 vol.3, 2004. doi:10.1109/IROS.2004.1389727.
[28] S. Karaman and E. Frazzoli. Sampling-based algorithms for optimal motion planning. The International Journal of Robotics Research, 30(7):846–894, 2011. doi:10.1177/0278364911406761.
[29] P. E. Hart, N. J. Nilsson, and B. Raphael. A formal basis for the heuristic determination of minimum cost paths. IEEE Transactions on Systems Science and Cybernetics, 4(2):100–107, 1968. doi:10.1109/TSSC.1968.300136.
[30] Q. Nguyen and K. Sreenath. Exponential control barrier functions for enforcing high relative-degree safety-critical constraints. In 2016 American Control Conference (ACC), pages 322–328, 2016.
[31] S. Macenski, F. Martín, R. White, and J. Ginés Clavero. The marathon 2: A navigation system. In 2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 2718–2725, 2020. doi:10.1109/IROS45743.2020.9341207.
A Notation
Table 6: Notation.
| Symbol | Meaning |
|---|---|
| state: position and velocity | |
| control input and admissible input set | |
| drift and input terms of the dynamics (of the velocity equation) | |
| horizon time, number of steps, sampling time | |
| discrete step and its index set | |
| sampling steps of a trajectory-level baseline | |
| start, goal, and conditioning | |
| demonstration and demonstration dataset | |
| learned vector field and its position and velocity branches (HSP) | |
| trajectory-conditioned target field and kinematic lift | |
| noise scale of the conditional paths, with contracting gain | |
| one-step state reference | |
| PD gains; nominal and filtered inputs | |
| barrier functions, their index set, and the safe set | |
| discrete-time HOCBF sequence | |
| sets defined by , and both | |
| class- functions (their linear gains) | |
| safety margin in the barrier | |
| planning mode |
B SafeStreamingFlow Planning Pseudocode
Algorithm 1 SafeStreamingFlow
Require: system dynamics (1); learned fields ; start and goal ; step size ; planning horizon ; PD gains ; barrier functions with ; planning mode .
1: Initialize as .
2: for do
3: if
4: Observe .
5: end if
6: Compute via (15)-(16).
7: Compute via (17).
8: Solve optimization problem in (18) to obtain .
9: Propagate the state via the system dynamics (1):
10:
11: if
12: Robot agent tracks for any controller.
13: end if
14: end for
15: return
C Proof of Theorem 1 (Forward Invariance)
The argument follows [24], specialized to relative degree two; we state the result for several constraints satisfied by a single applied input. Fix . We show for all by induction on ; the base case holds because . Suppose , i.e., and , and let be the successor of under (2) with the applied input . Since and are class- functions with for , we have for all . By (4c), condition (6) at the applied input gives
so . By (4b), gives
so ; here is the value at the actual successor, since depends only on position and does not depend on . Hence , and by induction for all . Since was arbitrary, for all , where the last equality is (3).
D Proof of Theorem 2 (Marginal Matching)
Fix condition , let , and define the trajectory-conditioned distribution . The start-goal-conditioned target marginal is .
We show that the target marginal curve satisfies the continuity equation induced by the optimal vector field in the weak sense:
Equivalently, for every , it suffices to prove
Consider a fixed demonstration . Differentiating the noise schedule in (11) gives , so the time derivative of (11) is
For any test function , the pushforward definition implies
Differentiating this with respect to t and applying the chain rule yields
Averaging over yields
The right-hand side of (24) involves the conditional expectation . Since the conditional flow matching loss (12) is a pointwise least-squares regression problem, its minimizer satisfies -a.e. Substituting this into (24) proves (20), and satisfies (19), concluding the proof.
Note that this proof is different from [7] because the contraction term is different from that of [7], which has singular covariance, i.e., .
E QCQP Structure of the Discrete-Time HOCBF Constraint
We show that the discrete-time HOCBF safety filter used in this work becomes a QCQP when the barrier functions are quadratic and the class- functions are linear as described in Appendix I. We focus on the position-based quadratic barrier functions in (31) used in our experiments. This choice is motivated by the fact that such barriers are a common form for collision avoidance and have relative degree two. If velocity is included in the barrier function, the relative degree becomes one rather than two; in this case, a standard CBF is sufficient and an HOCBF is not required.
At time step , the state is fixed and the optimization variable is the current control input . Let and . Under the Euler discretization of the second-order dynamics,
(25)
Since the barrier depends only on position, the input first appears in the two-step-ahead position prediction:
where and . Thus, the two-step-ahead position is affine in . Now define , , and . Because and is quadratic, we have
(27)
where , , and .
For linear class- functions, the relative degree two discrete-time HOCBF condition (6) can be written as
(28)
Substituting the quadratic expression for gives
where . Therefore, each HOCBF constraint has the quadratic form, and we can write the safety filter as follows:
If the admissible input set is given by box constraints, , then (30) is a QCQP with a quadratic objective, quadratic HOCBF constraints, and linear input constraints.
F Hierarchical State Prediction Ablation: Avoiding the Kinematic Shortcut
We ablate the proposed HSP, described in Section 4.2, against a full state prediction (FSP) that directly predicts from the full current state .
Figure 4 plots the position prediction loss during training, where denotes the predicted next position produced by the learned vector field and denotes the ground-truth position from the demonstration dataset . The HSP decreases slowly and saturates around 0.8, while the FSP quickly converges to near-zero loss, approximately 0.06.
This gap does not indicate better planning. The FSP can minimize the loss by exploiting what we refer to as a kinematic shortcut. As a result, the next position is predicted almost deterministically from the current velocity, with little reliance on start–goal conditioning.
Position Prediction Loss Comparison (First 10K Steps)

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.
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.
| Method | Umaze () | Medium () | Large () | |||
|---|---|---|---|---|---|---|
| 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 |
Table 7 reports goal-reaching success across all three maps under open- and closed-loop execution. Because success requires reaching within a tight tolerance of the goal, small accumulated errors lead to failure.
Despite its lower training loss, FSP degrades at execution time, particularly as the horizon increases: shortcut-dependent position predictions accumulate errors over successive steps, causing rapid drift from the goal (e.g., 5.8% success on Large, closed-loop). HSP, by predicting position from alone—without access to —remains robust and achieves substantially higher success across all maps and execution modes.
Training without noise. Setting places every training state on a demonstration, so the target of (12) becomes the demonstration velocity and training reduces to next-state regression with the same loss. Table 8 compares this variant with on Maze2D Large; the two perform comparably.
Table 8: Training noise on Maze2D Large (closed loop, safety filter on; mean std over three training seeds, 100 rollouts each; violations counted at ).
| 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 |
G Justifying Hierarchical State Prediction
The HSP ablation (Appendix F, Table 7) shows that the FSP attains lower training loss yet far lower closed-loop success than HSP. This appendix explains why, as a four-link causal chain.
L1 The kinematic shortcut exists in the demonstration data.
L2 FSP actually learned that shortcut, not merely that it could.
L3 FSP ignores the goal as a consequence.
L4 The shortcut causally drives closed-loop failure, which HSP avoids by construction.
All experiments use D4RL Maze2D (Umaze/Medium/Large), seed 42. FSP is the monolithic predictor of Appendix F; HSP is the proposed factorized predictor whose position branch has no v input.
G.1 The shortcut exists, and FSP learned it (links L1, L2)
For every demonstration transition we compute the forward-Euler residual (physical maze units), and evaluate the trained predictors' next-position MSE in the same units. We make two predictions:
-
Data side. Mean and its fraction of are (else there is no shortcut to exploit).
-
Model side. FSP MSE floor (it fits the shortcut as tightly as the data allows); HSP MSE floor (it discarded the shortcut).
Table 9: E1/E1b. Data residual floor and per-model next-position MSE (physical units). The shortcut is 5–6 orders below ; FSP sits at the floor, HSP above it.
| Map | floor | 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 |
Both predictions hold on every map ( transitions). FSP's MSE is at, and slightly below, the forward-Euler floor: with as input it can fit the data's semi-implicit-Euler kinematics, which is tighter than forward Euler; HSP, lacking , cannot. The HSP/floor ratio grows with horizon (), as expected when longer rollouts amplify the discarded residual.
G.2 Functional form of the shortcut (link L2)
If FSP implements the shortcut, its position-output Jacobian w.r.t. velocity must match the closed-form slope analytically implied by forward Euler plus the input normalization. We finite-difference over 2000 probes. Prediction: FSP J diagonal, slope = analytical value, ; HSP (architectural).
Table 10: FSP matches the analytical kinematic-shortcut slope to on every map; the map is essentially linear (, diagonal fraction ). HSP exactly, since its position branch has no input.
| Map | analytic slope | measured slope | rel. err | 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 |
To three significant figures, FSP is the closed-form linear map from to .
G.3 FSP ignores the goal (link L3)
If FSP plans via the velocity shortcut, its prediction should be (near-)invariant to the commanded goal, whereas HSP's must vary with it. For probe states held fixed we sweep the goal over a bank of 64 and measure the prediction variance , normalized by the data-side goal-discriminative variance (kNN estimate over the probes with upper-median ). Prediction: , and replacing the goal perturbs HSP far more than FSP.
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.
| Map | perm. ratio | |||
|---|---|---|---|---|
| Umaze | ||||
| Medium | ||||
| Large |
Figure 5 makes this concrete on Maze2D Large: sweeping the goal leaves FSP's one-step direction in a single goal-invariant bundle, while HSP's fans toward each respective goal.
G.4 Causal closed-loop sweep (link L4)
We inject into the predictor's velocity input each step , leaving the true dynamics propagation unchanged, across . Prediction: FSP success collapses with while HSP stays flat, the effect being velocity-channel-specific and amplified in closed loop.
Table 12: E4. Success@ at , over 15/15/10 rollouts per cell (Umaze/Medium/Large). HSP is flat everywhere. FSP collapses in closed loop already at , worsening with horizon ; the gap is far smaller open-loop, isolating the failure to closed-loop velocity feedback.
| Map | closed, filter off | open, filter off | ||
|---|---|---|---|---|
| FSP | HSP | FSP | HSP | |
| Umaze | .33→.20 | .87→.93 | .93→.93 | |
| Medium | .07→.07 | .47→.53 | ||
| Large | .00→.10 | .60→.60 | .90→.90 | |
In closed loop the realized state drifts from the nominal rollout; for FSP this drift, entering through the velocity channel, corrupts the position prediction via the shortcut even with no injected noise, so explicit adds little further degradation (FSP is already at its closed-loop floor). HSP's position branch is invariant to that channel and stays flat. This explains the closed-loop collapse in Table 7 (Appendix F): the position branch of HSP does not see , including the drift that feedback control introduces.
The shortcut captures only the first-order term ; the residual is the acceleration content . Two consecutive positions therefore identify (the average velocity), not : the latter requires learning the increment , which is exactly what provides.
FSP
HSP


Figure 5: Visual instantiation of E2 on Maze2D Large. For three goal-discriminative probes (•, ■, ▲; deterministic selection from the upper-median- pool), we sweep the same 64-goal bank used in Table 11 and plot the unit-direction one-step displacement ( )/ , color-matched to goal index. Columns: FSP vs HSP; rows: flow time (both networks consume 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 .
H Multimodality
This section shows experimentally that SafeStreamingFlow produces multimodal plans by adding small noise to the initial position, as in StreamingFlow[7]. At test time, we sample and keep the conditioning unchanged; with , the plan is unique. Figure 6 shows 50 open-loop plans on Maze2D Large for one start-goal pair with , without the safety filter: the plans split into two routes that pass a wall block on opposite sides (43 and 7 plans).
Noise at the start yields several plans, but this alone does not make the planner multimodal: if the direction of the perturbation decided the route, the plans would only carry the input noise.
We therefore test whether the route can be predicted from the perturbation, on the 19 groups of 50 plans that produce more than one route (two start–goal pairs, three training seeds, and ).
In 15 of these groups, the route cannot be predicted from the direction of the perturbation. Plans that take different routes start together and split partway through the plan: the distance between them grows to 9.3 times its initial value (median), against 2.9 times for plans on the same route, and reaches half of its maximum at 36% of the horizon. The perturbation may bias the route, but the route stays unpredictable from its direction: the flow turns small differences in the start into a choice between routes, so the noise yields distinct routes rather than shifted copies of one plan.

Figure 6: Plans from one start (●) to one goal (★) on Maze2D Large; small samples of near yield two routes, shown in two colors.
I Experiment Details
We document the simulation environment, planning hyperparameters, and barrier function configuration for each experimental setting. Source code and configurations are included in the supplementary material.
I. 1 Common Setup
Hardware. All experiments run on a single workstation with an AMD EPYC 9354 CPU and an NVIDIA RTX 4090 (24 GB) GPU.
Unified barrier form. Maze2D, F1TENTH, and Warehouse navigation all use the same super-ellipse barrier
where is the obstacle center, its semi-axes, the order, and a robust safety margin. With and this reduces to the quadratic form with . Per-task obstacle geometries are visualized in the corresponding subsections below; Hopper uses a different barrier form documented in Section I.4.
HOCBF parameterization. The discrete-time HOCBF (Section 4.3) is parameterized by class- gains in
The gains are the discrete-time counterparts of linear class- functions and with ; this linear choice is the special case of the HOCBF also known as the exponential CBF [30]. Per-environment gains and are given below.
Metrics. Across all tasks we report:
-
Succ.(%): fraction of rollouts that reach the goal, , without violation. For methods without active safety, Succ. counts goal-reaching only, since no barrier constraint is enforced.
-
Viol.(%): fraction of rollouts whose executed trajectory enters a barrier region () at any step; in Hopper, the torso rises above 1.5 m.
-
: when, in every rollout, the plan satisfies at every waypoint (plan-level indicator); not reported for methods without active safety.
-
: acceleration smoothness of the plan, (Warehouse: Appendix I.5).
-
Trap(%): fraction of rollouts with discontinuous safety corrections.
-
: optimization time and end-to-end latency per generated trajectory (per action in Hopper).
Goal and safe success of every method. The main tables report Succ. as safe success for methods with active safety and as goal-reaching for the others; Table 13 reports both for every method.
Table 13: Goal-reaching rate (G) and safe success (S, goal reached without violation) of every method, in %. Violations use in Maze2D and F1TENTH and in Warehouse. -: not evaluated.
| Method | Maze2D | F1TENTH | Warehouse | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Umaze | Medium | Large | Budapest | Catalunya | G | S | ||||||
| RRT* [28] | 96 | 91 | 95 | 94 | 92 | 86 | - | - | - | - | 56 | 56 |
| A* [29] | 100 | 93 | 96 | 85 | 89 | 85 | - | - | - | - | 41 | 41 |
| Diffuser [3] | 94 | 62 | 94 | 46 | 74 | 25 | 79 | 0 | 69 | 69 | 50 | 35 |
| Diffuser + CG [9] | 54 | 36 | 2 | 2 | 4 | 1 | 86 | 0 | 59 | 59 | 44 | 37 |
| SafeDiffuser [15] | 94 | 67 | 92 | 49 | 69 | 13 | 79 | 0 | 0 | 0 | 47 | 34 |
| FM [6] | 97 | 53 | 88 | 33 | 62 | 25 | 47 | 20 | 68 | 47 | 58 | 45 |
| SafeFM [6] | 99 | 80 | 93 | 46 | 65 | 23 | 0 | 0 | 0 | 0 | 51 | 37 |
| FlowMatcher [6] | 95 | 60 | 90 | 22 | 67 | 28 | 0 | 0 | 0 | 0 | 45 | 37 |
| SafeFlowMatcher [6] | 97 | 66 | 88 | 25 | 68 | 24 | 0 | 0 | 0 | 0 | 45 | 38 |
| StreamingFlow (open-loop) | 94 | 51 | 93 | 58 | 89 | 46 | 77 | 0 | 99 | 99 | 57 | 45 |
| StreamingFlow (closed-loop) | 100 | 55 | 94 | 53 | 91 | 43 | - | - | - | - | 54 | 41 |
| SafeStreamingFlow (open-loop) | 98 | 98 | 94 | 93 | 84 | 76 | 77 | 73 | 99 | 99 | 57 | 51 |
| SafeStreamingFlow (closed-loop) | 98 | 98 | 95 | 95 | 88 | 88 | - | - | - | - | 51 | 51 |
Filter settings and solver statistics. Table 14 lists the settings of SafeStreamingFlow and its closed-loop solver statistics for each benchmark. Each per-step problem is solved by SLSQP, which fails only on Maze2D Large.
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).
| Benchmark | H | (s) | PD () | Input bound | Solved (%) | Failed (%) | At bound (%) | ||
|---|---|---|---|---|---|---|---|---|---|
| Maze2D Umaze | 0.005 | 0.1 | 128 | 0.01 | (1,1) | 12.92 | 0 | 19.95 | |
| Maze2D Medium | 0.005 | 0.1 | 256 | 0.01 | (1,1) | 11.95 | 0 | 17.20 | |
| Maze2D Large | 0.005 | 0.1 | 384 | 0.01 | (1,1) | 10.72 | 0.125 | 15.64 | |
| Hopper | 2.0 | 1000 | 0.008 | - | 0.42 | 0 | 3.84 | ||
| Warehouse | 0.005 | 0.1 | 512 | 0.05 | (2.0,0.2) | 10.31 | 0 | 46.06 |
Open-loop versus closed-loop evaluation. The goal-reaching tasks (Maze2D, F1TENTH, Warehouse navigation) are start-goal-conditioned: a plan fixes both endpoints, and (via inpainting for diffusion baselines). Replanning at an intermediate step would require reconditioning on —neither endpoint—over a remaining horizon , outside the fixed-horizon formulation these baselines are trained for; we therefore evaluate them open-loop. Hopper, a receding-horizon task with no terminal goal, conditions on the current state alone, so replanning is native and all methods run closed-loop. SafeStreamingFlow streams one executed state per step and supports both settings.
I.2 Maze2D
Environment. D4RL maze2d-{umaze,medium,large}-v1 [25]. Evaluation is conducted over 100 rollouts per map with uniform-random start-goal sampling from empty cells. Obstacle layouts for the three maps are shown in Figure 7.

(a) Umaze

(b) Medium

(c) Large
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.
Planning horizon and sampling steps.
| Umaze | Medium | Large | |
|---|---|---|---|
| Map grid | 5×5 | 8×8 | 9×12 |
| H (horizon) | 128 | 256 | 384 |
| K (sampling) | 64 | 256 | 256 |
SafeFlowMatcher requires steps due to its two-phase planning structure [6].
Barrier and HOCBF parameters. Eq. (31) with and for SafeStreamingFlow and for evaluation; the trajectory-level safe baselines use in their filters. For SafeStreamingFlow, HOCBF gains are . The filter's model integrates velocity before position (semi-implicit Euler), so the input already enters ; for each obstacle, the QCQP enforces together with , under the input bound . Goal threshold (D4RL sparse-reward radius).
Classical planners. A* and RRT* plan on the known map with the barrier obstacles inflated by 0.05, and their paths are tracked by the same PD controller.
Qualitative example. Figure 8 shows an example plan and the resulting closed-loop rollout on Maze2D Large.


Figure 8: Plan (left) and rollout (right) on Maze2D Large. denotes the goal ; the colored line is the trajectory from start (blue) to end (red). Black arrows visualize step-wise HOCBF safety corrections.
Computational Efficiency We measure the cost of generating one trajectory on Maze2D Large (AMD EPYC 9354 + RTX 4090). Table 15 reports total neural-network forward time (NN), optimization solve time (), end-to-end latency (), per-step FLOPs, and the number of optimization solves (#Opt).
Table 15: Computational efficiency on Maze2D Large. NN, , and are totals for generating one full trajectory; FLOPs are reported per emitted step.
| Method | NN (ms) | (ms) | (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 | |
| FM | 896.0 | - | 896.0 | 771.1 | - |
| SafeFM | 998.4 | 9139.2 | 10137.6 | 771.1 | |
| FlowMatcher | 896.0 | - | 896.0 | 771.1 | - |
| SafeFlowMatcher | 972.8 | 9164.8 | 10137.6 | 771.1 | |
| StreamingFlow | 1843.2 | - | 1843.2 | 120.9 | - |
| SafeStreamingFlow | 1843.2 | 1689.6 | 3532.8 | 120.9 | H |
Trajectory-level safe baselines apply CBF-QP corrections to all states at every sampling step, requiring solves for a single trajectory; SafeStreamingFlow solves a single HOCBF-QCQP per emitted step, totaling . Consequently, SafeStreamingFlow reduces the optimization solve time by roughly relative to the trajectory-level safe baselines—the empirical ratio falls short of the theoretical factor of because the baselines benefit from batched QP solving—and this is the primary source of its end-to-end latency advantage. SafeStreamingFlow also incurs the lowest per-step FLOPs ( below the baselines); its higher NN wall-clock time comes from unbatched, sequential streaming forward passes.
I.3 F1TENTH
Environment. F1TENTH autonomous racing simulator [26] with a single-track bicycle dynamics model integrated via RK4. We evaluate on two tracks: Budapest (centerline length 402 m, 1 obsta-cle) and Catalunya (centerline length 416 m, 3 obstacles). Track geometries and obstacle placements are shown in Figure 9. Evaluation over 100 rollouts per track; the start and goal positions are perturbed by Gaussian noise with standard deviation 0.02 m.

(a) Budapest (1 obstacle).

(b) Catalunya (3 obstacles).
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.
Planning horizon and sampling steps. (Budapest), (Catalunya); for all trajectory-level baselines.
Barrier and HOCBF parameters. Eq. (31) with (circular, ) and . The robust margin is shared between the safety filter and the evaluation metric. For Safe-SFP variants, HOCBF gains are derived from , with trajectory step s. At racing speed, the drift term dominates the exponential CBF condition, so the filter omits this term for safety.
Evaluation mode. F1TENTH is evaluated in open loop, and a rollout reaches the goal when its final position lies within 1.0 m of the goal without a wall collision. On Budapest, the plans of SafeStreamingFlow pass 6–12 cm outside the obstacle, but the car deviates from the plan by about 17 cm, which accounts for the remaining violations.
I. 4 Hopper
Environment. D4RL hopper-medium-expert-v2 [25], a single-leg locomotion task with MuJoCo physics. The 11-dimensional observation excludes the global x-position for translational invariance:
The action consists of thigh/leg/foot torques clipped to . Episode length control steps; MuJoCo timestep 0.002 s with frame_skip = 4 (control step 0.008 s).
Safety constraint. We enforce a velocity-augmented ceiling barrier
together with a linear class- gain per control step (18.75 s ). The Viol. column counts ceiling violations ( ). A representative SafeStreamingFlow rollout under this barrier is shown in Figure 10.
Figure 10: Hopper rollout under SafeStreamingFlow with the velocity-augmented ceiling barrier (Eq. 32). Red horizontal line: ceiling m. The torso remains beneath the ceiling throughout the hopping gait.
Reduction from relative-degree-2 HOCBF to relative-degree-1 CBF. Under control-affine dynamics , , a position-only barrier has relative degree 2: control enters only at , and the standard HOCBF chain requires two class- conditions. The velocity-augmented barrier (32) carries in its definition, so its first time derivative already involves control:
where is the component of acting on vertical acceleration. Hence has relative degree 1, and the two-level HOCBF chain collapses to a single class- condition:
enforced at every emission step. This is the relative-degree-1 case of the HOCBF framework. Because the reduced constraint (33) is affine in the control input (the MuJoCo dynamics are linearized via a finite-difference Jacobian), the per-step problem is a quadratic program (QP)—a quadratic tracking objective with one affine HOCBF constraint and box input bounds—rather than the QCQP used for the relative-degree-2 navigation tasks. We solve it with SLSQP.
Score metric. D4RL normalized return, Score = , averaged over 100 rollouts.
Timing. Hopper highlights the structural advantage of streaming. As a receding-horizon task with no terminal goal, it requires a fresh control output at every step. SafeStreamingFlow produces each action with a single streaming sample, so its per-action cost ( for the filter, averaged over all steps; for the NN forward plus filtering) stays at the millisecond scale. Trajectory-level baselines, by contrast, must generate—and safety-filter—a full H-step plan to emit even one action, inflating the per-action cost by orders of magnitude (e.g., SafeDiffuser's 1012.4 ms vs. SafeStreamingFlow's 7.30 ms).
I. 5 Warehouse Navigation
Environment. ROS2-based Gazebo Fortress simulation of a m warehouse (free space , ), populated with shelving, pallets, and crates as visualized in Figure 11. The robot is a custom mecanum platform ( m chassis, 5 kg mass, 0.22 m Nav2 inflation radius). Physics step s with real-time factor 1. The setup runs the full ROS2/Nav2 stack with rigid-body physics (Figure 12).
Demonstration data. 10,000 trajectories collected by running Nav2 [31] on the warehouse with uniformly sampled random start and goal poses (min goal distance 2.0 m), at a 20 Hz control rate.
Static obstacle layout. The safety filter treats two abstract circular obstacles in the high-traffic corridor, with (see Figure 11).
Barrier and HOCBF parameters. Eq. (31) with and ; evaluation uses . For Safe-SFP variants, HOCBF gains . Position-shield QP variants (safe_diffuser, safe_fm, safe_flow_matcher) apply a one-step linearized projection to each generated waypoint with endpoint re-pinning.

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 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.
Controllers. All learned methods (Diffuser, FM, FlowMatcher, their safe variants, StreamingFlow, and SafeStreamingFlow) are executed through the same direct PD controller on /cmd_vel at 20 Hz (gains , linear-velocity clamp 0.50 m/s). The classical baselines (A*, RRT*) emit geometric paths without a velocity reference and are therefore tracked by the Nav2 FollowPath controller (Regulated Pure Pursuit, goal tolerance 0.25 m, desired linear velocity 0.35 m/s). For the streaming methods (StreamingFlow, SafeStreamingFlow), the PD loop additionally consumes the per-step velocity reference, and the HOCBF-QCQP filter (Eq. 18) operates inside this tick.
Benchmark protocol. 100 (start, goal) pairs sampled with seed 42 from the free-space bounds above, distance range [5, 15] m. Goal tolerance 0.25 m. After the planned horizon (25.6 s), the PD controller keeps pulling the robot toward the goal. The single violation of SafeStreamingFlow (closed-loop) occurs in this phase. Sm. is the mean acceleration of the commanded velocity.