Automated and Formal Synthesis of Neural Barrier Certificates for Dynamical Models

Andrea Peruffo, Daniele Ahmed, Alessandro AbateTACAS 2021

Abstract

Ensuring the safety of complex dynamical systems is a critical challenge in robotics, autonomous vehicles, and synthetic biology. This paper presents a framework for the automated synthesis of Neural Barrier Certificates (BCs)—mathematical proofs that guarantee a system will never enter an unsafe state. By utilizing a CounterExample-Guided Inductive Synthesis (CEGIS) loop, the proposed method combines the expressive power of neural networks with the formal rigor of SMT solvers. Experimental results show that this approach achieves safety proofs up to 100x faster and with 1,000x less data than previous state-of-the-art methods, while scaling to high-dimensional and hybrid systems.

Introduction

In safety-critical applications, it is essential to prove that a dynamical model will remain within a safe operating region. A Barrier Certificate (BC) acts as a mathematical "fence" in the system's state space; if the system starts on the safe side, its dynamics ensure it can never cross into the unsafe region. However, finding these certificates for non-linear systems is computationally difficult. Traditional methods like Sum-of-Squares (SOS) optimization often struggle with numerical instability or non-polynomial dynamics (e.g., trigonometric or exponential functions). While recent neural network (NN) approaches have shown promise, they often lack tight integration with formal verification and remain data-intensive.

Methodology: The CEGIS Framework

The core of this work is a closed-loop framework called CounterExample-Guided Inductive Synthesis (CEGIS). This framework facilitates a continuous interaction between a Learner and a Verifier to iteratively refine a candidate Barrier Certificate.

The CEGIS loop for neural barrier certificate synthesis.
  1. The Learner (Neural Network): The Learner proposes a candidate BC. It trains a neural network using a specialized loss function designed to satisfy the mathematical conditions of a BC: the value must be non-positive in initial states and positive in unsafe states.
  2. The Verifier (SMT Solver): The Verifier takes the candidate BC and attempts to find a counter-example—a point in the continuous state space where the BC conditions are violated. This is achieved using Satisfiability Modulo Theory (SMT) solvers like dReal and Z3.

If a counter-example is found, it is passed back to the Learner to guide the next training iteration. This loop continues until the Verifier can no longer find any violations, resulting in a formally proven safety certificate.

Key Innovations

  • Data Efficiency: By training only on counter-examples rather than a uniform grid, the model learns from significantly fewer samples (e.g., 500 vs. 65,000 in prior work).
  • Hybrid Architecture: Interleaving linear and polynomial layers provides the numerical robustness needed for SMT solvers while maintaining high expressivity.
  • Saturated Leaky ReLU Loss: This improved loss function rewards the network for maintaining a safety margin, which accelerates the verification process.

Experimental Evaluation

The framework was evaluated on a variety of benchmarks, including:

  • Standard Models: Darboux (2D), Exponential (2D), and Obstacle Avoidance (3D).
  • Complex Challenges: A 2D Hybrid Model with switching behaviors and high-dimensional ODE models (up to 8 dimensions).
  • Baselines: Comparisons were made against the previous state-of-the-art NN-based approach and traditional SOSTOOLS.

Results

The proposed method demonstrated substantial improvements across several metrics:

  • Speed: Synthesis was up to two orders of magnitude faster than previous NN methods, with verification speedups reaching 1,000x.
  • Formal Soundness: Unlike probabilistic ML approaches, this method provides a mathematical guarantee of safety.
  • Scalability: The ability to handle 8-dimensional systems represents a significant advancement over traditional methods that often fail beyond 3D.
  • Robustness: The algorithm consistently found valid certificates across multiple runs with different random initializations.

Conclusion and Future Work

While the CEGIS loop is not guaranteed to terminate (it is "incomplete"), it proves highly effective in practice. Future research will focus on automating hyperparameter selection (e.g., network depth and activation functions) and integrating these techniques into the FOSSIL software tool. This work marks a significant step toward making formal safety verification practical for complex, high-dimensional autonomous systems.

Summary updated

BibTeX
@inproceedings{peruffo2021automated,
  author = {Andrea Peruffo and Daniele Ahmed and Alessandro Abate},
  title = {{Automated and Formal Synthesis of Neural Barrier Certificates for Dynamical Models}},
  booktitle = {TACAS},
  year = {2021},
  doi = {10.1007/978-3-030-72016-2\_20},
}
Figure