WorksComputer Science
MA-SafeDiffuser: Safe Multi-Agent Planning with Diffusion Probabilistic Models
Abstract
We propose MA-SafeDiffuser, a multi-agent extension of SafeDiffuser that equips diffusion-based trajectory planners with finite-time diffusion invariance guarantees for joint-agent safety specifications. Building on the single-agent construction that embeds control barrier function (CBF) constraints into reverse-diffusion updates, we: (i) formalize joint safe sets as intersections of per-agent and pairwise barrier sets; (ii) derive centralized and decentralized (communication-aware) constrained denoising procedures with provable invariance under mild assumptions; (iii) address local-trap and deadlock phenomena via time-varying specifications and liveness CBFs; and (iv) develop a lightweight benchmarking suite including a multi-agent Maze2D domain. Empirically, MA-SafeDiffuser reduces violation counts relative to unconstrained diffusion baselines, while retaining planning quality. We provide algorithms, proofs, and reference implementations.
Introduction
Diffusion probabilistic models (DDPMs) [10] were recently proposed as a powerful class of generative models whose iterative denoising dynamics can be repurposed for trajectory synthesis and planning. Recent exciting work such as Diffuser [11] and subsequent follow-ups on classifier/energy guidance [5] demonstrate that diffusion models can indeed produce long-horizon behaviors that emulates task-level structure and can also leverage heterogeneous offline experience. When applied casually, however, unconstrained denoising provides no formal safety guarantees: for instance, an optimized sample may graze or penetrate obstacles, violate actuation limits, or collide with other agents.
Extension from diffusion to safe diffusion. The SafeDiffuser framework [20] addresses this issue in the single-agent setting by embedding Control Barrier Function (CBF) inequalities [1] into each reverse step of the diffusion process. Conceptually, the unconstrained denoiser proposes an update and a safety projector modifies it to satisfy linearized CBF rows; an execution-time filter then mirrors the same CBF constraints in receding horizon. This yields finite-time diffusion invariance for the safe set while retaining the modeling flexibility of diffusion planning. Extensions of CBFs, e.g., exponential CBFs for higher relative degree [16] and nonsmooth barrier sets [9] further enlarge the class of safety specifications that can be handled.
Motivation for Multi-agent. Many real systems such as robot swarms, UAV traffic management, multi-arm manipulation, automated warehouses are inherently multi-agent. Safety must hold (i) for each agent with respect to walls, bounds, and actuation limits; (ii) pairwise to prevent inter-agent collisions; and sometimes (iii) globally for task-level constraints. Classical reactive methods such as artificial potential fields [12], velocity obstacles and RVO/ORCA [8, 19], and model-predictive control with hand-crafted penalties provide strong baselines in practice, but do not yield end-to-end invariance guarantees when coupled with learned generative planners and can deadlock under symmetric interactions. On the learning side, multi-agent RL (e.g., MADDPG [14], MAPPO [21]) excels at flexible coordination but typically lacks hard safety certificates and may require extensive online exploration; recent surveys on SafeRL and SafeMARL further highlight these limitations and open challenges in constrained multi-agent settings [13].
Our Contributions. We develop MA-SafeDiffuser, a multi-agent extension of SafeDiffuser that equips diffusion planning with centralized and decentralized safety enforcement and theoretical guarantees. The key idea is to formalize the joint safe set at each waypoint as the intersection of per-agent, pairwise, and (optional) task barriers, and to enforce the corresponding linearized CBF rows during denoising. A two-time formulation (reverse step over planning waypoints ) enables receding-horizon enforcement at together with temporal regularization and short multi- seeding to distribute margin across all .
Key Contributions.
Joint safety with diffusion. A centralized projector that enforces the conjunction of per-agent and pairwise CBF rows throughout reverse denoising, with optional task constraints. A receding–horizon execution-time filter mirrors these rows to certify the applied control.
Finite-time diffusion invariance. Under standard regularity, step-size bounds, and feasibility assumptions, we prove that the denoising process is finite-time diffusion invariant for the joint safe set, and we provide a discrete-time CBF comparison lemma for reverse-Euler updates.
Decentralized enforcement with neighbor messaging. A communication–aware variant in which each agent enforces local self/task rows and robust pairwise rows using predicted neighbor states, responsibility shares, and a computable robustness margin that compensates for bounded prediction errors; invariance carries over under clear Lipschitz and step-bound conditions.
Practical deadlock mitigations. Time-varying specifications (TVS) that relax early reverse steps, small symmetry-breaking biases in pairwise shares, and progress/liveness barriers toward corridor waypoints to avoid local traps; these mechanisms are orthogonal to the safety proof and improve success rates in practice.
Evaluation and differentiable enforcement. A light Maze2D benchmark with door-aware geometry and per-step action clamps for fair Safe/Unsafe comparisons; enforcement can be implemented via differentiable QP layers (OptNet, CVXPY-Layers) [2, 6] or via parameter-free Dykstra projections onto half-spaces [3, 7], and solves in milliseconds in our experiments.
Our approach complements the growing literature on diffusion for decision making and control [5, 10, 11], including goal/skill-conditioned and score-guided variants, by hardening the generative sampler with CBF certificates. Relative to multi-agent navigation baselines (potential fields, VO/ORCA) [8, 12, 19] and MARL [14, 21], MA SafeDiffuser provides a model-agnostic safety layer that can be used with hand-crafted (score) denoisers or learned score networks and yields invariance guarantees at both denoising and execution time.
Organization of this paper. Section 2 formalizes the two-time indexing, barrier classes, and joint safe sets. Section 3 presents centralized and decentralized projectors and TVS/liveness devices. Section 5 establishes diffusion invariance and decentralized robustness. Section 6 reports Maze2D results and ablative analyses. Section 8 concludes the paper by summarizing limitations and future directions (larger agent counts, richer tasks, tighter learned scores).
Problem Formulation and Notation
States, trajectories, indices. We use the two-time notation of [20]: diffusion time indexes the reverse steps of the denoiser, the planning time indexes the waypoints of a trajectory. For agents, we define agent has state space and we have state at . We stack joint states as
We define a joint trajectory at diffusion step to be . We use the notation for the trajectory space and use bold symbols for joint quantities.
Reverse-time update. Let denote the stacked reverse-time update at step (arranged by waypoints and agents). The unconstrained reverse dynamics are formalized via the Euler limit as follows
where is produced by the denoiser’s drift (reference interpolation + temporal smoothing) and this is subsequently projected to enforce safety constraints [11, 20].
Safety specifications. At each waypoint , we have three classes of (Clarke-regular) barrier functions as follows:
Per-agent barriers with safe super-level sets ,
Pairwise barriers with safe sets ,
(optional) Task or global barriers with safe set defined as .
The joint waypoint-wise safe set can now be defined as follows
We can now extend this safe waypoint notion to safe trajectories: a trajectory is safe iff for all . The trajectory-level safe set is then written as follows
Definition 1 (Multi-agent finite-time diffusion invariance). The reverse-time denoising process is finite-time diffusion invariant for if there exists an index such that, for every , the denoised trajectory is safe: , i.e., for all .
Remark 2 (Enforcement index and receding horizon). When it comes to implementing CBFs, we usually apply the linearized constraints at the very first point in time, or , which is referred to as the receding horizon, and then rely on temporal regularization of the reverse model and a very short period of multi- enforcement to get a safety net that covers the rest of the planning horizon. See §3 and §5.
Method: MA-SafeDiffuser
In our multi-agent extension, we enforce safety by projecting the unconstrained reverse-diffusion drift onto linearized CBF half-spaces at a designated enforcement index. By default we choose , as

