  ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning


                             Wei Xiao 1 Tsun-Hsuan Wang 1 Chuang Gan 2 Daniela Rus 1


                         Abstract                                     train (Pereira et al., 2020) (Xiao et al., 2023) (Wang et al.,
                                                                      2023b). It is desirable to merge these models as we can
     Safe learning is central to AI-enabled robots
                                                                      get better performance controllers in general (Beygelzimer
     where a single failure may lead to catastrophic
                                                                      et al., 2015) (Agarwal et al., 2020). Traditional mixture of
     results. Existing safe learning methods are not
                                                                      expert methods (Shazeer et al., 2017) (Riquelme et al., 2021)
     scalable, inefficient and hard to train, and tend
                                                                      (Zhou et al., 2022) or other merging approaches (Huang
     to generate unstable signals under noisy inputs
                                                                      et al., 2023) (Ramé et al., 2023) (Wang et al., 2024) are not
     that are challenging to be deployed for robots. To
                                                                      designed to retain the safety of the models. In this work,
     address these challenges, we propose Adaptive
                                                                      we explore to leverage the collective power of many safety-
     explicit-Barrier Net (ABNet) in which barriers
                                                                      critical models to handle complex tasks while preserving
     explicitly show up in the closed-form model that
                                                                      the safety of the models.
     guarantees safety. The ABNet has the potential to
     incrementally scale toward larger safe foundation                There are various definitions of safety for robotics and au-
     models. Each head of ABNet could learn safe con-                 tonomy, and safety can be basically defined as something
     trol policies from different features and focuses                bad never happens. Mathematically, safety can be defined as
     on specific part of the observation. In this way, we             a continuously differentiable constraint with respect to the
     do not need to directly construct a large model for              system state and it can be further captured by the forward
     complex tasks, which significantly facilitates the               invariance of the safe set over such a constraint (Ames et al.,
     training of the model while ensuring its stable out-             2017) (Xiao & Belta, 2021) (Glotfelter et al., 2017). In other
     put. Most importantly, we can still formally prove               words, we can use different constraints and approaches to
     the safety guarantees of the ABNet. We demon-                    enforce safety. The way we learn such safety enforcement
     strate the efficiency and strength of ABNet in 2D                methods may depend on the focused observation feature.
     robot obstacle avoidance, safe robot manipulation,               For instance, some human drivers may focus on the left lane
     and vision-based end-to-end autonomous driving,                  boundary in driving in order to achieve safe lane keeping,
     with results showing much better robustness and                  while others may focus on the right lane boundary, as shown
     guarantees over existing models1 .                               in Fig. 1. Merging these models enables us to build ro-
                                                                      bust and powerful learning models. However, the adaptivity
                                                                      of the merging method to different safe models is crucial,
1. Introduction                                                       especially in retaining safety.
Robot learning usually requires to leverage scalable training         In the literature, differentiable Quadratic Programs (dQP)
and vast amount of data. There are many large models (Li              (Amos & Kolter, 2017) and differentiable Model Predictive
et al., 2022) for complex robotic tasks including manipula-           Control (dMPC) (Amos et al., 2018) are widely used for
tion, locomotion, autonomous driving (Bommasani et al.,               safe robot learning. However, dMPC is restricted to lin-
2021) (Singh et al., 2023) (Wang et al., 2023a). However,             ear systems with linear constraints. Barrier-based learning
these models are not trustworthy and have no safety guar-             methods (Robey et al., 2020) (Pereira et al., 2020) (Srini-
antees. Existing methods that incorporate guarantees or               vasan et al., 2020), such as the BarrierNet (Xiao et al., 2023)
certificates into neural networks are not scalable and hard to        (Wang et al., 2023b) (Liu et al., 2023), are widely used to
   1 Computer Science and Artificial Intelligence Lab, MIT, USA       transform nonlinear problems into dQPs and can equip deep
2 UMass Amherst and MIT-IBM Watson AI Lab, USA. Correspon-            learning systems with safety guarantees. However, there are
dence to: Wei Xiao <weixy@mit.edu>.                                   several limitations of these learning methods: (i) they are
                                                                      involved with solving batch QPs during training, which is
Proceedings of the 42nd International Conference on Machine           inefficient, and dQPs tend to give awful solutions that signif-
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025           icantly deteriorate the model; (ii) they can only implement
by the author(s).
   1 Code is available at: https://github.com/Weixy21/                a single safety enforcement method as the last layer of the
ABNet                                                                 neural network, which is not scalable to larger safe learning

                                                                  1
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

                                An Efficient Safety-Guaranteed Learning System with Scalability
                                                                                     Cross connection
                     Observation
                      variables                                                                      h    Outputs
                                                                                                         (Controls)
                                                        …

                                                                                          Gate
                       Focus on                                              Safety Set
                                                                                           Linear
                    different parts      CNN NN: LSTM, etc. Adaptive explicit-Barrier Net(ABNet)


Figure 1: The proposed ABNet that is efficient, scalable and generates stable output while guaranteeing safety for robots.
Each head of ABNet in the model could learn safe control policies with focus on different observation feature in a scalable or
one-shot/direct manner. Barriers play the role of gates in determining the closed-form safe control and are more interpretable.


models; (iii) these methods tend to generate unstable output           in vision-based driving).
under noise, which cannot be deployed for robots.
In this paper, we propose the Adaptive explicit-Barrier Net           2. Problem Formulation
(ABNet) to merge many safety-critical models while pre-               We consider the following safe robot learning problem:
serving the safety guarantees. The ABNet is efficient, scal-
able, robust to noise, and easy to be trained in an incremental       Problem. Given (a) a robotic system with dynamics; (b)
manner. As shown in Fig. 1, we may build multi-head mod-              a state-feedback nominal controller π ∗ (x) = u∗ (such as
els within the ABNet. Each head of the ABNet may pay                  a model predictive controller) that provides the training
attention to different observation features to generate a safe        label; (c) a set of safety constraints b j (x) ≥ 0, j ∈ S (b j
control policy. We combine the outputs of all the safe learn-         is continuously differentiable, S is a constraint set); (d) a
ing models in a way that is provably safe. The weights                neural network controller π(x, z|θ ) = u parameterized by
of this combination quantify the importance of each head              θ (under observation z);
of the model, and they are trainable. The structure of the            Our goal is to find the optimal parameter
ABNet allows us to build larger safe foundation models for
complicated robotic applications as we can incrementally                          θ ∗ = arg min Ex,z [ℓ(π ∗ (x), π(x, z|θ ))],   (1)
                                                                                                 θ
train safe models corresponding to different robot skills and
this will simply increase the head h of the ABNet.                    while satisfying all the safety constraints in (c) and the
                                                                      dynamics constraint (a). E is the expectation, and ℓ is a loss
In summary, we make the following new contributions:                  function.
• We propose a novel explicit-Barrier model that shows su-
  perior performance in stable training and computation than          3. Adaptive Explicit-Barrier Net
  dQP (Amos & Kolter, 2017) and BarrierNet (Xiao et al.,              In this section, we present the architecture of the Adaptive
  2023) while guaranteeing safety of robot learning, and the          explicit-Barrier Net (ABNet) and formally prove its safety
  explicit-Barrier model is crucial to build larger models via        guarantees in learning systems.
  merging due to its high-efficiency in dealing with nonlinear
  systems and constraints.                                            Our proposed method can fuse machine learning models
                                                                      that can strictly enforce system safety. In the literature, to
• We propose a novel ABNet that merges many safety-
                                                                      make the safety model trainable without losing guarantees,
  critical learning models, and this new model is scalable,
                                                                      we would usually require the model to be in the form of
  robust, and easy to be trained.
                                                                      differentiable convex optimizations, such as differentiable
• We formally prove the safety guarantees of the proposed             QP (Amos & Kolter, 2017), differentiable MPC (Amos
  ABNet.                                                              et al., 2018) or differentiable CBF (Xiao et al., 2023). In
