arXiv:2611.04957cs.RONov 2026

Manuscript Offprint

arXiv:2611.04957

Safeguarding Multi-Agent Reinforcement Learning for Connected and Automated Vehicles with Recursively Feasible Control Barrier Functions

Jianye Xu, Yousef Sayed, Bassam Alrifaee

Jianye Xu 1^{1} ID^{ID}, Student Member, IEEE, Yousef Sayed 2^{2} ID^{ID}, Bassam Alrifaee 2^{2} ID^{ID}, Senior Member, IEEE

Abstract—Multi-Agent Reinforcement Learning (MARL) shows promise in coordinating connected and automated vehicles but offers no safety guarantee. Although Control Barrier Functions (CBFs) can add this guarantee, their optimization problem can become infeasible in practice due to control bounds. Moreover, they often overapproximate vehicle and road geometry, which makes them conservative. This paper proposes the Backup-Horizon CBF (BH-CBF), which evaluates safety along a horizon until all vehicles stop. BH-CBF is recursively feasible under control bounds, and it considers the exact vehicle and road geometry. Based on BH-CBF, we derive a fully decentralized safety filter that only needs a single broadcast of vehicle states and routes per step and stays real-time in dense traffic. We use BH-CBF to safeguard a MARL policy over its life cycle: as a reward during pre-training, as a run-time filter at deployment, and as a filter in the training loop that keeps fine-tuning on unseen maps collision-free. In simulations on real-world maps of a roundabout and an intersection, BH-CBF avoids all collisions of unsafe MARL policies and keeps its safety guarantee at every step. Existing filters either collide, lose the guarantee, or fall back to full braking far more often. In recorded roundabout traffic with 1264 human-driven vehicles over 115 km, our safeguarded policies shorten the median travel time by 14% compared with the human drivers, without any collision.

Index Terms—Connected and autonomous vehicles, control barrier functions, methods for safety, multi-agent reinforcement learning, optimization and control

I. INTRODUCTION

Multi-Agent Reinforcement Learning (MARL) policies have become a promising approach to coordinating Connected and Automated Vehicles (CAVs) in interactive traffic such as merges, lane changes, intersections, and roundabouts [1]–[4]. Such policies are fast at run time and scale with the number of vehicles, and they can learn cooperative behavior from interaction instead of relying on hand-designed coordination rules [1]. However, a learned policy offers no safety guarantee since it is trained to maximize a reward that scores its behavior. Collision penalties reduce collisions but do not exclude them, and the behavior of the policy degrades in scenarios that differ from training, such as unseen road layouts [5] or the transfer from simulation to real vehicles [6]. Therefore, safety-critical deployment requires a safeguard for the learned policy that does not depend on how well the policy generalizes.

Figure

(a) A roundabout.

(b) An intersection.

Fig. 1: An unsafe MARL policy safeguarded by our BH-CBF. Light trails: predictions of braking to a standstill along the route. Red: standstill distance of a vehicle pair.

Safeguards for learned policies can be classified by how they modify the action proposed by the policy [7], which we call the nominal action. Action masking restricts the action space to verified actions, action replacement substitutes a verified action, as in shields [8], and action projection moves the action to the closest safe one. We focus on action projection, which keeps interventions small. Control Barrier Function (CBF) safety filters are among the most prominent projection methods, where a Quadratic Program (QP) modifies the nominal action minimally so that a barrier condition holds [7]. The barrier condition bounds how fast a safety margin (e.g., the distance to the nearest vehicle) may shrink in the next step. It thereby keeps the system in a safe set of states at all future times, i.e., it renders the safe set forward invariant [9], [10]. Since CBF filters work with any nominal planner, they suit learned policies [11]. Learned graph CBFs even scale to more than a thousand agents, although their learned barriers are not verified [12]. For CAVs, MARL policies have been safeguarded by replacing unsafe merging actions with those of a priority-based supervisor [2] and by testing discrete lane-change actions for the feasibility of a CBF-QP [3]. However, two shortcomings of existing CBF filters limit their use for CAVs in dense urban traffic.