Figure 1. Algorithm 1 MA-SafeDiffuser: Centralized projector (with one reverse step at ). Here is the TVS relaxation schedule—a nonincreasing function of the reverse index (with ) that temporarily offsets the barrier and whose (discrete) diffusion-time derivative is denoted .
Require: Previous trajectory ; unconstrained reverse drift (from (1)); barrier rows at enforcement index ; variant ; step ; step bound ; weights
Ensure: Projected update and next trajectory
Linearize barriers at : for each active row (self/pair/task) form gradient and right-hand side : RoS/ReS: ;
TVS: .
Build convex program in decision variables as follows
subject to
Solve (QP or Dykstra on half-spaces) to obtain ; set in RoS.
Update reverse step: .
(Optional all- enforcement) If required (cf. §5), repeat 1–5 with rows at all for a fixed number of reverse steps.
return .
receding horizon at every reverse step . The same filter is applied at execution time to the instantaneous control. In our proposal we have the following: (i) a central projector that is responsible for enforcing all per-agent, pairwise, and task rows jointly (see §4.1); (ii) a decentralized variant with neighbor messaging and robust margins (see §4.2); and (iii) a set of time-varying specifications and liveness mechanisms that avoids deadlock (see §4.4). The regularization of the reverse model and/or a brief period of enforcing the model at different values of send the margin to all values of , when the constraints are only applied at (see cf. §5).
Algorithms
Centralized joint enforcement
For the reverse step we let denote the stacked unconstrained drift (cf. (1)). We solve a minimum-deviation objective at index , by linearizing the active barriers as follows.
Here , is an extended class- function, and collects relaxation variables. The variants are:
RoS (robust-safe): here we consider hard enforcement with and all .
ReS (relaxed-safe): here we allow with diffusion-time weights to recover feasibility; feasibility gaps vanish as decreases.
TVS (time-varying-safe): here we replace each by and augment the RHS by (the linearization is applied to ).
During numerical simulations, imposing step bounds (e.g., for each agent block) is useful for controlling truncation errors and ensuring numerical stability. The resulting QP can be solved using any sparse convex QP solver (e.g., OSQP or CVXPY-Layers [6]). When all constraints are linearized half-spaces, one may alternatively employ Dykstra-type projection methods [3, 7] (see §4.3).
All- enforcement (optional). In case, the denoiser lacks a temporal contraction, we may enforce (3)–(5) for all during the first reverse steps; this will ensure a safety margin at every waypoint that persists under the subsequent -only enforcement (cf. 7), however, at the expense of more possibly more compute.
Decentralized enforcement with neighbor messaging
In an environment with multiple agents and limited long range communication, we may consider a decentralized variant of our method. To this end, each agent solves a local projector using predicted neighbor states denoted by . These predicted neighbor states are obtained from the previous communication round, for example. In the decentralized setting, we need to localize the barriers. For pairwise barriers, we linearize locally at and we enforce a robust inequality with responsibility sharing , :
(and similarly for agent ). With two free Jacobi and ADMM-style rounds [4] per diffusion step, messages are updated and the local projections are recomputed. Under prediction error , Lipschitz constants (barrier value), (barrier gradients), (class-), and per-step bounds , it suffices (see Theorem 8) to pick
to guarantee that the true centralized pairwise inequalities (with ) are satisfied (see Theorem 8 for a detailed proof). We note that self and task barriers do not depend on predictions and they can be enforced locally similar to the centralized case.
Execution-time safety filter
On completion of the reverse steps at index , we get a first waypoint proposal, namely, . Before execution at task time , we solve the instantaneous CBF projection for $u_t=x_{t+1}-x_t with the same rows (now evaluated at ) and alongwith explicit step bounds, e.g., (or for example, ). As mentioned before, this receding-horizon filter prevents rare large steps from creating violations and mirrors SafeDiffuser’s deployment [20]. When constraints are linearized half-spaces, Dykstra’s algorithm provides a parameter-free projection onto the intersection of half-spaces [3, 7]; otherwise, we may prefer to solve a small convex QP problem. The execution-time filter is essential to preserve invariance for the applied control (cf. 7).
Avoiding traps and deadlock
Despite the safety constraints using control barriers, we may encounter deadlocks, and local traps. To this end, we propose to employ three practical devices to reduce deadlock and local traps without sacrificing (safety) invariance:
Time-varying specifications (TVS). Use with nonincreasing in reverse time and ; constraints are relaxed early and tightened near .
Symmetry breaking. We add small bias offsets or priorities in pairwise shares to avoid stalemates in symmetric configurations. For example, will avoid the symmetry.
Liveness/progress CBFs. We include auxiliary barriers that encode progress toward intermediate subgoals for example, corridor waypoints, ensuring nonzero “driving” terms when pure safety is noninformative.
As we show later, these mechanisms are orthogonal to the core safety projector and are compatible with the invariance proofs we derive in Section 5.
Theoretical Results
We prove finite-time diffusion invariance under standard smoothness and feasibility assumptions, and we also provide a decentralized robustness guarantee.
Assumption 3 (Regularity and feasibility). All active barriers are assumed to be are on an open set , i.e., are continuously differentiable and we assume that their gradients are locally Lipschitz on ; moreover, for each barrier, there exists an extended class- function . At every reverse step , the projector (3)–(5) (RoS) is feasible or admits relaxations (ReS/TVS) with . The unconstrained drift is assumed to be locally Lipschitz in and that it satisfies per-step bounds .
Lemma 4 (Barrier conjunction). Let and consider . If for all and all , , then is forward invariant, that is, we have for all $t\ge 0.
Proof Sketch. We know that each single set is forward invariant by the CBF condition; as we know that at boundary points the field is tangent-inward [1, 9, 15]. For smooth inequality sets, the tangent cone of the intersection equals the intersection of tangent cones, so for all active implies , and invariance will follow from Nagumo’s theorem [15]. The same conclusion will hold for locally Lipschitz
| Algorithm 2 MA-SafeDiffuser-Dec | Decentralized projector (one reverse step at ) |
| Require: | Neighbor graph ; last-round neighbor predictions ; robust margin ; shares , ; per-agent bound |
| Ensure: | Local updates and aggregated |
| 1: | for in parallel do |
| 2: | Self/task rows: build and (if present) global rows as in Alg. 1. |
| 3: | Pairwise rows (robust): for each , linearize at and enforce . |
| 4: | Local solve: minimize subject to the above and ; broadcast updated to . |
| 5: | end for |
| 6: | Repeat the local step for message-passing rounds. |
| 7: | Aggregate and update . |
| 8: | return . |
Table 2.
when using Clarke generalized gradients. More detail can be found in supplementary.
A discrete-time CBF lemma (reverse time). We use the following Euler-discretized comparison, which basically follows from regularity.
Lemma 5 (Discrete-time CBF monotonicity). Let in a neighborhood of with locally Lipschitz gradient constant and let be an extended class-. Suppose satisfies and consider the reverse-time Euler step with . Then for there exists such that
In particular, we have that if then for all .
Proof Sketch. By ,
with the remainder bounded by . We substitute and then . The step-size condition ensures the implicit inequality preserves nonnegativity when (discrete comparison).
Remark 6 (Finite-time reach under RoS/TVS). If (RoS), one can choose with finite-time property on and small so that the truncation is dominated by ; then the discrete recursion crosses into in finitely many steps. Under TVS with , , the same argument would apply to , giving .
Theorem 7 (Centralized multi-agent finite-time diffusion invariance). Under Assumption 3, if at every reverse step the centralized projector enforces (3)–(5) (RoS or TVS) for all peer-agent, pairwise, and task barriers at the enforcement index, which by default
is , then the denoising process is finite-time diffusion invariant for with probability 1 (w.r.t. model noise). Moreover, the execution-time safety filter preserves invariance for the applied control .
Sketch of Proof. We fix any barrier at . By Lemma 5, the enforced inequality implies no boundary crossing in reverse time (considering small ), so for all for some (note that finite-time reach holds by Remark 6). By Lemma 4, the conjunction over all active rows is forward invariant at . If all are enforced, we are basically done. Otherwise, we either (i) enforce all for finitely many reverse steps to seed a margin everywhere, or (ii) we rely on temporal regularization of the reverse model to propagate a margin from to all (both are standard in the baseline SafeDiffuser [20] paper). The “probability 1” qualifier here is conditional on the event that each QP (or projection) is feasible; by Assumption 3 this event has probability 1 since the projection is a deterministic measurable map of the model noise. The execution-time CBF filter then basically satisfies , hence preserves invariance per a discrete-time CBF argument identical to Lemma 5. More detail can be found in appendix. □
Theorem 8 (Decentralized invariance under bounded error). Assume neighbor messages yield predictions with bounded error . Suppose each agent enforces its local pairwise CBF with a robust margin and responsibility shares , . Let and be local Lipschitz constants for and its gradients, for , and assume per-step bounds . If we have
then the decentralized projected updates satisfy the true centralized pairwise inequalities. Consequently, the conclusions of 7 hold.
Sketch of Proof. By Summing the two local inequalities (one at agent , one at agent ) built with predicted neighbor states, and compare them to the centralized inequality evaluated at the true joint state. Use Lipschitz bounds on barrier values and gradients and the per-step bound to show the centralized left-hand side exceeds the predicted one minus the error term . Choosing as in (7) makes the sum nonnegative, hence the true centralized pairwise inequality holds. Taking the finite conjunction over all pairs and combining with self/task rows (which do not require predictions) gives the desired centralized feasibility, …
Remark 9 (Complexity and solvers). The centralized QP has dimension and sparse rows from pairwise constraints. First-order operator-splitting solvers (e.g., OSQP [17]) and differentiable layers (OptNet [2], CVXPY-Layers [6]) are suitable; when constraints are linearized half-spaces, Dykstra-type projections offer a parameter-free alternative [3, 7].
Numerical Experiments
We evaluate MA-SafeDiffuser in Maze2D domain to validate multi-agent safety and study the effect of reward shaping and fairness clamps. All experiments were done on RTX 4090 GPUs using python and standard pytorch libraries like pytorch and numpy in double precision arithmetic.
Maze2D (Multi-Agent) setup
Environment. The Maze2D domain is a continuous planar environment bounded within the axis-aligned box . The interior of is partitioned into a grid of square rooms, each separated by solid wall segments except for small open passages (doors) centered on the walls. Each wall is represented as a line segment , while each door is modeled as a short open gap on the same line. Walls are impassable obstacles, whereas doors define narrow traversable corridors through which agents can pass. In the Figures 1, 2, walls are shown in black, door openings in green, and goal regions as orange boxes. Agents are depicted as colored points that begin near random valid start positions (blue markers) and must navigate to their respective goal boxes while avoiding wall and inter-agent collisions. We evaluate configurations with agents. The kinematic update rule follows with bounded control , and all motion takes place continuously in .
Safety constraints. (i) Box invariance: ; (ii) Wall clearance: with ; (iii) No wall crossing: ; (iv) Pairwise separation: for . The joint waypoint-wise safe set is given by (2).
Planner. At each reverse step, MA-SafeDiffuser performs a score-guided denoising update followed by a projection onto the linearized safety set via Dykstra iterations. Both centralized and decentralized projection modes are supported: the centralized variant enforces all inter-agent constraints jointly, while the decentralized variant performs per-agent local projections using neighbor information within a communication radius of . The reference trajectory is generated via door-aware interpolation between start and goal waypoints.
Reward shaping and metrics. We measure three metrics per episode: (i) total violation count (primary safety metric); (ii) total return based in goal progress, success bonus (+15) and step penalty (-0.002); (iii) success rate fraction of agents that reach goals before horizon . To equalize control effort across planners, both Safe and Unsafe variants use identical action clamp .
We use two shaping variants:
Progress-dominant shaping rewards forward motion toward the goal and completion bonuses with mild step costs.
Safety shaping augments with small penalties for wall proximity and intersection events, enabling finer differentiation between near-miss and hard violation.
Baselines and fairness. Unsafe = unconstrained denoising (no safety filter). Safe = MA–SafeDiffuser diffusion planner with CBF-style projection. Centralized vs. Decentralized = comparison between full-state projection and limited-neighbor projection under identical seeds and random noise. All runs use shared random seeds to ensure fair comparison under equivalent stochasticity.
Protocol and hyperparameters. Each configuration is run for three random seeds, across diffusion horizon , . Planner hyperparameters are fixed as , smoothing , , projection iterations = 80, . We evaluate both Safe and Unsafe planners over a 700-step horizon, resulting in 54 configurations across 3 seeds in total.
Violation counting. We follow a strict safety accounting scheme in all Maze2D experiments. At each timestep, the environment monitors three types of safety infractions: (i) soft proximity violations when an agent enters the near-wall buffer region , (ii) hard wall-cross violations when the straight-line segment intersects any wall segment , and (iii) boundary violations when an agent exits the box domain . Even visually collision-free trajectories (e.g., 2-agent Safe case in Figure. Figure 2) may register a small number of soft violations when agents pass within a few centimeters of a wall or corner. This conservative counting ensures that the safety metric penalizes both hard collisions and near-wall grazing events, encouraging overcautious rather than risky planning behavior.

