Value Functions are Control Barrier Functions: Verification of Safe Policies using Control Theory

Daniel Chee Hian Tan, Fernando Acero, Robert McCarthy, Dimitrios Kanoulas, Zhibin LiarXiv 2023 · DOI

Introduction

Reinforcement Learning (RL) has demonstrated remarkable success in mastering complex control tasks. However, the "black-box" nature of deep neural networks remains a significant barrier to their deployment in safety-critical applications, such as autonomous driving or human-robot interaction. In these domains, providing formal guarantees of safety is not just a preference but a requirement.

Researchers from University College London (UCL) propose a novel framework that bridges the gap between the flexible, data-driven world of RL and the rigorous, certificate-based world of control theory. They demonstrate that under specific conditions, a learned Value Function can be mathematically treated as a Control Barrier Function (CBF)—a fundamental tool used by control engineers to prove the safety and invariance of dynamical systems.

Theoretical Framework: Value Functions as Certificates

Traditional safety in RL often relies on Constrained Markov Decision Processes (cMDPs), which typically assume that safety constraints are known analytically. In contrast, Control Theory utilizes certificate functions, such as Lyapunov or Barrier functions, to provide formal safety guarantees. However, manually designing these functions for high-dimensional systems with complex dynamics is notoriously difficult.

The authors address this by defining a Safety-Preserving Task Structure. In this setup, the reward function is binary: $r = 1$ for safe states and $r = 0$ for unsafe states, with "early termination" occurring immediately upon failure. The core theoretical contribution is Theorem 3.1, which proves that the optimal value function $V^*$ for such a task can be transformed into a valid Control Barrier Function $h = V^* - R$. This implies that if an agent maintains its value above a threshold $R$, it is formally guaranteed to remain within the safe set indefinitely.

The SIGMOID-SUP Approach

To practically implement this theoretical link using neural networks, the authors introduced the SIGMOID-SUP architecture, which incorporates three key elements:

  1. Bounded Parametrization: A sigmoid-based output layer ensures the learned value function $V$ remains within the theoretically required range $[0, \frac{1}{1-\gamma}]$.
  2. Supervised Loss: Standard RL signals (like TD error) are often weak at the boundaries of the state space because agents rarely visit unsafe states. The authors added a supervised loss term to explicitly force $V(x) = 0$ for known unsafe states, sharpening the "barrier."
  3. Diverse Exploration: By utilizing a wider range of initial states during training, the model learns the barrier across the entire state space rather than just along a single optimal trajectory.

Experimental Evaluation

The approach was evaluated on the CartPole environment for theoretical validation and on MuJoCo Locomotion tasks (Walker2d, Hopper, Ant) using offline RL datasets from D4RL.

Key Metrics: Validity and Coverage

The authors introduced two critical metrics to evaluate learned safety certificates:

  • Validity: Does the learned function satisfy the mathematical conditions required to be a valid CBF?
  • Coverage: How much of the safe state space does the function actually protect?
Figure 6: Comparison of different model architectures across Validity and Coverage metrics. SIGMOID-SUP (orange) demonstrates superior performance, achieving high validity while maintaining significant coverage.

As shown in the results, standard MLP-based critics often fail to satisfy the necessary barrier conditions. In contrast, the SIGMOID-SUP model achieves near 100% validity in the CartPole environment, providing a mathematically sound safety certificate.

Safe Exploration and Scalability

The learned CBF can be used to constrain even a random policy, allowing for safe exploration of the state space. As illustrated in the CartPole experiments, the constrained policy prevents the system from reaching unsafe boundaries while a standard rollout would fail.

Figure 1: Trajectory of a CartPole agent under CBF constraints. The "Constrained" policy (blue) keeps the cart within safe bounds (black lines) throughout the episode, whereas unconstrained rollouts risk failure.

In high-dimensional MuJoCo environments, the approach significantly increased the "safety-constrained episode length" compared to baselines. Notably, the authors found that random offline data often produced better safety certificates than expert data, as random trajectories explore the boundaries where safety constraints are most critical.

Conclusion and Future Work

This research provides a formal link between RL value functions and control-theoretic safety certificates. By treating value functions as Control Barrier Functions, the authors enable the verification of deep RL policies. While the current approach provides strong statistical evidence of safety, future work aims to incorporate formal verification methods, such as Lipschitz-continuity bounds, to provide "hard" guarantees. Additionally, extending this framework to perceptual inputs (e.g., learning CBFs directly from vision) remains a promising direction for autonomous robotics.

Summary updated

BibTeX
@misc{tan2023value,
  author = {Daniel Chee Hian Tan and Fernando Acero and Robert McCarthy and Dimitrios Kanoulas and Zhibin Li},
  title = {{Value Functions are Control Barrier Functions: Verification of Safe Policies using Control Theory}},
  year = {2023},
  eprint = {2306.04026},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.04026},
}
Figure