Ensuring Deployment-Time Safety of Neural Network Controlled Systems via Localized Certificate Repair
Authors: Xiaoyang Lv, Peixin Wang, Jianhao Bai, Bai Xue, Min Zhang, Luke Ong
Organizations: Shanghai Key Laboratory of Trustworthy Computing, East China Normal University · KLSS, Institute of Software, Chinese Academy of Sciences · College of Computing and Data Science, Nanyang Technological University
Barrier certificates provide formal safety guarantees for neural network controlled systems by ensuring that system trajectories avoid unsafe regions over time. However, after deployment, previously unseen obstacles or constraint changes may introduce new unsafe regions, invalidating the original certificate and potentially leading to unsafe behavior. We address this setting with adaptive piecewise barrier certificates, which preserve the original certificate and policy in unchanged regions while introducing localized updates around newly emerged unsafe regions. The central question is how to perform such updates efficiently during system execution without retraining from scratch. Our key idea is to cast deployment-time adaptation as a localized certificate repair problem and reduce it to an optimization task that leverages the learned structure of previous barrier certificates, enabling fast updates without global retraining. We further design a staged repair framework that progressively transitions from localized repair to joint policy-certificate updates and, when necessary, localized retraining. Empirical results on four benchmarks with five new obstacles show that our method succeeds in all cases and completes within tens of seconds on average, whereas retraining from scratch fails in most cases. On instances where retraining succeeds, our method is 17.3× faster on average. It incurs only 16.2% performance degradation relative to the original policy.
Figures & tables
Figure 1
Benchmark
Original BC
Baseline
Ours
Obstacle ID
Global retrain
Stage I
Stage II
Stage III
Verification
Total time
B1
616.6
O1
1516.3
10.6 ✗
55.3 ✓
0
2.0
67.9
O2
F
10.3 ✓
0
0
3.2
13.5
O3
F
11.2 ✓
0
0
3.1
14.3
B2
685.3
O1
1309.5
8.2 ✗
40.7 ✓
0
1.2
50.1
O2
F
8.1 ✗
44.8 ✓
0
1.5
54.4
Table 1: Runtime (in seconds) comparison under multiple obstacles across benchmarks.
Figure 3
Benchmark
Scale of Snew
Stage I
Stage II
Total time of Stages I,II
Stage III
MC
0.6×
5.1 ✗
F
F
F
0.8×
8.2 ✓
0
8.2
0
1.0×
11.9 ✓
0
11.9
0
1.2×
17.7 ✗
77.3 ✓
95.0
0
1.4×
22.3 ✗
F
F
402.5 ✓
PD
0.6×
6.4 ✗
F
F
F
Table 2: Runtime (in seconds) under different scaling factors of repair regions.
Benchmark
Obstacle ID
Original global BC
First repaired local BC
Previous template
Stage I
Stage II
Total time
Stage I
Stage II
Total time
Stage I
Stage II
Total time
MC
O1
11.5
F
F
–
–
–
11.5
F
F
O2
11.6
F
F
12.2
0
12.2
12.2
0
12.2
O3
12.1
F
F
11.8
0
11.8
11.9
0
11.9
PD
O1
14.4
F
F
–
–
–
14.4
F
F
O2
14.0
F
F
14.8
0
14.8
14.8
0
14.8
Table 3: Running time (in seconds) comparison of template selection across benchmarks.
Benchmark
# Obs.
Ours
Shielding
Total runtime
Avg. reward
Success rate (%)
# Shield Interventions
Total runtime
Avg. reward
Success rate (%)
B1
O1
67.9
57.10
100
622
269.8
56.14
100
O2
81.4
55.37
100
972
413.6
53.96
100
O3
95.7
54.59
100
1354
573.2
51.30
97
B2
O1
50.1
95.11
100
241
102.0
94.83
100
O2
104.5
94.89
100
270
116.2
94.12
100
Table 4: Comparison between our method and shielding under multiple obstacles across benchmarks.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Benchmark
Original BC
Baseline
Ours
Obstacle ID
Global retrain
Stage I
Stage II
Stage III
Verification
Total time
B1
616.6
O1
1516.3
10.6✗
55.3✓
222.1
2.0
67.9
O2
F
10.3✓
0
194.9
3.2
13.5
O3
F
11.2✓✓
0
204.2
3.1
14.3
O4
F
11.3✓
0
270.7
3.2
14.5
O5
F
11.6✓
0
234.0
3.2
14.8
Appendix
Table 5: Running time (in seconds) comparison under multiple newly introduced obstacles across benchmarks.
Benchmark
Scale of Snew
Stage I
Stage II
Stage III
Total time of Stages I,II
B1
0.6×
5.6✗
F✗
F✗
F
0.8×
8.3✗
F✗
F✗
F
1.0×
11.0✓
0
204.2
11.0
1.2×
17.2✓
0
281.5
17.2
1.4×
19.9✗
72.5✓
366.1
92.4
B2
0.6×
4.7✗
F✗
F✗
F
Appendix
Table 6: Running time (in seconds) under different scaling factors of repair regions.
Benchmark
Obstacle ID
Original global BC
First repaired local BC
Previous template
Stage I
Stage II
Step time
Stage I
Stage II
Step time
Stage I
Stage II
Step time
B1
O1
10.6
55.3
65.9
–
–
–
10.6
55.3
65.9
O2
10.5
54.2
64.7
10.3
0
10.3
10.3
0
10.3
O3
10.9
0
10.9
10.6
0
10.6
11.0
0
11.0
O4
11.4
0
11.4
10.9
0
10.9
11.3
0
11.3
O5
11.3
0
11.3
11.3
0
11.3
11.6
0
11.6
Appendix
Table 7: Running time comparison of different template-selection strategies across four benchmarks.
Benchmark
# Obs.
Ours
Shield
Total runtime
Avg. reward
Success rate (%)
# Shield Interventions
Total runtime
Avg. reward
Success rate (%)
B1
O1
67.9
57.10
100
622
269.8
56.14
100
O2
81.4
55.37
100
972
413.6
53.96
100
O3
95.7
54.59
100
1354
573.2
51.30
97
B2
O1
50.1
95.11
100
241
102.0
94.83
100
O2
104.5
94.89
100
270
116.2
94.12
100
Appendix
Table 8: Comparison between our method and shielding under multiple obstacles across benchmarks.
Benchmark
Obstacle ID
Learning rate
10−5 (main setting)
10−4
10−3
B1
O1
1728.5
F
F
O2
F
F
F
O3
F
F
F
O4
F
F
F
O5
F
F
F
Appendix
Table 9: Effect of the learning rate on global retraining. Numerical entries report the mean end-to-end runtime (in seconds) over 20 runs per configuration.
Barrier certificates are scalar functions over the state space of dynamical systems that separate all unsafe states from all reachable states. The existence of a barrier certificate formally verifies the safety of the dynamical system. Recent approaches synthesize barrier certificates by iteratively training a neural network. In each iteration, the candidate is formally verified - if successful, the barrier certificate is found. Instead, we propose a set-based training approach that tightly integrates verification into training via a set-based loss function that soundly encodes all barrier certificate properties. A loss of zero formally proves the validity of the barrier certificate, collapsing the iterative training and verification into a single training procedure. Our experiments demonstrate that our set-based training approach scales well with the system dimension and naturally handles complex nonlinear dynamics.
Control barrier functions are an effective model-based tool to formally certify the safety of a system. However, transferring their theoretical guarantees to real-world robotics systems requires high model fidelity. For example, payloads or wind disturbances can cause significant model perturbations to an aerial vehicle, leading to safety compromises. In this work, we propose a certifiable online learning-enhanced robust adaptive control barrier function, which adapts to disturbances using a Neural ODE and quantifies its adaptation uncertainty with conformal prediction. Our approach guarantees safety at all time under unknown time-varying model disturbances. It adopts a conservative strategy when the adaptation uncertainty is high; and efficiently adapts to reduce controller conservativeness as it receives more data. Our approach provides a provable safety guarantee with a probability bound under suitable Lipschitz smoothness assumptions on the underlying model and trajectory. These results demonstrate the potential of our method as a practical safety controller for robotics system operating under model perturbations.
Lishuo Pan, Mattia Catellani, An Cao +2
Department of Computer Science, Brown University, Providence, RI 02912 USA · Department of Sciences and Methods for Engineering, University of Modena and Reggio Emilia, 41121 Modena, Italy · Division of Physics, Mathematics and Astronomy, California Institute of Technology, Pasadena, CA 91125 USA
While neural network control policies are powerful, their deployment on safety critical systems depends on ensuring that they obey strict constraints. Existing work often treats safety as a metric to optimize for, which competes with other performance objectives, if training converges at all. Instead, we introduce ShardNet, a neural network architecture that strictly enforces unions of polyhedral constraints by construction, using a differentiable projection layer parameterized by a classification network. The key insight is to embed safety into the neural network's structure, allowing performance to be optimized independently because formal safety guarantees are always given. In contrast with existing neural architectures that can only enforce simple convex constraints, ShardNet enables the first safe-by-construction synthesis of forward-invariant neural network controllers on closed-loop systems where safety constraints are expressed as nonconvex unions of polyhedras or learned value function level sets. To support this, we also introduce a technique to verify and train such value functions correctly as rectified linear unit (ReLU) networks, which has not previously been possible. On double integrator benchmarks drawn from the literature, ShardNet policies maintain 100% safety on verified sets and achieves significantly lower objective loss compared to existing formal methods. Furthermore, our value function training technique also produces safe sets more than 3 times larger than existing verification approaches.
Long Kiu Chung, Shreyas Kousik
Department of Mechanical Engineering, Georgia Institute of Technology, Atlanta, GA.