Figure 2. Qualitative results for centralized (decentralized=False) MA-SafeDiffuser. Each panel compares safe and unsafe trajectories across randomized initializations for , 4, 8 agents. For , and ; for , and ; and for , and . SafeDiffuser agents maintain clearance through doors and corners, whereas unsafe diffusion plans exhibit oscillatory behavior and occasional wall penetration. Start positions (blue dots) and goals (orange boxes) are placed asymmetrically and randomized across runs to emulate a warehouse-like navigation scenario. While safe agents may incur occasional violations due to proximity constraints, their violation rates remain substantially lower than those of unsafe agents.
Results and discussion
Quantitative Results. Across all settings, total returns scale approximately linearly with the number of agents , as each agent receives an independent goal-progress reward and success bonus. The Safe variant consistently achieves comparable total reward to the Unsafe baseline while reducing violation counts by 40-60%. This demonstrates that enforcing control-barrier projections in the reverse denoising steps preserves planning performance without sacrificing efficiency.
Remark 10 (Ablations and fairness). Without a uniform step bound, Unsafe can “jump” aggressively and avoid repeated proximity ticks, while Safe moves conservatively and may accumulate soft proximity penalties when sliding along walls. Enforcing the same instantaneous clamp for both methods, counting proximity only when approaching the wall, and using a short refractory period for proximity events restores a fair comparison and highlights the safety advantage of MA–SafeDiffuser. Increasing or yields smoother trajectories and fewer boundary contacts, confirming that longer reverse horizons enhance constraint satisfaction. However, very high values of , incur diminishing returns and longer runtime. Table 1 illustrates mean violations for Safe vs. Unsafe across all , revealing clear safety gains that scale with the number of agents. Across all settings, total returns scale approximately linearly with the number of agents , as each agent receives an independent goal-progress reward and success bonus.
| Setting | Agents (M) | Success | ||||
| Centralized | 2 | 33.76 | 33.98 | 9 | 23.66 | True |
| 4 | 66.62 | 66.73 | 11.33 | 42.66 | True | |
| 8 | 133.04 | 133.16 | 40 | 87.33 | True | |
| Decentralized | 2 | 33.74 | 33.80 | 16 | 22.66 | True |
| 4 | 66.70 | 66.71 | 45 | 73.66 | True | |
| 8 | 135.29 | 135.35 | 70.66 | 88.66 | True |
Table 1. Representative three-seed outcomes (Maze2D). Reported rewards are total episode returns over steps.
Qualitative Results. Trajectory rollouts in Figure 2 show that MA-Safe Diffuser agents maintain safe clearances when crossing doorways and avoid wall clipping even under dense interactions. Unsafe denoisers exhibit oscillations and frequent minor breaches near corners.
Learned Score Denoiser (MLP MA-SafeDiffuser)
To test generalization beyond handcrafted priors, we train a goal-augmented MLP score network that approximates the scaled denoising residual from synthetic diffusion pairs.
Dataset. We generate 1500 training samples by adding Gaussian noise at random diffusion times to reference door-guided trajectories and record the normalized denoising targets. The input vector includes noisy trajectory, reference, goal offset, and sinusoidal time embedding.
Network: The MLP has two hidden layers of size (256, 256) with ReLU activation and is trained using Adam for 1000 epochs with learning rate , weight decay , and per-feature normalization. The final training loss stabilized around 0.40 (normalized MSE), confirming moderate convergence.
Evaluation: The trained MLP is used within the MA-Safe Diffuser planner (, ) for both Safe and Unsafe variants. Representative results are in Table 2. The safe variant reduces violation count by while maintaining identical return and success rate, confirming that the learned denoiser preserves CBF-based safety enforcement. Trajectory visualizations as shown in Figure 1 show smoother door transitions and fewer wall contacts compared to the unconstrained baseline. Our results on MLP based denoiser is preliminary, and very likely needs finetuning. For the 2DMaze experiment, our method is able to learn the trajectories well without using MLP.
Comparison with SafeRL Methods. Table 3 compares MA-Safe Diffuser with MAPPO-Lagrangian under identical door-based waypoint guidance. While MAPPO-Lagrangian enforces safety via a learned soft-penalty mechanism, this approach leads to stalling behavior in the narrow maze, resulting in a 0% success rate even after 600 training episodes within the 700-step horizon. In contrast, MA-SafeDiffuser applies zero-shot geometric projections with corridor relaxation, achieving 100% success. These results demonstrate that explicit geometric feasibility provides greater robustness and sample efficiency than learned soft-constraint policies in constrained multi-agent environments.
| Method | Success Rate | Reward | Violations |
| MAPPO-Lag | 0% | -0.82 | 532.3 |
| Centralized | 100% | 66.62 | 11.33 |
| Decentralized | 100% | 66.70 | 45.00 |
Table 3. Comparative performance with MAPPO-Lag on the Maze2D environment ( agents). Results are averaged over 3 random seeds with a step horizon.
Related Work
Diffusion for planning and control. The paper Diffuser [11] adapts denoising diffusion probabilistic models (DDPMs) [1] for goal-conditioned trajectory synthesis via iterative denoising. Extensions explore task-conditioned guidance using classifier or energy-based methods [5].
Safe diffusion. SafeDiffuser [20] integrates control barrier functions (CBFs) into diffusion steps for single-agent safety under robust or time-varying conditions. We extend this to multi-agent systems, supporting self, pairwise, and task-level safety with decentralized enforcement and execution-time filtering.

