Latent Barrier Steering: Hierarchical Safety for Generative Planning
We introduce Latent Barrier Steering (LBS), a hierarchical semantic-to-path framework for safe flow-matching-based generative planning. Existing control-barrier-function (CBF) safety filters for diffusion and flow-matching planners act locally on generated samples, either during sampling or after prediction.
From the abstract. Our summary is in progress.
Full paper
Latent Barrier Steering: Hierarchical Safety for Generative Planning
Published under CC BY 4.0. Reproduced with attribution; original at arXiv:2611.13227 (PDF).
Abstract
We introduce Latent Barrier Steering (LBS), a hierarchical semantic-to-path framework for safe flow-matching-based generative planning. Existing control-barrier-function (CBF) safety filters for diffusion and flow-matching planners act locally on generated samples, either during sampling or after prediction. Such repair is effective for small violations, but can struggle when a new constraint blocks the whole selected behavior mode rather than merely perturbing it locally. LBS decouples behavior selection from path certification through two coordinated interventions: it first steers the generator’s behavior latent toward rollouts with larger safety margin, then decodes the steered latent and applies a path-space CBF quadratic program (QP) only for residual violations. We show that latent steering increases the margin available to the path-space corrector, yielding finite-time recovery guarantees and reduced correction burden. Experiments across navigation and robot end-effector planning tasks show that LBS preserves safety while improving goal reaching and reducing correction burden compared with path-level safety filters.
1 Introduction
Robotic path planning must combine expressive behavior generation with strong safety guarantees. Generative policies, including diffusion and flow-matching planners, are attractive because they model multimodal trajectory distributions and synthesize diverse high-dimensional behaviors from demonstrations [16, 10, 34, 23, 17, 5, 3, 2]. Yet deployment safety is not inherited from offline training: new obstacles, workspace limits, or feasibility constraints can shift the test-time problem away from the demonstrations used to train the generator. This has motivated safe generative planners that combine learned samplers with control barrier functions (CBFs), which encode safety through a barrier-defined set, and impose constraints through quadratic programs or related filtering steps [1, 13, 27, 39, 40, 8, 41]. Existing CBF-based generative planners instantiate this idea primarily as path-level repair: they inject barrier constraints into the denoising or flow-generation process, or apply a CBF correction phase after a trajectory has been generated [40, 8, 41]. In both cases, the intervention acts on sample or waypoint coordinates, pushing unsafe portions of the trajectory back toward the safe set while staying close to the generator’s original output. This is effective when the generated trajectory is already nearly safe, so that only a short segment must be moved away from an obstacle. Under larger constraint shifts, however, the new constraint may block a substantial portion of the selected behavior mode. The corrector is then no longer making a local geometric repair: it must reshape a long connected segment of the rollout, which can increase intervention energy and leave the final trajectory safe but far from the goal.
z_{0} to z_{+} toward a safer rollout, then applies path-level CBF repair only for residual violations, yielding a trajectory that is both safe and goal-reaching.When path-level repair has to reshape a long segment of a rollout, the desired solution may be another behavior that the generator already knows how to produce. A multimodal demonstration dataset can contain several valid ways to solve the same start-goal task, such as passing above, below, or between obstacles, and generative policies can represent these alternatives as diverse rollouts. In standard generative planners, however, this diversity is usually accessed through stochastic sampling: the initial noise or sampling seed determines which behavior appears, with no direct handle for a safety filter to choose a rollout that is easier to certify. Geometry-aligned behavior latents, as in parameterized diffusion policies (PDP), provide such a handle by learning a low-dimensional coordinate in which nearby latent values decode to similar trajectories and larger latent moves induce more substantial behavior changes [43]. This suggests a different division of labor for safe generative planning as shown in Figure 1: use the behavior latent to select or interpolate a safer rollout before asking a path-level CBF corrector to enforce the final constraints.
In this paper, we propose Latent Barrier Steering (LBS), a two-stage framework for safe parameterized flow matching that separates behavior selection from path certification. LBS first applies a CBF quadratic program (CBF-QP) in the behavior latent space to steer the decoded rollout toward a larger robust safety margin. It then decodes the steered latent and applies a path-space CBF-QP only to the remaining waypoint-level violations. This semantic-to-path structure lets the planner change the selected behavior before invoking local path repair. Theoretically, we show that latent steering improves the safety margin handed to the path-space corrector, yielding finite-time latent recovery when a safe latent is reachable and tighter path-level correction-time and intervention-energy certificates. Empirically, LBS improves safety, goal reaching, and correction efficiency across constrained planning tasks. Our contributions are:
- Introduce semantic-to-path safety with parameterized flow matching. We build on a parameterized flow-matching planner whose geometry-aligned latent indexes different rollout behaviors. LBS uses this latent as the first point of safety intervention, steering the selected behavior before applying path-space CBF certification.
- Analyze when latent steering reduces path-space correction. We show that increasing the latent safety margin gives the path-space corrector a less-violating warm start. This yields finite-time latent recovery when a safe latent is reachable, and tighter correction-time and intervention-energy certificates for the downstream CBF-QP.
- Demonstrate safer and more goal-directed constrained planning. Across constrained planning tasks, LBS preserves safety while improving goal reaching and reducing correction energy compared with path-level safety filters.
2 Related Work
Generative policies for planning.
Diffusion and flow-based generative models provide expressive trajectory priors for robot planning and control, with diffusion planners modeling flexible multimodal behavior through iterative denoising and flow-matching planners improving sampling efficiency through deterministic transport [16, 10, 34, 23, 24, 17, 5, 37, 29, 3, 2]. These models have been applied to offline RL, visuomotor imitation, navigation, manipulation, and diverse human-demonstration datasets [25, 33, 18]. Their strength is that a single learned sampler can represent many plausible trajectories for the same task context. However, the generated behavior is usually selected by conditioning variables or stochastic noise, so multimodal diversity does not by itself provide a controllable safety mechanism under new constraints.
Safety certification for generative planners.
Control barrier functions (CBFs) and related invariance tools provide a standard way to enforce safety by maintaining the forward invariance of a superlevel set, often through a quadratic program that minimally modifies a nominal command [1, 13, 27, 39]. Recent safe generative planners attach this machinery to diffusion or flow sampling: SafeDiffuser embeds finite-time invariance into the diffusion process, SafeFlow introduces flow-matching barrier functions for safe trajectory generation, and SafeFlowMatcher decouples prediction from correction by applying a finite-time CBF certificate only to the final path-space correction phase [40, 8, 41]. These methods provide formal safety mechanisms at test time, but their interventions are still expressed in sample or waypoint coordinates. They therefore primarily address local path repair after the generator has already selected a behavior.
Behavior latents and controllable multimodality.
Controllable multimodality has a long history in parameterized actions, options, and skills, where a policy selects both a discrete behavior and continuous parameters that adapt the behavior to a task instance [36, 20, 7, 15, 26, 32, 9, 11, 44, 14, 45]. Related work on skill discovery and latent-action imitation learns reusable behavior abstractions from demonstrations or interaction data [28, 33, 21, 31, 38]. PDP brings this idea to diffusion policies by learning a continuous behavior latent whose geometry is aligned with trajectory similarity, turning noise-driven diversity into an optimizable behavior handle [43]. These threads motivate our use of a behavior latent as the semantic coordinate for safety-aware steering before path-level certification.
3 Background
3.1 Parameterized flow matching for trajectory planning
Let \mathcal{D} denote the waypoint space, and let \tau=(\tau^{0},\ldots,\tau^{H})\in\mathcal{D}^{H+1} denote a planning trajectory over horizon H under context c. Flow matching learns a time-dependent vector field v_{t}(\cdot,c;\theta) whose ODE transports a simple prior p_{0} to the demonstration distribution q(\tau\mid c) [23, 24]: \frac{d}{dt}\psi_{t}(\tau_{0},c)=v_{t}(\psi_{t}(\tau_{0},c),c;\theta), with \tau_{0}\sim p_{0} and \psi_{1}(\tau_{0},c)\sim q(\cdot\mid c). Following conditional flow matching, a standard objective samples \tau_{0}\sim p_{0}, \tau_{1}\sim q(\cdot\mid c), t\sim\mathrm{Unif}[0,1], sets \tau_{t}=(1-t)\tau_{0}+t\tau_{1}, and regresses to the optimal-transport velocity:
\mathcal{L}_{\mathrm{FM}}(\theta)=\mathbb{E}\big[\left\lVert v_{t}(\tau_{t},c;\theta)-(\tau_{1}-\tau_{0})\right\rVert_{2}^{2}\big].To expose a controllable behavior coordinate, we follow parameterized diffusion policies and learn a trajectory encoder q_{\phi}(z\mid\tau) for a low-dimensional latent z\in\mathcal{Z}\subset\mathbb{R}^{d_{z}} [43]:
q_{\phi}(z\mid\tau)=\mathcal{N}\!\big(\mu_{\phi}(\tau),\operatorname{diag}(\sigma_{\phi}^{2}(\tau))\big),\qquad\bar{z}(\tau)=\mu_{\phi}(\tau),where \bar{z}(\tau) is the deterministic code used for conditioning. The generator produces \tau(z;\xi)=G_{\theta}(c,z,\xi), with stochastic seed \xi or deterministic decode \hat{\tau}_{\theta}(z,c). With latent prior p(z) and nonnegative weights \lambda_{\mathrm{rec}},\lambda_{\mathrm{KL}},\lambda_{\mathrm{geo}}, we write a generic parameterized flow-matching objective as
\displaystyle\mathcal{L}_{\text{PFM}}(\theta,\phi)={} \\ \displaystyle\mathcal{L}_{\mathrm{FM}}(\theta;z,c)+\lambda_{\mathrm{rec}}\,\mathbb{E}_{\tau,z\sim q_{\phi}}\!\big[\left\lVert\tau-\hat{\tau}_{\theta}(z,c)\right\rVert_{2}^{2}\big] \\ \displaystyle+\lambda_{\mathrm{KL}}\,\mathbb{E}_{\tau}\!\big[D_{\mathrm{KL}}(q_{\phi}(z\mid\tau)\,\|\,p(z))\big]+\lambda_{\mathrm{geo}}\,\mathcal{L}_{\mathrm{geo}},where the geometry loss aligns trajectory and latent distances. For a sampled pair (\tau_{i},\tau_{j}), PDP computes a trajectory distance \delta^{X}_{ij}=d_{\mathrm{softDTW}}(X(\tau_{i}),X(\tau_{j})) between behavior-trace feature sequences X(\tau_{i}) and X(\tau_{j}) using soft-DTW [6], and a latent distance \delta^{z}_{ij}=\left\lVert\bar{z}(\tau_{i})-\bar{z}(\tau_{j})\right\rVert_{2}. It then penalizes \mathcal{L}_{\mathrm{geo}}=\mathbb{E}_{(i,j)}[(\delta^{z}_{ij}-\kappa_{\mathrm{geo}}\delta^{X}_{ij})^{2}], with scale \kappa_{\mathrm{geo}}>0. This geometry term encourages z to act as a behavior coordinate: nearby latents decode to similar trajectory traces, while larger latent displacements correspond to larger behavioral changes.
3.2 Control barrier functions for path safety
For a control-affine system \dot{x}=f(x)+g(x)u with state x\in\mathcal{D} and input u\in\mathcal{U}, and a C^{1} barrier b:\mathcal{D}\to\mathbb{R}, a control barrier function defines safety as \mathcal{C}=\{x:b(x)\geq 0\} and enforces forward invariance through the inequality L_{f}b(x)+L_{g}b(x)u+\alpha(b(x))\geq 0, where L_{f},L_{g} are Lie derivatives and \alpha is a class-\mathcal{K} rate [1, 13]. Given a nominal input u^{\mathrm{nom}}, the standard CBF-QP chooses the closest safe input:
u^{\star}=\mathop{\mathrm{arg\,min}}_{u\in\mathcal{U}}\left\lVert u-u^{\mathrm{nom}}\right\rVert_{2}^{2}\quad\text{s.t.}\quad L_{f}b(x)+L_{g}b(x)u+\alpha(b(x))\geq 0For states that may start outside \mathcal{C}, fractional-power rates \alpha(b)=\kappa_{\mathrm{cbf}}\,\mathrm{sgn}(b)|b|^{\rho} with rate constant \kappa_{\mathrm{cbf}}>0 and fractional-power exponent 0<\rho<1 give finite-time convergence into \mathcal{C} [27, 39, 40].
Safe generative planners apply such constraints during diffusion or flow sampling, or as a correction phase after unconstrained prediction [40, 8, 41]. SafeFlowMatcher’s hard-correction phase satisfies, at sampling time t, for corrected waypoint \tau_{t}^{c,k} (waypoint k of the path at time t) and correction input u_{t}^{k},
\nabla b(\tau_{t}^{c,k})^{\top}u_{t}^{k}+\epsilon\,\mathrm{sgn}(b(\tau_{t}^{c,k})-\delta)\,|b(\tau_{t}^{c,k})-\delta|^{\rho}+w_{t}^{k}r_{t}^{k}\geq 0,where \epsilon>0 is the convergence rate, 0<\rho<1 is the same fractional-power exponent as in (4), \delta\geq 0 is the robustness margin, and w_{t}^{k}\geq 0 is a vanishing weight schedule paired with a per-waypoint slack variable r_{t}^{k} that together deactivate after switch time t_{w}. The corrector enters \mathcal{C}_{\delta}=\{b\geq\delta\} within correction time
T_{\mathrm{SFM}}\leq t_{w}+\frac{(\delta-b(\tau_{t_{w}}^{c,k}))^{1-\rho}}{\epsilon(1-\rho)}.This bound depends on the pre-correction barrier margin, the downstream quantity tightened in Section 4.
4 Latent Barrier Steering
We introduce Latent Barrier Steering (LBS), a two-stage safety framework for generative planning that separates behavior-level steering from path-level certification. Prior CBF-based generative planners apply certified correction after a plain generator has already selected a behavior mode, leaving the corrector to repair the resulting rollout in waypoint or sample space. LBS instead builds on a parameterized flow-matching planner whose geometry-aligned behavior latent indexes different task-solving rollouts. At test time, Stage I treats this latent as the first safety intervention point: given a differentiable barrier function for the deployment constraint, it steers the latent toward a decoded rollout with a larger worst-case barrier margin. Stage II then uses this decoded rollout as a safety-aware warm start for a downstream path-space CBF-QP corrector, which enforces the remaining waypoint constraints under standard barrier-certificate conditions.
4.1 LBS Objective with a Geometry-Aligned Latent
Stage I steers the behavior coordinate of a parameterized flow-matching planner. For a fixed task context c, each latent z\in\mathcal{Z} decodes to a rollout
\tau(z)=G_{\theta}(c,z)=\bigl(\tau^{0}(z),\ldots,\tau^{H}(z)\bigr)\in\mathcal{D}^{H+1}.We use a deterministic decode \tau(z) by fixing the sampling randomness. The geometry-regularized objective in Section 3.1 encourages local latent moves to induce controlled rollout changes. Because the encoder is KL-regularized toward the prior p(z)=\mathcal{N}(0,I), Stage I restricts steering to a compact region \Omega\subseteq\mathcal{Z} around the prior center, implemented by latent clipping. The prior is used only to organize the latent space during training. At test time, Stage I optimizes a single latent within \Omega, which contains the encoded demonstration modes and their interpolation region. On this region, we assume the decoder and barrier are locally Lipschitz. This is an analysis assumption encouraged by the geometry objective rather than guaranteed by it (Appendix B.4). Concretely, for z,z^{\prime}\in\Omega and x,x^{\prime}\in\mathcal{D},
\|\tau(z)-\tau(z^{\prime})\|\leq L_{\tau}\|z-z^{\prime}\|,\qquad|b(x)-b(x^{\prime})|\leq L_{b}\|x-x^{\prime}\|.This local geometry is the condition that makes latent-space safety steering meaningful: a controlled update in z produces a controlled change in the decoded rollout.
We now define the latent safety objective. Using the barrier b and robustness margin \delta from Section 3.2, Stage I assigns each latent a differentiable approximation to the worst shifted waypoint margin of its decoded rollout:
m_{\beta}(z):=-\frac{1}{\beta}\log\sum_{k=0}^{H}\exp\!\left(-\beta\bigl(b(\tau^{k}(z))-\delta\bigr)\right),\qquad\beta>0.This soft-min margin satisfies
\min_{k}\bigl(b(\tau^{k}(z))-\delta\bigr)-\frac{\log(H+1)}{\beta}\leq m_{\beta}(z)\leq\min_{k}\bigl(b(\tau^{k}(z))-\delta\bigr),so \varepsilon_{\mathrm{soft}}=\log(H+1)/\beta is the only gap between m_{\beta} and the true worst-waypoint margin; see Appendix B.1. Combining this construction with the local geometry above gives
|m_{\beta}(z)-m_{\beta}(z^{\prime})|\leq L_{b}L_{\tau}\|z-z^{\prime}\|,\qquad z,z^{\prime}\in\Omega,with proof in Appendix B.2. Thus, controlled motion in the behavior latent produces controlled changes in the rollout safety margin. The strongest Stage I target is the safe-latent set \mathcal{Z}_{\delta}:=\{z\in\mathcal{Z}:m_{\beta}(z)\geq 0\}, whose elements decode to rollouts satisfying the buffered waypoint constraint up to the soft-min gap. LBS, however, does not require Stage I to reach this set before handoff: increasing m_{\beta} already reduces the barrier deficit that Stage II must correct. This is the margin quantity used in Section 4.2 for latent CBF steering and in Section 4.3 to relate latent progress to the path-space correction burden. Because m_{\beta} is defined over discrete waypoints, all guarantees following are stated at the waypoint level. Appendix B.3 extends these margins to continuous path segments.
4.2 Stage I: Latent CBF Steering
Stage I uses the latent margin m_{\beta} from Section 4.1 as a barrier over the behavior latent. Rather than modifying waypoints independently, it updates z so that the pretrained decoder produces a rollout with larger safety margin before path-space correction. We model latent steering as \dot{z}=u_{z} and choose the smallest modification to a reference latent update u_{z}^{\mathrm{ref}}. In our implementation, u_{z}^{\mathrm{ref}}(z)=-\gamma_{z}z with \gamma_{z}>0, which mildly contracts the latent toward the prior center and discourages off-support drift. At each latent z, LBS solves
u_{z}^{\star}(z)=\arg\min_{u\in\mathbb{R}^{d_{z}}}\|u-u_{z}^{\mathrm{ref}}(z)\|_{2}^{2}\quad\mathrm{s.t.}\quad\nabla m_{\beta}(z)^{\top}u+\kappa\,\operatorname{sgn}(m_{\beta}(z))|m_{\beta}(z)|^{\rho}\geq 0,where \kappa>0 and 0<\rho<1 are the CBF rate and exponent. Because (7) has one affine constraint, it is the projection of u_{z}^{\mathrm{ref}} onto a half-space. Let \psi(z):=\nabla m_{\beta}(z)^{\top}u_{z}^{\mathrm{ref}}(z)+\kappa\,\operatorname{sgn}(m_{\beta}(z))|m_{\beta}(z)|^{\rho}. Then, whenever \nabla m_{\beta}(z)\neq 0,
u_{z}^{\star}(z)=u_{z}^{\mathrm{ref}}(z)+\frac{[-\psi(z)]_{+}}{\|\nabla m_{\beta}(z)\|_{2}^{2}}\nabla m_{\beta}(z).Thus, Stage I follows the reference update when it already satisfies the latent barrier condition, and otherwise adds the minimum correction along \nabla m_{\beta}; the derivation is in Appendix C.1.
Proposition 1 (Latent margin decrease).
Let V(z):=[-m_{\beta}(z)]_{+}. Along the Stage I flow \dot{z}=u_{z}^{\star}(z), whenever m_{\beta}(z)<0 and \nabla m_{\beta}(z)\neq 0,
\dot{V}(z(t))\leq-\kappa V(z(t))^{\rho}.Proposition 1 says that Stage I decreases the margin deficit whenever the unsafe decoded rollout has a first-order latent direction for improvement. The proof is a direct consequence of the CBF constraint and is given in Appendix C.2. When this first-order sensitivity is uniformly nonzero on the unsafe part of \Omega, the same fractional-power rate gives finite-time recovery.
Theorem 1 (Finite-time Stage-I recovery).
Suppose the latent flow \dot{z}=u_{z}^{\star}(z) remains in \Omega before reaching \mathcal{Z}_{\delta}, and suppose there exists g_{m}>0 such that \|\nabla m_{\beta}(z)\|_{2}\geq g_{m} for all z\in\Omega with m_{\beta}(z)<0. Then, for any z_{0}\in\Omega with m_{\beta}(z_{0})<0, z(t)\in\mathcal{Z}_{\delta} for all t\geq T_{z}:=|m_{\beta}(z_{0})|^{1-\rho}/(\kappa(1-\rho)). Moreover, \mathcal{Z}_{\delta} is forward-invariant.
The proof is in Appendix C.3. In practice, Stage I uses projected Euler steps with either backpropagated or finite-difference estimates of \nabla m_{\beta}; implementation details and generator-call cost are given in Appendix E.
4.3 Stage II Correction and Handoff
Stage I returns a steered latent z_{+} and decoded rollout \tau(z_{+}). Stage II then applies the path-space CBF-QP from Section 3.2 to certify the remaining waypoint-level violations. The key question is whether improving the latent margin m_{\beta} actually reduces the path-space violation.
Let \tilde{b}_{t_{w}}(z):=\min_{k}(b(\tau_{t_{w}}^{c,k}(z))-\delta) denote the shifted path margin at the start of hard correction, where t_{w} is the switch time used by the path-space corrector. For predictor–corrector methods, the switch-time path may differ from the decoded rollout; write this deviation as \varepsilon_{\mathrm{pred}}(z):=\max_{k}\|\tau_{t_{w}}^{c,k}(z)-\tau^{k}(z)\|_{2}. For a post-hoc corrector applied directly to \tau(z), \varepsilon_{\mathrm{pred}}(z)=0.
Proposition 2 (Latent-to-path margin transfer).
Under the local regularity condition in Section 4.1, for all z\in\Omega,
|\tilde{b}_{t_{w}}(z)-m_{\beta}(z)|\leq\varepsilon_{\mathrm{soft}}+L_{b}\varepsilon_{\mathrm{pred}}(z),\qquad\varepsilon_{\mathrm{soft}}=\frac{\log(H+1)}{\beta}.Proposition 2 is the formal handoff from latent steering to path correction: increasing m_{\beta}(z) improves the initial path-space margin up to the soft-min gap and any predictor deviation. The proof is in Appendix D.1. Thus, Stage I does not need to certify the trajectory by itself; it only needs to reduce the deficit that Stage II starts from.
Corollary 1 (Reduced Stage-II correction burden).
Let V_{+}:=[-\tilde{b}_{t_{w}}(z_{+})]_{+} be the initial Stage-II barrier deficit. With Stage-II CBF rate \epsilon>0 and exponent \rho\in(0,1), the path-space corrector satisfies
T_{\mathrm{corr}}(z_{+})\leq t_{w}+\frac{V_{+}^{1-\rho}}{\epsilon(1-\rho)}.If the squared intervention magnitude is bounded by c_{II}V_{\mathrm{path}}^{2\rho} during correction, then
J_{II}(z_{+})\leq\frac{c_{II}V_{+}^{1+\rho}}{\epsilon(1+\rho)}.Corollary 1 shows why the latent stage is useful even when it does not reach \mathcal{Z}_{\delta}: by decreasing V_{+}, Stage I tightens both the certified correction-time bound and the intervention-energy bound. The proof follows the standard fractional-power CBF argument and is given in Appendix D.2.
It remains to choose when to stop latent steering. Running Stage I longer reduces the terminal deficit but incurs additional latent-steering cost. In the exact-gradient limit, the descent law from Proposition 1 gives V_{+}^{1-\rho}=V_{0}^{1-\rho}-\eta\kappa(1-\rho)N_{z}, where V_{0}:=[-m_{\beta}(z_{0})]_{+}. Combining this decrease with a per-step Stage-I cost c_{I} and the Stage-II energy bound above yields a cost-sensitive stopping rule.
Theorem 2 (Cost-sensitive Stage-I handoff).
Suppose the Stage-I decrease law holds along the latent trajectory and the margin-transfer slack in Proposition 2 is absorbed into the Stage-II deficit. For V_{0}>0, the resulting upper bound on total cost is minimized at V_{+}^{\star}=(c_{I}\epsilon/(\eta\kappa c_{II}))^{1/(2\rho)}. The corresponding handoff iteration is N_{z}^{\star}=(V_{0}^{1-\rho}-(V_{+}^{\star})^{1-\rho})/(\eta\kappa(1-\rho)) when V_{+}^{\star}<V_{0}; otherwise, LBS hands off to Stage II immediately.
Theorem 2 says that Stage I should stop once another latent update is expected to cost more than the correction energy it saves downstream. The convexity argument and the explicit total-cost expression are deferred to Appendix D.3.
5 Experiments
We evaluate whether combining behavior-latent steering with path-space CBF certification improves constrained flow-matching planning. The experiments are organized around four questions. Q1: How does LBS compare with existing safe generative planners across different domains and test-time safety constraints? Q2: How does LBS change the generated behavior before path-space correction? Q3: How effective is Stage I’s latent steering design compared with alternative ways of selecting the behavior latent? Q4: What does Stage I achieve on its own, and what does it hand off to Stage II?
Setup.
We evaluate on constrained planning tasks spanning low-dimensional navigation, long-horizon maze navigation, and robot end-effector planning. In each domain, the pretrained flow-matching planner is trained on a multimodal dataset with several feasible ways to reach the goal. At test time, we keep the pretrained planner fixed and introduce three different safety constraints, shown in Figure 2. These constraints vary how much the originally generated rollout must change before it can be certified, but the method is not given this structure explicitly. Full domain construction, obstacle layouts, model architectures, and training details are provided in Appendix F.
Baselines and Metrics.
We compare LBS against vanilla flow-matching planner, SafeDiffuser [40], SafeFlow [8], and SafeFlowMatcher [41], which corresponds to using Stage II without latent steering. We report Barrier Safety (referred to as Safety below, with Maze2D walls handled as described in Appendix F.3), Reach, final goal distance (ED), CBF intervention Energy, curvature smoothness (CS), and per-episode Stage-I/Stage-II runtime. Together, these metrics distinguish whether a method is safe, goal-reaching, or both, with low correction burden.
5.1 Performance Comparison Across Domains and Constraints
Table 1 reports Safety, Reach, and intervention Energy for all three constraints in each domain. Final goal distance, curvature smoothness, and runtime are reported in Appendix I. This comparison evaluates whether LBS improves the overall safety–performance tradeoff relative to existing path-level safety filters under the same pretrained planner and test-time constraints.
Across domains and constraints, the table shows a clear separation between goal-directed generation and certified safety. The unconstrained flow-matching planner often preserves the task behavior learned from demonstrations, so its rollouts remain close to the goal, but it has no mechanism to adapt that behavior to new safety constraints. This leads to goal-reaching trajectories that are frequently unsafe. Existing CBF-based safety filters correct this failure in the opposite direction: they reliably improve safety, but because the intervention is applied in sample or waypoint space after a behavior has already been selected, the corrected trajectory can lose the structure needed to complete the task. This is reflected not only in reduced reach, but also in larger final distance (Table 6) and higher correction energy.
- I
- Vanilla FM
- 12%
- 100%
- –
- 12%
- 100%
- –
- 0%
- 50%
- –
- SafeDiffuser
- 100%
- 10%
- 1.226
- 100%
- 0%
- 0.0023
- 100%
- 0%
- 0.0288
- SafeFlow
- 100%
- 18%
- 1.077
- 100%
- 16%
- 0.0020
- 100%
- 0%
- 0.1208
- SafeFlowMatcher
- 100%
- 18%
- 1.166
- 100%
- 14%
- 0.0075
- 100%
- 0%
- 0.2668
- Full LBS
- 100%
- 100%
- 0.037
- 100%
- 100%
- 0.0004
- 100%
- 95%
- 0.010
- II
- Vanilla FM
- 0%
- 100%
- –
- 0%
- 100%
- –
- 38%
- 50%
- –
- SafeDiffuser
- 100%
- 34%
- 0.728
- 100%
- 0%
- 0.0023
- 100%
- 7%
- 0.0010
- SafeFlow
- 100%
- 20%
- 0.976
- 100%
- 0%
- 0.0023
- 100%
- 25%
- 0.0624
- SafeFlowMatcher
- 100%
- 22%
- 1.051
- 100%
- 0%
- 0.0086
- 98%
- 18%
- 0.1404
- Full LBS
- 100%
- 90%
- 0.160
- 100%
- 100%
- 0.0004
- 100%
- 90%
- 0.009
- III
- Vanilla FM
- 0%
- 100%
- –
- 0%
- 100%
- –
- 28%
- 50%
- –
- SafeDiffuser
- 100%
- 0%
- 1.321
- 100%
- 0%
- 0.0023
- 100%
- 7%
- 0.0072
- SafeFlow
- 100%
- 4%
- 1.262
- 100%
- 0%
- 0.0023
- 100%
- 38%
- 0.0345
- SafeFlowMatcher
- 100%
- 4%
- 1.366
- 100%
- 0%
- 0.0086
- 100%
- 53%
- 0.0740
- Full LBS
- 100%
- 82%
- 0.303
- 100%
- 98%
- 0.0028
- 100%
- 93%
- 0.004
Full LBS changes this pattern by intervening before path-space certification: the latent stage can change the selected behavior, giving Stage II a rollout that is closer to both the safe set and the task solution. This explains why LBS preserves goal reaching while maintaining high safety, and why its CBF intervention energy is lower in most settings. Because all methods use the same pretrained planner within each domain, the gains come from where safety intervention is applied at test time rather than from a stronger generator or additional task-specific training. The runtime columns in Table 6 reflect the current implementation tradeoff: Stage I adds overhead due to zeroth-order finite-difference gradients, while Stage II remains comparable to path-level baselines. This overhead grows linearly with the behavior-latent dimension d_{z} (Appendix E.3), which is set by the number of demonstrated behavior modes rather than by the horizon or robot degrees of freedom (d_{z}\leq 4 in all domains), and the resulting 0.35–4.50 s of Stage I is incurred once before execution. Thus, under the present implementation, the main efficiency gain appears as reduced correction burden rather than lower wall-clock time; cheaper latent-gradient estimators should reduce the Stage I cost while preserving the qualitative advantage.
5.2 Ablation: Latent Steering Provides the Warm Start
The main comparison shows that LBS improves the safety–goal-reaching tradeoff, but the table alone does not explain how the two stages interact. We therefore visualize a representative episode in Figure 3, comparing path-space correction with and without the latent-steering stage. The figure is organized as two rows with five columns. The first row shows Full LBS: the rollout is first decoded from the initial behavior latent, then updated through Stage I, and finally passed to Stage II for path-space CBF correction. The second row removes Stage I and applies the same Stage II corrector directly to the original decoded rollout. The first panel of Full LBS is therefore the same rollout as the Stage-II-only warm start shown in the third panel of the second row.
This visualization isolates the role of Stage I. Before path-space correction, the initial rollout is unsafe and poorly positioned for local repair. When Stage II starts directly from this cold rollout, the CBF-QP can push the trajectory toward the safe set, but the correction remains tied to the originally selected behavior and fails to recover a goal-reaching path. In contrast, Stage I changes the decoded behavior before certification: by the third column of the LBS row, the rollout is not necessarily fully safe, but it is already in a much better region for downstream correction. Starting from this latent-steered warm start, Stage II only needs to remove residual waypoint-level violations, and the final trajectory remains both safe and task-completing.
This ablation supports the central semantic-to-path design of LBS. Stage I is not intended to replace CBF certification, and Stage II is not sufficient when initialized from a behavior that is incompatible with the new constraint. The improvement comes from their composition: latent steering changes the selected behavior at the level of the generator, while path-space correction certifies the remaining local violations. The comparison also explains the lower intervention energy observed in Table 1: after Stage I, the corrector starts from a less-violating and more goal-directed rollout, so it does not need to perform a large deformation in waypoint space.
5.3 Ablation Study of the Stage-I Latent Steering
Table 2 compares ways of selecting the latent before path-space correction. All methods use the same pretrained generator, the same safety margin m_{\beta}(z), and the identical Stage-II corrector:
- Best-of-
N(BoN): sampleNlatents from the prior and select the decoded rollout with the largestm_{\beta}. We reportN\in\{1,4,16,64\}(BoN-N). - Plain latent gradient ascent (PLGA): directly ascend
m_{\beta}(z), with the best step size per domain from\{10^{-3},\dots,1\}.
PLGA and LBS share the same initial latent, gradient estimator, clipping region \Omega, early-stopping criterion, and Stage-I wall-clock budget: the update rule is the only difference. We also report Stage I only, which decodes the steered latent without Stage-II correction. Table 2 supports three observations:
- Neither stage suffices alone. Stage II alone is safe but rarely reaches the goal, whereas Stage I alone preserves reach but leaves residual violations. Stage I does not need to reach the buffered safe-latent set for the two to combine well: its terminal margin is still negative in most episodes, yet it shrinks the deficit handed to Stage II (Section 5.4).
- Increasing
Ndoes not recover goal reaching. BoN reaches the goal in at most48\%of episodes for anyN, and Reach is non-monotonic inN(in Maze2D,48\%atN=4but0\%atN=64). BoN can only choose among behaviors exposed by prior sampling, and selecting by safety margin among them favors conservative behaviors that do not complete the task. - The CBF-QP update outperforms plain gradient ascent. PLGA, which does optimize the latent, closes most of the gap, but LBS achieves higher Reach in all three domains, with the largest gap in Maze2D, where preserving task-level structure during safety optimization is hardest. PLGA always moves along
\nabla_{z}m_{\beta}, so it keeps pushing the latent toward higher-margin, often more conservative behaviors even when the margin is already improving fast enough. The CBF-QP instead follows the reference updateu_{z}^{\mathrm{ref}}whenever it already satisfies the prescribed margin-improvement condition, and otherwise adds only the smallest correction along\nabla_{z}m_{\beta}needed to satisfy it (Eq. (8)). This better preserves goal-directed behavior when aggressive margin ascent conflicts with progress toward the goal.
- Stage II only (SafeFlowMatcher)
- 100%
- 4%
- 100%
- 0%
- 100%
- 53%
- Stage I only
- 10%
- 100%
- 10%
- 100%
- 20%
- 95%
- BoN-1 + Stage II
- 100%
- 0%
- 100%
- 0%
- 100%
- 0%
- BoN-4 + Stage II
- 100%
- 0%
- 100%
- 0%
- 90%
- 48%
- BoN-16 + Stage II
- 100%
- 0%
- 100%
- 32%
- 100%
- 5%
- BoN-64 + Stage II
- 100%
- 0%
- 100%
- 36%
- 98%
- 0%
- PLGA + Stage II
- 100%
- 76%
- 100%
- 92%
- 100%
- 68%
- Full LBS
- 100%
- 82%
- 100%
- 98%
- 100%
- 93%
5.4 What Stage-I Latent Steering Hands Off to Stage II
Section 5.3 shows that Stage-I latent steering yields the best safety–reach trade-off once combined with Stage II, but not what the steering itself changes before the handoff. We therefore track the Stage-I latent trajectory directly (Table 3): how much the latent margin improves, whether the steering gradient remains informative, and how far from the buffered safe-latent set Stage I leaves the latent when Stage II takes over. The gradient norms show no systematic collapse in the evaluated regions, and the latent margin improves substantially in every domain, including 2D point-navigation, where clipping activates in every episode. The terminal margin nevertheless remains negative in most episodes: Stage I typically does not reach the buffered safe-latent set on its own, but hands Stage II a much smaller deficit. This is the warm-start role analyzed in Proposition 2 and Corollary 1.
- 2D
- -1.03\to-0.08
- 0.46
- 100%
- 90%
- Franka
- -0.21\to-0.006
- 0.09
- 8%
- 84%
- Maze2D
- -0.63\to-0.11
- 0.18
- 22%
- 88%
6 Limitations and Conclusion
We presented Latent Barrier Steering (LBS), a two-stage framework for safe flow-matching planning that steers a geometry-aligned behavior latent before path-space CBF certification. LBS gives the path-space corrector a safer, more goal-directed warm start, reducing the need to reshape an unsuitable rollout locally. Our analysis shows that latent margin improvement reduces the Stage II deficit, yielding finite-time recovery conditions and tighter correction-time and intervention-energy certificates. Empirically, LBS improves the safety–goal-reaching tradeoff over path-level safety filters across constrained planning tasks. The safety guarantee covers the planned path certified by Stage II. For Franka, this is the planned end-effector path, so tracking error and full-body collisions are outside its scope. The finite-time Stage I result depends on local regularity and non-vanishing pulled-back gradients of the learned latent-to-trajectory map, which the training objective encourages but does not certify. The current zeroth-order Stage I implementation also adds runtime overhead. Cheaper gradient estimators or learned margin critics are natural next steps.
Acknowledgments and Disclosure of Funding
This work used computational resources and services provided by the Unity Research Computing Platform. We also thank the anonymous reviewers for their comments and suggestions, which helped strengthen and clarify this work.
References
Appendix A Notation
\mathcal{Z}\subset\mathbb{R}^{d_{z}}: latent space;\Omega\subset\mathcal{Z}: compact region of validity for the latent CBF analysis.\tau(z)=(\tau^{0}(z),\ldots,\tau^{H}(z))\in\mathcal{D}^{H+1}: rollout at latentzwith context and noise fixed or averaged out.h_{k}(z)\triangleq b(\tau^{k}(z))-\delta: per-waypoint shifted barrier;m_{\beta}(z)=-\beta^{-1}\log\sum_{k}e^{-\beta h_{k}(z)}: softmin margin.\mathcal{Z}_{\delta}=\{z\in\mathcal{Z}:m_{\beta}(z)\geq 0\}: robust safe latent set.u_{z}^{\mathrm{ref}}:\mathcal{Z}\to\mathbb{R}^{d_{z}}: locally bounded reference update;u_{z}^{\star}: solution of (7).J_{\tau^{k}}(z)\in\mathbb{R}^{d_{\mathcal{D}}\times d_{z}}: Jacobian of\tau^{k}atz;H_{\tau^{k}}(z): Hessian tensor.\left[x\right]_{+}=\max(x,0), applied componentwise on vectors.U_{\mathrm{ref}}=\sup_{z\in\Omega}\left\lVert u_{z}^{\mathrm{ref}}(z)\right\rVert_{2},\left\lVert\nabla m_{\beta}\right\rVert_{\infty}=\sup_{z\in\Omega}\left\lVert\nabla m_{\beta}(z)\right\rVert_{2},M_{m}=\sup_{z\in\Omega}|m_{\beta}(z)|.g_{m}is the non-degeneracy lower bound on\|\nabla m_{\beta}\|_{2}on the unsafe set (hypothesis of Theorem 1);L_{b},L_{\tau}are the Lipschitz constants of the barrier and decoder from Section 4.1;L_{m}\leq L_{b}L_{\tau}is the resulting Lipschitz constant ofm_{\beta}(Appendix B.2);L_{\nabla m}is the Lipschitz constant of\nabla m_{\beta}used in the optional discrete-time analysis (Appendix C.4).
Appendix B Auxiliary Soft-Min and Geometry Facts
This appendix collects three small derivations and one geometry remark that the main text invokes without proof. Sections B.1–B.3 are referenced from Section 4.1; Section B.4 comments on the modeling status of the local geometry condition.
B.1 Soft-min margin and soft-min gap
The soft-min surrogate m_{\beta} in main-text eq. (4.1) sandwiches the true worst-waypoint margin: for any \beta>0 and any finite collection \{h_{k}\}_{k=0}^{H}\subset\mathbb{R},
\min_{k}h_{k}-\tfrac{\log(H+1)}{\beta}\;\leq\;m_{\beta}=-\beta^{-1}\log\sum_{k=0}^{H}e^{-\beta h_{k}}\;\leq\;\min_{k}h_{k}.This is the bound stated in main-text eq. (4.1); the soft-min gap is \varepsilon_{\mathrm{soft}}=\beta^{-1}\log(H+1).
Proof.
Let h_{\star}=\min_{k}h_{k}. Since e^{-\beta h_{\star}}\leq\sum_{k}e^{-\beta h_{k}}\leq(H+1)e^{-\beta h_{\star}}, applying -\beta^{-1}\log(\cdot) (which reverses inequalities) gives h_{\star}-\beta^{-1}\log(H+1)\leq m_{\beta}\leq h_{\star}, which is (9). ∎
The soft-min gradient is the softmax distribution: \partial_{h_{k}}m_{\beta}=w_{k}\triangleq e^{-\beta h_{k}}/\sum_{j}e^{-\beta h_{j}}\in[0,1] with \sum_{k}w_{k}=1. Hence m_{\beta} is 1-Lipschitz in \mathbf{h} under \left\lVert\cdot\right\rVert_{\infty}, since |m_{\beta}(\mathbf{h})-m_{\beta}(\mathbf{h}^{\prime})|\leq\left\lVert w\right\rVert_{1}\left\lVert\mathbf{h}-\mathbf{h}^{\prime}\right\rVert_{\infty}=\left\lVert\mathbf{h}-\mathbf{h}^{\prime}\right\rVert_{\infty} by Hölder’s inequality.
B.2 Lipschitz latent margin
This subsection derives main-text eq. (4.1): the Lipschitz constant L_{m}\leq L_{b}L_{\tau} for z\mapsto m_{\beta}(z).
Derivation of eq. (4.1).
Write h_{k}(z):=b(\tau^{k}(z))-\delta and \mathbf{h}(z):=(h_{0}(z),\ldots,h_{H}(z)). By main-text eq. (4.1), each h_{k} is L_{b}L_{\tau}-Lipschitz on \Omega:
|h_{k}(z)-h_{k}(z^{\prime})|\leq L_{b}\|\tau^{k}(z)-\tau^{k}(z^{\prime})\|_{2}\leq L_{b}L_{\tau}\|z-z^{\prime}\|_{2}.Combined with the 1-Lipschitzness of m_{\beta} in \mathbf{h} under \left\lVert\cdot\right\rVert_{\infty} (Section B.1),
|m_{\beta}(z)-m_{\beta}(z^{\prime})|\leq\left\lVert\mathbf{h}(z)-\mathbf{h}(z^{\prime})\right\rVert_{\infty}=\max_{k}|h_{k}(z)-h_{k}(z^{\prime})|\leq L_{b}L_{\tau}\left\lVert z-z^{\prime}\right\rVert_{2}.The constant L_{m}\leq L_{b}L_{\tau} does not depend on \beta: the soft-min weights only redistribute Lipschitz mass across waypoints, never amplify it. ∎
B.3 Waypoint-to-segment buffer
This subsection extends the waypoint-level margin to safety on continuous path segments, as referenced from Section 4.1. Suppose consecutive decoded waypoints are at most \ell apart and b is L_{b}-Lipschitz. We show
\min_{k}b(\tau^{k}(z))\geq\tfrac{L_{b}\ell}{2}\quad\Longrightarrow\quad[\tau^{k}(z),\tau^{k+1}(z)]\subseteq\{x:b(x)\geq 0\}\quad\forall k,a one-step Lipschitz bridge using the elementary geometric fact that any point on a line segment is at most half the segment length from at least one endpoint.
Derivation of (10).
Fix k and x\in[\tau^{k}(z),\tau^{k+1}(z)]. The two distances \|x-\tau^{k}\|_{2} and \|x-\tau^{k+1}\|_{2} sum to \|\tau^{k+1}-\tau^{k}\|_{2}\leq\ell, so at least one is \leq\ell/2. Calling the corresponding waypoint y, L_{b}-Lipschitzness of b gives
b(x)\geq b(y)-L_{b}\|x-y\|_{2}\geq\min_{k}b(\tau^{k}(z))-\tfrac{L_{b}\ell}{2}\geq 0by hypothesis. Thus b(x)\geq 0 for every x on every inter-waypoint segment. ∎
The factor of \tfrac{1}{2} comes entirely from the geometric step “the nearer endpoint is within \ell/2”; without it the buffer would have to be L_{b}\ell. Choosing \delta\geq L_{b}\ell/2 in the main text is the tightest robustness margin that makes a buffered waypoint certificate sufficient for segment safety.
B.4 Remarks on the latent safe set and learned latent geometry
Interpretation of the latent safe set.
The safe-latent set \mathcal{Z}_{\delta}=\{z:m_{\beta}(z)\geq 0\} is the preimage, through the learned decoder, of planned trajectories that satisfy the buffered waypoint condition. It is not a physical forward-invariance certificate for the robot dynamics. Stage I also does not optimize a notion of safety defined by Euclidean latent geometry alone: for every candidate z, LBS decodes \tau(z), evaluates the trajectory-space barriers b(\tau^{k}(z)), and updates z through the pulled-back gradient \nabla_{z}m_{\beta}(z), so the update is determined by the safety of the decoded trajectory. Accordingly, the forward invariance of \mathcal{Z}_{\delta} in Theorem 1 refers to the latent flow \dot{z}=u_{z}^{\star}(z), and the final safety claim of LBS is the path-space certificate provided by Stage II. This is consistent with existing safe generative planners [40, 8, 41], which also impose safety on the trajectories generated by a diffusion or flow-matching model. LBS adds a behavior-selection step before path-space correction. Throughout the paper, safety refers to the satisfaction of these constraints by the generated plan. It is distinct from the security and privacy of the generative model itself [30, 22].
Learned latent geometry.
The local Lipschitz condition (main-text eq. (4.1)) is an analysis assumption, not a global consequence of the soft-DTW objective. The geometry loss [6] encourages nearby latents to decode to nearby behavior traces, but global bi-Lipschitz guarantees would require stronger conditions such as full training support, smooth non-collapsed decoder, and exclusion of off-manifold extrapolation. We therefore restrict Stage I to a clipped region \Omega around the prior center and rely on the local condition only inside \Omega.
Relation to parameterized diffusion policies.
The geometry objective is inherited from parameterized diffusion policies (PDP) [43], which show that, trained on multimodal demonstrations, it yields a low-dimensional behavior manifold that supports smooth interpolation between demonstrated strategies and the synthesis of intermediate behaviors. PDP also ablates this term: removing it produces a geometrically warped latent space and substantially degrades gradient-based adaptation, while a discrete behavior representation cannot synthesize intermediate strategies. Meaningful latent interpolation therefore does not come from flow matching alone, but from the combination of multimodal demonstrations, the geometry-alignment objective, and a continuous behavior-conditioned generator. Constraint II in our experiments tests this property directly: every demonstrated mode is blocked, so success requires decoding an unseen intermediate behavior rather than selecting a demonstrated one. LBS reaches the goal in 90\%, 100\%, and 90\% of episodes in 2D point-navigation, Franka, and Maze2D, respectively, at 100\% Safety (Table 1). We do not claim robustness to arbitrarily misaligned latent spaces. LBS relies on this learned local structure and uses it only within \Omega.
Appendix C Proofs for Stage-I Latent Steering
This appendix proves the Stage-I results stated in Section 4.2: the closed-form projection (Section C.1), Proposition 1 (Section C.2), and Theorem 1 (Section C.3). A discrete-time and inexact-gradient version is given as an optional extension (Section C.4).
C.1 Closed-form projection for the latent CBF-QP
This subsection derives the closed-form solution (8). With \psi(z):=\nabla m_{\beta}(z)^{\top}u_{z}^{\mathrm{ref}}(z)+\kappa\,\mathrm{sgn}(m_{\beta}(z))|m_{\beta}(z)|^{\rho} as defined in the main text, (7) has a single linear inequality constraint, so its solution is the Euclidean projection of u_{z}^{\mathrm{ref}} onto a closed half-space.
Derivation of (8).
Form the Lagrangian
\mathcal{L}(u,\mu)=\|u-u_{z}^{\mathrm{ref}}\|_{2}^{2}-\mu\bigl(\nabla m_{\beta}^{\top}u+\kappa\,\mathrm{sgn}(m_{\beta})|m_{\beta}|^{\rho}\bigr),\quad\mu\geq 0.Stationarity gives u-u_{z}^{\mathrm{ref}}=\tfrac{\mu}{2}\nabla m_{\beta}, i.e., u=u_{z}^{\mathrm{ref}}+\lambda\nabla m_{\beta} with \lambda:=\mu/2\geq 0. If \psi(z)\geq 0, the reference is feasible and complementary slackness gives \lambda=0. If \psi(z)<0, the constraint binds at the optimum, so \psi(z)+\lambda\,\|\nabla m_{\beta}\|_{2}^{2}=0, giving \lambda=-\psi(z)/\|\nabla m_{\beta}\|_{2}^{2}>0. Combining the two cases yields \lambda(z)=[-\psi(z)]_{+}/\|\nabla m_{\beta}(z)\|_{2}^{2} and (8). ∎
The projection has no free parameter: once u_{z}^{\mathrm{ref}} and the CBF rate (\kappa,\rho) are fixed, u_{z}^{\star} is uniquely determined wherever \nabla m_{\beta}(z)\neq 0.
C.2 Proof of Proposition 1: latent margin decrease
Let V(z):=[-m_{\beta}(z)]_{+}. We show that whenever the CBF constraint in (7) is satisfied at z with m_{\beta}(z)<0, the latent flow \dot{z}=u_{z}^{\star}(z) produces \dot{V}(z)\leq-\kappa V(z)^{\rho}.
Proof of Proposition 1.
On \{m_{\beta}(z)<0\}, V(z)=-m_{\beta}(z)>0 and \mathrm{sgn}(m_{\beta})=-1. The CBF constraint in (7) becomes \nabla m_{\beta}(z)^{\top}u_{z}^{\star}(z)\geq\kappa V(z)^{\rho}. Since V(z)=-m_{\beta}(z) on this set, \dot{V}(z(t))=-\dot{m}_{\beta}(z(t))=-\nabla m_{\beta}(z(t))^{\top}u_{z}^{\star}(z(t)). Combining,
\dot{V}(z(t))\leq-\kappa\,V(z(t))^{\rho}.∎
C.3 Proof of Theorem 1: finite-time recovery
Theorem 1 adds a non-degeneracy hypothesis \|\nabla m_{\beta}(z)\|_{2}\geq g_{m}>0 on the unsafe set, under which the descent inequality from Proposition 1 integrates to a finite-time bound. Before the proof we record well-posedness of the Stage-I flow.
Lemma 1 (Well-posedness of the latent flow).
Under the local Lipschitz condition of Section 4.1, the non-degeneracy hypothesis, and locally Lipschitz u_{z}^{\mathrm{ref}}, the closed-form solution u_{z}^{\star} in (8) is locally bounded and locally Lipschitz on \Omega\setminus\mathcal{Z}_{\delta}. Hence \dot{z}=u_{z}^{\star}(z) admits a unique Carathéodory solution from any z(0)\in\Omega until it enters \mathcal{Z}_{\delta} or exits \Omega.
Proof.
On \Omega\setminus\mathcal{Z}_{\delta}, the denominator \|\nabla m_{\beta}\|_{2}^{2} is bounded below by g_{m}^{2}>0. Since \nabla m_{\beta}, m_{\beta}, and u_{z}^{\mathrm{ref}} are locally Lipschitz on \Omega, and \psi\mapsto[-\psi]_{+} is 1-Lipschitz, (8) is a rational function of locally Lipschitz quantities with bounded-below denominator, so u_{z}^{\star} is locally Lipschitz. Picard–Lindelöf applies on \Omega\setminus\mathcal{Z}_{\delta}. ∎
Proof of Theorem 1.
On \Omega\setminus\mathcal{Z}_{\delta} and under non-degeneracy, Proposition 1 gives the strict descent
\dot{V}(z(t))\leq-\kappa\,V(z(t))^{\rho},\quad V(z(t))>0.The scalar comparison ODE \dot{y}=-\kappa y^{\rho} with y(0)=V(z_{0}) separates as y^{-\rho}\,dy=-\kappa\,dt and integrates to y(t)^{1-\rho}=y(0)^{1-\rho}-\kappa(1-\rho)t, vanishing at t^{\star}=y(0)^{1-\rho}/(\kappa(1-\rho)). By the comparison lemma [19, Lemma 3.4], V(z(t))\leq y(t) on [0,t^{\star}], so V(z(t))=0 for t\geq T_{z}=|m_{\beta}(z_{0})|^{1-\rho}/(\kappa(1-\rho)). Forward invariance of \mathcal{Z}_{\delta} follows because at any boundary point V=0 and \dot{V}\leq 0 by (11), interpreted as zero at V=0. ∎
C.4 Optional: discrete-time and inexact-gradient steering
This subsection states a robustness guarantee for the discrete-time projected Euler iterate of Section 4.2 when the latent gradient is replaced by a finite-difference estimate. It is not used by the main-text claims but supports implementation analysis. We first record an auxiliary Lipschitz bound on \nabla m_{\beta} used by Taylor’s theorem along the Euler step.
Lemma 2 (Lipschitz gradient of m_{\beta}).
If, in addition to the conditions of Section 4.1, \tau is C^{2} on \Omega with \left\lVert J_{\tau}\right\rVert_{\mathrm{op}}\leq L_{\tau}, \left\lVert H_{\tau}\right\rVert_{\mathrm{op}}\leq M_{\tau}, and \nabla b is L_{\nabla b}-Lipschitz, then \nabla m_{\beta} is Lipschitz on \Omega with
L_{\nabla m}\leq M_{\tau}L_{b}+L_{\tau}^{2}L_{\nabla b}+\tfrac{\beta(H+1)}{2}(L_{b}L_{\tau})^{2}.Proof.
Writing \nabla m_{\beta}(z)=\sum_{k}w_{k}(z)\nabla h_{k}(z) with \nabla h_{k}=J_{\tau^{k}}^{\top}\nabla b\circ\tau^{k}, we bound the two factors separately. Each \nabla h_{k} is (M_{\tau}L_{b}+L_{\tau}^{2}L_{\nabla b})-Lipschitz by adding/subtracting J_{\tau^{k}}(z^{\prime})^{\top}\nabla b(\tau^{k}(z)). The softmax w(\mathbf{h}) has Jacobian \partial_{\mathbf{h}}w=\beta(\mathrm{diag}(w)-ww^{\top}) with operator norm \leq\beta/2 (a covariance with eigenvalues bounded by 1/2, since \mathrm{Var}_{w}(v)\leq 1/2 for unit v, with equality at two-point uniform w). Combined with \left\lVert\partial_{z}\mathbf{h}\right\rVert_{\mathrm{op}}\leq\sqrt{H+1}\,L_{b}L_{\tau} and Cauchy–Schwarz, \left\lVert w(z)-w(z^{\prime})\right\rVert_{1}\leq\frac{\beta(H+1)}{2}L_{b}L_{\tau}\,\left\lVert z-z^{\prime}\right\rVert_{2}. Combining (with \left\lVert\nabla h_{k}\right\rVert_{2}\leq L_{b}L_{\tau}),
\left\lVert\nabla m_{\beta}(z)-\nabla m_{\beta}(z^{\prime})\right\rVert_{2}\leq L_{\nabla h}\,\left\lVert z-z^{\prime}\right\rVert_{2}+\left\lVert w(z)-w(z^{\prime})\right\rVert_{1}\,L_{b}L_{\tau},giving (12). ∎
Theorem 3 (Inexact-gradient discrete-time recovery).
Let \widehat{\nabla}m_{\beta}(z)=\nabla m_{\beta}(z)+e(z) with \sup_{\Omega}\|e(z)\|_{2}\leq\varepsilon_{g}, and let \widehat{u}_{z}(z) be the closed-form QP solution (8) using \widehat{\nabla}m_{\beta} in place of \nabla m_{\beta}. Suppose Lemmas 1–2 hold and the Euler iterate z_{i+1}=z_{i}+\eta\widehat{u}_{z}(z_{i}) remains in \Omega. Then
V_{i+1}\leq V_{i}-\eta\kappa V_{i}^{\rho}+c_{1}\eta\varepsilon_{g}+c_{2}\eta^{2},\qquad V_{i}:=[-m_{\beta}(z_{i})]_{+},with structural constants c_{1}, c_{2} depending on L_{\nabla m}, \sup_{\Omega}\|u_{z}^{\star}\|_{2}, and the bounds in Section 4.1. For any \varepsilon>0 with \kappa\varepsilon^{\rho}>c_{1}\varepsilon_{g}+c_{2}\eta, the iterates enter \{z:m_{\beta}(z)\geq-\varepsilon\} in N^{\star}\leq V_{0}^{1-\rho}/[\eta(1-\rho)(\kappa-\varepsilon^{-\rho}(c_{1}\varepsilon_{g}+c_{2}\eta))] iterations, with equilibrium gap \varepsilon=O((\varepsilon_{g}+\eta)^{1/\rho}).
Proof.
Step 1 bounds the perturbed barrier rate. Let \widehat{\psi}=\widehat{\nabla}m_{\beta}^{\top}u_{z}^{\mathrm{ref}}+\kappa\,\mathrm{sgn}(m_{\beta})|m_{\beta}|^{\rho}=\psi+e^{\top}u_{z}^{\mathrm{ref}}, so |\widehat{\psi}-\psi|\leq\sup_{\Omega}\|u_{z}^{\mathrm{ref}}\|_{2}\,\varepsilon_{g}. A direct expansion of \nabla m_{\beta}(z)^{\top}\widehat{u}_{z}(z) using \nabla m_{\beta}=\widehat{\nabla}m_{\beta}-e and the closed-form \widehat{u}_{z}=u_{z}^{\mathrm{ref}}+\widehat{\lambda}\widehat{\nabla}m_{\beta} yields, on m_{\beta}<0, \nabla m_{\beta}(z)^{\top}\widehat{u}_{z}(z)\geq\kappa V(z)^{\rho}-c_{1}\varepsilon_{g}, where c_{1} absorbs |e^{\top}u_{z}^{\mathrm{ref}}| and the 1-Lipschitz dependence of [-\widehat{\psi}]_{+} on \widehat{\psi}-\psi. Step 2 applies Taylor’s theorem to m_{\beta} along the Euler step using Lemma 2: m_{\beta}(z_{i+1})\geq m_{\beta}(z_{i})+\eta\,\nabla m_{\beta}(z_{i})^{\top}\widehat{u}_{z}(z_{i})-\tfrac{1}{2}L_{\nabla m}\eta^{2}\|\widehat{u}_{z}(z_{i})\|_{2}^{2}, and substituting Step 1 plus \|\widehat{u}_{z}\|_{2}\leq\sup_{\Omega}\|u_{z}^{\star}\|_{2} gives (13). Step 3: whenever V_{i}\geq\varepsilon, V_{i}^{-\rho}\leq\varepsilon^{-\rho}, so (13) bounds V_{i+1}\leq V_{i}-\eta\kappa^{\prime}V_{i}^{\rho} with \kappa^{\prime}=\kappa-\varepsilon^{-\rho}(c_{1}\varepsilon_{g}+c_{2}\eta)>0. Discrete fractional-power decay yields the N^{\star} bound; balancing \kappa\varepsilon^{\rho}=c_{1}\varepsilon_{g}+c_{2}\eta gives the equilibrium gap. ∎
Appendix D Proofs for Stage-II Correction and Handoff
This appendix proves the Stage-II results stated in Section 4.3: Proposition 2 (Section D.1), Corollary 1 (Section D.2), and Theorem 2 (Section D.3).
D.1 Proof of Proposition 2: latent-to-path margin transfer
Proof of Proposition 2.
Decompose \tilde{b}_{t_{w}}(z)-m_{\beta}(z) into a soft-min gap and a predictor gap.
Soft-min gap. By the soft-min sandwich (Section B.1) applied to h_{k}(z)=b(\tau^{k}(z))-\delta, with \hat{m}(z):=\min_{k}h_{k}(z), |\hat{m}(z)-m_{\beta}(z)|\leq\varepsilon_{\mathrm{soft}}=\beta^{-1}\log(H+1).
Predictor gap. By Lipschitzness of b and the definition of \varepsilon_{\mathrm{pred}}(z),
|b(\tau_{t_{w}}^{c,k}(z))-b(\tau^{k}(z))|\leq L_{b}\,\|\tau_{t_{w}}^{c,k}(z)-\tau^{k}(z)\|_{2}\leq L_{b}\varepsilon_{\mathrm{pred}}(z).Subtracting \delta and taking minima over k (using |\min_{k}f_{k}-\min_{k}g_{k}|\leq\max_{k}|f_{k}-g_{k}|) gives |\tilde{b}_{t_{w}}(z)-\hat{m}(z)|\leq L_{b}\varepsilon_{\mathrm{pred}}(z).
Combine. The triangle inequality yields the bound stated in Proposition 2. ∎
Remark 1 (Predictor-sensitivity bound).
For a SafeFlowMatcher-style corrector whose predictor is a Lipschitz ODE with field L_{v}-Lipschitz in state, standard ODE sensitivity gives \varepsilon_{\mathrm{pred}}(z)\leq L_{\tau}e^{L_{v}t_{w}}\bar{\xi}+\int_{0}^{t_{w}}w_{s}r_{s}\,ds, where \bar{\xi} controls initial perturbation and the integral captures the soft-slack term in (5). For a post-hoc path-space CBF-QP applied directly to \tau(z), \varepsilon_{\mathrm{pred}}(z)\equiv 0 and Proposition 2 reduces to the soft-min-only bound.
D.2 Proof of Corollary 1: correction time and energy
Proof of Corollary 1.
The Stage-II CBF-QP with fractional-power rate \epsilon and exponent \rho enforces \dot{V}_{\mathrm{path}}\leq-\epsilon V_{\mathrm{path}}^{\rho} on V_{\mathrm{path}}>0, parallel to (11). Integrating yields V_{\mathrm{path}}(t)^{1-\rho}=V_{+}^{1-\rho}-\epsilon(1-\rho)(t-t_{w}) for t\in[t_{w},T_{\mathrm{corr}}], so
T_{\mathrm{corr}}\leq t_{w}+\frac{V_{+}^{1-\rho}}{\epsilon(1-\rho)}.For the energy bound, J_{II}(z_{+})\leq\int_{t_{w}}^{T_{\mathrm{corr}}}c_{II}\,V_{\mathrm{path}}(t)^{2\rho}\,dt. Substituting V_{\mathrm{path}}(t)^{2\rho}=(V_{+}^{1-\rho}-\epsilon(1-\rho)(t-t_{w}))^{2\rho/(1-\rho)} and the change of variables u=V_{+}^{1-\rho}-\epsilon(1-\rho)(t-t_{w}) gives
J_{II}(z_{+})\leq\frac{c_{II}}{\epsilon(1-\rho)}\int_{0}^{V_{+}^{1-\rho}}u^{2\rho/(1-\rho)}\,du=\frac{c_{II}\,V_{+}^{1+\rho}}{\epsilon(1+\rho)}.∎
D.3 Proof of Theorem 2: cost-sensitive handoff
Proof of Theorem 2.
Stage-I descent in continuous time. Under the non-degeneracy hypothesis along the Stage-I trajectory, the comparison lemma applied to Proposition 1 gives V(t)^{1-\rho}=V_{0}^{1-\rho}-\kappa(1-\rho)t for t\in[0,V_{0}^{1-\rho}/(\kappa(1-\rho))] (same scalar argument as in Section C.3). Identifying t=N_{z}\eta in the exact-gradient limit gives the discrete decay law
V_{+}^{1-\rho}=V_{0}^{1-\rho}-\eta\kappa(1-\rho)\,N_{z},so the number of Stage-I iterations needed to reach a given terminal deficit V_{+} is N_{z}(V_{+})=(V_{0}^{1-\rho}-V_{+}^{1-\rho})/(\eta\kappa(1-\rho)).
Joint-cost expression. Combining (14) with the Stage-I per-iteration cost J_{I}(N_{z})=N_{z}c_{I} (Appendix E.3) and the Stage-II energy bound from Corollary 1, the joint cost as a function of V_{+}\in(0,V_{0}] is
J_{\mathrm{tot}}(V_{+})\leq\frac{c_{I}\bigl(V_{0}^{1-\rho}-V_{+}^{1-\rho}\bigr)}{\eta\kappa(1-\rho)}+\frac{c_{II}\,V_{+}^{1+\rho}}{\epsilon(1+\rho)},the upper bound used in Theorem 2.
Convexity. Differentiating with respect to V_{+}\in(0,V_{0}],
\frac{dJ_{\mathrm{tot}}}{dV_{+}}=-\frac{c_{I}}{\eta\kappa}\,V_{+}^{-\rho}+\frac{c_{II}}{\epsilon}\,V_{+}^{\rho}.The second derivative c_{I}\rho V_{+}^{-\rho-1}/(\eta\kappa)+c_{II}\rho V_{+}^{\rho-1}/\epsilon is strictly positive for V_{+}>0, so J_{\mathrm{tot}} is strictly convex on (0,V_{0}].
Optimum. Setting (16) to zero,
\frac{c_{II}}{\epsilon}V_{+}^{2\rho}=\frac{c_{I}}{\eta\kappa},\quad\Longrightarrow\quad V_{+}^{\star}=\left(\frac{c_{I}\,\epsilon}{\eta\kappa\,c_{II}}\right)^{1/(2\rho)},the unique stationary point and, by strict convexity, the unique global minimum. The handoff iteration N_{z}^{\star} follows from the descent relation when V_{+}^{\star}\leq V_{0}. If V_{+}^{\star}>V_{0}, dJ_{\mathrm{tot}}/dV_{+}<0 on (0,V_{0}], so J_{\mathrm{tot}} is strictly decreasing on (0,V_{0}] and the constrained minimum is at V_{+}=V_{0}, i.e., N_{z}^{\star}=0 and Stage I is skipped. ∎
Remark 2 (Effect of margin transfer slack on V_{+}^{\star}).
The proof above absorbs the soft-min and predictor-sensitivity slack from Proposition 2 into the constant c_{II}. Retaining the slack explicitly replaces V_{+} by \widetilde{V}_{+}:=V_{+}+\varepsilon_{\mathrm{soft}}+L_{b}\bar{\varepsilon}_{\mathrm{pred}} in the Stage-II energy bound (Corollary 1), and the optimum V_{+}^{\star} shifts upward by an amount that vanishes as \beta\to\infty and \varepsilon_{\mathrm{pred}}\to 0 (post-hoc corrector). The qualitative form of the stopping rule is unchanged.
Remark 3 (Discrete-time and inexact-gradient corrections).
Theorem 2 uses the exact-gradient continuous-time descent law from Proposition 1. Replacing it with the discrete inexact-gradient analysis of Theorem 3 adds correction terms c_{1}\eta\varepsilon_{g}+c_{2}\eta^{2} per step, which propagate through (14) as a downward shift of the achievable V_{+} floor. The optimum V_{+}^{\star} in Theorem 2 remains valid above this floor; below it, the achievable V_{+} is bounded by the equilibrium gap \varepsilon=O((\varepsilon_{g}+\eta)^{1/\rho}) from Theorem 3.
Appendix E Algorithm and Implementation
This appendix gives the full LBS algorithm with implementation details: the pseudocode, the projected Euler update with finite-difference gradient estimation, the per-step and total Stage-I cost used by Theorem 2, and the hyperparameters used across all experiments.
E.1 Pseudocode
Stage I does not need to reach the safe-latent set \mathcal{Z}_{\delta} before handoff: increasing m_{\beta} already reduces the deficit Stage II must correct (Section 4.3). The flag \mathtt{residual\_violation} records whether the Stage-I terminal margin was negative; the certified safe trajectory is always produced by Stage II.
E.2 Projected Euler and gradient estimation
Stage I is implemented with projected explicit Euler steps,
z_{i+1}\;=\;\Pi_{\Omega}\bigl(z_{i}+\eta\,\widehat{u}_{z}(z_{i})\bigr),where \eta>0 is the latent step size and \Pi_{\Omega} projects onto the latent clipping box \Omega. The update direction \widehat{u}_{z}(z_{i}) is the closed-form latent CBF projection (8) evaluated with an estimate \widehat{\nabla}m_{\beta}(z_{i}) of the latent gradient. When backpropagation through the decoder is available, the gradient can be computed directly. Otherwise, we use central finite differences,
[\widehat{\nabla}m_{\beta}(z)]_{i}\;=\;\frac{m_{\beta}(z+he_{i})-m_{\beta}(z-he_{i})}{2h},\qquad i=1,\ldots,d_{z},which costs 2d_{z} generator evaluations per latent step. Central differences have truncation error \varepsilon_{g}=O(h^{2}) for C^{3} scalar fields. For larger d_{z}, SPSA-style random directional estimators [35] or a learned critic for m_{\beta} are natural replacements.
E.3 Cost accounting
Each Stage-I iteration consists of one rollout decode, one margin evaluation, 2d_{z} additional generator calls for the central-difference gradient, one closed-form projection, and one Euler update. We summarize the dominant cost as a per-step constant c_{I}>0 (in our setting, c_{I} is dominated by the 2d_{z} generator calls, so each Stage-I iteration uses 2d_{z}+1 generator evaluations). Over N_{z} Stage-I iterations, the total Stage-I cost is
J_{I}(N_{z})\;=\;N_{z}\,c_{I},which is balanced against the Stage-II correction energy in Theorem 2. The handoff iteration N_{z}^{\star} in Theorem 2 selects the smallest N_{z} for which the marginal Stage-I cost matches the marginal reduction in Stage-II correction energy. Stage II adds one decoded rollout and the cost of the chosen path-space corrector, so the total LBS cost is
\mathrm{Cost}_{\mathrm{LBS}}\;=\;N_{z}(2d_{z}+1)\,C_{\mathrm{gen}}\;+\;C_{\mathrm{gen}}\;+\;C_{\mathrm{stageII}}.Per-step sampler-space methods such as SafeDiffuser and SafeFlow instead solve CBF-QPs throughout the denoising or flow integration horizon. SafeFlowMatcher solves QPs only during its correction phase, but without the Stage I semantic warm start.
E.4 Hyperparameters
All experiments use the same defaults, not per-domain tuned:
(\kappa,\;\rho,\;\eta,\;N_{z},\;\gamma_{z},\;\beta,\;\delta,\;h)\;=\;(1.0,\;0.5,\;0.1,\;20,\;0.01,\;10,\;0.05,\;0.01),with latent clipping box \Omega=[-6,6]^{d_{z}}.
Appendix F Experimental Details
This appendix documents the three benchmark domains, their training data and per-domain backbone size, the three constraint setups used in each, and the evaluation protocol. Backbone training and inference hyperparameters are summarised in Appendix G and H, respectively, and we do not duplicate them here.
The three domains share a common evaluation template: each domain has a fixed start–goal pair, a multi-modal expert dataset, and three deliberately different constraint setups labelled mode-selection (S1), mode-interpolation (S2), and CBF-correction (S3). S1 admits at least one demonstration mode without modification; S2 blocks every demonstration mode but leaves a feasible path that requires latent interpolation between modes; S3 leaves every demonstration mode partially clipped, so a path-space CBF correction is required on top of the latent solution.
F.1 2D point-navigation
Dynamics.
Single-integrator on \mathbb{R}^{2}, s_{t+1}=s_{t}+a_{t}, with start s_{0}=(0,0) and goal g=(10,0), horizon H=50. State is (x,y) and actions are (a_{x},a_{y}) with no per-step bound (training data dictates magnitude).
Training modes.
Four sine-wave modes with peak amplitude y_{\mathrm{peak}}\in\{-3,-1,1,3\}, 30 demonstrations per mode, additive state noise \mathcal{N}(0,0.15^{2}) at each step with endpoints clamped to start and goal. Each demonstration interpolates start and goal along x and rides the sine in y.
Backbone.
The 2D backbone is intentionally small (see Appendix G): hidden width 256, four residual blocks, behavior latent d_{z}=2. The encoder is a transformer trajectory VAE with sinusoidal positional encoding.
Constraint setups.
- A single rectangular hazard
[3,7]\times[-5,2]. Three modes (y_{\mathrm{peak}}\in\{-3,-1,1\}) intersect the rectangle; the upper modey_{\mathrm{peak}}{=}3clears it. Latent recovery is sufficient: Stage I selects the upper mode and Stage II makes near-zero corrections.: Two rectangles[3,7]\times[0.5,6]and[3,7]\times[-6,-0.5]form a horizontal corridor of width1aty\in[-0.5,0.5]forx\in[3,7]. All four training modes are blocked, but the interiory_{\mathrm{peak}}{\approx}0region is open. Latent interpolation is required: Stage I driveszto a peak amplitude not seen in training; Stage II remains nearly inactive.: A single thicker hazard[3,7]\times[-3.5,3.5]. All four modes clip the band; the outer pairy_{\mathrm{peak}}{=}\pm 3have moderate overlap. Stage I alone is insufficient: the latent solution rides the band edge but still violates at corners; Stage II’s path-space CBF closes the residual gap.
F.2 Franka 3D end-effector
Domain.
7-DoF Franka Panda arm in Cartesian end-effector planning mode. The trajectory variable is the EE position (x,y,z)\in\mathbb{R}^{3}; we plan in EE space and project to joint space via the standard differential-IK controller used in the Franka stack. Start s_{0}=(0.3,0.0,0.5)\,\mathrm{m}, goal g=(0.7,0.0,0.3)\,\mathrm{m}, horizon H=50. Differentiable EE-position barriers are used by every method, matching SafeFlow [8].
Training modes.
Eight expert behaviors covering combinations of approach direction (up/down/left/right) and approach distance (near/far), 50 demonstrations per behavior. The behaviors are chosen so that each constraint setup eliminates a well-defined subset of them.
Backbone.
Hidden width 256, four residual blocks, d_{z}=4 (see Appendix G); z-projection width 32; no auxiliary start–goal context (start/goal are fixed).
Constraint setups.
All three setups place a thin wall at x\in[0.45,0.55] between start and goal:
- Lower wall blocks
z<0.58; upper portion is solid except for a sloty\in[-0.08,0.08],z\in[0.58,0.85]; a small sphere of radius0.03at(0.5,0,0.66)sits inside the slot. Among the eight training modes only the up–far behavior threads the slot. Stage I selects up–far; Stage II edges around the sphere.: Same wall structure, but the open region is a diagonal holey\in[0.04,0.20],z\in[0.48,0.58]that lies between the up–near and right–near training behaviors. No single training mode threads the hole; latent interpolation produces an approach via\sim(0.5,0.12,0.53).: Same diagonal hole as S2, plus a small sphere of radius0.03at(0.5,0.12,0.53)inside the hole. Stage I produces the interpolated approach; Stage II’s path-space CBF detours the EE around the sphere within the\sim 0.16{\times}0.10\,\mathrm{m}window.
F.3 Maze2D
Domain.
D4RL maze2d-large layout [12]. The state is (x,y,\dot{x},\dot{y}) and the action is the 2D velocity command; the planner outputs an action sequence and rolls it forward through the standard maze2d single-integrator dynamics. Horizon H=384, matching SafeDiffuser [40]. Start s_{0}=(1,3), goal g=(7,9); eight start–goal context dimensions are fed to the backbone via FiLM (see Appendix G).
Training data.
A custom 300-trajectory dataset on six distinct routes (50 demonstrations per route) collected by a dense-waypoint expert controller. The six routes are referenced in the setup descriptions below by their direction codes (e.g. “LD” = left then down). D4RL’s native maze2d-large replay buffer has narrow corridors with limited mode diversity, so a custom dataset is needed to make the mode-selection vs. interpolation distinction sharp.
Backbone.
Hidden width 768, 20 residual blocks, z-projection width 128, d_{z}=4, encoder positional-encoding max length 1024. The deeper/wider model is needed for the longer horizon; see Appendix G.
Constraint setups.
Each setup uses a small set of circular hazards plus a few axis-aligned rectangular wall extensions chosen to close five of the six demonstration routes:
- Six small circles (
r{=}0.4) and six wall rectangles fence off the entire right half of the maze, leaving only the LD route (down the left corridor and across the bottom row). Baselines without latent recovery default to the right-arc path and trap against the right-side fence.: Hazards block the L entrance, the D branch, and the UD branch. RUR is partly open but pinched by a small obstacle; latent interpolation is needed to bend RUR into the residual corridor.: Hazards block the L entrance and the U branch. RD is partly open but a small additional obstacle clips the natural rollout. Stage I selects the residual mode; Stage II’s path-space CBF deflects the rollout around the small obstacle.
Wall handling.
Following the literature convention used by SafeDiffuser, SafeFlow, and SafeFlowMatcher, the CBF barrier and reported safety metric are defined over user-specified hazard obstacles only; the maze walls themselves are handled implicitly by the generator’s learned prior and, for executable rollout, by Liang–Barsky truncation against the wall set (so a rollout that would tunnel through a wall is clipped at the wall and the post-truncation goal-error is what we report).
F.4 Evaluation protocol
Episodes and seeds.
Each method is evaluated on 50 episodes per setup with a single fixed seed (default 42). Episodes within a setup vary only in the diffusion / flow-matching latent noise; start, goal, and obstacle layout are fixed by definition of the setup.
Safety metric.
Segment-based safety using Liang–Barsky segment / axis-aligned-box intersection for rectangle hazards and a closed-form segment / sphere test for sphere hazards. A trajectory is safe iff none of its H piecewise-linear segments intersects any hazard. We report mean Safety as the fraction of safe episodes.
Reach metric.
Goal-reach is determined by the post-truncation final-state distance to the goal: an episode counts as “reached” iff the truncated rollout ends within a domain-specific tolerance of the goal. The tolerance and other thresholds are fixed across methods per domain.
Other metrics.
Beyond Safety and Reach, we report final goal distance (ED), CBF intervention energy, curvature smoothness (CS), and per-episode Stage-I/Stage-II wall-clock time. The full three-constraint results are reported in Appendix I.
Hardware.
Wall-clock numbers are measured on a single CPU thread for the 2D domain and a single A100 GPU for Franka and Maze2D. The 2D backbone is small enough to time on CPU; Franka and Maze2D backbones use GPU at test time.
Baselines.
The three CBF baselines (SafeDiffuser, SafeFlow, SafeFlowMatcher) are run from their reference open-source implementations with the same hazard set, start, goal, and horizon as our methods. We retrain each baseline’s backbone on our domain datasets so that the comparison isolates the safety wrapper rather than the prior. Their training and test-time hyperparameters follow the upstream defaults; we list only our method’s settings in Appendices G and H.
Appendix G Backbone Training Hyperparameters
This appendix records the exact hyperparameters used to train the parameterised flow-matching backbone used by Latent Barrier Steering. We list only our method’s settings; baselines (SafeDiffuser, SafeFlow, SafeFlowMatcher) follow their respective open-source reference implementations and are not duplicated here.
The training pipeline has two stages per domain. We first train a Trajectory VAE encoder with a soft-DTW reconstruction term to produce the behavior latent z; we then freeze the encoder and train the conditional flow-matching generator on top.
G.1 Trajectory VAE encoder
The encoder is a transformer-style trajectory VAE with sinusoidal positional encoding and FiLM-style decoding. Optimiser settings are shared across all three domains: AdamW with learning rate 10^{-4}, weight decay 10^{-5}, cosine-annealed to a minimum of 10^{-6} over the full schedule, batch size 32. The reconstruction term is soft-DTW [6] with smoothing \gamma_{\mathrm{DTW}}=10^{-2}. The latent dimension d_{z} matches the value used by the LBS hyperparameter table in Appendix E.4.
- Hidden width
- 128
- 128
- 128
- Latent dim d_{z}
- 2
- 4
- 4
- Optimizer
- AdamW
- AdamW
- AdamW
- Learning rate
- 10^{-4}
- 10^{-4}
- 10^{-4}
- Weight decay
- 10^{-5}
- 10^{-5}
- 10^{-5}
- LR schedule
- cosine
- cosine
- cosine
- Batch size
- 32
- 32
- 32
- Soft-DTW \gamma_{\mathrm{DTW}}
- 10^{-2}
- 10^{-2}
- 10^{-2}
G.2 Conditional flow-matching generator
The generator is a z-conditioned flow-matching velocity predictor with the linear interpolant x_{t}=(1-t)x_{0}+t\varepsilon and an explicit-Euler ODE sampler. It uses FiLM injection of the encoder z and (for Maze2D only) FiLM injection of an 8-dimensional start–goal context c. We optimise with Adam, learning rate 10^{-4}, batch size 32.
- Hidden width
- 256
- 256
- 768
- Residual blocks
- 4
- 4
- 20
- z-projection width
- 32
- 32
- 128
- Start/goal conditioning dim
- —
- —
- 8
- FM Euler steps
- 50
- 50
- 50
- Optimizer
- Adam
- Adam
- Adam
- Learning rate
- 10^{-4}
- 10^{-4}
- 10^{-4}
- Batch size
- 32
- 32
- 32
G.3 Notes on choices
The encoder and generator hyperparameters are not tuned per constraint regime; we use one set per domain and reuse the same checkpoints across all three constraint setups in the main results. The 2D and Franka backbones are deliberately small (\sim0.4–0.6 M parameters) so that the central-difference cost of Stage I (Appendix E.4) stays within a few seconds per call; Maze2D is wider/deeper to handle the longer horizon. Released checkpoints are the best-validation snapshots used in all main-text tables. Both backbones are trained on demonstrations alone, without reward labels [4, 42], and a new test-time constraint requires no retraining.
Appendix H Inference Hyperparameters: Stage I and Stage II
This appendix lists the test-time hyperparameters of our method only (Latent Barrier Steering, Stage I + Stage II). Baseline test-time settings follow each baseline’s reference implementation and are not duplicated.
H.1 Stage I (Latent Barrier Steering)
Stage I solves the latent-side finite-time recovery flow of Section 4. The same set of LBS hyperparameters is used across all three domains and all constraint setups; the values are listed in Appendix E.4. For the reader’s convenience the operational parameters are:
- Finite-time rate exponent
\rho=0.5and gain\kappa=1.0(linear-rate variant of the LBS QP). - Latent Euler step size
\eta=0.1. - Latent iteration cap
N_{z}=20, with early stopping as soon as the soft-min marginm_{\beta}(z_{i})\geq 0. - Reference drift
\gamma_{z}=10^{-2}(encoder-anchor contraction; referenceu_{z}^{\mathrm{ref}}=-\gamma_{z}(z-z_{0})). - Soft-min sharpness
\beta=10. - Margin slack
\delta=0.05. - Latent clip-box
[-6,6]^{d_{z}}applied componentwise after every Euler step.
The same finite-difference estimator of \nabla_{z}m_{\beta} is used in all domains. The full operational hyperparameter sextuplet (\kappa,\rho,\eta,N_{z},\gamma_{z},\beta,\delta) is reported as a single row in Appendix E.4 and we do not duplicate it here.
H.2 Stage II (path-space CBF correction)
Stage II takes the Stage I-warm-started rollout and applies a per-step CBF QP along the executed trajectory. The corrector hyperparameters are fixed across domains and constraint setups: a fractional-power rate with tuple (\varepsilon,\rho,\delta)=(0.3,\,0.5,\,0.05), where \rho=0.5 is the fractional exponent (matching Stage I), \varepsilon scales the fractional gain, and \delta is the same activation slack as in Stage I.
The corrector is solved as a small QP over the per-step action a_{t}, with \|a_{t}-a_{t}^{\mathrm{ref}}\|^{2} as the QP cost and the fractional-rate CBF constraint as the only inequality. We use the unconstrained a_{t}^{\mathrm{ref}} produced by the parameterised generator at the Stage-I-warm-started latent.
H.3 Sampling/integration setup at test time
At test time we use the same sampler discretisation as during training: a 50-step explicit-Euler ODE for the flow-matching generator. Stage II runs along the entire executed horizon.
Appendix I Full results across all three constraints
The main-text Table 1 reports Safety, Reach, and Energy. This appendix reports all metrics, including final goal distance, curvature smoothness, and per-episode Stage-I/Stage-II runtime, for all three constraints in each domain. Per-cell entries are means over 50 episodes (60 for Maze2D), aggregated under the same hyperparameters reported in Appendix E.4 and the evaluation protocol of Appendix F.4. The pretrained flow-matching planner is the same across all methods within a domain. ED is reported in task units; Franka ED is in metres.
- 2D
- I
- Vanilla FM
- 12%
- 100%
- 0.21
- –
- 0.88
- –
- 0.09
- SafeDiffuser
- 100%
- 10%
- 6.38
- 1.226
- 1.56
- –
- 0.11
- SafeFlow
- 100%
- 18%
- 5.57
- 1.077
- 1.42
- –
- 0.10
- SafeFlowMatcher
- 100%
- 18%
- 5.61
- 1.166
- 1.56
- –
- 0.10
- Full LBS
- 100%
- 100%
- 0.23
- 0.037
- 0.87
- 0.35
- 0.10
- II
- Vanilla FM
- 0%
- 100%
- 0.21
- –
- 0.88
- –
- 0.09
- SafeDiffuser
- 100%
- 34%
- 3.75
- 0.728
- 1.24
- –
- 0.12
- SafeFlow
- 100%
- 20%
- 4.90
- 0.976
- 1.31
- –
- 0.11
- SafeFlowMatcher
- 100%
- 22%
- 4.99
- 1.051
- 1.44
- –
- 0.11
- Full LBS
- 100%
- 90%
- 0.89
- 0.160
- 1.03
- 0.65
- 0.11
- III
- Vanilla FM
- 0%
- 100%
- 0.21
- –
- 0.88
- –
- 0.10
- SafeDiffuser
- 100%
- 0%
- 6.83
- 1.321
- 1.61
- –
- 0.12
- SafeFlow
- 100%
- 4%
- 6.44
- 1.262
- 1.48
- –
- 0.10
- SafeFlowMatcher
- 100%
- 4%
- 6.52
- 1.366
- 1.66
- –
- 0.10
- Full LBS
- 100%
- 82%
- 0.97
- 0.303
- 0.82
- 1.80
- 0.11
- Franka
- I
- Vanilla FM
- 12%
- 100%
- 0.002
- –
- 0.14
- –
- 0.08
- SafeDiffuser
- 100%
- 0%
- 0.250
- 0.0023
- 0.18
- –
- 0.09
- SafeFlow
- 100%
- 16%
- 0.214
- 0.0020
- 0.17
- –
- 0.08
- SafeFlowMatcher
- 100%
- 14%
- 0.241
- 0.0075
- 0.79
- –
- 0.08
- Full LBS
- 100%
- 100%
- 0.016
- 0.0004
- 0.28
- 0.80
- 0.09
- II
- Vanilla FM
- 0%
- 100%
- 0.002
- –
- 0.14
- –
- 0.08
- SafeDiffuser
- 100%
- 0%
- 0.250
- 0.0023
- 0.18
- –
- 0.10
- SafeFlow
- 100%
- 0%
- 0.251
- 0.0023
- 0.17
- –
- 0.09
- SafeFlowMatcher
- 100%
- 0%
- 0.276
- 0.0086
- 0.87
- –
- 0.09
- Full LBS
- 100%
- 100%
- 0.017
- 0.0004
- 0.34
- 1.10
- 0.09
- III
- Vanilla FM
- 0%
- 100%
- 0.002
- –
- 0.14
- –
- 0.09
- SafeDiffuser
- 100%
- 0%
- 0.250
- 0.0023
- 0.18
- –
- 0.11
- SafeFlow
- 100%
- 0%
- 0.251
- 0.0023
- 0.17
- –
- 0.10
- SafeFlowMatcher
- 100%
- 0%
- 0.276
- 0.0086
- 0.87
- –
- 0.10
- Full LBS
- 100%
- 98%
- 0.042
- 0.0028
- 0.50
- 1.55
- 0.10
- Maze2D
- I
- Vanilla FM
- 0%
- 50%
- 2.69
- –
- 0.17
- –
- 0.44
- SafeDiffuser
- 100%
- 0%
- 5.13
- 0.0288
- 0.11
- –
- 0.63
- SafeFlow
- 100%
- 0%
- 4.97
- 0.1208
- 0.21
- –
- 0.84
- SafeFlowMatcher
- 100%
- 0%
- 4.83
- 0.2668
- 0.63
- –
- 0.84
- Full LBS
- 100%
- 95%
- 0.71
- 0.010
- 0.15
- 4.50
- 0.68
- II
- Vanilla FM
- 38%
- 50%
- 2.69
- –
- 0.17
- –
- 0.42
- SafeDiffuser
- 100%
- 7%
- 6.38
- 0.0010
- 0.10
- –
- 0.50
- SafeFlow
- 100%
- 25%
- 3.31
- 0.0624
- 0.20
- –
- 0.70
- SafeFlowMatcher
- 98%
- 18%
- 3.76
- 0.1404
- 0.42
- –
- 0.68
- Full LBS
- 100%
- 90%
- 0.87
- 0.009
- 0.16
- 3.80
- 0.58
- III
- Vanilla FM
- 28%
- 50%
- 2.69
- –
- 0.17
- –
- 0.43
- SafeDiffuser
- 100%
- 7%
- 6.37
- 0.0072
- 0.10
- –
- 0.49
- SafeFlow
- 100%
- 38%
- 2.43
- 0.0345
- 0.19
- –
- 0.69
- SafeFlowMatcher
- 100%
- 53%
- 2.08
- 0.0740
- 0.30
- –
- 0.69
- Full LBS
- 100%
- 93%
- 0.27
- 0.004
- 0.29
- 4.10
- 0.62