Verification-Guided Shielding for Deep Reinforcement Learning

Davide Corsi, Guy Amir, Andoni Rodríguez, Guy Katz, César Sánchez, Roy Fox

Abstract

Deep Reinforcement Learning (DRL) has demonstrated remarkable success in complex control tasks, yet its deployment in safety-critical environments remains limited by a lack of formal guarantees. Traditional safety mechanisms, such as formal verification and online shielding, often suffer from either a lack of runtime adaptability or prohibitive computational overhead. This paper presents a hybrid framework that integrates offline formal verification with selective online shielding. By partitioning the state space into provably safe and potentially unsafe regions, the system invokes its safety shield only when necessary. Experimental results on robotics benchmarks demonstrate that this approach reduces runtime overhead by up to 71% while maintaining absolute safety guarantees.

Introduction

Deep Reinforcement Learning (DRL) policies are typically optimized for expected cumulative rewards, a metric that prioritizes average performance over worst-case safety. This "reliability gap" means that even a policy with a 99% success rate may fail catastrophically in rare edge-case scenarios. In domains such as autonomous navigation or healthcare, such failures are unacceptable.

To mitigate these risks, researchers have historically relied on two distinct methods:

  1. Formal Verification: An offline process that checks if a neural network policy violates predefined safety properties. While rigorous, it is a diagnostic tool that identifies bugs without providing a mechanism to correct them during execution.
  2. Shielding: An online monitoring system that intercepts the agent's actions, overriding those that would lead to a safety violation. While effective, traditional shielding is computationally expensive because it must evaluate every action at every time step, often rendering real-time robotics applications unfeasible.

This research addresses the computational burden of shielding by asking a fundamental question: Can we use formal verification to identify regions where the agent is provably safe, thereby allowing the shield to remain dormant until it is truly needed?

The Verification-Guided Shielding Framework

The authors propose a five-stage pipeline designed to transition from a raw DRL policy to a safety-guaranteed, high-efficiency system.

1. Domain Splitting and Initial Verification

The process begins with Domain Splitting, using the $\epsilon$-ProVe algorithm to partition the agent's input space—such as sensor readings and positional data—into smaller, manageable regions. The system then employs Marabou, a sound and complete neural network verifier, to rigorously test these regions. If Marabou proves a region is safe, it is marked as such; if a single counter-example is found, the region is classified as unsafe.

2. Clustering and Symbolic Representation

Verification often produces tens of thousands of fragmented unsafe regions. Checking the agent's state against such a massive list in real-time would be slower than the shield itself. To solve this, the framework uses agglomerative clustering to merge these fragments into a smaller set of compact, convex shapes. These regions are then converted into symbolic representations using Satisfiability Modulo Theories (SMT) solvers like Z3. This allows the system to determine if an agent has entered an unsafe zone using high-speed logical operations.

3. Selective Shielding

During deployment, the safety shield operates in a "selective" mode. It remains inactive as long as the agent stays within provably safe regions. The shield only "wakes up" to monitor and potentially override the agent's actions when the current state falls within the pre-identified symbolic unsafe regions. This surgical intervention preserves the agent's autonomy while ensuring a 0% collision rate.

Experimental Evaluation

The framework was evaluated on two primary navigation benchmarks:

  • Particle World: A 2D environment where an agent navigates to a target while avoiding obstacles using proximity sensors.
  • Mapless Navigation: A complex robotics task requiring a robot to navigate an unknown arena using 7 LiDAR scans and GPS data.

Key Findings

  • The Fallacy of Empirical Testing: The authors tested over 250 agents, selecting those with success rates exceeding 95%. Despite their high performance, formal verification discovered specific inputs for every single agent that would lead to 100% certain collisions. This underscores that empirical testing is insufficient for safety-critical deployment.
  • Efficiency Gains: In the Mapless Navigation task, the selective shield was active only 1.3% to 3.4% of the time. This led to a significant reduction in computational overhead. In Particle World, while standard shielding added a 40x overhead to execution time, the verification-guided approach reduced this to 14.1x. In the more complex robotics task, overhead dropped from 4.5x to just 1.5x.
  • Performance: The hybrid approach achieved an execution efficiency gain of up to 71.1% compared to traditional "always-on" shielding, without sacrificing the safety guarantee.

Discussion and Limitations

While Verification-Guided Shielding represents a significant step forward, several challenges remain. The method requires a logic-based encoding of environment dynamics; if the environment is too complex to model symbolically, synthesizing the shield becomes difficult. Additionally, while the shield ensures safety, it does not guarantee the agent will reach its goal efficiently—a shielded agent might become "trapped" in a safe but non-productive loop.

Furthermore, the current reliance on the Marabou verifier limits the framework to specific neural network activation functions. Future work will focus on integrating verification directly into the training loop to create "safety-aware" policies that minimize the need for shielding from the outset.

Conclusion

Verification-Guided Shielding bridges the gap between rigorous formal methods and practical DRL deployment. By using offline verification to "green-light" safe zones, the framework transforms shielding from a constant computational burden into a targeted safety net, enabling safer and more efficient autonomous systems.

Summary updated

Abstract

In recent years, Deep Reinforcement Learning (DRL) has emerged as an effective approach to solving real-world tasks. However, despite their successes, DRL-based policies suffer from poor reliability, which limits their deployment in safety-critical domains. Various methods have been put forth to address this issue by providing formal safety guarantees. Two main approaches include shielding and verification. While shielding ensures the safe behavior of the policy by employing an external online component (i.e., a ``shield'') that overrides potentially dangerous actions, this approach has a significant computational cost as the shield must be invoked at runtime to validate every decision. On the other hand, verification is an offline process that can identify policies that are unsafe, prior to their deployment, yet, without providing alternative actions when such a policy is deemed unsafe. In this work, we present verification-guided shielding --- a novel approach that bridges the DRL reliability gap by integrating these two methods. Our approach combines both formal and probabilistic verification tools to partition the input domain into safe and unsafe regions. In addition, we employ clustering and symbolic representation procedures that compress the unsafe regions into a compact representation. This, in turn, allows to temporarily activate the shield solely in (potentially) unsafe regions, in an efficient manner. Our novel approach allows to significantly reduce runtime overhead while still preserving formal safety guarantees. We extensively evaluate our approach on two benchmarks from the robotic navigation domain, as well as provide an in-depth analysis of its scalability and completeness.
BibTeX
@inproceedings{corsi2024verification,
  author = {Davide Corsi and Guy Amir and Andoni Rodríguez and Guy Katz and César Sánchez and Roy Fox},
  title = {{Verification-Guided Shielding for Deep Reinforcement Learning}},
  booktitle = {RLC},
  year = {2024},
  url = {https://openreview.net/forum?id=cbv3eKoagp},
}
Figure