alphaFeedback

WorksComputer Science

CS-Pi: Constraint-Satisfying Flow Policy Sampling

AI contributions
Not recorded for this paper
View details

Abstract

A flow-matching policy deployed in the field must often satisfy a constraint that was absent from its demonstrations, such as avoiding an obstacle it has never seen. Retraining for every new constraint is impractical, so the constraint must be enforced at inference time. Enforcing it must not discard what the policy learned: an action the policy would rarely sample may avoid the obstacle yet fail the task. We therefore want actions that are both safe, satisfying the constraint, and plausible, remaining likely under the policy. Gradient guidance, the most common approach, steers noisy states, so it must evaluate its cost on the policy's running estimate of the clean action; when the policy is uncertain between passing left or right of an obstacle, this estimate is their average and can pass straight through it. We instead build on rejection and projection. Rejection redraws actions until one is safe: every output is plausible, but the wait is intractable when safe actions are rare. Projection moves an action to the nearest safe one: it is efficient, but the result need not be plausible. Our key insight is that flow-matching sampling lets us combine the two, keeping projection's efficiency and rejection's plausibility. CS-Pi, our draw-project-renoise sampler, projects each draw to the nearest safe action, adds noise back scaled to how far the projection moved it, and re-runs the unmodified policy until a draw is safe. Replacing only the projection step extends CS-Pi to continuous costs. Across a 2D diagnostic, a 7-DoF shelf pick-and-place, an orientation preference, and a zero-shot Franka deployment, CS-Pi reaches 81% safe success on the shelf and 55% on hardware, against 55% and 40% for projection, while staying plausible.

Introduction

Large-scale flow-matching and diffusion policies have become capable generalist priors for robot manipulation[1, 2]: trained once on broad demonstrations, a single model can pick and place objects, open drawers, and fold clothes. Yet no training set anticipates every deployment, and such a policy will inevitably meet safety-critical scenarios its demonstrations never contained, for example: a wine glass left beside the drawer it must open, which the arm must not touch. This requirement is a constraint, supplied only at deployment. It defines a safe set: the set of actions that satisfy it; in our example, every action that does not touch the glass. Our goal is to sample actions that both come from the policy and lie in the safe set, without retraining the policy for each new constraint. The natural approach is to correct the policy’s output: sample an action and project it onto the safe set, moving it to the nearest safe action, or steer the denoising trajectory using a function of the constraint. Such corrections address the second half of this goal, moving the action into the safe set. They can lose the first: the correction can move the action somewhere the policy would rarely sample. This matters because the policy is what captures the task. An action it considers unlikely may clear the wine glass yet no longer reach the drawer handle. Such an action also loses what the policy learned from the demonstrations, beyond the task itself: smooth, kinematically feasible motion. We therefore require the sampled action to be both safe, satisfying the constraint, and plausible, remaining likely under the policy.

Sampling a flow-matching policy under a deployment-time constraint

Figure 1. Sampling a flow-matching policy under a deployment-time constraint. Left: The policy πθ\pi_\theta denoises Gaussian noise a0∼N(0,I)a_0 \sim\mathcal{N}(0,I) (t=0→1t=0 \to1) into an action chunk a∼πθa \sim\pi_\theta, a short sequence of robot motions. Its draws are multimodal: three ways to reach the apple, drawn as paths in the real scene and as modes of the density πθ(a)\pi_\theta(a); the most likely passes through the obstacle. Middle: Constraints such as obstacle avoidance or velocity and joint limits, and soft costs LL, are supplied only at deployment. The obstacle constraint defines a safe set CC, the actions that avoid it. Right: We want actions that are safe (a∈Ca \in C) and plausible (likely under πθ\pi_\theta), i.e. draws from πθ(a) 1C(a)\pi_\theta(a)\,1_C(a), where 1C1_C is 1 on CC and 0 elsewhere: the unsafe mode is removed and the others keep their shape. CS-Pi (ours) targets this distribution without retraining the policy.

Among such training-free samplers, the most common is gradient guidance [3, 4, 5], which nudges each denoising step along the gradient of a cost on the action. Guidance has two shortcomings. First, safety constraints are typically hard constraints: an action either satisfies them or violates them, with no degree in between. An action either touches the wine glass or it does not; this yes-or-no answer says nothing about which way to move the arm, so a hard constraint offers no gradient to follow. Guidance must instead use a smooth cost, such as a collision cost that grows as the arm nears the glass, which discourages contact but does not rule it out. Second, even a smooth cost is meaningful only on a clean action, while guidance acts on noisy intermediate states. Guidance therefore evaluates the cost at a proxy: the policy’s running estimate of the clean action, an average over every clean action the noisy state could still become. This proxy is reliable only when the cost changes slowly across those actions, so sharpening the cost toward the true constraint makes guidance less reliable, not more. The proxy fails when the policy is uncertain between distinct modes, such as passing left or right of the glass. The average of the two can pass straight through the glass, an action the policy would never sample. The gradient evaluated there may point towards neither mode (App. § 10).

We instead build on rejection and projection, two classical mechanisms that act only on the final sampled action rather than guiding the intermediate noise levels. Rejection sampling redraws complete actions from the policy until one satisfies the constraint: every output is plausible, but the wait is intractable when safe actions are rare. Projection maps a sampled action to the nearest constraint-satisfying point: it is efficient, but the projected action need not be plausible and can be jerky or task-irrelevant. Our key insight is that flow-matching sampling lets us combine the two, keeping projection’s efficiency and rejection’s plausibility. When a projected action is implausible, we need not take rejection’s drastic step of restarting sampling from pure noise; we can instead resample from a reduced noise level around the projection, so the policy returns a safe and plausible action near the projection.

We operationalize this insight in CS-Pi, a draw-project-renoise sampler (Figure 2). CS-Pi starts from a single draw from the policy and refines it in a loop. Each iteration projects the current draw onto the safe set and, rather than executing the possibly implausible projection, adds noise back to it, scaled to how far the projection moved the draw. It then re-runs the unmodified policy from that noise level to obtain the next draw. The loop ends once a draw is safe. Each draw comes from the policy and tends to land closer to the safe set than the last, so the draws approach the safe set while remaining plausible, at a compute cost far below rejection and with no constraint gradient at any noisy state. We first present CS-Pi for hard constraints, then extend it to continuous costs, such as an orientation preference, by replacing only the projection step. The same change lets CS-Pi combine hard constraints with costs. Across a 2D diagnostic, a 7-DoF shelf pick-and-place with deployment-time obstacles, the orientation preference above, and a zero-shot Franka deployment, CS-Pi is the only sampler that satisfies the constraint while staying plausible wherever the constraint permits; on the shelf it reaches 81% safe success (completing the task without collision) against 55% for projection and 32% for gradient guidance.

Sampling a safe action from a flow-matching policy

Figure 2. Sampling a safe action from a flow-matching policy. Gradient guidance steers each denoising step with a cost gradient evaluated at a proxy and can still violate the constraint. Projection moves the draw to the safe set, yielding an action the policy would rarely sample. Rejection sampling redraws from pure noise until a draw is safe. CS-Pi projects the draw, renoises the projection to time n=k/(k+δ)n = k/(k + \delta) set by the projection residual δ\delta (larger δ\delta renoises more), and re-runs the policy until a draw is safe and plausible.

Related Work

Gradient guidance. In the robotic settings we consider, constraints and preferences are typically expressed as analytic costs on the action, such as a signed-distance collision cost, a joint-limit penalty or an orientation error. The standard way to steer a diffusion or flow-matching policy [6] toward low cost at deployment is gradient guidance, which nudges each denoising step along the gradient of that cost: classifier-free guidance [4, 7], DPS [8], ΠGDM [9], MPGD [10], AdjointDPM [11], Diffuser [3], and Lan-o3dp [12]. But the cost is meaningful only on a clean action, so each method evaluates it at a proxy, the policy’s running estimate of the clean action. The proxy is accurate when the cost changes slowly and the policy has settled on one mode, and it breaks down otherwise, pushing the sample toward implausible actions (Appendix § 10). Trust Sampling [13] takes several guidance steps per denoising step, capping their number by how far the proxy can be trusted at that noise level and stopping early when the sample leaves the region the policy was trained on. It shares our aim of keeping samples plausible, but every step still follows the proxy’s gradient.

Rejection, reweighting, and projection. A constraint can also be met without following the proxy’s gradient, by acting on the policy’s clean actions. Rejection sampling redraws complete actions until one is safe: every output is plausible, but the wait is intractable when safe actions are rare. Sequential Monte Carlo (SMC) samplers reweight and resample a population of particles rather than discarding them (the Twisted Diffusion Sampler [14], Feynman–Kac samplers [15, 16]); they need more particles as the safe set shrinks, and the weight that steers each particle at a noisy step is still evaluated at the proxy (Appendix § 10). Projection moves a sample to the nearest safe action without any cost gradient, either at every denoising step [17] or once, on the final action, which is then executed; in both cases the projected action need not be plausible. CS-Pi also avoids the proxy’s gradient but combines rejection and projection: it projects the final action, then renoises the projection rather than executing it and re-denoises it with the policy, returning a plausible draw closer to the safe set without rejection’s wait or SMC’s particle budget.

Control-barrier-function samplers. SafeDiffuser [18] enforces forward invariance by solving a control-barrier-function (CBF) quadratic program at each denoising step; SafeFlowMatcher [19] alternates flow prediction with barrier-based correction; and SAD-Flower [20] augments a flow with a virtual safe control input and a learned dynamics model. These methods are designed to certify safety under their respective assumptions, but the certificate says nothing about plausibility. Their corrections continuously deform the current sample: when a constraint blocks the mode the sample has committed to, a correction can push it out of the unsafe region but does not redraw it from another mode of the policy. CS-Pi instead projects, renoises and re-denoises with the policy, which allows such a mode switch while keeping each draw plausible.

CBF samplers also require a differentiable barrier with the structure needed to evaluate its Lie derivatives and relative degree; SAD-Flower additionally assumes a learned dynamics model. CS-Pi requires only a projection onto the safe set, which enables its zero-shot use with existing policies, such as π0.5\pi_{0.5}, and obstacle bounding boxes estimated from vision (§ 4.4). We test SafeDiffuser and SafeFlowMatcher on the same policies and report them in Tables 1 and Table 2 and App. § 7. SAD-Flower is not evaluated as it requires a learned dynamics model, which our setups do not provide.

MethodSafe-SR (%) ↑\uparrowGoal reaching (%) ↑\uparrowCollision (%) ↓\downarrowlog⁡L↑\log L \uparrowNFE ↓\downarrow
Unconstrained3.375.380.015.02240
Gradient guidance (α=0.20\alpha=0.20)32.032.00.710.42240
Trust Sampling (w=0.1w=0.1, J=5J=5)53.360.712.012.231104
Rejection (B=100B=100)34.768.038.714.228745
Projection55.358.76.011.41240
SafeDiffuser13.316.719.37.50†7.50^{\dagger}240
SafeFlowMatcher44.748.78.010.90432
CS-Pi (k=50k=50, Kmax⁡=5K_{\max}=5)81.384.73.317.96271

Table 2. Shelf pick-and-place, 5 scenarios, 150 tasks (30/scenario). Safe-SR: collision-free rollouts that pick and place the cube. log⁡L\log L: mean log-likelihood under πθ\pi_\theta (nats/dim; the unconstrained policy scores 15.02). NFE: flow-model calls per trajectory. †\daggerMedian: a few diverged SafeDiffuser chunks make its mean uninformative.

Deployment-time safety for vision-language-action models. Recent work shares our practical motivation of enforcing constraints on a pretrained vision-language-action (VLA) policy at deployment. OmniGuide [5] steers flow-matching VLAs [2, 21] toward collision avoidance and semantic targets with gradient guidance on differentiable energy fields, and thus evaluates its cost at the proxy. VLSA [22] instead acts once, on the final action, much as projection does: a CBF filter changes the VLA’s output action as little as possible to satisfy the barrier condition, and the robot executes the filtered action. Its authors report that this filter causes a safety-induced distribution shift. Our hardware experiment uses a similar setup, a π0.5\pi_{0.5} policy on a Franka arm, and there CS-Pi improves on both gradient guidance and projection (§ 4.4).