First, existing CBF filters often overapproximate the vehicle and road geometry. Multi-robot CBFs commonly model agents as disks [13]. Lane-keeping CBFs bound the lateral offset of a reference point from the lane center [9], [14] or shrink the admissible lateral offsets and yaw angles of a rectangle on a straight lane to an inscribed ellipse [15]. Such approximations remove the lateral space a rectangular vehicle has in a narrow lane, which makes the filter conservative, lowers throughput, or even causes deadlocks. Optimization inside the filter can

1^{1}Department of Computer Science, RWTH Aachen University, Germany, xu@embedded.rwth-aachen.de

2^{2}Department of Aerospace Engineering, University of the Bundeswehr Munich, Germany, yousef.sayed@tum.de, bassam.alrifaee@unibw.de

This work has been submitted to the IEEE for possible publication. Copyright may be transferred without notice, after which this version may no longer be accessible.

compute exact distances between convex shapes, but these methods solve one centralized QP over all robots [16] or address a single robot [17]. Moreover, the distance is zero for overlapping shapes, so it gives no direction to recover from a collision. The largest gap along the edge normals of two polygons is a closed-form lower bound of their signed distance that is negative when they overlap [18]. However, its smoothed version is proven to be a conservative continuous-time CBF only for two single integrators with unbounded inputs [19].

Second, existing CBF filters lack recursive feasibility, i.e., the guarantee that the filter finds an admissible control that satisfies the barrier condition at every future step. This lack is the most consequential limitation for safeguarding MARL policies. A function whose nonnegative values define the safe set is only a candidate CBF. It is a valid CBF if such a control exists at every safe state, and only then does the filter remain feasible and keep the safe set forward invariant [20], [21]. Under control bounds, no general method yields a valid CBF, so candidate CBFs are often used in practice without this guarantee [22], [23]. This is because the barrier condition is myopic: it constrains only the next step, whether a continuous-time condition is enforced at the sampling instants [14], [15], [19] or a discrete-time condition is imposed on a one-step prediction [24]. Some constraints are affected by the control indirectly. For example, an acceleration command changes the distance between two vehicles only through their speeds. The High-Order CBF handles such constraints by chaining a set of class K functions [22], whereas the Truncated Taylor CBF (TTCBF) of our prior work imposes the condition on a truncated Taylor prediction with a single class K function [25], [26]. In dense traffic, vehicles approach each other quickly when merging or entering a roundabout and come close to each other or to a lane boundary. Then no control within control bounds satisfies the condition, the QP becomes infeasible, and the safety guarantee is lost. CBF-based merging of CAVs [27] and a CBF shield for MARL-based CAV planning [3] share this limitation: both guarantees assume that the QP is feasible at every step. The shield falls back to an emergency stop without a safety guarantee when the QP is infeasible.

Several families of filters look beyond one step and preserve the ability of a fallback maneuver to keep the system safe [28]. Hamilton-Jacobi reachability analysis yields the least restrictive filter, but its computational cost grows exponentially with the state dimension, so it cannot be applied to many CAVs [28]. Predictive safety filters plan a whole input sequence that ends in a set known to be safe [29]. Most methods use a fixed backup policy, which is a fallback maneuver such as emergency braking, and require that the backup keeps the system safe from the state that the applied control reaches. Model predictive shielding [8], [30], gatekeeper [31], and fail-safe trajectories [32] use action replacement: they substitute the backup control for an unsafe nominal action, so an intervention can jump from the nominal action to full braking. Backup CBFs impose continuous-time conditions along the backup over a fixed horizon that must end in a known safe set [33], [34]. The smallest safety margin along a fixed policy is itself a discrete-time CBF [35]. It has been learned without verification [35], evaluated by finite rollouts in continuous time

[36], and derived for a single controlled vehicle on a straight road [37]. A related reach-avoid value has been approximated online by differential dynamic programming [38]. For CAVs, these backup-based filters either switch abruptly to the backup, require a fixed horizon ending in a synthesized terminal set, or are limited to one vehicle or to barriers without a guarantee.