• We demonstrate the strength and effectiveness of our                the former two cases, the considered robot learning prob-
  model on a variety of robot control tasks, including 2D             lems are usually with linear dynamics and linear constraints.
  robot obstacle avoidance, safe robot manipulation, and              Otherwise, the optimization becomes nonlinear (i.e., not
  vision-based end-to-end autonomous driving in an open               trainable in neural networks). Although one can transform
  dataset. We also show that existing models/policies merg-           constrained optimizations into unconstrained optimizations
  ing could make safety worse in complicated tasks (such as           that are trainable using classical barrier functions (Boyd &

                                                                  2
                               ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

Vandenberghe, 2004), it may make the system lose safety                                                                        dMPC head h
                                                                                  Input: 𝐻 𝑧1 𝜃ℎ,1
guarantees.                                                                                                                 Objective: (6) with
                                                                                                                     BarrierNet    and 2
                                                                                                                         𝐻 𝑧 𝜃ℎ,𝑘head   𝐹 𝑧 𝜃𝑓,ℎ
                                                                                                                                                           𝑢ℎ
                                                                                                                      Objective: (6) with                         𝑤ℎ
                                                                                                            Explicit-Barriers.thead 1
3.1. Multi-head Explicit-Barrier                                                  Input: 𝑝𝑖 (𝑧|𝜃𝑝 )                𝐻 𝑧 𝜃ℎ,𝑘 and 𝐹 𝑧 𝜃𝑓,2
                                                                                                                                                          𝑢2               𝑢
                                                                                                                            −1. constraints: (7) with
                                                                                                                         dCBF                                    𝑤2
                                                                                                            𝑢1 = −𝜆1 𝑥 𝐻       𝐿 𝜓𝐼,𝑚−1
                                                                                                                    s.t −1 𝑝𝑔) and                 𝑚
                                                                                                                                                                       ∑
                                                                                                                 −𝜆2 𝑥 𝑝𝐻𝑖 (𝑧|𝜃        𝑝𝑚,𝑘 (𝑧𝑘 |𝜃𝑝,ℎ
                                                                                                                               𝐿𝑔𝜓𝐼𝐼,𝑚−1              )
                                                                                                                                                          𝑢1    𝑤1
We focus on general safe robot learning problems with non-                                          𝑚
                                                                                  Input: 𝑝𝑚,1 (𝑧1 |𝜃𝑝,1 )      −1    .
                                                                                                            −𝐻 (𝑧   |𝜃 constraints:
                                                                                                                  dCBF
                                                                                                                    1     )𝐹(𝑧 |𝜃 (7)
                                                                                                                        ℎ,1     1     ) wi
                                                                                                                                    𝑓,1                            Outputs
linear dynamics and constraints. For such problems, it has                                                                                  𝑚 )
                                                                                                                  𝑝𝑖 (𝑧|𝜃𝑝 ) and 𝑝𝑚,𝑘 (𝑧𝑘 |𝜃𝑝,2                   (Controls)
been shown that we can use the CBF transformation to re-                          Input: 𝐹 𝑧1 𝜃𝑓,1
duce nonlinear optimizations onto quadratic optimizations                                                    Gate: 𝜆1 𝑥 , 𝜆2 𝑥
with safety guarantees (Ames et al., 2017) (Xiao & Belta,
2021), which gives rise to the so-called BarrierNet (Xiao                         Figure 2: Architecture of multi-head explicit-barriers. AB-
et al., 2023).                                                                    Net is capable (adaptive) to fuse any safe learning models,
                                                                                  such as the proposed explicit-barriers, BarrierNet, dMPC,
Specifically, consider robot dynamics as: ẋ = f (x) +
                                                                                  etc. The ABNet is usually used in conjunction with any
g(x)u, where x ∈ Rn is the robot state, f : Rn → Rn and
                                                                                  other neural networks and can be implemented in parallel.
g : Rn → Rn×q are locally Lipschitz, and u ∈ Rq is the con-
                                                                                  The parameters (inputs) of each head of ABNet are the out-
trol. We can also consider non-affine control systems by
                                                                                  puts of previous layers (such as CNN or LSTM).
defining auxiliary systems (Xiao et al., 2021).
Implicit-Barrier. The constrained optimal control in the
considered problem in Sec. 2 is then transformed into the                         solving batch QPs (Amos & Kolter, 2017), which is ineffi-
following differentiable CBF/BarrierNet (Xiao et al., 2023),                      cient. Since CBFs do not explicitly show up in the solution,
which may form a head of the model:                                               we call differentiable CBF (3) as implicit-barrier. In the
                                                                                  following, we derive the trainable explicit solution of the
                1
  uk = arg min u(t)T H(zk |θh,k )u(t) + F T (zk |θ f ,k )u(t)                     differentiable CBF, which is our proposed explicit-barrier.
           u(t) 2
                                                            (2)                   Explicit-Barrier. It has been shown in (Luenberger, 1997)
s.t.                                                                              that we can find the explicit solution of a QP if there are only
                                                                                  two constraints. As the cardinality of the safety constraint
L f ψ j,m−1 (x, z|θ p ) + [Lg ψ j,m−1 (x, z|θ p )]u
                 m
                                                                                  set S may be greater than two, the number of HOCBFs in
   + pm,k (zk |θ p,k )α j,m (ψ j,m−1 (x, z|θ p )) ≥ 0, j ∈ S,                     the differentiable CBF (3) will also be greater than two.
   ψ j,i (x, z|θ p ) = ψ̇ j,i−1 (x, z|θ p )                                       In order to address this, first, we can define two safety
                                                                                  functions bI (x) = −ln(∑ j∈S1 exp(−b j (x))) and bII (x) =
   + pi (z|θ pi )α j,i (ψ j,i−1 (x, z|θ p )), i ∈ {1, . . . , m−1}, j ∈ S,
                                                                                  −ln(∑ j∈S2 exp(−b j (x))), where S = S1 ∪ S2 . By (Boyd
   ψ j,0 (x, z|θ p ) = b j (x), j ∈ S,                                            & Vandenberghe, 2004), we have that max j∈S b j (x) ≤
                                                                        (3)       ln(∑ j∈S exp(b j (x))). It can be easily shown that bI (x) ≥ 0
where H(zk |θh,k ) ∈ Rq×q is positive definite, and                               and bII (x) ≥ 0 implies b j (x) ≥ 0, ∀ j ∈ S.
−H −1 (zk |θh,k )F(zk |θ f ,k ) can be interpreted as a reference
control (the output of previous network layers). The con-                         Alternatively, we can simply consider the two most risk
straints above are the High-Order CBFs (HOCBFs) con-                              safety specifications, i.e., bI (x) = mini∈S b j (x), bII (x) =
structed in enforcing the safety constraints b j (x) ≥ 0 of                       mini∈S\arg mini∈S b j (x) b j (x). This approach is simpler and it
relative degree m(Xiao & Belta, 2021). It can be shown                            works well for most obstacle avoidance tasks.
that the satisfaction of the first HOCBF constraint in                            Then, the explicit optimal solution of the differentiable CBF
the above implies the satisfaction of b j (x) ≥ 0, ∀ j ∈ S,                       with the above two safety specifications can be given by
which proves the safety of differentiable CBF. In the
above, L f ψ = dψ                          dψ                                                     uk = −λ1 (x)H −1 Lg ψI,m−1 (x)
                       dx f (x), Lg ψ = dx g(x), k ∈ {1, . . . , h}, and                                                                                               (4)
h is the number of heads (as shown in Fig. 1). pi ≥                                                   − λ2 (x)H −1 Lg ψII,m−1 (x) − H −1 F,
0, i ∈ {1, . . . , m − 1}, pm,k ≥ 0 are penalty functions (out-
puts of the previous network, as shown in Fig. 2) on                              where H, F are given as in (2) with arguments omitted.
the strictly increasing and zero-passing functions α j,i , i ∈                    λ1 (x) ≤ 0, λ2 (x) ≤ 0 are two gate functions ((14), (15)
{1, . . . , m}, j ∈ S, and will determine the conservativeness of                 given in Appendix), and ψI,m−1 (x), ψII,m−1 (x) are the two
the robot. θ := (θh , k, θ f ,k , θ p,k  m , θ ), k ∈ {1, . . . , h}, where       HOCBFs corresponding to bI (x), bII (x) defined similarly
                                              p
                                                                                  as in (3). As we can see that bI (x), bII (x) explicitly show
θ p := (θ p1 , . . . , θ pm−1 ) are all trainable parameters. zk is the
                                                                                  up in the above equation while it guarantees safety, we call
observation of the head k, and it is possible that all heads
                                                                                  it explicit-Barrier. This makes the explicit-Barrier more
share the same observation, i.e. zk = z, ∀k ∈ {1, . . . , h}.
                                                                                  interpretable. The whole explicit solution derivation process
The training of the above differentiable CBF (3) involves                         is given in Appendix Sec. A.

                                                                              3
                             ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

Adaptive mechanism. Each head of ABNet may learn                             Algorithm 1 Construction and training of ABNet
different safe control policies even if all the heads have                     Input: the problem setup (a)-(d) given in the problem
the same observation z. The benefit is that the final per-                     formulation (Sec. 2).
formance is achieved "collectively" by all heads and thus                      Output: a robust and safe controller u for the system.
each head can just focus on the "subproblem" with safety.                      (a) Formulate each head of explicit-Barriers as in (4).
Alternatively, we may also make each head of ABNet focus                       (b) Build the cross connection among explicit-Barriers
on different observations zk . The observation zk may come                     via pi (z|θ pi ), i ∈ {1, . . . , m − 1}.
from different parts of the sensor observation (such as the                    (c) Fuse all the heads of explicit-Barriers as in (5).
left lane boundary and right lane boundary in driving shown                    if Incremental training then
in Fig. 1), or even different perceptions (such as vision,                        Decouple pi (z|θ pi ), i ∈ {1, . . . , m − 1} and define them
lidar, etc.)                                                                      for each explicit-Barrier.
Cross connection. It can be noted from (3) that each head                         Train each head of explicit-Barriers, respectively.
of ABNet k ∈ {1, . . . , h} has some cross connection with                        Choose a pi (z|θ pi ), i ∈ {1, . . . , m − 1} from one of the
other heads, as also shown in Fig. 1. In other words,                             explicit-Barriers to build cross connection.
ψ j,i (x, z|θ p ), i ∈ {1, . . . , m − 1}, j ∈ S are formulated in the            Fuse all the explicit-Barriers via (6).
same way through the shared parameter θ p (independent                         else
from k). This is to ensure (i) the construction for provable                      Directly train the ABNet via reverse mode error back
safety (as shown later), and (ii) some shared information                         propagation.
across different heads of ABNet as they all generate safe                      end if
controls for the robot.
Fusion. Another important consideration is how should we                     ABNet can generate smooth signals.
fuse all these controls uk , k ∈ {1, . . . , h} while preserving             Theorem 3.2. (Safety of merging of ABNets) Given two
the safety property of each head of the ABNet. We propose                    ABNets, the merged model using the form as in (5) again
the following form:                                                          guarantees the safety of system.
                    h                      h
             u = ∑ wk uk ,        where ∑ wk = 1.                 (5)        3.2. Model Training
                   k=1                    k=1
                                                                             The ABNet can be trained incrementally or in one-shot.
In the above, wk ≥ 0, k ∈ {1, . . . , h} are trainable parameters.           This is due to the fact that each head of ABNet can generate
The composition of explicit-Barrier (4), BarrierNet, and                     a control policy that is applicable to the system. The linear
dMPCs, etc, in the form of (5) is our proposed ABNet, as                     combination weights wk , k ∈ {1, . . . , h} in the ABNet denote
shown in Fig. 2. The safety guarantees of the ABNet is                       the importance of the corresponding control policies.
shown in the following theorem:
                                                                             Incremental training. In ABNet, we may train each head
Theorem 3.1. (Safety of ABNets) Given the multi-head                         k, k ∈ {1, . . . , h} of the model in a scalable way as we wish to
ABNet formulated as in (4) and all other safe learning mod-                  minimize the loss between their output uk and the label u∗
els (BarrierNet, dMPC, etc.). If the system is initially safe                as well. The training can be done by directly incorporating
(i.e., b j (x(t0 )) ≥ 0, ∀ j ∈ S), then a control policy u from              the explicit-Barrier (4) into the model. There are some cross
the ABNet output (5) guarantees the safety of system, i.e.,                  connections via pi (z|θ p ) between explicit-Barriers in the
b j (x(t)) ≥ 0, ∀ j ∈ S, ∀t ≥ t0 .                                           ABNet that may prevent the implementation of the training.
All the proofs for theorems are given in Appendix B. If                      We may address this by training a pi (z|θ p ) for each head
the system is not initially safe (i.e., b j (x(t0 )) < 0, ∃ j ∈ S),          of the ABNet. After we train all heads of the model, we
then the system state x will be driven to the safe side of the               may fix the parameters of those models, choose a pi (z|θ p )
state space due to the Lyapunov property of CBF/HOCBFs                       from one of the explicit-Barriers (or take an average of all
(Ames et al., 2017) (Xiao & Belta, 2021). This enables the                   pi (z|θ p ) among the models) to build the cross connection,
possibility of utilizing data that violates safety to conduct                and train the weights wi for some more iterations. Another
adversary training of the ABNet.                                             way is to fuse these explicit-Barriers by testing loss. In other
                                                                             words, the weight wk , k ∈ {1, . . . , h} can be determined by:
Natural noise filter. The ABNet is a natural noise filter
since wk ∈ [0, 1], ∀k ∈ {1, . . . , h} in (5). This can ensure that                                      1/ℓk (uk , u∗ )
                                                                                               wk =                         ,              (6)
the output u of the model is stable with a large enough head                                          ∑hk=1 1/ℓk (uk , u∗ )
number h if all the heads have different observation zk for
                                                                             where ℓk is a loss function.
the current environment. This feature makes ABNet a very
robust and adaptive controller for robotic systems, and thus,                If we already have some trained ABNet, and we wish to

                                                                         4
                                                                           ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning


                                                                                                                          0.1650
                                                                                                                         (4.3e-3)
                             0.16                   explicit-Barrier
                                                    dQP
                             0.14
      Computation time (s)


                             0.12
                                                                                                         0.0971
                             0.10                                                                       (5.7e-3)

                             0.08
                             0.06                                                       0.0475
                                                                                       (1.3e-4)
                                                                       0.0347
                             0.04                     0.0245          (3.3e-3)
                                                     (8.0e-3)
                             0.02
                                                8.7e-4           9.1e-4           8.8e-4           9.2e-4           9.3e-4
                                               (9.2e-5)         (1.8e-4)         (1.3e-4)         (1.7e-4)         (1.7e-4)
                             0.00                    1               32              128              512             1024
                                                                             Batch_size

                                           6
                                                    NN                                                                    5.241
                                                    ABNet                                                               (2.2e+01)
                                           5        BNet
                    Training time (hour)




                                           4

                                           3

                                           2

                                           1                                             0.538
                                                                                        (1.7e-1)          0.315
                                                0.013 0.017 0.068 0.023 0.046                     0.107 (5.5e-4)
                                               (6.9e-4)(6.2e-4)(6.7e-4) (5.6e-4)(6.2e-4)         (5.6e-4)
                                           0          1                           10                         100
                                                                           num of heads
Figure 3: Computation (upper, numbers in the bracket de-                                                                                Figure 4: 2D robot obstacle avoidance closed-loop testing
note variance) and training efficiency (lower, numbers in                                                                               control profiles (upper) and ABNet performance with the
the bracket denote testing loss) comparison of our proposed                                                                             increasing of ABNet heads using scalable training (lower).
explicit-Barrier (ABNet) with dQP and BarrierNet (BNet).                                                                                This scalable training for ABNet is with safety guarantees.
The use of dQP in BarrierNet could give very bad solutions.                                                                             The controls are subject to input noise, and thus are non-
NN is a normal neural network without safety guarantees.                                                                                smooth.
                                                                                                                                        • How does the proposed explicit-Barrier compare with dQP
add some new capabilities (such as safe driving by only                                                                                   (Amos & Kolter, 2017) and BarrierNet (Xiao & Belta,
focusing on the left lane boundary) to the model, then we                                                                                 2021) in terms of computation and training efficiency?
can train some heads of ABNets based on the new data
we have. Finally, we can fuse the models similarly with                                                                                 • Does our method match the theoretic results in experiments
safety guarantees as shown in Thm. 3.2. This shows the                                                                                    and is it scalable?
scalability of the proposed ABNet that allows us to build                                                                               • How does our method compare with state-of-the-art mod-
larger foundational safe models in an incremental way.                                                                                    els in enforcing safety constraints?
One-shot/Direct training. The one-shot training of the AB-                                                                              • The benefit of models/policies merging and the robustness
Net can be directly done using the traditional reverse mode                                                                               of our models in safety and smoothness?
automatic differentiation. In addition to the loss between the
eventual output u of the ABNet and the label u∗ , we may                                                                                Benchmark models: We compare with (i) baseline: Ta-
also consider the losses on uk , k ∈ {1, . . . , h}, as well as on                                                                      bles 1, 2–single end-to-end learning model (E2E) (Levine
the reference controls H −1 (zk |θh,k )F(zk |θ f ,k ), in order to                                                                      et al., 2016) and Table 3–single vanilla end-to-end (V-E2E)
improve the training performance.                                                                                                       model (Amini et al., 2022), (ii) safety guaranteed models:
                                                                                                                                        (implicit-) BarrierNet (BNet) (Xiao et al., 2023), Deep for-
The construction and training of the ABNet involve the
                                                                                                                                        ward and backward (DFB) model (Pereira et al., 2020), (iii)
formulation of each head of explicit-Barriers as in (4), the
                                                                                                                                        policies merging: BarrierNet policies merged with uncer-
model fusion as in (5), and the scalable or direct training as
                                                                                                                                        tainty propagation (BNet-UP) (Wang et al., 2023b) that
shown above (Alg. 1).
                                                                                                                                        employs Gaussian kernels with Scott’s rule (Scott, 2015) to
                                                                                                                                        select the bandwidth, (iv) models merging: E2Es merged
4. Experiments                                                                                                                          with Monte-Carlo Dropout (E2Es-MCD) (Gal & Ghahra-
                                                                                                                                        mani, 2016), E2Es merged with Deep Resembles (E2Es-DR)
In this section, we conduct several experiments to answer
                                                                                                                                        (Lakshminarayanan et al., 2017).
the following questions:
                                                                                                                                    5
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

                        Table 1: 2D robot obstacle avoidance closed-loop testing under noisy input.
                M ODEL                    S AFETY       C ONSER .          MSE(↓)        u1 U NCER -     u2 U NCER -    T HEORET.
                                           (≥ 0)        (≥ 0& ↓)                         TAINTY (↓)      TAINTY (↓)     GUAR .

    E2E (L EVINE ET AL ., 2016)           -14.140     −2.976±3.770 0.007±0.004              0.063          0.049          ×
         E2E S -MCD (G AL &                -2.087     −1.341±0.824 0.004±0.001              0.041          0.026          ×
        G HAHRAMANI , 2016)
  E2E S -DR (L AKSHMINARAYANAN            -35.130     −3.176±4.299 0.080±0.006              0.032          0.020          ×
           ET AL ., 2017)
                                                                                                                          √
   DFB (P EREIRA ET AL ., 2020)            36.659     47.810±4.377       0.013±0.003        0.062          0.052          √
    BN ET (X IAO ET AL ., 2023)            5.045      7.966±1.287        0.014±0.006        0.074          0.047
  BN ET-UP (WANG ET AL ., 2023 B )         5.988      8.573±1.738        0.008±0.004        0.054          0.028          ×
                                                                                                                          √
        ABN ET-10- SC ( OURS )              5.731     6.269±0.319        0.011±0.007        0.065          0.027          √
         ABN ET-10 ( OURS )                12.639     13.887±1.323       0.008±0.005        0.049          0.030          √
         ABN ET-100 ( OURS )               10.122     11.729±0.816       0.012±0.006        0.049          0.013


Our models: We consider the minimum function method                   4.2. 2D Robot Obstacle Avoidance
in determining bI (x) and bII (x). Sec. 4.2 and 4.3: ABNet
                                                                      We aim to find a neural network controller for a 2D robot
trained in a scalable way with 10 heads (ABNET-10-SC),
                                                                      that can drive the robot from an initial location to an ar-
ABNet trained in one shot with 10 heads (ABNET-10), AB-
                                                                      bitrary destination while avoiding crash onto the obstacle.
Net trained in one shot with 100 heads (ABNET-100). Sec.
                                                                      All the models (h copies/heads) have the same input (with
4.4: our ABNet trained in one shot with 10 heads using the
                                                                      uniformly distributed noise, 10% of the input magnitude in
same input images (ABNET), ABNet with attention images
                                                                      testing). The detailed problem setup and model introduc-
and 10 heads (ABNET-ATT), our ABNet first trained with
                                                                      tions are given in Appendix C.2.
ABNET scaled by ABNET-ATT (20 heads, ABNET-SC).
Evaluation metrics: The evaluation metrics are defined
as follows: mean square error of the model testing (MSE),
satisfaction of safety constraints where non-negative val-
ues mean safety guarantees (SAFETY), system conserva-
tiveness (CONSER.), steering control u1 uncertainty (u1
UNCERTAINTY), acceleration control u2 uncertainty (u2
UNCERTAINTY), and theoretical safety guarantees (THE-
ORET. GUAR.) respectively. The metrics are explicitly
defined in Appendx C.

4.1. Computation and Training Time
We first compare the training stability and efficiency of our
proposed explicit-Barrier (or ABNet) with dQP (Amos &
Kolter, 2017) and BarrierNet (Xiao et al., 2023). The dQP
method is based on the “QPFunction” library from OptNet
(Amos & Kolter, 2017), and BarrierNet is based on dQP. The
computation times under different batch sizes are shown in
Fig. 3 (upper). The computation time significantly increases
as the increasing of the batch size, but the proposed explicit-
Barrier remains to be efficient. Fig. 3 (lower) shows the
training time (of the model based on the 2D robot case in
Sec. 4.2) under different number of heads. The training               Figure 5: Robot manipulation closed-loop end-effector tra-
time of our proposed ABNet is comparable to a normal NN               jectories (upper) and ABNet performance with the increas-
(NN is without safety guarantees). While the BarrierNet               ing of model heads using scalable training (lower). The
(based on dQP) tends to give very bad training and testing            transparent trajectories in the upper figure are correspond-
solutions, as also shown in Fig. 7 in the Appendix, which             ing to results in all runs.
significantly deteriorates the quality of model training.
                                                                      Models/policies merging can improve the performance as

                                                                  6
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

          Table 2: Robot manipulation closed-loop testing under noisy input and comparisons with benchmarks.
                M ODEL                   S AFETY       C ONSER .           MSE(↓)          u1 U NCER -     u2 U NCER -     T HEORET.
                                          (≥ 0)        (≥ 0& ↓)                            TAINTY (↓)      TAINTY (↓)      GUAR .

    E2E (L EVINE ET AL ., 2016)          -11.027     −1.082±2.992 3.6e-4±1.7e-4               0.013           0.009           ×
         E2E S -MCD (G AL &              -11.827     0.162±2.085 1.1e-4±7.3e-5                0.008           0.005           ×
        G HAHRAMANI , 2016)
  E2E S -DR (L AKSHMINARAYANAN           -11.381     −0.958±1.875 1.3e-4±8.5e-5               0.007           0.005           ×
           ET AL ., 2017)
                                                                                                                              √
   DFB (P EREIRA ET AL ., 2020)            2.905     6.023±3.110        8.7e-4±1.9e-4         0.019           0.018           √
    BN ET (X IAO ET AL ., 2023)            0.147     0.745±0.505        2.3e-4±1.2e-4         0.010           0.009
  BN ET-UP (WANG ET AL ., 2023 B )         0.206     0.346±0.098        5.2e-5±3.2e-5         0.005           0.005           ×
                                                                                                                              √
        ABN ET-10- SC ( OURS )             0.233     0.570±0.360        5.9e-5±5.5e-5         0.006           0.005           √
         ABN ET-10 ( OURS )                0.039     0.272±0.443        1.2e-4±9.6e-5         0.008           0.007           √
         ABN ET-100 ( OURS )               0.053     0.123±0.177        1.1e-4±4.4e-5         0.005           0.004


shown by the MSE metrics in Table 1 and the scalable train-           Table 2, the proposed ABNet-100 model is the least con-
ing in Fig. 4. Note that our scalable training for ABNets             servative one with the lowest control uncertainties as well
has safety guarantees. The DFB tends to be very conserva-             under noisy inputs (significantly improved compared with
tive as the CBFs within which are not differentiable, which           BNet and DFB), which demonstrates its advantage over
presents a high conservative value shown in Table 1. Our              other models. This uncertainty improvement is also shown
proposed ABNets can significantly reduce the uncertainty of           by the control distributions in Fig. 9 in Appendix C.3 (BNet:
the outputs (controls) under noisy input while guaranteeing           red area v.s. ABNet-100: blue area). The BNet-UP achieves
safety, and this uncertainty decreases as the increases of the        the best performance without safety guarantees.
heads in the ABNets, as shown by the last two and three
columns in Table 1, as well as shown in Fig. 4 and 8 of               4.4. Vision-based End-to-End Autonomous Driving
Appendix C.2 where the control uncertainty of ABNet-100
is lower than the one of BNet. The smoothness of the con-             We finally test our models in a more complicated and real-
trols also increases with the increase of model heads (e.g.,          istic task: vision-based driving, using an open dataset and
blue from ABNet v.s. red from BNet in Fig. 8). In terms of            benchmark from the VISTA (Amini et al., 2022). One of
performance, our proposed ABNets can also improve the                 ABNets, named ABNet-att, is constructed such that different
testing errors compared to BNet and DFB, as shown by the              heads focus on different parts of the image (left lane bound-
MSE in Table 1. The E2Es-MCD model can achieve the best               ary, right lane boundary, etc., the corresponding images are
performance, but this is at the cost of safety (the SAFETY            shown in Fig 10 of Appendix C.4). For more experiment
metric in Table 1 is negative, which implies violated safety).        and model details, please refer to Appendix C.4.
                                                                      As shown in Table 3, the proposed ABNets can avoid crash
4.3. Safe Robot Manipulation                                          onto obstacles with 100% obstacle passing rate, including
                                                                      the ABNet-sc that is trained in a scalable way with two
In robot manipulation, we employ a two-link planar robot
                                                                      ABNets (also shown by the scalable training in Fig. 6). This
manipulator to grasp an object from an arbitrary point to an
                                                                      is because the ABNets can learn the correct steering control
arbitrary destination while avoiding crashing onto obstacles.
                                                                      (the blue and green sine waves shown in Fig. 11 (right)
All the models (h copies/heads) have the same input (with
                                                                      in Appendix C.4) to avoid the obstacle without stopping in
uniformly distributed noise, 10% of the input magnitude
                                                                      front of it. Compared to the baseline MPC, the proposed AB-
in testing). We compare our proposed ABNets with the
                                                                      Net is much more efficient (0.004s v.s. 0.872s). Although
same benchmark models as in the last subsection. More
                                                                      linearization is possible in MPC to improve the efficiency,
detailed problem setup and model introductions are given
                                                                      it may make the MPC lose safety guarantees. The DFB and
in Appendix C.3.
                                                                      BNet-related models learn a significant deceleration control
Again, models/policies merging can improve the perfor-                (shown in Fig. 11) to avoid crashing onto obstacles, which
mance as shown by the MSE metrics in Table 2 and the                  explains why the corresponding obstacle passing rates are
scalable training in Fig. 5. All the E2E-related models are           low compared to other models in Table 3 and why the blue
not robust to noise and violate safety constraints (i.e., crash       trajectories (BNet) terminate near the obstacle in Fig. 6
onto obstacles) under noisy input since there are no formal           (upper). Nonetheless, there are still some crash cases in
guarantees, and such an example is shown by the magenta               DFB and BNet models due to badly learned CBF parame-
trajectory curve of the end-effector in Fig. 5. As shown in           ters that make the inter-sampling effect (i.e., safety violation

                                                                  7
                                   ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

Table 3: Vision-based end-to-end autonomous driving closed-loop testing and comparisons with benchmarks. New items are
short for obstacle crash rate (CRASH), obstacle passing rate (PASS).
                        M ODEL                      C RASH            PASS        S AFETY       C ONSER .      u1 U NCER -   u2 U NCER -   T HEORET.
                                                      (↓)              (↑)         (≥ 0)        (≥ 0& ↓)      TAINTY (↓)     TAINTY (↓)    GUAR .

   V-E2E (A MINI ET AL ., 2022)                         6%             94%        -60.297    −0.610±21.165       0.443         0.222         ×
         E2E S -MCD (G AL &                             8%             92%        -60.566    −2.211±22.343       0.429         0.227         ×
        G HAHRAMANI , 2016)
  E2E S -DR (L AKSHMINARAYANAN                          9%             91%        -60.572    −1.499±21.500       0.431         0.224         ×
           ET AL ., 2017)
                                                                                                                                             √
   DFB (P EREIRA ET AL ., 2020)                         4%          39%           -18.114    −0.828±5.444        0.513         0.125         √
    BN ET (X IAO ET AL ., 2023)                         3%          33%           -16.694    −4.882±4.817        0.724         0.385
  BN ET-UP (WANG ET AL ., 2023 B )                      2%          35%           -23.252    −5.190±4.920        0.726         0.532         ×
                                                                                                                                             √
           ABN ET ( OURS )                              0%          100%           1.455     6.132±2.181         0.168         0.316         √
         ABN ET- ATT ( OURS )                           0%          100%           4.198     8.053±1.449         0.172         0.269         √
          ABN ET- SC ( OURS )                           0%          100%           2.221     7.224±1.667         0.130         0.256


between discretized times) serious. Most importantly, our                                setting, as shown by the magenta (ABNet-att) and cyan
proposed ABNet can learn less uncertain controls for this                                (ABNet) trajectories in Fig. 6 (upper) and the green (ABNet-
complicated task, as shown in Table 3, the scalable training                             att) and blue (ABNet) areas in Fig. 11. Ablation studies
in Fig. 6, and Fig. 11 (e.g., ABNet:blue or ABNet-att:green                              on the robustness of our ABNets in terms of safety under
area v.s. BNet: red area).                                                               high-noisy inputs (50% noise level) are given in Table 4 of
                                                                                         Appendix C.4.
              40
                          V-E2E
              35          MPC                                                            5. Related Works
                          ABNet
              30          ABNet-att
                          ABNet-sc                                                       Scalability, merging and uncertainty in safe robot learn-
              25          BNet-UP                                                        ing. Machine learning has been widely used in robot control
                          BNet
                          Road boundaries                                                (Bommasani et al., 2021) (Singh et al., 2023) (Wang et al.,
       y(m)




              20
                          Obstacle                                                       2023a). However, there is increasing concern for machine
              15
                                                                                         learning, especially large foundation models, being used in
              10                                                                         robotics (Bommasani et al., 2021). Mixture of expert meth-
              5                                                                          ods (Shazeer et al., 2017) (Riquelme et al., 2021) (Zhou
                                                                                         et al., 2022) are scalable but hard to retain the property
              0
                   25    20   15   10       5   0   5   10   15                          (such as safety) of the models. The uncertainty resulting
                                        x(m)
                                                                                         from noisy model input or dataset is preventing the deploy-
                                                              4.0                        ment to real robots (Loquercio et al., 2020) (Kahn et al.,
                                                                                         2017). To address this, predictive uncertainty quantifica-
                                                              3.5
                                                                                         tion (Gal & Ghahramani, 2016) (Lakshminarayanan et al.,
                                                              3.0                        2017), also a model merging approach, has been widely
                                                                  Uncertainties




                                                              2.5                        adopted. It has been shown to work well in vision-based
                                                                                         autonomous driving under noisy input (Wang et al., 2023b)
                                                              2.0
                                                                                         using the Gaussian kernel with Scott’s rule (Scott, 2015) to
                                                              1.5                        select bandwidth. The main challenge of this technique is
                                                              1.0                        that it may make the system lose performance guarantees,
                                                                                         such as safety. Other model merging approaches (Huang
Figure 6: Vision-based end-to-end autonomous driving                                     et al., 2023) (Ramé et al., 2023) (Wang et al., 2024) do not
closed-loop testing trajectories in VISTA (upper) and AB-                                preserve safety either. We address the uncertainty and scal-
Net performance with the increasing of model heads using                                 ablibity problem using the proposed ABNets with provable
scalable training (lower). This scalable training is done by                             safety.
both the ABNet and ABNet-att in Table 3 with safety guar-                                CBFs and set invariance. In control theory, the set in-
antees.                                                                                  variance has been widely adopted to prove and enforce the
The ABNet-att can learn more consistent autonomous driv-                                 safety of dynamical systems (Blanchini, 1999) (Rakovic
ing behavior than the ABNet due to the image attention                                   et al., 2005) (Ames et al., 2017) (Xiao & Belta, 2021) (Xiao

                                                                                     8
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

et al., 2023). The Control Barrier Function (CBF) (Ames               2020), and this can also be done in conjunction with AB-
et al., 2017) (Xiao & Belta, 2021) is such a state of the             Net. Third, the model merging is done in the output space,
art technique that can enforce set invariance (Aubin, 2009),          future work will further focus on model merging with safety
(Prajna et al., 2007), (Wisniewski & Sloth, 2013), and trans-         guarantees in the parameter space. Finally, we will apply
forms a nonlinear optimization problem to a quadratic prob-           the proposed model in environments that involve contact
lem that is very efficient to solve. CBFs originates from             handling, such as grasping.
barrier functions that are originally used in optimization
problems (Boyd & Vandenberghe, 2004). However, the                    Acknowledgements
CBF tends to make the system conservative (i.e., at the cost
of performance) in order to enforce safety, and it is not             The research was supported in part by Capgemini Engineer-
scalable to build large models. Our proposed ABNet can                ing. It was also partially sponsored by the United States Air
address all these limitations.                                        Force Research Laboratory and the United States Air Force
                                                                      Artificial Intelligence Accelerator and was accomplished
