How to Train Your Neural Control Barrier Function: Learning Safety Filters for Complex Input-Constrained Systems

Oswin So, Zachary Serlin, Makai Mann, Jake Gonzales, Kwesi Rutledge, Nicholas Roy, Chuchu Fan

TL;DR

This paper introduces Policy Neural Control Barrier Functions (PNCBFs), a novel method for learning safety filters that scale to high-dimensional systems with strict actuator limits. By proving that the value function of a nominal policy is itself a valid Control Barrier Function, the authors bypass the "chicken-and-egg" problem of needing a pre-defined safe set to train a neural safety certificate.

What Problem Does This Paper Address?

Ensuring safety in autonomous systems—like self-driving cars or drones—often involves Control Barrier Functions (CBFs). Think of a CBF as a "safety filter" that sits between a high-level controller and the hardware. If the controller suggests a move that would lead to a crash, the CBF nudges the command just enough to keep the system within a "safe set" of states.

However, designing these functions is notoriously difficult for two reasons:

  1. High Relative Degree: In many systems, control inputs (like acceleration) don't immediately affect the safety constraint (like position). You have to differentiate the constraint multiple times to see the input's effect.
  2. Input Constraints: Real-world actuators have limits (e.g., a motor can only spin so fast). Standard CBF methods often ignore these limits, leading to filters that "ask" the hardware for impossible maneuvers, resulting in safety violations.

Existing Neural CBFs (NCBFs) try to learn these functions using deep learning, but they usually require knowing the "safe set" beforehand to supervise training. Finding that safe set is often just as hard as finding the CBF itself.

Methods

The authors propose Policy Neural Control Barrier Functions (PNCBFs). Their key innovation is shifting the perspective from "finding a function that satisfies safety conditions" to "evaluating how safe a specific policy is."

The "Aha!" Moment: Value Functions are CBFs

The researchers prove that the value function of a nominal policy—specifically one that tracks the maximum constraint violation over a future horizon—is a valid CBF.

Understanding how the policy value function informs safety.

The PNCBF Pipeline

  1. Policy Evaluation: They train a neural network to approximate the value function $V^{h,\pi}$ of a given policy $\pi$ by rolling out trajectories and recording the worst-case safety violations.
  2. Discounting & Contraction: To ensure the neural network converges to a useful solution (and doesn't just output a constant), they introduce a discounting factor $\lambda$. This implicitly chooses the "safety horizon" the filter considers.
  3. Policy Iteration: Once they have a learned safety filter, they use it to create a new, safer nominal policy and repeat the process. This iteratively expands the volume of the safe set.
Policy iteration on a double integrator, showing the safe set expanding over iterations.

Datasets

The method was evaluated across several challenging control benchmarks:

  • Double Integrator & Segway: Low-dimensional systems used to visualize the "permissiveness" of the safety filter.
  • F-16 Fighter Jet: A high-dimensional (16D state space, 3D control) ground collision avoidance scenario. This is a significant jump in complexity, as traditional grid-based safety methods (like Hamilton-Jacobi reachability) typically fail beyond 5 dimensions.
  • Multi-Agent Quadcopters: A 12D state space problem involving two drones maintaining communication range while avoiding a dynamic obstacle.
  • Hardware Validation: The multi-agent quadcopter setup was deployed on real drones navigating around a Boston Dynamics Spot robot.

Key Insights and Ideas

  • Bypassing the Safe Set Requirement: Unlike previous NCBF methods, PNCBF doesn't need a pre-defined safe set for training. It discovers the safe set naturally by evaluating the policy's performance.
  • Permissiveness vs. Safety: A common failure of handcrafted safety filters (like Higher-Order CBFs) is being too conservative—they might keep the system safe but prevent it from doing anything useful.
Comparison showing how standard HOCBFs can be overly conservative or violate safety under input constraints.
  • Scalability: By using neural networks for policy evaluation rather than solving complex minimax optimization problems, the method scales to the 16-dimensional F-16 model, which is often considered the "frontier" for formal safety methods.

Key Results

  • F-16 Performance: PNCBF recovered a significantly larger safe region than all baselines in the 16D state space.
  • Rapid Convergence: In the multi-agent quadcopter simulation, policy iteration reduced the fraction of unsafe states by 90% in just two iterations compared to the next best method.
  • Hardware Success: The system successfully filtered unsafe commands in real-time on quadcopter hardware, preventing collisions with a moving quadruped robot while respecting tight motor limits.

Limitations and Future Work

  • Model Dependence: The training process relies on having an accurate dynamics model for rollouts. If the model used for training differs significantly from reality, the safety guarantees may degrade.
  • Formal Verification: While the empirical results are strong, the learned neural network itself is not formally verified. The authors suggest that existing neural network verification tools could be used as a post-processing step.
  • Future Directions: The team plans to investigate "Robust PNCBFs" that can account for model uncertainty and environmental noise during the learning phase.

Summary updated

BibTeX
@inproceedings{so2024how,
  author = {Oswin So and Zachary Serlin and Makai Mann and Jake Gonzales and Kwesi Rutledge and Nicholas Roy and Chuchu Fan},
  title = {{How to Train Your Neural Control Barrier Function: Learning Safety Filters for Complex Input-Constrained Systems}},
  booktitle = {IEEE International Conference on Robotics and Automation},
  year = {2024},
  doi = {10.1109/icra57147.2024.10610418},
}
Figure