Partial renoising. Adding noise to an input and denoising it again is an established way to make an edited input plausible under a generative model. SDEDIT [23] renoises a user’s stroke painting and denoises it into a realistic image; RePaint [24] renoises around known pixels to inpaint the rest; and DenoDiffusion [25] reuses a human demonstration retargeted to the robot into actions the policy would plausibly produce. In each, the renoised input is given in advance and the amount of noise is set by hand, once. CS-Pi instead renoises the policy’s own draw after projecting it onto the safe set, sets the amount of noise from how far the projection moved the draw, and repeats until a draw is safe. This turns a one-shot edit into a loop that drives the draw toward the safe set (§ 3).

Approach

We want to sample from a flow-matching policy under a constraint supplied only at deployment time. The action we draw must satisfy two equally important requirements: it must be safe, satisfying the constraint, and plausible, remaining likely under the policy. An action the policy would essentially never draw, even one that satisfies the constraint, may be jerky, kinematically infeasible, or task-inappropriate.

Setup and notation. The policy πθ\pi_{\theta} generates a clean action a∈RD\mathbf{a} \in\mathbb{R}^{D} by integrating a learned velocity field along an ODE, from Gaussian noise a0∼N(0,I)\mathbf{a}_{0} \sim\mathcal{N}(\mathbf{0}, I) at time t=0t = 0 to the clean action at t=1t = 1. We write a=πθ(an;n)\mathbf{a} = \pi_{\theta}(\mathbf{a}_{n}; n), integrating from an intermediate state an\mathbf{a}_{n} at time t=n∈[0,1]t = n \in[0,1] to t=1t = 1, so an ordinary draw is a=πθ(a0;0)\mathbf{a} = \pi_{\theta}(\mathbf{a}_{0}; 0) with a0∼N(0,I)\mathbf{a}_{0} \sim\mathcal{N}(\mathbf{0}, I), abbreviated a∼πθ\mathbf{a} \sim\pi_{\theta}; we overload πθ(a)\pi_{\theta}(\mathbf{a}) for the marginal density it induces over clean actions. At deployment we are given a safe set C⊆RD\mathcal{C} \subseteq\mathbb{R}^{D}, absent at training, through its Euclidean projection P(a)=arg min⁡a′∈C∥a′−a∥\mathcal{P}(\mathbf{a}) = \operatorname*{arg\,min}_{\mathbf{a}' \in\mathcal{C}} \lVert\mathbf{a}' - \mathbf{a} \rVert, which is closed-form or a cheap iterative solve for the constraint we consider. Our goal is to draw a∼πθ\mathbf{a} \sim\pi_{\theta} with a∈C\mathbf{a} \in\mathcal{C}. We generalize our method to admit continuous cost functions at the end of the section.

Overview. We want samples that are both safe and plausible. Rejection sampling and projection are two classical approaches, each achieving one of these: rejection redraws unmodified policy samples until one is safe, so every draw is plausible, but almost all are wasted when safe actions are rare; projection maps the clean sample to the nearest point in the safe set, so every action is safe, but the projected action is one the policy is unlikely to produce. Our insight is to strike a balance between the two, projection’s efficiency and rejection’s plausibility, by using the projection not as the action to execute but as an anchor for the next draw. Concretely, we draw a clean action, project it onto CC, renoise the projection to a noise level set by how far the projection moved the draw (the projection residual), and re-denoise from there; we iterate until a draw is itself safe.

From projection to a resampling target. Projection gives us a useful starting point for the next draw. The projected sample ac(i)=P(a^(i))\mathbf{a}_c^{(i)} = \mathcal{P}(\hat{\mathbf{a}}^{(i)}) of the current clean draw a^(i)\hat{\mathbf{a}}^{(i)}, which we call the anchor, is cheap to compute and safe by construction, and it sits closer than a^(i)\hat{\mathbf{a}}^{(i)} to the safe actions the policy is likely to draw. It therefore tells us where the next draw should concentrate, i.e. near ac(i)\mathbf{a}_c^{(i)}, without executing ac(i)\mathbf{a}_c^{(i)}. The corresponding idealized target biases the policy toward ac(i)\mathbf{a}_c^{(i)} while preserving its own structure:

q(i)(a)∝πθ(a)⋅N(a;ac(i),(σ(i))2I).(1)q^{(i)}(\mathbf{a}) \propto\pi_\theta(\mathbf{a}) \cdot\mathcal{N}\left(\mathbf{a}; \mathbf{a}_c^{(i)}, \left(\sigma^{(i)}\right)^2 I\right). \tag*{(1)}

Drawing from Eq. (1), projecting the result, and recentering the next target on that projection defines one iteration of a loop that terminates when a draw lands in CC.

Setting σ(i)\sigma^{(i)} from the projection residual. We set σ(i)\sigma^{(i)} from the projection residual δ(i)=∥a^(i)−ac(i)∥\delta^{(i)} = \lVert\hat{\mathbf{a}}^{(i)} - \mathbf{a}_c^{(i)}\rVert itself, because δ(i)\delta^{(i)} already encodes how much trust to place in ac(i)\mathbf{a}_c^{(i)} as an anchor. A small δ(i)\delta^{(i)} means the current draw was nearly safe, so plausible actions likely lie near ac(i)\mathbf{a}_c^{(i)} and the next draw should concentrate there. A large δ(i)\delta^{(i)} means the current draw was far from CC, so ac(i)\mathbf{a}_c^{(i)} may sit in a region the policy assigns vanishing mass; the next draw should be loose enough to give a different policy mode (e.g., passing right of an obstacle rather than left) a chance to be reached. We therefore set σ(i)=δ(i)/k\sigma^{(i)} = \delta^{(i)}/k for a positive coefficient kk, the only hyperparameter introduced in the loop. The hyperparameter kk slides between the two extremes: k→0k \to0 gives σ(i)→∞\sigma^{(i)} \to\infty and recovers rejection, while k→∞k \to\infty gives σ(i)→0\sigma^{(i)} \to0 and recovers projection.

Realising the target via partial renoising. Sampling from Eq. (1) for an arbitrary σ(i)\sigma^{(i)} is intractable in general as the policy density πθ(a)\pi_\theta(\mathbf{a}) is implicit, defined only through the ODE, and its product with a Gaussian has no closed form. We therefore renoise the projected point to the intermediate time n(i)=k/(k+δ(i))n^{(i)} = k/(k + \delta^{(i)}),

an(i)=n(i)ac(i)+(1−n(i))ϵ(i),ϵ(i)∼N(0,I),(2)\mathbf{a}_n^{(i)} = n^{(i)}\mathbf{a}_c^{(i)} + \left(1 - n^{(i)}\right)\boldsymbol{\epsilon}^{(i)}, \qquad\boldsymbol{\epsilon}^{(i)} \sim\mathcal{N}(\mathbf{0}, I), \tag*{(2)}

and re-denoise from an(i)\mathbf{a}_n^{(i)}. This choice of n(i)n^{(i)} ties the amount of noise to σ(i)\sigma^{(i)}: (1−n(i))/n(i)=δ(i)/k=σ(i)\left(1 - n^{(i)}\right)/n^{(i)} = \delta^{(i)}/k = \sigma^{(i)}, so a larger residual adds more noise. Appendix § 11 states the exact rule for the next draw under this construction and its scope.

Iterating to safety. We pass each new draw back as the next a^\hat{\mathbf{a}}: project, renoise, re-run the policy, repeat, until the draw lands in CC. We refer to this draw-project-renoise loop as Constraint-Satisfying Flow Policy Sampling (CS-Pi; Figure 2), stated in Algorithm 1; it terminates when δ≤τ\delta\le\tau, i.e., once a draw lies within τ\tau of CC, after a cap of Kmax⁡K_{\max} iterations. On average each successive draw lands closer to the safe set (Appendix § 13), so the residual δ\delta shrinks (resulting in a larger nn) with each iteration, bringing the current draw closer to a safe and plausible draw.

Constraint-Satisfying Flow Policy Sampling
1:Draw a0∼N(0,I)\mathbf{a}_0 \sim\mathcal{N}(\mathbf{0}, I); a^(0)←πθ(a0;0)\hat{\mathbf{a}}^{(0)} \leftarrow\pi_\theta(\mathbf{a}_0; 0)▷ initial policy draw
2:for i=0,…,Kmax⁡−1i = 0, \ldots, K_{\max} - 1 do
3:ac(i)←P(a^(i)); δ(i)←∥a^(i)−ac(i)∥\mathbf{a}_c^{(i)} \leftarrow\mathcal{P}(\hat{\mathbf{a}}^{(i)}); \ \delta^{(i)} \leftarrow\lVert\hat{\mathbf{a}}^{(i)} - \mathbf{a}_c^{(i)}\rVert
4:if δ(i)≤τ\delta^{(i)} \le\tau then
5:return a^(i)\hat{\mathbf{a}}^{(i)}
6:end if
7:n(i)←k/(k+δ(i)); ϵ(i)∼N(0,I)n^{(i)} \leftarrow k/(k + \delta^{(i)}); \ \boldsymbol{\epsilon}^{(i)} \sim\mathcal{N}(\mathbf{0}, I)
8:an(i)←n(i)ac(i)+(1−n(i))ϵ(i)\mathbf{a}_n^{(i)} \leftarrow n^{(i)}\mathbf{a}_c^{(i)} + (1 - n^{(i)})\boldsymbol{\epsilon}^{(i)}
9:a^(i+1)←πθ(an(i);n(i))\hat{\mathbf{a}}^{(i+1)} \leftarrow\pi_\theta(\mathbf{a}_n^{(i)}; n^{(i)})▷ re-denoise from time nn
10:end for
11:return P(a^(Kmax⁡))\mathcal{P}(\hat{\mathbf{a}}^{(K_{\max})})▷ optional terminal projection

Table 1. Algorithm 1 Constraint-Satisfying Flow Policy Sampling

Incorporating soft preferences as continuous costs. So far we have enforced a hard constraint, i.e. an action either lies in CC or it does not. Deployment also brings softer preferences, behaviors to favor rather than boundaries to clear, such as keeping the gripper near-vertical while carrying a full cup (§ 4.3), and we generalize the same loop to express these preferences alongside hard constraints. This generalization needs only one change: CS-Pi uses the projection only to produce an anchor for the next draw; for a continuous cost LL, that anchor comes instead from the proximal operator

prox⁡βL(a^)=arg⁡min⁡a′∈RD[L(a′)+12β∥a′−a^∥2](3)\operatorname{prox}_{\beta L}(\hat{a}) = \underset{a' \in\mathbb{R}^{D}}{\arg\min}\left[L(a') + \frac{1}{2\beta}\lVert a' - \hat{a}\rVert^{2}\right] \tag*{(3)}

which trades reducing LL against staying close to the current draw a^\hat{a}, with β\beta setting the balance; the rest of the algorithm is unchanged. Hard constraints and continuous costs are then composed by being applied in sequence to the same clean draw, with the operators encoding priority by their order. For example, CS-Pi can first pull toward the preferred orientation with the proximal operator and then project onto the safe set, so the constraint takes precedence. A gradient method would instead have to merge both into a single objective.

Optional terminal projection. If no draw lies within τ\tau of CC after Kmax⁡K_{\max} iterations, CS-Pi can project the last draw and execute the result, trading plausibility for safety when safety must come first. Even then the loop pays off: in simulation, the executed actions are more likely under the policy than a typical one-shot projection. App. § 15 studies how often the terminal projection is triggered and how likely the resulting actions are.

Experiments

Throughout, we measure two things for each sampler: whether it satisfies the constraint and whether its samples are plausible. We evaluate four settings: a 2D navigation task where the whole action distribution is easy to visualize, a 7-DoF shelf pick-and-place, an orientation-preference cost (3D-ORIENT), and a real-world Franka deployment; App. § 7 adds a 3D obstacle-avoidance benchmark, SPHERE-AVOID.

Our primary metric is the safe success rate (Safe-SR): the fraction of rollouts that satisfy the constraint and complete the task. Plausibility is measured by log⁡L\log L, the mean log-likelihood πθ\pi_{\theta} assigns to a method’s actions (nats/dim; higher is more plausible). Compute is reported as NFE, the flow-network forward passes per rollout (not comparable across benchmarks). We compare against gradient guidance, Trust Sampling (step size ww, at most JJ guidance steps per denoising step), rejection sampling (redraw budget BB), projection, the unconstrained policy, and two CBF samplers (SafeDiffuser [18] and SafeFlowMatcher [19]), each reported at the best value of its main hyperparameters (App. § 12). CS-Pi has a single hyperparameter, kk, and is robust across a broad range of it (App. § 17). It uses the terminal projection on every obstacle benchmark but not on 3D-ORIENT, where the target is a preference.

2D Avoidance: constraint satisfaction without distribution shift

AVOIDANCE is a 2D planar environment in which an agent travels from a fixed start position to a goal region. We collect demonstrations that reach the goal along distinct paths, so the policy is multimodal, mirroring real manipulation data where demonstrations of one task take different routes or have different styles. Because the action space is 2D, we can plot each sampler’s full distribution. Plausibility is measured by how many of the rollouts stay inside the demonstration support: the part of the plane the demonstrations pass through. At deployment we impose obstacles the policy never saw, in six scenarios of varying difficulty. Figure 3 shows rollouts for one scenario; the remaining five are in App. § 9.

2D AVOIDANCE trajectory distributions for Gradient guidance, Trust Sampling, Rejection, CS-Pi, and Projection

Figure 3. 2D AVOIDANCE trajectory distributions, one scenario per method. 20 rollouts overlaid on the demonstration support (shaded); the obstacles are outlined. Gradient guidance and Trust Sampling visibly leave the support to reach the goal or cut through the obstacle; rejection stays on-support but only a few draws survive; CS-Pi keeps every trajectory in-distribution while routing around the obstacle. The other five scenarios are in App. § 9.

Three methods reach at least 99% safe success: SafeDiffuser, projection and CS-Pi (Table 1). Among them, CS-Pi keeps the most rollouts fully on-support (0.857) and has the highest log-likelihood (1.53), while projection’s log-likelihood collapses to −85.89. Gradient guidance, Trust Sampling and rejection stay plausible but reach at most 79.4% safe success.

Composing a hard constraint with a soft preference. A safe set cannot express a preference among feasible actions. On the same 2D AVOIDANCE environment we add to the obstacle constraint a soft preference toward a height yref=0.7y_{\mathrm{ref}}=0.7. CS-Pi applies the two in sequence by priority, whereas the baselines must fold them into one weighted cost; only CS-Pi satisfies both (App. § 9, Figure 8).

Constraint and preference on 2D AVOIDANCE (cluttered)

Figure 8. Constraint and preference on 2D AVOIDANCE (cluttered). No setting of gradient guidance (α\alpha) or Trust Sampling (ww) satisfies both the obstacle constraint and the (y−0.7)2(y-0.7)^2 preference: low settings collide, high settings stay far from yref=0.7y_{\mathrm{ref}}=0.7. CS-Pi meets both.

MethodSafe-SR (%) ↑fully-in-supp. ↑logL ↑NFE ↓
Unconstrained5.20.8001.66456
Gradient guidance67.20.4101.49298
Trust Sampling34.90.3501.434421
Rejection79.40.7501.6673921
Projection99.80.640−85.8952
SafeDiffuser100.00.8301.4492
SafeFlowMatcher45.20.000−463220
CS-Pi99.00.8571.53283

Table 1 (PDF p. 7). 2D AVOIDANCE, macro over six scenarios (200 rollouts per cell; best hyperparameter per method). Safe-SR: rollouts reaching the goal collision-free. fully-in-supp.: fraction of rollouts whose every waypoint lies inside the demonstration support. logL: mean log-likelihood under πθ\pi_\theta.

Shelf pick-and-place with deployment-time obstacles

The shelf benchmark tests whether a sampler can satisfy a deployment-time obstacle constraint without discarding the task semantics encoded by the policy. A 7-DoF Franka picks a 4 cm cube from a three-rung shelf and places it on the table; at inference we add obstacles absent at training (App. § 8). A rollout is safe and successful if it is collision-free, picks the cube, and places it. CS-Pi and projection share the same L-BFGS [26] proximal step, so any gap between them is due to the iterative loop of CS-Pi.

CS-Pi reaches the highest safe success rate (81.3%; Table 2) and is the only method whose actions score above the unconstrained policy in mean log-likelihood; projection and the gradient baselines satisfy the obstacle only by making the chunk implausible. CS-Pi, projection, gradient guidance and SafeFlowMatcher collide on at most 8% of rollouts, so among them performance depends mainly on whether the gripper still reaches the cube. Projection and the gradient baselines avoid the obstacles by moving the arm away from them, and often away from the cube as well; CS-Pi instead re-denoises a trajectory that passes between the obstacles and still reaches the cube (84.7% goal reaching, above even the unconstrained policy’s 75.3%).

3D-Orient: reaching with an orientation preference

3D-Orient tests CS-Pi on a continuous cost. The task is a 7-DoF reach to a goal sampled anywhere in the robot’s reachable workspace; on top of it we add a soft preference to hold a top-down orientation R∗R^*, encoded as the cost L(q)=∑t=1H∥R(qt)−R∗∥F2L(q)=\sum_{t=1}^{H}\lVert R(q_t)-R^*\rVert_F^2. The test is whether a method can achieve the orientation without giving up the reach. Projection, rejection and the CBF samplers require a safe set and do not apply to a continuous cost.

CS-Pi is the only method that does both (Table 3): 65.6% success, with goal reaching (98.9%) and end-effector step (0.07 m) matching the unconstrained policy. Gradient guidance loses the reach and roughens the path (< 7% success); Trust Sampling keeps the reach and a high log-likelihood only by barely changing the orientation (1.1% success). CS-Pi’s lower log-likelihood (10.21 vs. 13.46) is the cost of moving the gripper away from the policy’s preferred orientations. Guidance fails because of IK redundancy: many configurations reach the same point at different orientations, so the proxy averages them into an invalid configuration with an uninformative gradient (App. E).

Method (best cfg)Success ↑\uparrowGoal reaching ↑\uparrowlog⁡L↑\log L \uparrowMax EE step (m)NFE ↓\downarrow
Unconstrained2.2%98.9%13.460.07138
Gradient guidance (α=0.003\alpha=0.003)2.2%70.0%12.300.08154
Gradient guidance (α=0.03\alpha=0.03)6.7%7.8%9.620.40160
Trust Sampling (w=0.001w=0.001)1.1%98.9%13.440.071379
CS-Pi + EE-prox (k=10k=10, Kmax⁡=3K_{\max}=3)65.6%98.9%10.210.07210

Table 3. 3D-ORIENT, 90 rollouts per cell. Success: rollouts with a step simultaneously within 10 cm of the target position and within 0.36 rad of the target orientation. Goal reaching: rollouts ending within 10 cm of the target position. log⁡L\log L: mean log-likelihood under πθ\pi_\theta; comparisons are meaningful only at comparable success, since the guidance configurations attain only 2.2% and 6.7% success. Max EE step: largest single-step end-effector displacement. EE-prox: proximal step on the orientation cost (Eq. (3)). NFE: mean number of model evaluations per rollout.

Real-world deployment

We evaluate CS-Pi on a Franka arm with a Robotiq 2F-85 gripper, ZED 2 external and ZED Mini wrist cameras, and a DROID-finetuned π0.5\pi_{0.5}[27] policy used without further finetuning. The task is pick up the apple and place it on the blue plate. A vision pipeline conditioned on the ZED 2 RGB and depth images generate obstacle bounding boxes that form the constraint CC; deployment is zero-shot. We test over two layouts (Figure 4), 10 trials per method per layout, and compare CS-Pi, gradient guidance, and projection against the unguided policy. Table 4 reports the safe-success rate, per-step latency, and the log-likelihood the frozen prior assigns to the executed actions.

Hardware rollout strips showing CS-Pi and unguided policies

Figure 4. Hardware rollouts; frames run left-to-right within each strip. Green-bordered strips are CS-Pi, which enforces the deployment-time obstacle constraint and completes the pick-and-place; red-bordered strips are the same π0.5\pi_{0.5} policy run unconstrained. Layout 1 (first two): CS-Pi grasps the apple and places it, while the unconstrained policy clips the cup and loses the grasp. Layout 2 (last two): CS-Pi reaches down and lifts the apple cleanly, while the unconstrained policy collides with the obstacle.

CS-Pi reaches the highest safe success rate in both layouts (60% and 50%) and averaged over both (55%), versus 40% for projection, 25% for gradient guidance, 20% for Trust Sampling, and 10%

for the unconstrained policy. Its per-step latency (0.143 s) matches gradient guidance (0.139 s) and Trust Sampling (0.135 s); projection is cheaper (0.099 s) but enforces CC with a one-shot projection that drops its log-likelihood below the unconstrained policy’s (−473.2 versus −470.2), whereas CS-Pi stays close to it (−471.8) while satisfying the constraint. The runs are small-sample (10 trials per layout), but CS-Pi leads in both layouts.

Conclusion

CS-Pi samples safe and plausible actions from a flow-matching policy with a draw-project-renoise loop: it projects each draw onto the safe set, adds noise back scaled to how far the projection moved the draw, and re-runs the unmodified policy. It needs no constraint gradient at noisy states and no auxiliary network. CS-Pi also extends to continuous costs by replacing only the projection step with a proximal operator. Across a 2D diagnostic, a 7-DoF shelf pick-and-place, an orientation preference, and a zero-shot Franka deployment, CS-Pi is the only sampler that satisfies the constraint while staying plausible wherever the constraint permits. On hardware it reaches 55% safe success against 40% for projection and 25% for gradient guidance. A policy can thus meet a safety constraint it never trained on, without surrendering the behaviour that made it useful.

Limitations

Our theory covers a single iteration, we characterize the per-iteration sampling distribution, the distribution of the next draw given the current one (App. § 11), but we do not prove that the loop converges. In practice, CS-Pi does not always reach an action that is both safe and plausible. Therefore, when no draw lies within τ\tau of CC after Kmax⁡K_{\max} iterations, it must choose between the last draw, which may be unsafe, and the terminal projection, which is safe but often less likely under the policy (App. § 15).

CS-Pi also needs a usable projection P\mathcal{P} (or proximal operator prox⁡βL\operatorname{prox}_{\beta L}): the obstacle and joint-limit sets we use admit closed-form or cheap iterative solutions, but more complex sets need more complex solvers. It is also only as good as CC: on hardware we estimate CC from vision once per rollout and evaluate it in static scenes, so dynamic obstacles and errors from segmentation, depth and registration can misplace or mis-size CC. Finally, like every sampler we evaluate, CS-Pi operates on action chunks, the fixed-length sequences of actions a policy predicts at each query, and is therefore myopic: when the policy commits to a mode that is safe for the current chunk but has no safe continuation, CS-Pi cannot recover; trajectory-level planning is out of scope.

Project page

Qualitative videos of the 2D, simulated, and hardware rollouts, along with additional visualizations, are available at the project page:

https://babayaga840.github.io/CS-pi_site/

3D SPHERE-AVOID: pure obstacle avoidance

This benchmark complements the shelf result (§ 4.2) by isolating obstacle avoidance, with no task-semantic tension between the constraint and the policy. SPHERE-AVOID uses a simulated 7-DoF Franka Panda and a joint-space action: a flow-matching policy moves between a start and a goal configuration without colliding with sphere obstacles. The safe set CC is the collision-free set of the swept-sphere geometry plus joint limits. We test two layouts: L1 (10 spheres) and L2 (16 spheres). The policy was trained on demonstrations from both layouts.

Figure 5. The two SPHERE-AVOID layouts (L2 adds six obstacles).

CS-Pi with the terminal projection reaches 99.9% safe success on L1 and 91.8% on L2, the highest in both layouts, and of the methods that enforce the constraint it loses the least from L1 to L2 (8.1 points, against 26.1 for projection; Table 5). The strongest baselines are projection (88.2% / 62.1% on L1 / L2) and Trust Sampling (77.0% / 38.7% at 64–69 NFE), followed by SafeFlowMatcher (61.8% / 21.9%), rejection (56.7% / 14.1% at 388–492 NFE), SafeDiffuser (36.4% / 7.4%), gradient guidance (23.6% / 4.7%) and the unconstrained policy (8.9% / 0.8%). CS-Pi uses 20–26 NFE. Its log-likelihood matches the unconstrained policy on L1 (2.87 vs. 2.88) and is 0.30 lower on L2; rejection has the highest log-likelihood on both layouts.

MethodL1 (10 spheres)L2 (16 spheres)
Safe-SRlogLNFESafe-SRlogLNFE
Unconstrained8.92.88100.82.8410
Gradient guidance (α=0.01\alpha=0.01)23.62.73104.72.3210
Trust Sampling (w=0.3w=0.3, J=5J=5)77.03.036438.72.6869
Rejection56.73.4738814.13.19492
Projection88.22.671062.12.2810
SafeDiffuser36.42.51{sup}†`107.41.83{sup}†`10
SafeFlowMatcher61.82.301221.91.8212
CS-Pi (k=50k=50, Kmax⁡=20K_{\max}=20)99.92.872091.82.5426

Table 5. 3D SPHERE-AVOID. 120 tasks, of which 104 (L1) and 32 (L2) have a safe goal configuration; 8 samples per task. logL: mean log-likelihood under πθ\pi_\theta (nats/dim; the unconstrained policy scores 2.88 / 2.84). †Median: a few diverged SafeDiffuser samples make the mean uninformative (−119.5 / −17.3). Baselines are at their best swept configuration (App. § 12).

Shelf task scenarios

Clutter combo

(a) (a) Clutter combo

Tall table pillar

(b) (b) Tall table pillar

Two flankers

(c) (c) Two flankers (top)

Mid-rung neighbor

(d) (d) Mid-rung neighbor

Low-rung neighbor

(e) (e) Low-rung neighbor

Figure 6. The five shelf scenarios (blue: cube to grasp, orange: obstacles).

MethodClutterPillarFlankersMid-rungLow-rungMean
Unconstrained3.33.33.36.70.03.3
Gradient guidance16.770.016.733.323.332.0
Rejection20.083.320.033.316.734.7
Projection40.063.346.766.760.055.3
SafeDiffuser6.733.33.323.30.013.3
SafeFlowMatcher43.346.753.356.723.344.7
CS-Pi80.093.383.376.773.381.3

Table 6. Shelf safe success (%) per scenario, 30 tasks each. CS-Pi’s mean logL per scenario: 19.29 / 17.56 / 17.63 / 17.08 / 18.26. Trust Sampling (53.3% overall) is not broken down by scenario.

Additional 2D Avoidance results

2D AVOIDANCE trajectory distributions across six scenarios

Figure 7. 2D AVOIDANCE trajectory distributions, all six scenarios. 20 rollouts overlaid on the demonstration support (shaded); the obstacles are outlined.

Composing a hard constraint with a soft preference. On the cluttered scenario we add to the obstacle constraint the preference L(a)=(y−yref)2L(a) = (y-y_{\mathrm{ref}})^2 with yref=0.7y_{\mathrm{ref}}=0.7. CS-Pi applies the proximal step for the preference and then the projection, so the constraint takes precedence; gradient guidance and Trust Sampling descend a single weighted sum of the collision cost and the preference. A rollout meets both if it is collision-free and its mean height error ∣yt−0.7∣|y_t-0.7| is below 0.05. CS-Pi meets both on every rollout for k∈{30,100,200}k \in\{30, 100, 200\}; no setting of gradient guidance or Trust Sampling meets both (Table 8, Figure 8): low settings collide and high settings stay far from yrefy_{\mathrm{ref}}. Projection alone and rejection cannot target a preference and are omitted.

MethodSettingBoth met (%)Collision (%)Mean ∣y−0.7∣|y-0.7|NFE
Unconstrained–035.30.19510
Gradient guidanceα=0.1\alpha=0.1031.30.19410
α=0.3\alpha=0.3028.00.19310
α=1\alpha=1019.30.18910
α=3\alpha=3000.17810
α=10\alpha=10000.15010
Trust Samplingw=0.01w=0.01025.30.19070
w=0.05w=0.05000.16670
w=0.1w=0.1000.13570
CS-Pik=1k=1000.188110
k=10k=10000.09982
k=20k=20000.06563
k=30k=3010000.04345
k=100k=10010000.01023
k=200k=20010000.00721

Table 8. Constraint and preference on 2D AVOIDANCE (cluttered), 150 chunks per setting.

Why gradient guidance fails

Gradient guidance steers a flow-matching policy toward a cost LL defined on the clean action a1a_1, such as a collision cost or an orientation error. During sampling the integrator only ever holds a partially denoised state ata_t at time t∈(0,1)t \in(0,1), and the cost of a noisy state carries no information about the cost of the clean action it will become: L(at)L(a_t) and L(a1)L(a_1) are unrelated. Guidance therefore cannot evaluate the cost at ata_t. It must instead predict the clean action the current state will denoise into and evaluate the cost there. This requirement, forced by the cost being defined on a1a_1, is the root of the failure.

The guidance direction one would want. Guidance aims to sample from the tilted distribution p∗(a)∝πθ(a)exp⁡(−βL(a))p^*(a) \propto\pi_\theta(a)\exp(-\beta L(a)), which concentrates the policy on low-cost actions with strength β\beta. The exact correction this adds to the velocity at ata_t is the score of the tilt, ∇atlog⁡Ep(a1∣at)[exp⁡(−βL(a1))]\nabla_{a_t}\log\mathbb{E}_{p(a_1\mid a_t)}[\exp(-\beta L(a_1))]. To first order in β\beta this reduces to the posterior-mean gradient

g⋆(at)=Ep(a1∣at)[∇L(a1)],(4)g^\star(a_t) = \mathbb{E}_{p(a_1\mid a_t)}[\nabla L(a_1)], \tag*{(4)}

the cost gradient averaged over every clean action the noisy state could still become, weighted by the denoising posterior p(a1∣at)p(a_1 \mid a_t). Equation (4) is the guidance one would want: it accounts for the policy’s remaining uncertainty about a1a_1.

The Jensen swap. The expectation in Eq. (4) is intractable. The posterior p(a1∣at)p(a_1 \mid a_t) is defined only implicitly through the flow and has no closed form. Every gradient-guidance method makes the same substitution: it moves the gradient outside the expectation,

Ep(a1∣at)[∇L(a1)]≈∇L(Ep(a1∣at)[a1])=∇L(aˉ(at)),(5)\mathbb{E}_{p(a_1\mid a_t)}[\nabla L(a_1)] \approx\nabla L\left(\mathbb{E}_{p(a_1\mid a_t)}[a_1]\right) = \nabla L(\bar{a}(a_t)), \tag*{(5)}

replacing the expected gradient by the gradient at the expected action, the proxy aˉ(at)=E[a1∣at]\bar{a}(a_t) = \mathbb{E}[a_1 \mid a_t]. This is exact only when ∇L\nabla L is affine over the support of the posterior, that is, when LL is quadratic there. For a general cost the two sides differ by the Jensen gap; a second-order expansion of LL about aˉ\bar{a} gives

E[L(a1)]−L(aˉ)⏟Jensen gap=12⟨∇2L(aˉ),Cov⁡(a1∣at)⟩+…,(6)\underbrace{\mathbb{E}[L(a_1)] - L(\bar{a})}_{\text{Jensen gap}} = \frac{1}{2}\left\langle\nabla^2 L(\bar{a}), \operatorname{Cov}(a_1 \mid a_t)\right\rangle+ \ldots, \tag*{(6)}

and differentiating leaves a drift error of the same character: it scales with the curvature of the cost and with the spread of the denoising posterior. Both factors are largest exactly where guidance must act. The covariance Cov⁡(a1∣at)\operatorname{Cov}(a_1 \mid a_t) is wide at high noise, before the policy has committed to an action; and a hard constraint is the limit of a cost that is 00 on CC and unbounded off it, whose curvature diverges at the boundary.

The proxy is the Tweedie mean. The proxy aˉ(at)=E[a1∣at]\bar{a}(a_t) = \mathbb{E}[a_1 \mid a_t] is the posterior mean of the clean action (the Tweedie estimate); for a flow policy it is recovered by a single integration step from ata_t to t=1t = 1. When the posterior is unimodal and narrow, the proxy is accurate and the swap is benign. When the policy is still uncertain between distinct clean actions, the posterior is multimodal and its mean lies between the modes, at an action the policy assigns almost no mass and that need not be valid. The gradient ∇L(aˉ)\nabla L(\bar{a}) is then computed at a point on no mode. No choice of β\beta or step size repairs this, because the error is in where the gradient is evaluated, not in its magnitude.

3D-ORIENT: a worked failure. The orientation preference of § 4.3 is exactly this multimodal case. The cost L(q)=λ∥R(q)−R⋆∥22L(q) = \lambda\lVert R(q) - R^\star\rVert_2^2 on the seven joint angles has several minima because of inverse-kinematics redundancy: many distinct configurations reach the target orientation. When the denoising posterior places mass on two such branches, the proxy is their joint-space average, which lies between the basins and is not itself a valid configuration; it breaks both the position and the orientation target. Figure 9 shows two minima 0.02 mm apart in end-effector position whose joint-space mean lands 31 cm away. The gradient there has no consistent relation to the gradient at either branch, so guidance that descends it cannot honor the orientation without abandoning the reach (Table 3). CS–Pi evaluates the cost only on clean draws, each inside a single basin.

Saddle-ridge configuration of the orientation cost, rendered on the Franka

Figure 9. Saddle-ridge configuration of the orientation cost, rendered on the Franka. Inverse kinematics on a central target p∗=(0.45,0.05,0.50)p^* = (0.45, 0.05, 0.50). (A), (B): two minima of LL at the same end-effector position (0.02 mm apart) with distinct joint configurations (blue: elbow up; red: elbow rotated and wrist twisted). (C): the configuration qˉ=(q1+q2)/2\bar{q} = (q_1 + q_2)/2 that gradient guidance evaluates when its posterior places mass on both branches; the black dot marks its end-effector position, 31 cm from the target. The average breaks both the position and the orientation target, although both minima satisfy them.

Exact per-iteration sampling law

This section makes precise the Gaussian-window interpretation of one CS-Pi iteration. The model’s conditional law admits the closed form below, whereas a deterministic numerical flow defines a pushforward kernel whose density need not equal that conditional law.

Setup. Let the flow-matching interpolant be

At=tA1+(1−t)ϵ,ϵ∼N(0,I),A1∼πθ,(7)A_t = tA_1 + (1-t)\epsilon,\qquad\epsilon\sim\mathcal{N}(0,I),\qquad A_1 \sim\pi_\theta, \tag*{(7)}

so p(At∣A1=a)=N(At;ta,(1−t)2I)p(A_t \mid A_1 = a) = \mathcal{N}(A_t;ta,(1-t)^2I). At iteration ii, define

ac(i)=P(a^(i)),δ(i)=∥a^(i)−ac(i)∥,n(i)=kk+δ(i).(8)a_c^{(i)} = \mathcal{P}(\hat{a}^{(i)}),\qquad\delta^{(i)} = \lVert\hat{a}^{(i)} - a_c^{(i)}\rVert,\qquad n^{(i)} = \frac{k}{k+\delta^{(i)}}. \tag*{(8)}

For δ(i)>0\delta^{(i)} > 0, the rule for nn gives

1−n(i)n(i)=δ(i)k=σ(i).(9)\frac{1-n^{(i)}}{n^{(i)}} = \frac{\delta^{(i)}}{k} = \sigma^{(i)}. \tag*{(9)}

Proposition 1 (Conditional law of one iteration). Fix μ(i)∈RD\mu^{(i)} \in\mathbb{R}^D and form

an(i)=n(i)ac(i)+(1−n(i))μ(i).(10)a_n^{(i)} = n^{(i)}a_c^{(i)} + (1-n^{(i)})\mu^{(i)}. \tag*{(10)}

If re-denoising draws from the model conditional p(A1∣An(i)=an(i))p(A_1 \mid A_{n^{(i)}} = a_n^{(i)}), then the next draw has density

q(i)(a)=1Ziπθ(a)exp⁡[−∥a−a~c(i)∥22(σ(i))2],a~c(i)=ac(i)+σ(i)μ(i),(11)q^{(i)}(a) = \frac{1}{Z_i}\pi_\theta(a)\exp\left[-\frac{\lVert a-\tilde{a}_c^{(i)}\rVert^2}{2(\sigma^{(i)})^2}\right],\qquad\tilde{a}_c^{(i)} = a_c^{(i)}+\sigma^{(i)}\mu^{(i)}, \tag*{(11)}

where ZiZ_i is independent of aa: the policy seen through a Gaussian window with standard deviation σ(i)=δ(i)/k\sigma^{(i)} = \delta^{(i)}/k.

Proof. Bayes’ rule and Eq. (7) give

q(i)(a)∝πθ(a)p(an(i)∣A1=a)∝πθ(a)exp⁡(−∥an(i)−n(i)a∥22(1−n(i))2).(12)q^{(i)}(a) \propto\pi_\theta(a)p(a_n^{(i)}\mid A_1=a) \propto\pi_\theta(a)\exp\left(-\frac{\lVert a_n^{(i)}-n^{(i)}a\rVert^2}{2(1-n^{(i)})^2}\right). \tag*{(12)}

Using Eq. (10), an(i)−n(i)a=n(i)(ac(i)+1−n(i)n(i)μ(i)−a)a_n^{(i)}-n^{(i)}a = n^{(i)}\left(a_c^{(i)}+\frac{1-n^{(i)}}{n^{(i)}}\mu^{(i)}-a\right). Substituting Eq. (9) yields Eq. (11). ∎

Center and endpoint cases. For μ(i)=0\mu^{(i)}=0 the window is centered on the projection ac(i)a_{\mathrm{c}}^{(i)}. Algorithm 1 uses μ(i)=ϵ(i)∼N(0,I)\mu^{(i)}=\epsilon^{(i)}\sim\mathcal{N}(0,I); conditional on that draw, Proposition 1 remains exact with center ac(i)+σϵ(i)a_{\mathrm{c}}^{(i)}+\sigma\epsilon^{(i)}. At n=0n=0 the iteration is an unconditional redraw, as in rejection sampling; at n=1n=1 it returns the anchor, as in projection.

Scope. Proposition 1 is a per-iteration statement. It assumes exact posterior re-denoising; it does not establish that deterministic ODE integration samples this conditional, nor does it imply a stationary distribution, a convergence rate, or a bound after several iterations. Empirically, the projection residual decreases across iterations (App. § 13).

Hyperparameter sweeps and configuration selection

Every method in the main tables is reported at its best swept configuration. logL\mathit{logL} is the mean exact log-likelihood under πθ\pi_\theta (nats/dim); NFE is the mean number of flow-model calls per rollout.

Swept hyperparameters. For CS-Pi we sweep kk, the iteration cap Kmax⁡K_{\max} and the terminal projection (on/off). For gradient guidance we sweep the step size α\alpha. For Trust Sampling we sweep the step size ww, the maximum number of guidance steps per denoising step JJ, the schedule (constant vs. linear), whether a projection is applied after each step (“post-projection”), and, where a joint-limit penalty applies, its weight.

3D SPHERE-AVOID. Gradient guidance was swept over α∈[3⋅10−4,0.3]\alpha\in[3\cdot10^{-4},0.3] (best α=0.01\alpha=0.01: 23.6% / 4.7%) and Trust Sampling over w∈[0.01,1.0]w\in[0.01,1.0] with constant and linear schedules (best w=0.3w=0.3, J=5J=5: 77.0% / 38.7%). Table 9 gives CS-Pi across kk (Kmax⁡=20K_{\max}=20, no early stopping). Success rises with kk and saturates on L1 by k=20k=20. Table 5 uses k=50k=50; k=100k=100 is 4.3 points higher on L2.

kk1102050100
Safe-SR L1 / L290.1 / 59.897.8 / 77.799.6 / 88.399.4 / 90.299.8 / 94.5
NFE L172.024.420.919.218.7

Table 9. CS-Pi on SPHERE-AVOID across kk (Kmax⁡=20K_{\max}=20, no early stopping; the same evaluation as the no-stopping row of Table 13). Table 5 is a separate evaluation, so its values at k=50k=50 differ slightly.

2D AVOIDANCE. Gradient guidance uses the best α\alpha per scenario (macro 67.2%; Table 7); Trust Sampling reaches 34.9%. CS-Pi reaches 99.2–99.3% for k∈{5,10,20}k\in\{5,10,20\} (Table 19).

Methodleftrightbothclutt.narrownarrowerMean
Unconstrained20.00.00.01.010.00.05.2
Gradient guidance99.584.015.098.01007.067.2
Trust Sampling9.065.51.018.099.017.034.9
Rejection60.095.070.571.586.093.579.4
Projection10010010010099.010099.8
SafeDiffuser100100100100100100100
SafeFlowMatcher95.077.588.010.50.00.045.2

Table 7. 2D AVOIDANCE safe success (%) per scenario for the baselines, 200 rollouts each (CS-Pi: 99.0% overall, Table 1). Gradient guidance succeeds where one safe corridor dominates (left, cluttered, narrow) and fails where the safe set is a narrow passage the policy rarely uses (both, narrower).

ScheduleFire rateSafe-SRlogL medianNFE
adaptive, k=5k=5 / 10 / 2015.0 / 9.5 / 8.7%99.2 / 99.3 / 99.31.42 / 0.38 / 1.38180 / 153 / 145
constant n=0.5n=0.527.7%99.10.88181
constant n=0.8n=0.815.6%99.6−2.23161
zero noise, k=5k=5 / 10 / 2015.0 / 9.0 / 8.6%99.0 / 99.6 / 99.81.16 / 1.38 / 1.42183 / 150 / 144

Table 19. Schedule for nn on 2D AVOIDANCE. Fire rate is per plan step. Medians, because a few chunks where the terminal projection fires dominate the mean.

Shelf. Table 10 gives the full Trust Sampling sweep. Without post-projection Trust Sampling peaks at 53.3% (w=0.1w=0.1, J=5J=5), the reported configuration. With post-projection it peaks at 43.3%; post-projection is a terminal projection, which no baseline uses in the main tables. CS-Pi across kk (Kmax⁡=20K_{\max}=20, no early stopping): 70.7 / 78.7 / 80.0 / 76.7 / 69.3% at k=5k=5 / 10 / 20 / 50 / 100 (NFE 398 / 376 / 353 / 306 / 290); Table 2 uses k=50k=50, Kmax⁡=5K_{\max}=5 (81.3%).

wwno post-projection J=2J=2no post-projection J=5J=5no post-projection J=10J=10post-projection J=2J=2post-projection J=5J=5post-projection J=10J=10
0.0052.76.04.029.330.732.7
0.013.34.011.330.033.334.0
0.059.338.7—31.336.035.3
0.128.053.351.333.332.043.3

Table 10. Trust Sampling on Shelf: safe success (%) over w×Jw\times J, 150 tasks per cell (–: not run). Bold: the reported configuration (logL 12.23, NFE 1104).

Constraint and preference sweep for Trust Sampling, Gradient Guidance, and CS-$\Pi$

Figure 10. Constraint and preference: sweep. Fraction of rollouts meeting both for CS-Π\Pi (kk), gradient guidance (α\alpha) and Trust Sampling (ww); only CS-Π\Pi meets both, for k∈{30,100,200}k \in\{30, 100, 200\}.

Trajectories under the constraint and the $(y-0.7)^2$ preference for CS-$\Pi$, Gradient Guidance, and Trust Sampling

Figure 11. Trajectories under the constraint and the (y−0.7)2(y-0.7)^2 preference, five settings per method. Only CS-Π\Pi’s sweep contains settings that satisfy both; guidance and Trust Sampling trade one for the other at every setting. (a) CS-Π\Pi (proximal step, then projection); (b) Gradient guidance; (c) Trust Sampling.

3D-Orient. We report gradient guidance at two step sizes: α=0.003\alpha=0.003 keeps most of the reach (70.0%) and α=0.03\alpha=0.03 gives its best success (6.7%); larger and smaller values are worse. Trust Sampling uses w=0.001w=0.001 with the joint-limit penalty. CS-Π\Pi uses k=10k=10, Kmax⁡=3K_{\max}=3, λee=3000\lambda_{ee}=3000, β=106\beta=10^{6}.

Empirical convergence: time nn and projection residual

A successful CS-Pi loop drives the projection residual δ\delta to zero, and therefore n=k/(k+δ)n = k/(k + \delta) to 1. We log both per iteration (Table 11; for 3D-ORIENT and the preference, δ\delta is the proximal-step residual). Means are over loops still running at that iteration; for 2D we give the first and last iteration per group of scenarios.

Benchmark (kk)loopsmean nn per iterationresidual first →\to last
2D left/right/narrow (10)–0.64–0.81 →\to 0.99+2.7–6.3 →\to ≈ 0.1
2D both/cluttered (10)–0.63–0.68 →\to 0.986–8 →\to 0.5–0.7
2D narrower (10)–0.73 →\to 0.80 (stalls)4.1 →\to 2.9
2D constraint + preference (100)1500.743, 0.881, 0.919, 0.936, 0.946, 0.95334.6 →\to 3.42
SPHERE-AVOID L1 (50)1200.991, 0.997, 0.999, 0.999, 0.999, 0.9990.478 →\to 0.0071
SPHERE-AVOID L2 (50)1200.985, 0.993, 0.995, 0.997, 0.997, 0.9970.767 →\to 0.0497
SPHERE-AVOID L1 (10)1190.955, 0.977, 0.986, 0.991, 0.993, 0.9940.467 →\to 0.0225
Shelf (50)15080.994, 0.998, 0.999, 0.999, 0.9990.287 →\to 0.0376
Shelf (1)16020.808, 0.818, 0.817, 0.817, 0.8170.237 →\to 0.224
3D-ORIENT (10)14400.940, 0.966, 0.9780.633 →\to 0.222
3D-ORIENT (1)14400.633, 0.667, 0.6730.579 →\to 0.487

Table 11. Time nn and projection residual per iteration.

Where nn approaches 1. On SPHERE-AVOID and Shelf at their chosen kk the residual falls 7× (Shelf) to 67× (L1). Because the residuals are small relative to kk, nn is close to 1 from the first iteration: the loop re-runs the policy from a barely noised anchor, so each draw stays close to the projection. Lowering kk to 10 on SPHERE-AVOID lowers the first-iteration nn to 0.955 and the loop still converges.

Where it does not. With k=1k=1 on Shelf and 3D-ORIENT the loop stalls (nn stays at 0.82 and 0.67; the residual barely falls). On Shelf this costs safe success (66.7 vs. 81.3%); on 3D-ORIENT it costs NFE (348 vs. 210) and log-likelihood (9.53 vs. 10.21) but not success (64.4 vs. 65.6%). Under the preference the residual falls tenfold but never reaches zero: the proximal step always has a lower cost to move toward, so the loop refines rather than terminates. 3D-ORIENT keeps a small residual (0.22) because the orientation target is never met exactly. On the easy 2D scenarios nn rises above 0.99 within about four iterations and the residual falls about 100×; on narrower, the hardest scene, nn rises only from 0.73 to 0.80 and the residual stalls (4.1 →\to 2.9).

Early stopping

When the residual stops improving, further iterations cost compute without helping. We compare four stopping rules: none; stop when n>0.8n > 0.8; stop when n>0.9n > 0.9; and patience, which stops when the last five iterations close less than 5% of the remaining gap between nn and 1 (Table 13–Table 14; Kmax⁡=20K_{\max}=20).

Rulek=1k=1k=10k=10k=20k=20k=50k=50k=100k=100
none90.1/59.8 (72)97.8/77.7 (24)99.6/88.3 (21)99.4/90.2 (19)99.8/94.5 (19)
n>0.8n > 0.890.4/62.9 (54)88.2/62.1 (10)88.2/62.1 (10)88.2/62.1 (10)88.2/62.1 (10)
n>0.9n > 0.991.2/64.5 (68)88.2/60.2 (10)88.2/62.1 (10)88.2/62.1 (10)88.2/62.1 (10)
patience89.5/64.5 (31)96.6/75.8 (22)98.3/81.6 (20)99.5/84.0 (18)99.2/88.3 (17)

Table 13. Early stopping on SPHERE-AVOID: safe success L1 / L2 (%) and, in parentheses, L1 NFE.

Rulek=5k=5k=10k=10k=20k=20k=50k=50k=100k=100
none70.7 (398)78.7 (376)80.0 (353)76.7 (306)69.3 (290)
n>0.8n > 0.856.0 (255)56.0 (240)55.3 (240)56.7 (240)55.3 (240)
n>0.9n > 0.962.7 (272)62.0 (253)58.0 (240)57.3 (240)57.3 (240)
patience72.7 (312)76.0 (307)80.7 (307)79.3 (291)70.7 (280)

Table 14. Early stopping on Shelf: safe success (%) and, in parentheses, NFE.

The threshold rules are tuned to 2D and do not transfer. On SPHERE-AVOID and Shelf, nn is close to 1 from the first iteration at moderate and large kk, so these rules stop almost immediately and CS-Pi performs close to projection (88.2 / 62.1% on SPHERE-AVOID, 55–63% on Shelf). The patience rule is a trade-off rather than a free saving. Patience matches no stopping on Shelf (80.7 vs. 80.0% at k=20k=20) at 13% fewer NFE, and on SPHERE-AVOID L1 (99.5 vs. 99.4% at k=50k=50) at slightly lower NFE, but costs 6 points on L2 (84.0 vs. 90.2%). On 2D (Table 12; means over 11 values of kk and the six scenarios, 200 rollouts each) the patience rule matches the best threshold rule (0.868 vs. 0.864 success) at 36% fewer NFE than it and 54% fewer than no stopping. It also removes an over-refinement failure: at high kk on narrower, running without stopping collapses to ∼ 0%, while the rule holds 100%.

RuleSuccessNFEIterations
none0.8254473.94
n>0.8n > 0.80.8643222.62
n>0.9n > 0.90.8633362.85
patience0.8682061.59

Table 12. Early stopping on 2D AVOIDANCE, means over 11 values of kk and six scenarios (Kmax⁡=20K_{\max}=20).

Terminal projection: guarantee, how often it fires, and its cost

Guarantee and per-benchmark use. With the terminal projection in Algorithm 1, every executed action lies in C\mathcal{C}, provided C\mathcal{C} is nonempty and P\mathcal{P} is exact. This is the projection’s guarantee, not one supplied by the loop; the loop’s role is to reduce the residual before that step. We use the terminal projection on 2D AVOIDANCE, SPHERE-AVOID, Shelf and hardware, and not on 3D-ORIENT, where the target is a preference. No baseline uses one.

On versus off. Table 15 runs CS-Pi with and without the terminal projection. Without it, CS-Pi still has the highest safe success on Shelf (74.0%, against 55.3% for projection and 53.3% for Trust Sampling) and on SPHERE-AVOID L2 (69.9%, against 62.1% and 38.7%); log-likelihood barely changes on these benchmarks.

BenchmarkTerminal proj.Safe-SRlogL meanlogL medianFire rateNFE
SPHERE-AVOID L1on99.92.872.816.7%20
off98.12.872.81–20
SPHERE-AVOID L2on91.82.542.2746.9%26
off69.92.552.27–26
Shelfon81.317.969.6814.7%271
off74.017.599.94–270

Table 15. CS-Pi with and without the terminal projection. Fire rate: fraction of sampler calls still outside the tolerance after Kmax⁡K_{\max} iterations (Shelf: per plan step; SPHERE-AVOID: per task, over the tasks with a safe goal configuration).

Log-likelihood of the chunks where it fires. Table 16 splits CS-Pi’s chunks by whether the terminal projection fired. On SPHERE-AVOID L1 and Shelf, the chunks where it fired keep a median log-likelihood at or above one-shot projection’s (2.90 vs. 2.41; 14.70 vs. 8.45); on L2 they match it (2.11 vs. 2.13). These chunks are the hardest subset by construction, whereas the projection column is the median over all of projection’s chunks.

BenchmarkFiresConvergedFiredProjectionUnconstrained
SPHERE-AVOID L16.7%2.812.902.412.74
SPHERE-AVOID L246.9%2.432.112.132.90
Shelf14.7%9.3614.708.4510.00
Hardware4.8%−469.1−518.0−473.2−470.2

Table 16. Chunks where the terminal projection fires. Fire rate and median logL of converged and fired chunks, with projection and the unconstrained policy as references. Medians, because a few fired chunks dominate the mean.

On hardware the terminal projection fires on 91 of 1879 chunks (4.8%; 2.3% in layout 1, 6.2% in layout 2; in 15 of 20 trials), and those chunks score lower than projection (−518.0 vs. −473.2). The raw policy draws in these chunks are typical (median −463.1, against −464.2 for chunks that converged), so the drop comes from the terminal projection rather than from atypical draws. Before it fires, the loop has removed about 41% of the initial violation; the projection then moves the chunk by a median of 13.7 mm of end-effector motion (0.56× the chunk’s own motion, 1.6% of the workspace; p95 170 mm), and leaves a median residual penetration of 9.7 mm (p95 40.3 mm), so on hardware the terminal projection at the iteration cap does not certify feasibility. Chunks that converged execute an unmodified policy sample with median residual penetration 0.0 mm (p95 0.76 mm).

When CC misses the policy’s support. If CC is nonempty but the policy assigns it negligible mass, no sampler can return an action that is both safe and plausible. CS-Pi then degrades toward its terminal projection. A residual that stops shrinking, equivalently an nn that stops rising, is a runtime signal of this case; App. § 14 turns it into a stopping rule. On 2D narrower the residual falls from 4.1 to 2.9 and then stalls, with nn stuck near 0.80 (App. § 13).

Compute

NFE counts flow-network calls but omits projection and proximal solves and the backward passes of gradient guidance and Trust Sampling. Table 17 reports wall-clock time per rollout, measured on a single machine. CS-Pi costs 2.1× projection on SPHERE-AVOID and 1.6× on Shelf, because of its projection and proximal solves. It is 67× faster than Trust Sampling on 2D, 1.2× faster on Shelf, equal on 3D-ORIENT, and 2.1× slower on SPHERE-AVOID. The CBF samplers are the most expensive on SPHERE-AVOID and Shelf. Hardware compute is in App. § 21.§ 1.

Method2DSPHERE-AVOIDShelf3D-ORIENT
Unconstrained0.190.194.590.47
Gradient guidance0.520.5822.11.56
Trust Sampling8.702.0289.712.48
Projection0.081.9949.0—
SafeDiffuser0.137.14164—
SafeFlowMatcher0.1613.99167—
CS-Pi0.134.2476.012.70

Table 17. Wall-clock time per rollout (s), including flow calls, backward passes, projection and proximal solves.

Mechanism, sensitivity, and additional analyses

Why support membership can exceed the unconstrained policy’s. Renoising and re-denoising pulls a sample toward high-density regions, as in SDEdit, and feasibility and support membership are positively correlated in these tasks, so stopping on feasibility further favors on-support modes. Applying one renoise and re-denoise to an unmodified draw, with no constraint or projection, raises the fully-on-support rate by up to 7.5 points and the mean fraction of on-support waypoints from 96.9% to 98.6%.

Sensitivity to kk. Table 18 compares the tuned kk with a single fixed value for every benchmark. A single k=50k=50 is within 1.2 points of the best kk on 2D, SPHERE-AVOID L1, Shelf and 3D-ORIENT, and within 4.3 points on SPHERE-AVOID L2. A single k=20k=20 loses up to 7.4 points (SPHERE-AVOID L2). Within a benchmark, safe success varies by a few points over a broad range of kk on SPHERE-AVOID L1, Shelf and 3D-ORIENT; SPHERE-AVOID L2 is more sensitive (Table 9, Table 14).

BenchmarkReported kkSafe-SR (reported kk)Safe-SR (k=20k=20)Safe-SR (k=50k=50)
2D2099.099.099.1
SPHERE-AVOID L15099.999.299.9
SPHERE-AVOID L25091.884.491.8
Shelf5081.374.781.3
3D-ORIENT1065.664.464.4

Table 18. Reported versus fixed kk. Safe success (%) at the kk reported in Tables 1, Table 2, Table 3 and Table 5, and at a single kk shared by every benchmark. Over all sweeps, the best kk is within 1.2 points of k=50k=50 except on L2, where k=100k=100 is 4.3 points higher (Table 9). Shelf varies most between evaluations: four further evaluations at k=50k=50 give 75.8 ± 1.8 (mean ± standard error; 78.7 / 76.0 / 78.0 / 70.7). Each table is a separate evaluation, so values at the same kk can differ slightly across tables.

Schedule for nn. Table 19 compares the rule n=k/(k+δ)n=k/(k+\delta) with a constant nn and with renoising the projection with zero noise (adaptive nn, ϵ=0\epsilon=0), on 2D AVOIDANCE (Kmax⁡=5K_{\max}=5, 6×2006 \times200 rollouts). The adaptive rule fires the terminal projection least (8.7% at k=20k=20, against 15.6% and 27.7% for constant n=0.8n=0.8 and 0.5). Zero-noise renoising matches the adaptive rule on fire rate and median log-likelihood.

Smoothness. Table 20 reports the per-rollout maximum acceleration and jerk (second and third differences of the executed trajectory). On Shelf CS-Pi is within 5% of the unconstrained policy (acceleration +4.5%, jerk +4.8%), and projection is the least smooth. On SPHERE-AVOID CS-Pi is within 1% on L1 and +14% / +11% on L2, matching projection. On 2D the means are similar across methods, but CS-Pi and projection have heavier 95th-percentile tails (2.2–4.2× the unconstrained policy). On 3D-ORIENT CS-Pi’s end-effector step matches the unconstrained policy (0.07 m), but its joint-space acceleration is about 14× and its jerk about 11× higher: the end-effector proximal step uses the arm’s redundant joints. We therefore claim end-effector, not joint-space, smoothness on 3D-ORIENT.

BenchmarkMethodAcceleration meanAcceleration p95Jerk meanJerk p95
ShelfUnconstrained0.5180.6260.8411.000
ShelfCS-Pi0.5410.6510.8821.073
ShelfProjection0.5490.6660.9071.097
ShelfGradient guidance0.5210.6190.8741.013
ShelfTrust Sampling0.5240.6140.8780.983
ShelfRejection0.5210.6180.8450.966
SPHERE-AVOID L1Unconstrained0.1650.2430.1380.221
SPHERE-AVOID L1CS-Pi0.1660.2410.1370.215
SPHERE-AVOID L1Projection0.1710.2480.1420.222
SPHERE-AVOID L2Unconstrained0.1660.2160.1390.196
SPHERE-AVOID L2CS-Pi0.1890.2470.1550.217
SPHERE-AVOID L2Projection0.1920.2460.1550.201
2DUnconstrained0.00580.00880.00610.0092
2DCS-Pi0.00680.01960.00900.0306
2DProjection0.00600.01980.00870.0390
3D-ORIENTUnconstrained0.1650.2040.2770.347
3D-ORIENTCS-Pi2.2544.5742.9588.812
3D-ORIENTGradient guidance (α=0.03\alpha=0.03)0.9051.4991.3552.667

Table 20. Smoothness: per-rollout maximum joint-space acceleration and jerk, mean and 95th percentile over rollouts.

CBF certificates. A safety certificate alone does not make a sample useful: projection already supplies one. Only SafeDiffuser matches CS-Pi, and only on 2D (Table 1); both CBF samplers trail it on SPHERE-AVOID (Table 5) and Shelf (Table 2). SafeFlowMatcher on Shelf uses ρ=0.7\rho=0.7, ϵ=5\epsilon=5, α=0.07\alpha=0.07, Tp=10T_p=10, Tc=8T_c=8 (swept ρ∈{0.6,0.7,0.8}\rho\in\{0.6, 0.7, 0.8\}).

Blocked-mode diagnostic

This experiment isolates the claim in § 2 that a correction applied during denoising can move a sample out of an unsafe region but cannot move it to another mode of the policy. A flow-matching policy is trained on a symmetric two-mode Gaussian mixture in 2D (modes at (±1.2,0)(\pm1.2, 0), standard deviation 0.18). A disk of radius 0.55 centered on the left mode blocks it entirely. Because the problem is 2D, exact log-likelihoods and exact rejection sampling are tractable, so every method is compared with the correct answer: the policy restricted to the safe set. We evaluate the blocked subset, the 241 of 500 paired initial draws that land in the blocked mode (Figure 12).

Blocked-mode diagnostic, left mode blocked

Figure 12. Blocked-mode diagnostic, left mode blocked. Rejection and CS-Pi move blocked draws to the surviving mode; the other methods stay safe but land in low-likelihood regions of the policy.

All methods are safe on every draw, so safety does not separate them (Table 21). CS-Pi moves 85.9% of blocked draws to the surviving mode at a log-likelihood within 0.05 nats of exact rejection and at the same cost. Projection, SafeDiffuser and SafeFlowMatcher at its published defaults move none: each applies a deterministic correction to the blocked sample, so its output stays near the blocked mode. In a control where the constraint touches neither mode, CS-Pi is statistically indistinguishable from the unconstrained policy. SafeFlowMatcher was swept over 577 configurations, SafeDiffuser over 3, and CS-Pi over 27. One SafeFlowMatcher setting (a single prediction step) does move most blocked draws, but it moves samples to one mode even when the constraint touches neither mode, and returns unsafe actions when the policy has a single mode, so the move is not driven by the constraint.

MethodMoved to the surviving modemedian Δlog⁡p\Delta\log pNFE
Rejection (exact reference)92.5%−0.03284
CS-Pi85.9%−0.08282
Projection0.0%−3.56100
SafeDiffuser (λ=50\lambda=50)0.0%−3.56100
SafeFlowMatcher (published defaults)0.0%−6.42257

Table 21. Blocked-mode diagnostic, blocked subset (241 draws). Δlog⁡p\Delta\log p: change in exact log-likelihood relative to the unconstrained policy. Every method returns a safe action on all draws.

Reliability of posterior-mean guidance and approximate projection

The guidance proxy in Eq. (5) can fail even for a unimodal posterior. The relevant quantity is how quickly the cost curvature varies over the posterior’s spread.

Proposition 2 (Posterior-mean gradient error). Let p(a1∣at)p(a_1 \mid a_t) have mean aˉ\bar{a} and finite second moment. If LL has an LHL_H-Lipschitz Hessian in operator norm on the relevant domain, then

∥Ep(a1∣at)[∇L(a1)]−∇L(aˉ)∥≤LH2tr⁡Cov⁡(a1∣at).(13)\left\lVert\mathbb{E}_{p(a_1 \mid a_t)}[\nabla L(a_1)] - \nabla L(\bar{a}) \right\rVert\leq\frac{L_H}{2}\operatorname{tr}\operatorname{Cov}(a_1 \mid a_t). \tag*{(13)}

Proof. Taylor expansion of ∇L\nabla L about aˉ\bar{a} gives ∇L(a1)=∇L(aˉ)+∇2L(aˉ)(a1−aˉ)+r(a1)\nabla L(a_1) = \nabla L(\bar{a}) + \nabla^2 L(\bar{a})(a_1 - \bar{a}) + r(a_1) with ∥r(a1)∥≤LH2∥a1−aˉ∥2\lVert r(a_1)\rVert\leq\frac{L_H}{2}\lVert a_1 - \bar{a}\rVert^2 [28 Lemma 1.2.4]. Taking expectations cancels the linear term; then ∥E[r]∥≤E∥r∥≤(LH/2)E∥a1−aˉ∥2\lVert\mathbb{E}[r]\rVert\leq\mathbb{E}\lVert r\rVert\leq(L_H/2)\mathbb{E}\lVert a_1 - \bar{a}\rVert^2 and E∥a1−aˉ∥2=tr⁡Cov⁡(a1∣at)\mathbb{E}\lVert a_1 - \bar{a}\rVert^2 = \operatorname{tr}\operatorname{Cov}(a_1 \mid a_t).

The proxy is therefore reliable when the curvature varies slowly at the scale of the posterior’s spread. Multimodality is not required for bias: a wide unimodal posterior suffices. Multimodality creates the more severe case, in which the posterior mean lies off-support between modes.

Approximate and non-convex projections. For non-convex CC the projection can be set-valued, and iterative solvers may return only a local or approximate solution. During CS-Pi iterations this point is an anchor rather than the executed action, so renoising and re-denoising can absorb anchor error and move to another mode. Projection has no such correction. Only CS-Pi’s optional terminal step executes a projection; exact safety of the executed action still requires that step to be exact.

Benchmarks, metrics, and implementation details

Environments. 2D AVOIDANCE is a planar reaching task in [0,1]2[0,1]^2 with start (0.1,0.5)(0.1, 0.5) and goal (0.9,0.5)(0.9, 0.5); the state is (x,y,gx,gy)∈R4(x, y, g_x, g_y) \in\mathbb{R}^4 and the action a velocity (vx,vy)(v_x, v_y), in chunks of H=16H=16 steps with 4 executed per replan. Six training obstacles are present in every scenario; each test scenario adds obstacles that close off some of the demonstrated paths (left, right, both, cluttered, narrow, narrower). The safe set is the collision-free set. 3D SPHERE-AVOID (App. § 7) is a simulated 7-DoF Franka Panda planning task in joint space, parameterized as a B-spline with 28 control points per joint; the safe set is the collision-free set of the swept-sphere geometry plus joint limits. Shelf (§ 4.2) uses the same simulated arm for pick-and-place in five scenarios (App. § 8); actions are chunks of 16 absolute joint configurations. 3D-ORIENT is a 7-DoF reach to a goal anywhere in the reachable workspace, with an orientation preference handled by a proximal step on the end-effector orientation cost.

Metrics. Safe-SR is the fraction of rollouts that complete the task and satisfy the constraint (2D: reach the goal collision-free; SPHERE-AVOID: reach the goal with a collision-free trajectory; Shelf: pick and place the cube collision-free). On 3D-ORIENT, success requires a step within 10 cm of the target position and within 0.36 rad of the target orientation. fully-in-supp. is the fraction of rollouts whose every waypoint lies inside a dilated convex hull of the demonstrations. logL is the exact log-likelihood under πθ\pi_\theta (nats/dim), averaged over chunks. NFE is the mean number of flow-model calls per rollout.

Configuration. All simulated experiments use deterministic Euler integration. Table 22 lists the per-benchmark settings.

BenchmarkActionCS-PiTerm. proj.τ\tauRollouts
2D AVOIDANCE(vx,vy)(v_x, v_y), H=16H=16k=20k=20, Kmax⁡=5K_{\max}=5on0.016×2006 \times200
SPHERE-AVOIDB-spline, 28×728 \times7k=50k=50, Kmax⁡=20K_{\max}=20on0.001120×8120 \times8
Shelfjoint chunk, 16×716 \times7k=50k=50, Kmax⁡=5K_{\max}=5on0.001150 (30×5)150\ (30 \times5)
3D-ORIENT7-DoF jointsk=10k=10, Kmax⁡=3K_{\max}=3off0.00190 (30×3)90\ (30 \times3)
Real worldjoint velocitiesk=5k=5, Kmax⁡=5K_{\max}=5on0.00120 (10×2)20\ (10 \times2)

Table 22. Per-benchmark configuration. τ\tau: stopping tolerance. SPHERE-AVOID rollouts: 120 tasks ×\times 8 samples. 3D-ORIENT also uses λee=3000\lambda_{\mathrm{ee}}=3000 and β=106\beta=10^6.

Hardware deployment setup

We deploy CS-Pi zero-shot on a Franka FR3 with a Robotiq 2F-85 gripper, controlled through FrankaPy at 15 Hz. The policy is π0.5\pi_{0.5} finetuned on DROID; it acts in joint-velocity space, so every Cartesian constraint is enforced through forward kinematics and Jacobians on the integrated joint trajectory Q[t]=q0+Δt∑≤tVQ[t] = q_0 + \Delta t \sum_{\leq t} V, with Δt\Delta t the control period.

Perception to constraints. The ZED 2 side camera (RGB and metric depth) drives the constraint pipeline; the ZED mini wrist camera is used only by the policy. All geometry is expressed in the robot base frame. For benchmarking we assume a static scene and run the perception pipeline once per rollout: SAM2 segments the scene with no text prompt, each mask is unprojected through depth into a point cloud, and a vision-language model (Gemini) assigns only semantic roles (which segment to grasp, which to place on, which to ignore). It never produces coordinates; all positions and extents come from depth. Each obstacle is fit with a tight oriented bounding box; the grasp and target objects reduce to centroids. Because a single depth view sees only an object’s front, we mirror the occluded half across the camera-ray mid-plane before fitting, which enlarges the geometry in the safe direction.

Constraints and execution. A task state machine (REACH →\rightarrow GRASP →\rightarrow TRANSPORT →\rightarrow PLACE) rebuilds the active constraints every chunk: a goal attractor at the grasp or target centroid, a collision constraint between the robot and gripper sphere model and the obstacle boxes, a table half-space, and, once grasped, a sphere for the held object. CS-Pi, gradient guidance, Trust Sampling and projection receive the identical obstacle set, q0q_0 and Δt\Delta t, so the comparison differs only in the sampler. The collision cost takes the form each method is designed for: a hinge penetration penalty for CS-Pi and projection, and an OmniGuide-style log-barrier on clearance for gradient guidance and Trust Sampling. The perceived scene is saved to a scene file and replayed across methods.

Planned versus realized motion. Collisions are scored on the realized joint configuration each tick with zero safety margin. FrankaPy controller lag leaves the arm short of each commanded waypoint (∼50\sim50 mm of end-effector travel), so a chunk with zero planned constraint cost can still log a contact. This execution gap applies equally to every method.

Hardware execution analysis

The following statistics are computed offline from the logged trials (20 CS-Pi trials, 1879 chunks).

What executes. On 73.9% of chunks the raw π0.5\pi_{0.5} draw is already safe and executes unchanged (bit-identical); on 21.2% the loop converges and executes an unmodified re-denoised policy sample; on 4.8% the terminal projection fires (App. § 15). Iterations per chunk: 1 (1389 chunks), 2 (198), 3 (120), 4 (56), 5 (116). The median ratio of successive residuals is 0.20, 0.33, 0.61 and 0.77 over the first four iterations (96, 91, 81 and 75% of ratios below 1): contraction is strongest at the first iteration, and the violation that survives to the later iterations is the one that ends in the terminal projection.

Smoothness. Table 23 reports the per-trial maximum end-effector jerk, differentiated against measured timestamps. CS-Pi’s median is the highest (the correction adds motion), but it has the lightest tail: the ratio of the 95th percentile to the median is 1.64, against 1.80 for the unconstrained policy and 5.69 for projection.

MethodTrialsMedianp95p95 / median
Unconstrained20116.9210.31.80
Gradient guidance2090.9322.73.55
Trust Sampling10178.8333.51.87
Projection17167.0949.75.69
CS-Pi20181.6298.71.64

Table 23. Hardware smoothness: per-trial maximum end-effector jerk (m/s3^3), median and 95th percentile across trials.

Dynamic validity. The projection certifies joint-position limits, collision and the table, but not velocity or acceleration limits. The realized joint velocity never exceeded the Franka limits (0 of 130,361 joint-ticks; worst 0.77×\times the limit), because the impedance controller tracks only part of each commanded step. The commanded stream does exceed them occasionally: 0.08% of joint-ticks over the velocity limit within converged chunks, which execute unmodified policy samples, and 2.0% within chunks where the terminal projection fired. Adding velocity and acceleration bounds to the projection would extend the certificate to them.

Compute. CS-Pi makes 1.62 policy calls per chunk on average (0.62 re-denoises) and 2.57 projection solves; its mean NFE is 10.9 against 10 for a single draw, because with k=5k=5 the time nn is close to 1 and a re-denoise needs about one integration step. Per-step latency is reported in Table 4.

MethodSafe-SR (%) ↑\uparrowTime/step (s) ↓\downarrowlog⁡L↑\log L \uparrow
Layout 1Layout 2Averaged
Unconstrained200100.069−470.2±1.0-470.2\pm1.0
Gradient guidance4010250.139−464.9±1.4-464.9\pm1.4
Trust Sampling2020200.135−474.8±2.1-474.8\pm2.1
Projection4040400.099−473.2±2.3-473.2\pm2.3
CS-Pi6050550.143−471.8±1.7-471.8\pm1.7

Table 4. Hardware: pick the apple, place it on the blue plate on a Franka FR3 with π0.5\pi_{0.5}. Zero-shot; CC is obstacle bounding boxes from a ZED 2 RGB-D vision pipeline. Two layouts, 10 trials per method per layout (20 in total). CS-Pi has the highest safe success rate in each layout and averaged over both. log⁡L\log L is the log-likelihood πθ\pi_\theta assigns to executed actions (the unconstrained policy’s own draws score −470.2-470.2; higher is more plausible): CS-Pi stays close to the unconstrained policy, while projection and Trust Sampling fall below it.

References

  1. [1]K. Black, N. Brown, D. Driess, A. Esmail, M. Equi, C. Finn, N. Fusai, L. Groom, K. Hausman, B. Ichter, S. Jakubczak, T. Jones, L. Ke, S. Levine, A. Li-Bell, M. Mothukuri, S. Nair, K. Pertsch, L. X. Shi, J. Tanner, Q. Vuong, A. Walling, H. Wang, and U. Zhilinsky. π₀: A vision-language-action flow model for general robot control, 2026. URL https://arxiv.org/abs/2410.24164.
  2. [2]P. Intelligence, K. Black, N. Brown, J. Darpinian, K. Dhabalia, D. Driess, A. Esmail, M. Equi, C. Finn, N. Fusai, M. Y. Galliker, D. Ghosh, L. Groom, K. Hausman, B. Ichter, S. Jakubczak, T. Jones, L. Ke, D. LeBlanc, S. Levine, A. Li-Bell, M. Mothukuri, S. Nair, K. Pertsch, A. Z. Ren, L. X. Shi, L. Smith, J. T. Springenberg, K. Stachowicz, J. Tanner, Q. Vuong, H. Walke, A. Walling, H. Wang, L. Yu, and U. Zhilinsky. π₀.₅: a vision-language-action model with open-world generalization, 2025. URL https://arxiv.org/abs/2504.16054.
  3. [3]M. Janner, Y. Du, J. B. Tenenbaum, and S. Levine. Planning with diffusion for flexible behavior synthesis, 2022. URL https://arxiv.org/abs/2205.09991.
  4. [4]J. Ho and T. Salimans. Classifier-free diffusion guidance, 2022. URL https://arxiv.org/abs/2207.12598.
  5. [5]Y. Song, L. Le, Y.-H. Park, J. Wang, J. Shi, L. Liu, J. Gu, E. Eaton, D. Jayaraman, and K. Daniilidis. Omniguide: Universal guidance fields for enhancing generalist robot policies, 2026. URL https://arxiv.org/abs/2603.10052.
  6. [6]Y. Lipman, R. T. Q. Chen, H. Ben-Hamu, M. Nickel, and M. Le. Flow matching for generative modeling, 2023. URL https://arxiv.org/abs/2210.02747.
  7. [7]P. Dhariwal and A. Nichol. Diffusion models beat gans on image synthesis, 2021. URL https://arxiv.org/abs/2105.05233.
  8. [8]H. Chung, J. Kim, M. T. Mccann, M. L. Klasky, and J. C. Ye. Diffusion posterior sampling for general noisy inverse problems, 2024. URL https://arxiv.org/abs/2209.14687.
  9. [9]J. Song, A. Vahdat, M. Mardani, and J. Kautz. Pseudoinverse-guided diffusion models for inverse problems. In International Conference on Learning Representations, 2023.
  10. [10]Y. He, N. Murata, C.-H. Lai, Y. Takida, T. Uesaka, D. Kim, W.-H. Liao, Y. Mitsufuji, J. Z. Kolter, R. Salakhutdinov, and S. Ermon. Manifold preserving guided diffusion, 2023. URL https://arxiv.org/abs/2311.16424.
  11. [11]J. Pan, J. H. Liew, V. Y. F. Tan, J. Feng, and H. Yan. Adjointdpm: Adjoint sensitivity method for gradient backpropagation of diffusion probabilistic models, 2024. URL https://arxiv.org/abs/2307.10711.
  12. [12]H. Li, Q. Feng, Z. Zheng, J. Feng, Z. Chen, and A. Knoll. Language-guided object-centric diffusion policy for generalizable and collision-aware robotic manipulation, 2025. URL https://arxiv.org/abs/2407.00451.
  13. [13]W. Huang, Y. Jiang, T. V. Wouwe, and C. K. Liu. Constrained diffusion with trust sampling, 2024. URL https://arxiv.org/abs/2411.10932.
  14. [14]L. Wu, B. L. Trippe, C. A. Naesseth, D. M. Blei, and J. P. Cunningham. Practical and asymptotically exact conditional sampling in diffusion models, 2024. URL https://arxiv.org/abs/2306.17775.
  15. [15]M. Skreta, T. Akhound-Sadegh, V. Ohanesian, R. Bondesan, A. Aspuru-Guzik, A. Doucet, R. Brekelmans, A. Tong, and K. Neklyudov. Feynman-kac correctors in diffusion: Annealing, guidance, and product of experts, 2025. URL https://arxiv.org/abs/2503.02819.
  16. [16]R. Singhal, Z. Horvitz, R. Teehan, M. Ren, Z. Yu, K. McKeown, and R. Ranganath. A general framework for inference-time scaling and steering of diffusion models, 2025. URL https://arxiv.org/abs/2501.06848.
  17. [17]J. Zhang, L. Zhao, A. Papachristodoulou, and J. Umberger. Constrained diffusers for safe planning and control, 2025. URL https://arxiv.org/abs/2506.12544.
  18. [18]W. Xiao, T.-H. Wang, C. Gan, and D. Rus. Safediffuser: Safe planning with diffusion probabilistic models, 2023. URL https://arxiv.org/abs/2306.00148.
  19. [19]J. Yang, S. Jang, and S. Han. Safeflowmatcher: Safe and fast planning using flow matching with control barrier functions, 2026. URL https://arxiv.org/abs/2509.24243.
  20. [20]T.-Y. Huang, A. Lederer, D.-J. Wu, X. Dai, S. Zhang, H.-C. Lin, S.-H. Sun, S. Sosnowski, and S. Hirche. Sad-flower: Flow matching for safe, admissible, and dynamically consistent planning, 2026. URL https://arxiv.org/abs/2511.05355.
  21. [21]NVIDIA, ; J. Bjorck, F. Castañeda, N. Cherniadev, X. Da, R. Ding, L. J. Fan, Y. Fang, D. Fox, F. Hu, S. Huang, J. Jang, Z. Jiang, J. Kautz, K. Kundalia, L. Lao, Z. Li, Z. Lin, K. Lin, G. Liu, E. Llontop, L. Magne, A. Mandlekar, A. Narayan, S. Nasiriany, S. Reed, Y. L. Tan, G. Wang, Z. Wang, J. Wang, Q. Wang, J. Xiang, Y. Xie, Y. Xu, Z. Xu, S. Ye, Z. Yu, A. Zhang, H. Zhang, Y. Zhao, R. Zheng, and Y. Zhu. Gr00t n1: An open foundation model for generalist humanoid robots, 2025. URL https://arxiv.org/abs/2503.14734.
  22. [22]S. Hu, Z. Liu, S. Liu, J. Cen, Z. Meng, and X. He. Vlsa: Vision-language-action models with plug-and-play safety constraint layer, 2025. URL https://arxiv.org/abs/2512.11891.
  23. [23]C. Meng, Y. Song, J. Song, J. Wu, J. Zhu, and S. Ermon. Sdedit: Image synthesis and editing with stochastic differential equations. CoRR, abs/2108.01073, 2021. URL https://arxiv.org/abs/2108.01073.
  24. [24]A. Lugmayr, M. Danelljan, A. Romero, F. Yu, R. Timofte, and L. V. Gool. Repaint: Inpainting using denoising diffusion probabilistic models, 2022. URL https://arxiv.org/abs/2201.09865.
  25. [25]S. Park, H. Bharadhwaj, and S. Tulsiani. Demodiffusion: One-shot human imitation using pre-trained diffusion policy, 2026. URL https://arxiv.org/abs/2506.20668.
  26. [26]D. C. Liu and J. Nocedal. On the limited memory bfgs method for large scale optimization. Mathematical Programming, 45:503–528, 1989. URL https://api.semanticscholar.org/CorpusID:5681609.
  27. [27]A. Khazatsky, K. Pertsch, S. Nair, A. Balakrishna, S. Dasari, S. Karamcheti, S. Nasiriany, M. K. Srirama, L. Y. Chen, K. Ellis, P. D. Fagan, J. Hejna, M. Itkina, M. Lepert, Y. J. Ma, P. T. Miller, J. Wu, S. Belkhale, S. Dass, H. Ha, A. Jain, A. Lee, Y. Lee, M. Memmel, S. Park, I. Radosavovic, K. Wang, A. Zhan, K. Black, C. Chi, K. B. Hatch, S. Lin, J. Lu, J. Mercat, A. Rehman, P. R. Sanketi, A. Sharma, C. Simpson, Q. Vuong, H. R. Walke, B. Wulf, T. Xiao, J. H. Yang, A. Yavary, T. Z. Zhao, C. Agia, R. Baijal, M. G. Castro, D. Chen, Q. Chen, T. Chung, J. Drake, E. P. Foster, J. Gao, V. Guizilini, D. A. Herrera, M. Heo, K. Hsu, J. Hu, M. Z. Irshad, D. Jackson, C. Le, Y. Li, K. Lin, R. Lin, Z. Ma, A. Maddukuri, S. Mirchandani, D. Morton, T. Nguyen, A. O’Neill, R. Scalise, D. Seale, V. Son, S. Tian, E. Tran, A. E. Wang, Y. Wu, A. Xie, J. Yang, P. Yin, Y. Zhang, O. Bastani, G. Berseth, J. Bohg, K. Goldberger, A. Gupta, A. Gupta, D. Jayaraman, J. J. Lim, J. Malik, R. Martín-Martín, S. Ramamoorthy, D. Sadigh, S. Song, J. Wu, M. C. Yip, Y. Zhu, T. Kollar, S. Levine, and C. Finn. Droid: A large-scale in-the-wild robot manipulation dataset, 2025. URL https://arxiv.org/abs/2403.12945.
  28. [28]Y. Nesterov. Introductory Lectures on Convex Optimization: A Basic Course. Kluwer Academic Publishers, 2004.

Paper details

vlnc:W_767kv7nv
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

CC BY 4.0

Original source

  • Computer Science

Not recorded for this paper · View statement →

Looking for related papers…
Contents