Safety in neural networks. Safety is usually enforced us-
                                                                      under Cooperative Agreement Number FA8750-19-2-1000.
ing optimizations. Barrier functions have been widely used
                                                                      The views and conclusions contained in this document are
in safe Reinforcement Learning (RL) (Tessler et al., 2018;
                                                                      those of the authors and should not be interpreted as repre-
Achiam et al., 2017). However, safety cannot be guaranteed
                                                                      senting the official policies, either expressed or implied, of
in safe RL as the barrier functions are used as part of the
                                                                      the United States Air Force or the U.S. Government. The
reward function (a soft constraint). Recently, differentiable
                                                                      U.S. Government is authorized to reproduce and distribute
optimizations show great potential for learning-based con-
                                                                      reprints for Government purposes notwithstanding any copy-
trol with safety guarantees (Pereira et al., 2020; Amos et al.,
                                                                      right notation herein. This research was also supported in
2018; Xiao et al., 2023; Liu et al., 2023). The quadratic
                                                                      part by the AI2050 program at Schmidt Futures (Grant G-
program (QP) can be employed as a layer in the neural net-
                                                                      965 22-63172), and by the ONR Science of Autonomy pro-
work, i.e., the OptNet (Amos & Kolter, 2017). The OptNet
                                                                      gram N00014-23-1-2354.
