Introduction
Ensuring safety in complex, dynamic environments is a fundamental challenge in robotics. While Control Barrier Functions (CBFs) have emerged as a powerful tool for providing mathematical safety guarantees, designing them for systems with complex dynamics or non-convex obstacles remains difficult. Recent research has turned to machine learning to "refine" simple, handcrafted safety rules into more precise certificates. However, these learning-based approaches are often data-hungry, requiring extensive sampling to accurately define the boundary between safe and unsafe states.
Presented at ACC 2023, this work introduces a method to accelerate the learning of CBFs by integrating Prioritized Experience Replay (PER). By focusing on the most informative data points, the proposed framework recovers a larger portion of the safe operating space with significantly less data than traditional uniform sampling methods.
The Challenge of Sample Complexity in Safety Learning
A Control Barrier Function acts as a safety filter, intervening when a robot's primary controller attempts a command that would lead to a safety violation. A common starting point is a Handcrafted CBF (HCBF), which is safe but often overly conservative—for instance, treating a square obstacle as a large, safe circle.
To reduce this conservatism, researchers use neural networks to learn a correction term ($\Delta h$). The bottleneck in this process is sample complexity: accurately mapping the transition from safe to unsafe regions requires a vast amount of data. This paper addresses this inefficiency, making the refinement process faster and more practical for real-world applications.
Methodology: Prioritized Experience Replay for CBFs
The core innovation of this approach is the application of Prioritized Experience Replay (PER) to the CBF learning pipeline. Instead of treating all collected data equally, the system prioritizes samples that provide the most learning value.
1. Learning-Based Refinement with DDNs
The framework utilizes a Deep Differential Network (DDN) to learn the correction term. DDNs are uniquely suited for this task because they provide both the function value and its analytical gradient, both of which are required to satisfy the derivative-based constraints of a CBF.
2. Prioritized Sampling and Loss Functions
Data points are assigned a priority score based on their loss value. Points where the model’s current prediction is most inaccurate—such as states incorrectly labeled as safe or unsafe—are sampled more frequently during training. The optimization process relies on three specific loss components:
- $L_+$: Penalizes errors in safe states.
- $L_-$: Penalizes errors in unsafe states.
- $L_{\nabla h}$: Ensures the CBF derivative satisfies the necessary safety conditions (the barrier property).
To maintain computational efficiency, the authors employ a "sum tree" data structure, allowing prioritized sampling to occur in $O(\log n)$ time.
Theoretical and Practical Insights
The Convergence Mechanism
A key theoretical contribution of the paper (Theorems 1 and 2) explains why prioritized sampling is so effective in this context. The authors demonstrate that prioritized sampling with an L1 loss is mathematically equivalent to an L2 loss for high-error points. This forces the model to prioritize large errors during the early stages of training, leading to much faster initial convergence.
Two-Phase Learning
The authors observed that learning typically occurs in two distinct phases. Initially, the model learns from newly collected data. In the second phase, it re-samples high-error points from its history to "shore up" the safety boundary, ensuring the transition between safe and unsafe sets is precisely defined.
Experimental Results
The method was evaluated in two simulation environments: a Unicycle Model navigating around a square obstacle and a Two-Link Robotic Arm avoiding a wall.
- Faster Convergence: In the unicycle simulation, the PER-based approach reached the convergence epoch—where the safe set was fully recovered—significantly earlier than uniform sampling.
- Reduced Conservatism: The evaluation metrics showed that agents using prioritized sampling could navigate much closer to obstacles without violating safety. This indicates that the model learned a more accurate, less conservative boundary than uniform-sampling counterparts at the same stage of training.
- Consistency: While PER reached the solution faster, it did not sacrifice final accuracy. Both methods eventually converged to similar safety boundaries, but PER proved far more data-efficient.
Conclusion and Future Work
By integrating Prioritized Experience Replay, this research provides a path toward more practical, data-efficient safety certificates for autonomous systems. While the current results are simulation-based and require an initial handcrafted starting point, they demonstrate a significant reduction in the data required to refine safety boundaries. Future work will focus on integrating these learned certificates with performance-oriented controllers (such as Reinforcement Learning) and validating the framework on physical robotic hardware.
Summary updated