Figure 1. Qualitative rollouts of the learned-score variant of MA-SafeDiffuser with an MLP denoiser (4 agents, planning horizon , diffusion steps , and sampling steps; trained on 1500 trajectories for 1000 epochs). (Left) Safe planner with score-based generation combined with CLF (Control Lyapunov Function) and CBF (Control Barrier Function) projection, yielding . (Right) Unsafe planner without CBF enforcement, yielding . The safe variant produces smooth, wall-aware trajectories and avoids collisions, whereas the unsafe variant exhibits frequent constraint violations and unstable motion near obstacles.
| Mode | Reward | Violations | Success |
| Safe | 66.85 | 62 | True |
| Unsafe (no CBF) | 67.00 | 125 | True |
Table 2 (PDF p. 7). Learned MLP denoiser performance on Maze2D (4 agents, , , ).
Control barrier functions and invariance. CBFs offer an careful way to certify forward invariance by setting [1], with extensions for higher relative degree through exponential CBF [16] and nonsmooth sets [9]. We leverage these tools for waypoint-aware safety, establishing discrete-time invariance under diffusion updates.
Multi-agent safety and MARL. Traditional reactive methods (potential fields, velocity obstacles, MPC+CBF) and MARL baselines (MADDPG [14], MAPPO [21]) lack strict safety guarantees. Our CBF-with-diffusion projector enforces hard constraints during sampling and execution.
Optimization layers and projections. Differentiable QP layers (OptNet [2], CVXPY-Layers [6]) and operator-splitting solvers (OSQP [17]) enable scalable end-to-end safety. Projection methods (Dykstra [7]; see [3]) provide a parameter-free alternative for linearized constraints.
Benchmarking frameworks. PettingZoo [18] standardizes multi-agent benchmarks (e.g., MPE). We complement this with a lightweight Maze2D testbed for geometry-constrained, safety-aware evaluation.
Our approach MA-SafeDiffuser combines the generative expressiveness of diffusion planning [10, 11] with the formal guaranteed invariance of CBFs [1, 9, 16], SafeDiffuser’s single-agent theory [20] is extended to centralized and decentralized multi-agent joint safety and allows employing the latest projection/QP layers [2, 3, 7, 17] for realistic enforcement.
Conclusion and Limitations
We introduced MA-SafeDiffuser, a multi-agent safe diffusion planner with centralized and decentralized enforcement and finite-time diffusion invariance guarantees. Empirically, on Maze2D we see staggering violations reduction over unconstrained denoising. Sublimitations are: (i) QP feasibility with dense crowds (relaxed by ReS/TVS and introduced reverse steps), (ii) decentralized margins with the need for bounded comms errors, and (iii) shaping sensitivity of absolute returns on very long horizons. We believe that future work may involve scaling our method to larger number of agents and more complex planning tasks.
Acknowledgements
This research was financially supported by the University Grants Commission (UGC), Government of India, through the award of the Junior/Senior Research Fellowship (JRF/SRF) under the National Eligibility Test (NET) (Ref. No. 221610037786 & Ref. no. 221610070470). The work was also supported by the Council of Scientific and Industrial Research (CSIR), Government of India, through a CSIR Research Fellowship (09/0917(17235)/2023-EMR-I).
References
Proof of Theorem: Centralized multi-agent finite-time diffusion invariance
Theorem 11 (Centralized multi-agent finite-time diffusion invariance). Under Assumption 3, if at every reverse step the centralized projector enforces 4-7 (RoS or TVS) for all per-agent, pairwise, and task barriers at the enforcement index , then the joint denoising process is finite-time diffusion invariant for with probability 1 (with respect to the model noise). Moreover, the execution-time safety filter preserves invariance at runtime for the applied control .
Proof. We consider the joint state at reverse step and waypoint as and we collect all (self/pair/task) barriers in an index set with . We will first establish the claim for a single barrier at and subsequently apply Lemma 4 to the conjunction over .
Step 1 (discrete-time CBF inequality at ). By our Assumption 3, each is near , hence, the first-order Taylor expansion with a quadratic remainder holds along the Euler reverse update :
for some local . Since in this case, the centralized projector enforces at , we have that either the RoS row , or the TVS row , we obtain (for sufficiently small ) the reverse-time discrete CBF inequalities of Lemma 5 (with assumptions in Lemma):
RoS: , (8)
TVS: , (9)
,
with independent of on a compact neighborhood.
Step 2 (no boundary crossing in reverse time at ). By Lemma 5, there exists (depending on local Lipschitz constants and per-step bound ) such that for we have the following monotonicity implications
Hence, we have that nonnegativity at step does implies nonnegativity at step for the enforced index .
Step 3 (finite-time reach at ). If (RoS), then using Step 2 we have for all and in this case, we may take . On the other hand, if , we choose an extended class- function with the finite-time property
on (which is a standard approach in finite-time CBF design), and take small so that the truncation is dominated by (cf. Remark 6). Then the recursion (10) crosses into in finitely many reverse steps; invariance back to earlier then follows using Step 2. For TVS, same argument applied to yields (since ), hence, we have finite-time diffusion invariance with .
Step 4 (from to all waypoints). If rows at all are enforced for each of the first reverse steps, then Step 1–3 apply verbatim at each , seeding and propagating a uniform margin that persists thereafter under -only enforcement. Alternatively, if the reverse model includes a temporally strongly convex regularizer (reference interpolation along with discrete Laplacian smoothing), then successive waypoint differences would contract and a margin at will propagate to all thanks to a Lipschitz bound (as shown in SafeDiffuser [20] paper); hence we conclude that either route yields that there exists such that for all and all .
Step 5 (conjunction over barriers). Because the centralized projector enforces all active rows at simultaneously, from Lemma 4 we have forward invariance implication for intersection at , and by Step 4 for all , hence for the trajectory-level safe set .
Step 6 (probability-one statement and execution-time filter). The randomness due to the reverse model appears only in (and ); we do note that the projection/QP map is deterministic and measurable. By Assumption 3, we have that the RoS projector is feasible (or ReS/TVS is feasible with ) at every reverse step with probability 1, hence we have ample implications hold almost surely. Finally, the execution-time CBF filter satisfies the instantaneous rows (or the TVS variant), and by the same discrete-time argument as in Lemma 5, the applied step preserves forward invariance at runtime. Combining Steps 1–6 gives the claim.
Proof of Theorem 8: Decentralized Invariance
Theorem 12 (Decentralized invariance under bounded error). Assume that neighbor messages yield predictions denoted by with bounded error . Suppose each agent enforces its local pairwise CBF row with robust margin and responsibility shares , . Let be local Lipschitz constants (on a compact containing the visited states) for , its gradients, and , respectively, and assume per-step bounds . If
then we have that the decentralized projected updates satisfy the true centralized pairwise inequalities. Consequently, the conclusions of Theorem 7 hold.
Proof. We give a robustness argument for one reverse step , at the enforced waypoint , and for an unordered pair ; the result then follows by taking the finite conjunction over all pairs and all enforced barriers. Throughout we assume that we work on a compact guaranteed by our Assumption 3 and per-step bounds. Notation and assumptions. Let be a pairwise barrier with (Clarke) gradients . We denote the true states at by , and the communicated predictions by the following , with
Let denote the local increments chosen by the decentralized QPs (blocks of ), and assume . Let be an extended class– function. Fix responsibility shares , . Each agent enforces a local robust constraint:
Agent :
Agent :
As mentioned before, self and task barriers do not use predictions and are enforced locally as in the centralized projector.
Goal. We show the true centralized pairwise inequality holds at :
Summing (14) over all pairs (and combining with self or task rows) recovers the centralized rows at , so Theorem 7 applies.
Collect Lipschitz bounds. On there exist such that
From local to centralized. Summing (12)–(13) yields
By (18) and ,
By (16)–(19) and ,
Adding (23)–(24) to (21) gives
Thus we have that the true centralized inequality (14) holds whenever , i.e., we have the following
All pairs, self/task rows, and probability-one statement. Since the number of pairs is finite, taking the maximum of over yields a single bound ensuring all pairwise inequalities hold. Self and task rows are enforced locally (no prediction needed). The only randomness is in the unconstrained reverse drift; the local projections are deterministic measurable maps, and by Assumption 3 the local QPs are feasible with probability 1. Hence the above implication holds almost surely.
From one step to the full denoising process. At , the decentralized projections imply the centralized rows, so the hypothesis of Theorem 7 is satisfied on the enforced index. If the rows are also enforced at all , finite-time diffusion invariance follows immediately. In the receding-horizon case (only ), the same temporal coupling argument as in Theorem 7 (via reference interpolation + Laplacian smoothing, or a brief all- phase) propagates a margin to all , completing the proof.
Remark 13 (On the shorthand ). The informal shorthand “” should be interpreted after normalization by local constants on and the step bound . The rigorous sufficient condition is (27). In practice we plug conservative upper bounds for to pick a uniform margin.
Proof of Lemma 4: Barrier conjunction
Lemma 14 (Barrier conjunction). Let and consider the closed-loop system
where is locally Lipschitz. Suppose each is locally Lipschitz and (Clarke) differentiable a.e., and there exists an extended class- function (continuous, strictly increasing, ) such that, for all and all ,
Then is forward invariant: if , every (Carathéodory) solution with satisfies for all .
Proof. Step 0 (preliminaries). Local Lipschitzness of ensures existence and uniqueness of an absolutely continuous solution (Carathéodory sense). By Rademacher’s theorem each is differentiable a.e., and the chain rule gives for a.e. ,
Fix and write .
Step 1 (a scalar nonnegativity certificate). Define the “violation measure” by
Thus we have iff and if . The map is 1-Lipschitz and differentiable a.e.; in particular, along it is absolutely continuous with upper Dini derivative defined as follows
We show for all (a.e., which suffices).
Case A (). Then and is locally constant near , so .
Case B (). Here , hence (a.e.)
Using (28) evaluated at yields
Since and is strictly increasing with , we have . Therefore a.e. on and in particular .
Case C (). Taking the upper Dini derivative and using (28) with gives the following
because at points with . Hence, also on the boundary.
Combining the three cases, we conclude
By a standard result for absolutely continuous functions, (29) implies is nonincreasing in .
Step 2 (single-barrier invariance). If then , hence . Since is nonincreasing and always nonnegative, we must have for all , i.e.,
Thus the superlevel set is forward invariant under .
Step 3 (conjunction). The argument in Step 2 holds for each because the same closed-loop field satisfies (28) for all simultaneously. If , then for every , and by Step 2 we obtain for every and every $t\ge 0. Hence
which proves forward invariance of intersection.
Remarks. (i) On boundary , (28) reduces to the classical Nagumo tangency [15] condition , ensuring viability; for the term forces , driving trajectories back toward the safe side. (ii) The proof extends verbatim to locally Lipschitz (we implicitly used that each barrier is at least (and in some places ) by replacing pointwise gradients with Clarke generalized gradients and interpreting derivatives a.e.; the Dini-derivative argument remains valid. □
Proof of Lemma: Discrete-time CBF monotonicity
Lemma 15 (Discrete-time CBF monotonicity). Let on a neighborhood of the safe set with locally Lipschitz gradient constant , and let be an extended class- function. Assume that the (reverse-time) control update at satisfies the CBF row condition
and consider the reverse-time Euler step
Then there exists a constant (e.g., ) such that, for any
the following one-step inequality holds
In particular, if then we get the following
i.e., nonnegativity is preserved up to a second-order discretization error. If, in addition, either is affine in a neighborhood of the boundary (so and hence ) or a small terminal margin is enforced (e.g., via TVS), then .
Proof. We work with the integral mean-value representation of the increment of and use the property of (Lipschitz gradient). Let ; then . By the fundamental theorem of calculus, we have the following
Add and subtract inside the integrand and use the Lipschitz property of :
Recalling and applying the CBF inequality (30), we obtain
Finally, by using we can set
to obtain (32) exactly. This proves the first claim.
For the “in particular” statement, suppose . From (32) we get
Define . Since is strictly increasing with , is strictly increasing; thus implies , where is the unique solution of . By differentiability of at 0 and , a first-order expansion gives
so in particular for all sufficiently small . Therefore , which is (33). Two common ways to upgrade this “practical” nonnegativity to exact nonnegativity are:
If is affine near the boundary, then so , and (32) simplifies to ; with and for , it follows that .
If one enforces a tiny terminal margin (e.g., by a time-varying specification), then (32) yields directly.
The bound is not needed to derive (32); it is useful to guarantee that remains strongly increasing near the origin (slope ) and to make the term uniformly small relative to the linear term. □
More Experiments
In Figure 3, we do an extensive scaling study of our method with 2,4,8 agents. We report the mean of various runs with safe and unsafe agents. For the safe agents the violations are much less compared to unsafe. Note that our safe criteria also includes close proximity to wall and not necessarily hitting the wall, hence, as we verify from Figure 4, there are actually, almost negligible cases of safe agents hitting the wall when compared to unsafe agents. In the end, we believe that more extensive finetuning of parameters may result in even better results.

Figure 3. Scaling behavior of MA-SafeDiffuser under increasing multi-agent density (M = 2, 4, 8). Each bar reports the mean performance over 3 trials. The three subplots respectively show (a) average safety violations per episode, (b) success rate (%), and (c) Total reward per episode. Safe variants (green / blue) apply CBF-based safety projection, while unsafe variants (red / orange) execute unconstrained diffusion rollouts. Centralized SafeDiffuser enforces a joint global constraint, whereas decentralized SafeDiffuser applies local per-agent safety filtering.

Figure 4. Qualitative Results for Decentralized MA-SafeDiffuser. Each panel shows Safe (solid) vs. Unsafe trajectories across random initializations for , 4, 8 agents. For 2 agents, , , and for 4 agents, , and for 8 agents, , . SafeDiffuser agents maintain clearances through doors and corners, while Unsafe diffusion plans exhibit oscillations and occasional wall crossings.
References
- [1]Aaron D. Ames, Xiangru Xu, Jessy W. Grizzle, and Paulo Tabuada. 2017. Control Barrier Function Based Quadratic Programs for Safety Critical Systems. IEEE Trans. Automat. Control 62, 8 (2017), 3861–3876.DOI
- [2]Brandom Amos and J. Zico Kolter. 2017. OptNet: differentiable optimization as a layer in neural networks. In Proceedings of the 34th International Conference on Machine Learning - Volume 70 (ICML’17). JMLR.org, Sydney, Australia, 136–145.
- [3]Heinz H. Bauschke and Patrick L. Combettes. 2017. Convex Analysis and Monotone Operator Theory in Hilbert Spaces (2nd ed.). Springer, Cham.
- [4]Stephen Boyd, Neal Parikh, Eric Chu, Borja Peleato, Jonathan Eckstein, et al. 2011. Distributed optimization and statistical learning via the alternating direction method of multipliers. Foundations and Trends in Machine Learning 3, 1 (2011), 1–122.
- [5]Prafulla Dhariwal and Alexander Nichol. 2021. Diffusion models beat GANs on image synthesis. In Proceedings of the 35th International Conference on Neural Information Processing Systems (NIPS ’21). Curran Associates Inc., Red Hook, NY, USA, Article 672, 15 pages.
- [6]Steven Diamond and Stephen Boyd. 2016. CVXPY: A Python-Embedded Modeling Language for Convex Optimization. Journal of Machine Learning Research 17, 83 (2016), 1–5.
- [7]Richard L Dykstra. 1983. An Algorithm for Restricted Least Squares Regression. J. Amer. Statist. Assoc. 78, 384 (1983), 837–842.DOI
- [8]Paolo Fiorini and Zvi Shiller. 1998. Motion Planning in Dynamic Environments Using Velocity Obstacles. The International Journal of Robotics Research 17, 7 (1998), 760–772.DOI
- [9]Paul Golfetto, Jorge Cortés, and Magnus Egerstedt. 2017. Nonsmooth Barrier Functions With Applications to Multi-Robot Systems. IEEE Control Systems Letters 1, 2 (2017), 310–315.
- [10]Jonathan Ho, Ajay Jain, and Pieter Abbeel. 2020. Denoising diffusion probabilistic models. In Proceedings of the 34th International Conference on Neural Information Processing Systems (Vancouver, BC, Canada). Curran Associates Inc., Red Hook, NY, USA, 6840–6851.arxiv.org/abs/2006.11239
- [11]Michael Janner, Yilun Du, Joshua B. Tenenbaum, and Sergey Levine. 2022. Planning with Diffusion for Flexible Behavior Synthesis. arXiv:2205.09991 [cs.LG] https://arxiv.org/abs/2205.09991
- [12]Oussama Khatib. 1986. Real-Time Obstacle Avoidance for Manipulators and Mobile Robots. The International Journal of Robotics Research 5, 1 (1986), 90–98.
- [13]Ankita Kushwaha, Kiran Ravish, Preeti Lamba, and Pawan Kumar. 2025. A Survey of Safe Reinforcement Learning and Constrained MDPs: A Technical Survey on Single-Agent and Multi-Agent Safety. arXiv:2505.17342 [cs.LG] https://arxiv.org/abs/2505.17342
- [14]Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. 2017. Multi-agent actor-critic for mixed cooperative-competitive environments. In Proceedings of the 31st International Conference on Neural Information Processing Systems (Long Beach, California, USA) (NIPS’17). Curran Associates Inc., Red Hook, NY, USA, 6382–6393.arxiv.org/abs/1706.02275
- [15]Mitio M. 1942. Über die Lage der Integralkurven gewöhnlicher Differentialgleichungen. Proceedings of the Physico-Mathematical Society of Japan, Third Series 24 (1942), 551–559.
- [16]Quan Nguyen and Koushil Sreenath. 2016. Exponential Control Barrier Functions for Enforcing High Relative-Degree Safety-Critical Constraints. In Proceedings of the 2016 American Control Conference (ACC). IEEE, Boston, MA, USA, 322–328.
- [17]Bartolomeo Stellato, Goran Banjac, Paul Goulart, Alberto Bemporad, and Stephen Boyd. 2020. OSQP: An operator splitting solver for quadratic programs. Mathematical Programming Computation 12, 4 (2020), 637–672.
- [18]Justin K Terry, Benjamin Black, Mario Jakubik, Ananth Hari, Luis Santos, Clemens Dieffenbahl, Niall L Williams, Yashas Lokesh, Ryan Sullivan, Caroline Horsch, and Praveen Ravi. 2021. PettingZoo: Gym for Multi-Agent Reinforcement Learning. https://openreview.net/forum?id=YVwQYsU8aZ
- [19]Jur van den Berg, Stephen J. Guy, Ming Lin, and Dinesh Manocha. 2011. Reciprocal n-Body Collision Avoidance. In Robotics Research. Springer Berlin Heidelberg, Berlin, Heidelberg, 3–19.
- [20]Wei Xiao, Tsun-Hsuan Wang, Chuang Gan, and Daniela Rus. 2023. SafeDiffuser: Safe Planning with Diffusion Probabilistic Models. arXiv:2306.00148 [cs.LG] https://arxiv.org/abs/2306.00148
- [21]Chao Yu, Akash Velu, Eugene Vinitsky, Jiaxuan Gao, Yu Wang, Alexandre Bayen, and Yi Wu. 2021. The Surprising Effectiveness of PPO in Cooperative, Multi-Agent Games. arXiv:2103.01955 [cs.LG] https://arxiv.org/abs/2103.01955