has been used with CBFs in neural networks as a safe filter
controls (Pereira et al., 2020), in which CBFs themselves
are not trainable, which can significantly limit the learning         Impact Statement
capability. Neural network controllers with safety certificate
                                                                      This paper presents work whose goal is to advance the field
have been learned through verification-in-the-loop training
                                                                      of Machine Learning. There are many potential societal
(Deshmukh et al., 2019; Zhao et al., 2021; Ferlez et al.,
                                                                      consequences of our work, none which we feel must be
2020). However, the verification method cannot guarantee
                                                                      specifically highlighted here.
to cover the whole state space, and this method is also very
computationally expensive. None of these methods are scal-
able to larger models, and are subject to uncertainty, which          References
the proposed ABNet can address.                                       Achiam, J., Held, D., Tamar, A., and Abbeel, P. Constrained
                                                                        policy optimization. In International conference on ma-
6. Conclusions, Limitations and Future Work                             chine learning, pp. 22–31. PMLR, 2017.
We propose Adaptive explicit-Barrier Net (ABNet) that                 Agarwal, N., Brukhim, N., Hazan, E., and Lu, Z. Boost-
merges many safety-critical learning models while preserv-              ing for control of dynamical systems. In International
ing the safety in this paper. The proposed ABNet is efficient          Conference on Machine Learning, pp. 96–103. PMLR,
to train, scalable to build larger safe learning models, can            2020.
achieve better performance, and is robust to input noise. We
have demonstrated the effectiveness of the model on a se-             Ames, A. D., Xu, X., Grizzle, J. W., and Tabuada, P. Control
ries of robot control tasks. Nonetheless, our model (and all           barrier function based quadratic programs for safety crit-
the other barrier-based learning models (Ferlez et al., 2020)          ical systems. IEEE Transactions on Automatic Control,
(Xiao et al., 2023)) still have a few limitations motivating           62(8):3861–3876, 2017.
for further research.                                                 Amini, A., Wang, T.-H., Gilitschenski, I., Schwarting, W.,
Limitations. First, all the ABNets have the same safety                Liu, Z., Han, S., Karaman, S., and Rus, D. Vista 2.0:
constraints. We will explore how to merge ABNets with                  An open, data-driven simulator for multimodal sensing
different safety constraints in the future. Second, the ABNet          and policy learning for autonomous vehicles. In 2022
also requires safety specifications that may be unknown in             International Conference on Robotics and Automation
some robot control tasks, we may learn the safety specifi-             (ICRA), pp. 2419–2426. IEEE, 2022.
cations from data (Robey et al., 2020), (Srinivasan et al.,           Amos, B. and Kolter, J. Z. Optnet: Differentiable optimiza-

                                                                  9
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

  tion as a layer in neural networks. In Proceedings of                Levine, S., Finn, C., Darrell, T., and Abbeel, P. End-to-end
  the 34th International Conference on Machine Learning -                training of deep visuomotor policies. Journal of Machine
  Volume 70, pp. 136–145, 2017.                                          Learning Research, 17(39):1–40, 2016.
Amos, B., Rodriguez, I. D. J., Sacks, J., Boots, B., and               Li, J., Li, D., Xiong, C., and Hoi, S. Blip: Bootstrapping
 Kolter, J. Z. Differentiable mpc for end-to-end planning                language-image pre-training for unified vision-language
 and control. In Proceedings of the 32nd International                   understanding and generation. In International confer-
 Conference on Neural Information Processing Systems,                    ence on machine learning, pp. 12888–12900. PMLR,
 pp. 8299–8310. Curran Associates Inc., 2018.                            2022.
Aubin, J.-P. Viability theory. Springer, 2009.                         Liu, W., Xiao, W., and Belta, C. Learning robust and correct
Beygelzimer, A., Hazan, E., Kale, S., and Luo, H. On-                    controllers from signal temporal logic specifications using
  line gradient boosting. Advances in neural information                 barriernet. In 2023 62nd IEEE Conference on Decision
  processing systems, 28, 2015.                                          and Control (CDC), pp. 7049–7054. IEEE, 2023.

Blanchini, F. Set invariance in control. Automatica, 35(11):           Loquercio, A., Segu, M., and Scaramuzza, D. A general
  1747–1767, 1999.                                                       framework for uncertainty estimation in deep learning.
                                                                         IEEE Robotics and Automation Letters, 5(2):3153–3160,
Bommasani, R., Hudson, D. A., Adeli, E., Altman, R.,                     2020.
  Arora, S., von Arx, S., Bernstein, M. S., Bohg, J., Bosse-
  lut, A., Brunskill, E., et al. On the opportunities and risks        Luenberger, D. G. Optimization by vector space methods.
  of foundation models. arXiv preprint arXiv:2108.07258,                 John Wiley & Sons, 1997.
  2021.
                                                                       Nagumo, M. Über die lage der integralkurven gewöhnlicher
Boyd, S. P. and Vandenberghe, L. Convex optimization.                    differentialgleichungen. In Proceedings of the Physico-
  Cambridge university press, New York, 2004.                            Mathematical Society of Japan. 3rd Series. 24:551-559,
                                                                        1942.
Deshmukh, J. V., Kapinski, J. P., Yamaguchi, T., and
  Prokhorov, D. Learning deep neural network controllers               Pereira, M. A., Wang, Z., Exarchos, I., and Theodorou, E. A.
  for dynamical systems with safety guarantees: Invited                  Safe optimal control using stochastic barrier functions
  paper. In 2019 IEEE/ACM International Conference on                    and deep forward-backward sdes. In Conference on Robot
  Computer-Aided Design (ICCAD), pp. 1–7, 2019.                          Learning, 2020.
Ferlez, J., Elnaggar, M., Shoukry, Y., and Fleming, C.                 Prajna, S., Jadbabaie, A., and Pappas, G. J. A framework for
  Shieldnn: A provably safe nn filter for unsafe nn con-                 worst-case and stochastic safety verification using barrier
  trollers. preprint arXiv:2006.09564, 2020.                             certificates. IEEE Transactions on Automatic Control, 52
Gal, Y. and Ghahramani, Z. Dropout as a bayesian approx-                 (8):1415–1428, 2007.
  imation: Representing model uncertainty in deep learn-               Rakovic, S. V., Kerrigan, E. C., Kouramas, K. I., and Mayne,
  ing. In international conference on machine learning, pp.              D. Q. Invariant approximations of the minimal robust
 1050–1059. PMLR, 2016.                                                  positively invariant set. IEEE Transactions on automatic
Glotfelter, P., Cortes, J., and Egerstedt, M. Nonsmooth                  control, 50(3):406–410, 2005.
  barrier functions with applications to multi-robot systems.          Ramé, A., Ahuja, K., Zhang, J., Cord, M., Bottou, L., and
  IEEE control systems letters, 1(2):310–315, 2017.                      Lopez-Paz, D. Model ratatouille: Recycling diverse
Huang, C., Liu, Q., Lin, B. Y., Pang, T., Du, C., and Lin, M.            models for out-of-distribution generalization. In Inter-
  Lorahub: Efficient cross-task generalization via dynamic               national Conference on Machine Learning, pp. 28656–
  lora composition. arXiv preprint arXiv:2307.13269,                     28679. PMLR, 2023.
  2023.
                                                                       Riquelme, C., Puigcerver, J., Mustafa, B., Neumann, M.,
Kahn, G., Villaflor, A., Pong, V., Abbeel, P., and Levine, S.            Jenatton, R., Susano Pinto, A., Keysers, D., and Houlsby,
  Uncertainty-aware reinforcement learning for collision                 N. Scaling vision with sparse mixture of experts. Ad-
  avoidance. arXiv preprint arXiv:1702.01182, 2017.                      vances in Neural Information Processing Systems, 34:
                                                                         8583–8595, 2021.
Lakshminarayanan, B., Pritzel, A., and Blundell, C. Simple
  and scalable predictive uncertainty estimation using deep            Robey, A., Hu, H., Lindemann, L., Zhang, H., Dimarogonas,
  ensembles. Advances in neural information processing                   D. V., Tu, S., and Matni, N. Learning control barrier
  systems, 30, 2017.                                                     functions from expert demonstrations. In 2020 59th IEEE

                                                                  10
                        ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

  Conference on Decision and Control (CDC), pp. 3717–               Xiao, W., Belta, C., and Cassandras, C. G. Adaptive con-
  3724, 2020.                                                         trol barrier functions. IEEE Transactions on Automatic
                                                                      Control, 67(5):2267–2281, 2021.
Rucco, A., Notarstefano, G., and Hauser, J. An efficient
  minimum-time trajectory generation strategy for two-              Xiao, W., Wang, T.-H., Hasani, R., Chahine, M., Amini,
  track car vehicles. IEEE Transactions on Control Systems            A., Li, X., and Rus, D. Barriernet: Differentiable control
  Technology, 23(4):1505–1519, 2015.                                  barrier functions for learning of safe robot control. IEEE
                                                                      Transactions on Robotics, 39(3):2289–2307, 2023.
Scott, D. W. Multivariate density estimation: theory, prac-
  tice, and visualization. John Wiley & Sons, 2015.                 Zhao, H., Zeng, X., Chen, T., Liu, Z., and Woodcock, J.
                                                                      Learning safe neural network controllers with barrier cer-
Shazeer, N., Mirhoseini, A., Maziarz, K., Davis, A., Le,              tificates. Form Asp Comp, 33:437–455, 2021.
  Q., Hinton, G., and Dean, J. Outrageously large neural
  networks: The sparsely-gated mixture-of-experts layer.            Zhou, Y., Lei, T., Liu, H., Du, N., Huang, Y., Zhao, V.,
  arXiv preprint arXiv:1701.06538, 2017.                              Dai, A. M., Le, Q. V., Laudon, J., et al. Mixture-of-
                                                                      experts with expert choice routing. Advances in Neural
Singh, I., Blukis, V., Mousavian, A., Goyal, A., Xu, D.,              Information Processing Systems, 35:7103–7114, 2022.
  Tremblay, J., Fox, D., Thomason, J., and Garg, A. Prog-
  prompt: Generating situated robot task plans using large
  language models. In 2023 IEEE International Conference
  on Robotics and Automation (ICRA), pp. 11523–11530.
  IEEE, 2023.

Srinivasan, M., Dabholkar, A., Coogan, S., and Vela, P. A.
  Synthesis of control barrier functions using a supervised
  machine learning approach. In 2020 IEEE/RSJ Inter-
  national Conference on Intelligent Robots and Systems
  (IROS), pp. 7139–7145, 2020.

Tessler, C., Mankowitz, D. J., and Mannor, S. Re-
  ward constrained policy optimization. arXiv preprint
  arXiv:1805.11074, 2018.

Wang, L., Zhao, J., Du, Y., Adelson, E. H., and Tedrake, R.
 Poco: Policy composition from and for heterogeneous
 robot learning. arXiv preprint arXiv:2402.02511, 2024.

Wang, T.-H., Maalouf, A., Xiao, W., Ban, Y., Amini, A.,
 Rosman, G., Karaman, S., and Rus, D. Drive any-
 where: Generalizable end-to-end autonomous driving
 with multi-modal foundation models. arXiv preprint
 arXiv:2310.17642, 2023a.

Wang, T.-H., Xiao, W., Chahine, M., Amini, A., Hasani,
 R., and Rus, D. Learning stability attention in vision-
 based end-to-end driving policies. In Proceedings of The
 5th Annual Learning for Dynamics and Control Confer-
 ence, volume 211 of Proceedings of Machine Learning
 Research, pp. 1099–1111. PMLR, 15–16 Jun 2023b.

Wisniewski, R. and Sloth, C. Converse barrier certificate
 theorem. In Proc. of 52nd IEEE Conference on Decision
 and Control, pp. 4713–4718, Florence, Italy, 2013.

Xiao, W. and Belta, C. High-order control barrier functions.
  IEEE Transactions on Automatic Control, 67(7):3655–
  3662, 2021.

                                                               11
                           ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

A. Closed-form Solution of the Explicit-Barrier
Here, we show the process of deriving the closed-form solution of the explicit-Barrier following (Luenberger, 1997) (Ames
et al., 2017).
Similarly as in (3), we consider the following optimization (with the two specifications bI (x), bII (x) shown in the main text)
corresponding to the explicit-Barrier:
                                                    1
                                      uk = arg min u(t)T H(zk |θh,k )u(t) + F T (zk |θ f ,k )u(t)                                     (7)
                                               u(t) 2

s.t.
                                                                                  m
                  L f ψI,m−1 (x, z|θ p ) + [Lg ψI,m−1 (x, z|θ p )]u + pm,k (zk |θ p,k )αI,m (ψI,m−1 (x, z|θ p )) ≥ 0,
                                                                                    m
                  L f ψII,m−1 (x, z|θ p ) + [Lg ψII,m−1 (x, z|θ p )]u + pm,k (zk |θ p,k )αII,m (ψII,m−1 (x, z|θ p )) ≥ 0,

We first define
                                                                                                m
           g1 (x) = [−Lg ψI,m−1 (x, z|θ p )],     h1 (x) = L f ψI,m−1 (x, z|θ p ) + pm,k (zk |θ p,k )αI,m (ψI,m−1 (x, z|θ p )),
                                                                                                 m
                                                                                                                                      (8)
          g2 (x) = [−Lg ψII,m−1 (x, z|θ p )],     h2 (x) = L f ψII,m−1 (x, z|θ p ) + pm,k (zk |θ p,k )αII,m (ψII,m−1 (x, z|θ p )).

The matrix H is positive definite in the above optimization (7), we then define

                                           [ĝ1 (x), ĝ2 (x)] = H(zk |θh,k )−1 [g1 (x), g2 (x)],
                                                                                 g1 (x)T                                              (9)
                                                                                       
                                                 ĥ1 (x)         h1 (x)
                                                            =               −                 ûk
                                                 ĥ2 (x)         h2 (x)          g2 (x)T

where
                                                   ûk = −H(zk |θh,k )−1 F(zk |θ f ,k ).                                             (10)

Next, let vk := uk − ûk and ⟨·, ·⟩ define an inner product with weight matrix H(zk |θh,k ) so that ⟨vk , vk ⟩ = (vk )T H(zk |θh,k )vk .
The optimization problem (7) is equivalent to:

                                                    vk∗ = arg min⟨vk , vk ⟩,
                                                                   vk

                                                          s.t., ⟨ĝ1 (x), vk ⟩ ≤ ĥ1 (x),                                            (11)
                                                                  ⟨ĝ2 (x), vk ⟩ ≤ ĥ2 (x).

Finally, we have that the optimal solution of (7) is given by

                                                             uk = vk∗ + ûk .                                                        (12)

Let G(x) = [Gi j (x)] = [⟨ĝi (x), ĝ j (x)⟩], i, j = 1, 2 is the Gram matrix. Following (Luenberger, 1997) [Ch. 3], the unique
solution vk∗ to (11) is given by
                                                     vk∗ = λ1 (x)ĝ1 (x) + λ2 (x)ĝ2 (x)                                    (13)
where the two gate functions λ1 (x), λ2 (x) are given by:
                         
                         
                           0                                           if G21 (x) max(ĥ2 (x), 0) − G22 (x)ĥ1 (x) < 0
                          max(ĥ (x),0)
                                  1
               λ1 (x) =        G11 (x)                                  if G12 (x) max(ĥ1 (x), 0) − G11 (x)ĥ2 (x) < 0              (14)
                          max(G22 (x)ĥ1 (x)−G21 (x)ĥ2 (x),0)
                         
                                                                        otherwise .
                         
                                  G11 (x)G22 (x)−G12 (x)G21 (x)

                           
                             max(ĥ2 (x),0)
                           
                           
                              G22 (x)                                  if G21 (x) max(ĥ2 (x), 0) − G22 (x)ĥ1 (x) < 0
                  λ2 (x) =   0                                          if G12 (x) max(ĥ1 (x), 0) − G11 (x)ĥ2 (x) < 0              (15)
                            max(G11 (x)ĥ2 (x)−G12 (x)ĥ1 (x),0)
                           
                                                                        otherwise .
                           
                                  G11 (x)G22 (x)−G12 (x)G21 (x)


                                                                        12
                           ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

B. Proof of Theorems
Theorem 3.1. (Safety of ABNets) Given the multi-head ABNet formulated as in (4) and all other safe learning models
(BarrierNet, dMPC, etc.). If the system is initially safe (i.e., b j (x(t0 )) ≥ 0, ∀ j ∈ S), then a control policy u from the ABNet
output (5) guarantees the safety of system, i.e., b j (x(t)) ≥ 0, ∀ j ∈ S, ∀t ≥ t0 .
Proof: The proof outline is to first show the existence of new HOCBF constraints (corresponding to all the safety
specifications) that are defined over the output of the ABNet. Then, we can use Nagumo’s theorem (Nagumo, 1942) to
recursively show the forward invariance of each safety set in the HOCBFs, and this can eventually imply the satisfaction of
the safety specifications b j (x) ≥ 0, ∀ j ∈ S.
First, we show how we may ensure the safety of ABNet when there are other safe learning models, such as BarrierNet,
dMPC, etc. Given a safe learning model, we have that b j (x) ≥ 0, ∀ j ∈ S. By the adaptive CBF theorem (Xiao et al., 2021),
we have that the satisfaction of the adaptive CBF constraint is a necessary and sufficient condition for the safety of the
system. In other words, b j (x) ≥ 0, ∀ j ∈ S implies that there exists an adaptive CBF:
                                                                                  m
               L f ψ j,m−1 (x, z|θ p ) + [Lg ψ j,m−1 (x, z|θ p )]uk + pm,k (zk |θ p,k )α j,m (ψ j,m−1 (x, z|θ p )) ≥ 0, j ∈ S,        (16)
                  m ) > 0 is the penalty (adaptive) function, and ψ