Many interacting CAVs further require decentralized computation, because each vehicle must determine its own control from what it observes or receives. The core difficulty is to ensure that the control one vehicle optimizes does not conflict with the controls that the other vehicles optimize at the same time [39]. For a CBF, a pair condition couples the controls of two vehicles, so it must be split into one part per vehicle such that the two parts together imply it. Barrier certificates for multiple robots split each pair condition between the two robots in proportion to their acceleration limits [13]. In the decentralized backup CBF, each robot covers half of the allowed decrease of a smooth pair barrier [40]. This split is exact only in continuous time, where the rate of change of the barrier is the sum of one term per robot. Over a finite sampling step, the motions of the two robots interact, so the two halves no longer imply the pair condition. Other methods split the space instead of the condition and keep the planning problems recursively feasible. They separate the agents by hyperplanes between communicated trajectories [41] or by planes that bisect the braking positions of spherical agents, which needs no communication [42]. None of these splits a pair condition so that it remains valid over a finite step for rectangular vehicles whose heading changes.

Safeguarding a MARL policy also takes more than filtering its actions. A filter alone leaves the policy unchanged, so a policy that relies on it keeps proposing unsafe actions. A CBF can also make the policy itself safer. Its condition can serve as a reward that penalizes violations during training, as in our prior work [43]. The policy can also be trained with the filter in the loop [7], [11]. Both uses inherit the myopia of the one-step condition. The reward penalizes an unsafe action only when a violation is imminent, and an infeasible filter cannot avoid collisions with guarantees.

In summary, a decentralized CBF that is recursively feasible under control bounds and considers the exact vehicle and road geometry is still missing. Nor does any CBF for CAVs look far enough ahead to serve as a reward or as a filter in the training loop of a MARL policy. This paper closes both gaps with the Backup-Horizon CBF (BH-CBF). Our contributions are:

  1. We propose BH-CBF, which evaluates the safety margins along a backup policy that brakes every vehicle to a standstill along its route (light trails in Fig. 1). This horizon makes BH-CBF recursively feasible under control bounds, i.e., a valid CBF, and its margin considers the exact vehicle and road geometry.

  2. We derive a fully decentralized safety filter from BH-CBF. Each vehicle computes its own control from one broadcast of vehicle states and routes per step, and the computation time stays real-time in dense traffic.

  3. We show how BH-CBF safeguards a MARL policy over its life cycle: as a reward in pre-training, as a run-time filter at deployment, and as a filter in the training loop that keeps fine-tuning on unseen maps collision-free.

We evaluate BH-CBF on real-world maps of a roundabout and an intersection against state-of-the-art one-step CBF filters, the backup CBF, and model predictive shielding. In recorded roundabout traffic with 1264 human-driven vehicles, we demonstrate that our safeguarded policies shorten the median travel time of the human drivers by 14% without any collision. Video demonstrations and the code that reproduces our results are available at https://bassamlab.github.io/BH-CBF.

This paper extends our prior work. Our filter for polyline lane boundaries [44] covered the vehicle with circles and used a smoothed pseudo-distance, but it is limited to a single vehicle. Our learned pair barrier [45] approximated the separation of two rectangles by a neural network. BH-CBF uses the exact vehicle geometry instead and handles many vehicles. In [26], we suggested extending TTCBF to a longer look-ahead with the input held constant but left its theory open, which BH-CBF settles with an exact prediction along a backup policy. Our one-step CBF reward [43] used the TTCBF condition with circular footprints, and BH-CBF replaces both.

The rest of the paper is organized as follows. Section II states the problem. Section III presents BH-CBF with its guarantees, and Sec. IV describes how it safeguards MARL policies. Section V reports the evaluation, and Sec. VI concludes.

Throughout the paper, vectors, matrices, and vector-valued functions are bold, e.g., x\boldsymbol{x} and f\boldsymbol{f}; sets are calligraphic. A superscript ii or ijij refers to vehicle ii or to the pair (i,j)(i,j); other indices, such as the time step kk, are subscripts. A prediction made at step kk for step k+tk+t carries the subscript k+t∣kk+t|k, e.g., xk+t∣k\boldsymbol{x}_{k+t|k}. Joint quantities of all vehicles are written without the vehicle superscript, e.g., x=(x1,…,xn)\boldsymbol{x} = (\boldsymbol{x}^1, \ldots, \boldsymbol{x}^n). The Euclidean inner product and norm are ⟨⋅,⋅⟩\langle \cdot, \cdot \rangle and ∥⋅∥\|\cdot\|, and [⋅][\cdot] is the ceiling.

References (51)