Learning Control Barrier Functions from Expert Demonstrations.

Alexander Robey, Haimin Hu, Lars Lindemann, Hanwen Zhang, Dimos V. Dimarogonas, Stephen Tu, Nikolai Matni

TL;DR

This paper introduces a novel framework for learning Control Barrier Functions (CBFs)—mathematical certificates that guarantee safety—directly from expert demonstrations. By combining optimization with Lipschitz continuity arguments, the authors provide the first method to learn safety controllers for nonlinear systems that come with provable safety guarantees, even when using complex models like deep neural networks.

What Problem Does This Paper Address?

In robotics and autonomous systems, "safety-critical" isn't just a buzzword; it’s a requirement. Traditionally, engineers use Control Barrier Functions (CBFs) to ensure a system stays within a "safe set" (e.g., a car staying on the road). However, designing these functions manually for complex, nonlinear systems is incredibly difficult and often relies on "expert intuition" or computationally expensive tools like Sum-of-Squares (SOS) programming that don't scale well.

Meanwhile, imitation learning has been great at teaching robots how to perform tasks by watching experts, but it rarely provides formal guarantees that the robot won't crash. This paper bridges that gap: it uses expert data to learn the safety certificate itself, ensuring that the resulting controller is not just "probably safe" based on testing, but "provably safe" based on control theory.

Methods

The authors propose an optimization-based approach to learn a CBF $h(x)$ from a dataset of expert trajectories. The core idea is to find a function that satisfies three main conditions:

  1. Safety: The function must be positive at safe expert states.
  2. Unsafety: The function must be negative in known unsafe regions (the "boundary layer").
  3. Dynamics: The function's derivative must satisfy a specific inequality that ensures there always exists a control input to keep the system safe.

The "secret sauce" that enables provable guarantees is Lipschitz continuity. By bounding how fast the learned function can change, the authors prove that if the conditions are met at discrete data points (an $\epsilon$-net), they are guaranteed to hold in the continuous space between those points.

Figure 1: In (a), the safe set S (red box) and the set of expert trajectories (black lines). Next, in (b), the set D (orange ring) is the union of ϵ balls around the expert trajectories. The set N (black striped rings), defined around D, ensures that the learned safe set C (green ring), which is defined via the learned valid control barrier function h(x), is such that C ⊂D ⊆S. Finally, in (c), “artiticial” unsafe samples are no longer introduced in the center of the safe set (denoted by the blue set F).

The framework is agnostic to the model architecture. The authors demonstrate it using:

  • Random Fourier Features (RFF): Which allows the problem to be solved via convex optimization.
  • Deep Neural Networks (DNNs): Solved using standard gradient-based methods like Adam, with post-hoc verification of safety slacks.

Datasets

The authors evaluated their approach on two primary scenarios:

  • Planar 2D System: A synthetic nonlinear system used to verify the theoretical conditions (Lipschitz constants and $\epsilon$-nets) explicitly.
  • Aircraft Collision Avoidance: A high-fidelity simulation involving two UAVs. The expert data for this was generated in two ways:
  • Algorithmic Expert: Data from a standard Model Predictive Controller (MPC) equipped with a hand-crafted CBF.
  • Human Expert: Data collected from human players using a web-based flight simulator interface.

Key Insights and Ideas

  • Data-Driven Safety Certificates: Instead of just imitating a policy, we can imitate the safety boundary. This allows the system to be flexible in its task execution while remaining strictly safe.
  • The Buffer Zone: To learn a smooth function, you can't have safe and unsafe points overlapping. The authors introduce a "buffer region" (X_safe subset) that allows the CBF to transition gracefully from positive to negative values without requiring an impossibly high Lipschitz constant.
  • Control Barrier Filters: The authors introduce a "filter" concept (Figure 1c) that removes the need to sample unsafe points in the deep interior of a safe region, focusing the learning effort on the boundaries where safety is actually at risk.
  • Post-hoc Verification: For non-convex models like DNNs, they use "slack" variables to verify that the safety conditions are met across the entire dataset after training.

Key Results

  • Provable Safety: In the planar example, the authors explicitly computed Lipschitz bounds and verified that the learned CBF satisfied all theoretical conditions for forward invariance (safety).
  • Human-to-Robot Safety: The system successfully learned valid CBFs from noisy human demonstrations. Even though humans don't follow perfect mathematical trajectories, the optimization was able to extract a robust safety boundary.
  • Generalization: Controllers using the learned CBFs were able to steer agents safely even when starting from initial conditions far outside the original expert data. In the UAV example, the learned CBF successfully prevented collisions for all tested symmetric initial positions.

Limitations and Future Work

  • Dimensionality: The reliance on $\epsilon$-nets means the number of required samples can grow exponentially with the state dimension ($d$). While expert data helps focus on relevant regions, scaling to very high-dimensional systems remains a challenge.
  • Lipschitz Estimation for DNNs: Accurately estimating the Lipschitz constant for deep networks is notoriously difficult (NP-hard). The authors currently rely on post-hoc sampling and recent SDP-based approximation methods, but more efficient "safety-aware" architectures could be a future direction.
  • Known Dynamics: The current work assumes the underlying system dynamics ($f$ and $g$) are known. A natural next step is extending this to systems where the dynamics themselves must be learned from data.

Summary updated

BibTeX
@misc{robey2020learning,
  author = {Alexander Robey and Haimin Hu and Lars Lindemann and Hanwen Zhang and Dimos V. Dimarogonas and Stephen Tu and Nikolai Matni},
  title = {{Learning Control Barrier Functions from Expert Demonstrations.}},
  year = {2020},
  eprint = {2004.03315},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2004.03315},
}
Figure