where pm,k (zk |θ p,k                                               j,m−1 (x, z|θ p ) is defined as in (4).

Next, we consider the explicit-Barrier model. As shown in Appendix sec. A, the explicit-barrier (4) is the exact solution of
the QP (7). The solution of the QP (7) further implies the satisfaction of bI (x) ≥ 0, bII (x) ≥ 0 by the HOCBF theory (Xiao
& Belta, 2021), which is equivalent to have that b j (x) ≥ 0, ∀ j ∈ S (shown right before (4)). Again, by the adaptive CBF
theorem, we have that there exist adaptive CBFs as in the form of (16).
Finally, we only need to consider the case of fusing controllers uk , k ∈ {1, . . . , h} that satisfy the following:
                                                                                  m
               L f ψ j,m−1 (x, z|θ p ) + [Lg ψ j,m−1 (x, z|θ p )]uk + pm,k (zk |θ p,k )α j,m (ψ j,m−1 (x, z|θ p )) ≥ 0, j ∈ S,        (17)

Multiplying the weight wk ≥ 0 to the last equation, we have
                                                                                       m
           wk L f ψ j,m−1 (x, z|θ p ) + wk [Lg ψ j,m−1 (x, z|θ p )]uk + wk pm,k (zk |θ p,k )α j,m (ψ j,m−1 (x, z|θ p )) ≥ 0, j ∈ S,   (18)

Taking a summation of the last equation over all k ∈ {1, . . . , h}, the following equation establishes:
                                       h                                   h
                                      ∑ wk L f ψ j,m−1 (x, z|θ p ) + ∑ wk [Lg ψ j,m−1 (x, z|θ p )]uk
                                     k=1                                  k=1
                                                                                                                                      (19)
                                             h
                                                                m
                                       +∑        wk pm,k (zk |θ p,k )α j,m (ψ j,m−1 (x, z|θ p )) ≥ 0, j ∈ S,
                                           k=1


Since Lg ψ j,m−1 (x, z|θ p is a vector that is independent of k and ∑hk=1 wk = 1, the last equation can be rewritten as:
                                                                                            !
                                                                                                h
                                           L f ψ j,m−1 (x, z|θ p ) + Lg ψ j,m−1 (x, z|θ p )    ∑ wk uk
                                                                                               k=1
                                                                                                                                      (20)
                                            h
                                                                m
                                      +∑         wk pm,k (zk |θ p,k )α j,m (ψ j,m−1 (x, z|θ p )) ≥ 0, j ∈ S,
                                           k=1


The summation of class K functions is also a class K function. Since α j,m are class K functions, the
∑hk=1 wk pm,k (zk |θ p,k  j,m (ψ j,m−1 (x, z|θ p )) is also a class K function over ψ j,m−1 (x, z|θ p ). Therefore, equations (20)
                     m )α

are the new HOCBF constraints defined over the output of the ABNet, i.e., ∑hk=1 wk uk . In other words, whenever
ψ j,m−1 (x, z|θ p ) = 0, we have
                                                                                      !
                                                                                        h
                                 L f ψ j,m−1 (x, z|θ p ) + Lg ψ j,m−1 (x, z|θ p )      ∑ wk uk       ≥ 0, j ∈ S,                      (21)
                                                                                       k=1

                                                                         13
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning

The controls (outputs of the ABNet) ∑hk=1 wk uk ≡ u are directly used to drive the system, and z is taken as a piece-wise
constant within discretized time intervals (Xiao et al., 2023). Therefore, the last equation can be rewritten as
                  ∂ ψ j,m−1 (x, z|θ p )                    ∂ ψ j,m−1 (x, z|θ p )
                                        ( f (x) + g(x)u) =                       ẋ = ψ̇ j,m−1 (x, z|θ p ) ≥ 0, j ∈ S,         (22)
                          ∂x                                       ∂x

Since b j (x(t0 )) ≥ 0, we can always initialize the HOCBF definition such that ψ̇ j,m−1 (x, z|θ p ) ≥ 0 is satisfied at t0 (Xiao &
Belta, 2021). By Nagumo’s theorem (Nagumo, 1942) and (20)-(22), we have that ψ j,m−1 (x, z|θ p ) ≥ 0, ∀t ≥ t0 .
Recursively, we can show that ψ j,i (x, z|θ p ) ≥ 0, ∀t ≥ t0 , ∀i ∈ {0, . . . , m − 1} from i = m − 1 to i = 0. Since b j (x) =
ψ j,0 (x, z|θ p ) by (3), we have that b j (x(t)) ≥ 0, ∀t ≥ t0 , ∀ j ∈ S, which the safety guarantees of the ABNet for the system. ■




Theorem 3.2. (Safety of merging of ABNets) Given two ABNets, the merged model using the form as in (5) again
guarantees the safety of system.
Proof: The proof outline is similar to that of Theorem 3.1. From each ABNet, we can show the existence of new HOCBF
constraints (corresponding to all the safety specifications) that are defined over the output of each ABNet. Then we can
again show the existence of another set of new HOCBF constraints (corresponding to all the safety specifications) that are
defined over the output of the merged ABNet. Finally, we can also use Nagumo’s theorem (Nagumo, 1942) to recursively
show the forward invariance of each safety set in the HOCBFs, and this can eventually imply the satisfaction of the safety
specifications b j (x) ≥ 0, ∀ j ∈ S.
The mathematical proof is similar to that of Theorem 3.1, and thus is omitted.                                                   ■

C. Experiment Details
Metrics used in all the tables. The SAFETY metric is defined as:
                                       SAFETY = min{ min b(x(t))}k , k ∈ {1, . . . , N},                                       (23)
                                                       k       t∈[t0 ,T ]

where N is the number of testing runs (N = 100 in this case). T is the final time of each run. b(x) ≥ 0 is the safety constraint
that is given explicitly in each experiment below.
The CONSER. metric is defined as
                                  CONSER. mean = mean{ min b(x(t))}k , k ∈ {1, . . . , N},
                                                               k       t∈[t0 ,T ]
                                                                                                                               (24)
                                     CONSER. std = std{ min b(x(t))}k , k ∈ {1, . . . , N}.
                                                           k       t∈[t0 ,T ]


The UNCERTAINTY metric for both controls are calculated by:
                            ui UNCERTAINTY = mean {std{ui (t)}k , k ∈ {1, . . . , N}}, i ∈ {1, 2}.                             (25)
                                                      t∈[t0 ,T ]      k


All the class K functions in the BarrierNets/ABNets are implemented as linear functions with trainable slopes.

C.1. Training Stability and Efficiency
The dQP (Amos & Kolter, 2017) could give very bad solutions (although it still satisfies the safety constraints), as shown in
Fig. 7 (right), this could significantly deteriorate the training quality of the model.

C.2. 2D Robot Obstacle Avoidance
Models. All the models include fully connected layers of shape [5, 128, 32, 32, 2] with RELU as activation functions. There
are some additional layers of differentiable QPs in other models (other than E2E-related models). The model input is the
system state and the goal.

                                                                          14
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning




Figure 7: Comparison of ABNet (left) and BarrierNet (right) (based on dQP) in training stability. BarrierNet tends to give
very bad solutions. “time” in the x-axis denotes training iterations.

Training and Dataset. The dataset includes 100 trajectories, and each trajectory has 137 trajectory points. The ground
truth controls (i.e., training labels) are obtained via solving HOCBF-based QPs (Xiao & Belta, 2021). We use Adam as the
optimizer to train the model with a MSE loss function and a learning rate 0.001. We use the QPFunction from the OptNet
(Amos & Kolter, 2017) to solve the dQPs. The training time of the ABNet is about 1 hour for 20 epochs on a RTX-3090
computer.
Robot dynamics and safety constraints. We employ the bicycle model as the robot dynamics:
                                                                  
                                     ẋ(t)      v(t) cos θ (t)     0 0         
                                    ẏ(t)   v(t) sin θ (t)   0 0  u1 (t)
                                           =                +                                                     (26)
                                    θ̇ (t)         0          1 0  u2 (t)
                                     v̇(t)            0            0 1 | {zu
                                                                                }
                                   | {z } |           {z       } | {z }
                                       ẋ(t)               f (x)             g(x)


where (x, y) ∈ R2 denotes the 2D location of the robot, θ ∈ R is the heading angle of the robot, v ∈ R is the linear speed of
the robot. u1 , u2 are the angular speed and acceleration controls, respectively.
The safety constraint of the robot is defined as:

                                               b(x) = (x − x0 )2 + (y − y0 )2 − R2 ≥ 0,                                 (27)

where (x0 , y0 ) ∈ R2 is the 2D location of the obstacle, and R > 0 is its size.
Acceleration control profiles. We show the acceleration control profiles in Fig. 8. The corresponding uncertainty is also
significantly decreased with the proposed ABNet.

C.3. Safe Robot Manipulation
Models. All the models include fully connected layers of shape [6, 128, 256, 128, 128, 32, 32, 2] with RELU as activation
functions. There are some additional layers of differentiable QPs in other models (other than E2E-related models). The
model input is the system state and the goal.
Training and Dataset. The dataset includes 1000 trajectories, and each trajectory has about 350 trajectory points. The
ground truth controls (i.e., training labels) are obtained via solving HOCBF-based QPs (Xiao & Belta, 2021). We use Adam
as the optimizer to train the model with a MSE loss function and a learning rate 0.001. We use the QPFunction from the
OptNet (Amos & Kolter, 2017) to solve the dQPs. The training time of the ABNet is about 2 hours for 10 epochs on a
RTX-3090 computer.

                                                                   15
                          ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning




Figure 8: 2D robot obstacle avoidance acceleration control profiles and their distributions. The controls are subject to input
noise, and thus are non-smooth. All the testings are done in a closed-loop fashion, i.e., the model outputs are directly used to
control the robot.


Robot dynamics and safety constraints. We employ the following model as the manipulator dynamics:

                                       θ˙1
                                                            
                                                 ω1         0 0          
                                     ω˙1   0   1 0  u1
                                          =        +                                                                    (28)
                                     θ̇2   ω2   0 0  u2
                                       ω̇2        0         0 1 | {z }
                                    | {z } | {z } | {z } u
                                               ẋ          f (x)        g(x)


where (θ1 , θ2 ) ∈ R2 denotes the angles of the two-link manipulator joints (defined in the Cartesian space, we may get the
joint space angles q1 = θ1 , q2 = θ2 − θ1 ), (ω1 , ω2 ) ∈ R2 is the angular speed of the two-link manipulator joints, u1 , u2 are
the angular acceleration controls corresponding to the two joints, respectively.
The safety constraint of the robot is defined as:

                          b(x) = (l1 cos θ1 + l2 cos θ2 − x0 )2 + (l1 sin θ1 + l2 sin θ2 − y0 )2 − R2 ≥ 0,                    (29)

where (x0 , y0 ) ∈ R2 is the location of the obstacle, and R > 0 is its size. l1 > 0, l2 > 0 are the length of the two links of
the manipulator, respectively. In the current setting, the non-collision of the end-effector implies the non-collision of the
link. Therefore, we only need to consider the safety of the end-effector. We show both the u1 , u2 control profiles in Fig.
9 to demonstrate the advantage of the proposed ABNet. The metric definitions are the same as in the 2D robot obstacle
avoidance, and the number of testing runs is N = 100.

C.4. Vision-based End-to-End Autonomous Driving
Models. All the models include CNN ([[3, 24, 5, 2, 2], [24, 36, 5, 2, 2], [36, 48, 3, 2, 1], [48, 64, 3, 1, 1], [64, 64, 3, 1, 1]])
and LSTM layers (size: 64) and some fully connected layers of shape [32, 32, 2] ×2 with RELU as activation functions.
The dropout rates for both CNN and fully connected layers are 0.3. There are some additional layers of differentiable QPs in
other models (other than E2E-related models). The model input is the front-view RGB images (shape: 3 × 45 × 155) of the
ego vehicle, and the outputs are the steering rate and acceleration controls of the vehicle.
Training and Dataset. The dataset is open-sourced including 0.4 million image-control pairs from a closed-road sim-to-real
driving field. Static and parked cars of different types and colors are used as obstacles in the dataset. The dataset is collected
from the VISTA simulator (Amini et al., 2022). The ground truth controls (i.e., training labels) are obtained via solving a
nonlinear model predictive control (NMPC). We use Adam as the optimizer to train the model with a MSE loss function and
a learning rate 0.001. We use the QPFunction from the OptNet (Amos & Kolter, 2017) to solve the dQPs. The training time
of the ABNet is about 15 hours for 5 epochs on a RTX-3090 computer.

                                                                   16
                         ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning




Figure 9: Robot manipulation joint control profiles and their distributions. The controls are subject to input noise, and thus
are non-smooth. All the testings are done in a closed-loop fashion, i.e., the model outputs are directly used to control the
manipulator.
Brief introduction to VISTA. VISTA is a sim-to-real driving simulator that can generate driving scenarios from real driving
data (Amini et al., 2022). The VISTA allows us to train our model with guided policy learning. This learning method has
been shown to work for model transfer to a full-scale real autonomous vehicle. There three steps to generate the data: (i) In
VISTA, we randomly initialize the locations and poses of ego- and ado-cars that are associated with the real driving data; (ii)
we use NMPC to collect ground-truth controls (training labels) with corresponding states, and (iii) we collect front-view
RGB images along the trajectories generated from NMPC.
Vehicle dynamics and safety constraints. The vehicle dynamics are specified with respect to a reference trajectory (Rucco
et al., 2015), such as the lane center line. The two most important states are the along-trajectory progress s ∈ R and the
lateral offset distance d ∈ R of the vehicle center with respect to the trajectory. The dynamics are defined as:
                                                   v cos(µ+β )
                                                                                   
                                     ṡ                  1−dκ                   0 0
                                  d˙             v sin(µ + β )           0 0 
                                                                                         
                                                                                   u1
                                  µ̇  =  v sin β − κ       v cos(µ+β )   +   0 0   u2 ,                           (30)
                                                                                  
                                             lr                1−dκ
                                                                          
                                  v̇                                    
                                                          0                  1 0   | {z }
                                    δ̇                                          0 1      u
                                                           0
                                 | {z } |                  {z             } | {z }
                                    ẋ                  f (x)                 g(x)

where µ is the local heading error of the vehicle with respect to the reference trajectory, v is the linear speed of the
           is the curvature
vehicle, κ                 of the trajectory at the progess s. lr is the length of the vehicle from the tail to the center,
               lr
β = arctan lr +l f tan δ , where l f is the length of the vehicle from the head to the center. u1 , u2 are the steering rate and
acceleration controls of the vehicle, respectively.
The safety constraint of the vehicle is defined as:
                                           b(x) = (s − s0 )2 + (d − d0 )2 − R2 ≥ 0,                                        (31)
where (s0 , d0 ) ∈ R2 is the location of the obstacle in the curvi-linear frame (i.e., defined with respect to the reference
trajectory), and R > 0 defines its size that is chosen such that the satisfaction of the above constraint can make the ego
vehicle avoid crashing onto the obstacle.
Closed-loop testing. We test all of our models in a closed-loop manner in VISTA. In other words, at each time step, we get
the front-view RGB image observation from VISTA. Then, the model generates a control based on the image. Finally, the
control is used to drive the “virtual” vehicle in VISTA. This process is done recursively until the final time. The total number
of testing runs is N = 100 for all the tables. The obstacles are randomly initialized (in uniform probability distribution)
with lateral distance d0 ranges from ±0.1m to ±1.5m. In Figs. 6 and 11, the ego vehicle is randomly initialized with
d ∈ [−0.5, 0.5]m (in uniform probability distribution).

                                                                17
                         ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning




Figure 10: Attention-based image observations for the ABNet-att model. From left to right and top to down: attentions on
full image, left-most part, left lane boundary, lane center, right lane boundary, and right-most part.
Image observations for the ABNet-att model. We generate the attention-based observations as shown in Fig. 10. Each of
the attention images may play an important role in a specific driving scenario (e.g., attention on the left-most part may be
crucial for sharp-left turn).
Acceleration control profiles. We present both the acceleration control and steering rate control profiles in Fig. 11. Both
the BNet and BNet-UP models have forced the ego vehicle to have a large deceleration instead of making it to pass the
obstacle using the steering control when the vehicle approaches the obstacle. This can make the ego vehicle get stuck at the
obstacles, and thus, the obstacle passing rate (as shown in Table 3) is low in these two models.
Ablation studies on the model robustness in terms of safety under noisy input. To further test the model safety robustness,
we add random noise (50% magnitude of the image values) to all the image observations. The results are presented in Table
4. Our proposed ABNets can still guarantee the safety of the vehicle under noisy input (0% crash rate), while the crash rates
using other models significantly increase except the DFB model. This is because the HOCBFs in the DFB model are not
trainable, and the corresponding parameters are fixed. Badly trained HOCBFs could make the method fail to guarantee
safety due to the inter-sampling effect.




                                                             18
                         ABNet: Adaptive explicit-Barrier Net for Safe and Scalable Robot Learning




Figure 11: Vision-based end-to-end autonomous driving closed-loop testing control profiles. The models directly take
images as inputs, and output controls for the vehicle. All the testings are done in closed-loop in VISTA.




Table 4: Ablation study: vision-based end-to-end autonomous driving closed-loop testing under noise and comparisons
with benchmarks. Items in the first row are short for obstacle crash rate (CRASH), Obstacle passing rate (PASS), satisfaction
of safety constraints where non-negative values mean safety guarantees (SAFETY), system conservativeness (CONSER.),
acceleration control u1 uncertainty (u1 UNCERTAINTY), steering rate control u2 uncertainty (u2 UNCERTAINTY), and
theoretical safety guarantees (THEORET. GUAR.) respectively. In the model column, items are short for single vanilla end-
to-end driving model (V-E2E), E2Es merged with Monte-Carlo Dropout (E2Es-MCD), E2Es merged with deep resembles
(E2Es-MERG), deep forward and backward model (DFB), single BarrierNet (BNET), BarrierNet policies with uncertainty
propagation (BNET-UP), ABNet with 10 heads (ABNET), ABNet with attention images and 10 heads (ABNET-ATT),
ABNET-SC denotes our ABNet first trained with ABNET-ATT scaled by ABNET (20 heads)respectively. The safety metric
is defined as the minimum value of the safety specification b j (x), j ∈ S among all runs. The conservativeness metric is
defined as the mean (with std) of the minimum value (in each run) of the safety specification b j (x), j ∈ S among all runs.
The uncertainty metrics for both u1 and u2 are measured by the standard deviations of the model outputs (two controls)
among all runs.


               M ODEL                 C RASH    PASS     S AFETY      C ONSER .      u1 U NCER -     u2 U NCER -   T HEORET.
                                        (↓)      (↑)      (≥ 0)       (≥ 0& ↓)       TAINTY (↓)      TAINTY (↓)     GUAR .

   V-E2E (A MINI ET AL ., 2022)        31%      69%      -59.455   −8.932±19.741        0.529          0.239         ×
         E2E S -MCD (G AL &            28%      72%      -58.405   −8.116±20.802        0.524          0.232         ×
        G HAHRAMANI , 2016)
  E2E S -DR (L AKSHMINARAYANAN         27%      73%      -60.267   −8.781±20.910        0.512          0.225         ×
           ET AL ., 2017)
                                                                                                                     √
   DFB (P EREIRA ET AL ., 2020)         1%     37%       -13.281   −0.256±4.348         0.482          0.127         √
    BN ET (X IAO ET AL ., 2023)        23%     37%       -45.415   −9.114±13.382        0.730          0.316
  BN ET-UP (WANG ET AL ., 2023 B )     24%     39%       -44.634   −8.866±13.167        0.747          0.278         ×
                                                                                                                     √
           ABN ET ( OURS )              0%     100%       4.268     8.315±2.147         0.151          0.326         √
         ABN ET- ATT ( OURS )           0%     100%       5.986     7.032±0.405         0.118          0.213         √
          ABN ET- SC ( OURS )           0%     100%       4.118     7.515±1.120         0.128          0.255




                                                            19
