Test Where Decisions Matter: Importance-driven Testing for Deep Reinforcement Learning

Stefan Pranger, Hana Chockler, Martin Tappler, Bettina Könighofer

Abstract

Deep Reinforcement Learning (RL) policies are notoriously difficult to verify because testing every possible state is computationally impossible. This paper introduces Importance-driven Model-based Testing (IMT), a framework that identifies and prioritizes "critical" states where an agent's decisions have the most impact on safety. By focusing on these high-stakes moments, IMT can provide formal safety guarantees for the entire state space while sampling only a tiny fraction of the actual policy.

Introduction

As Reinforcement Learning (RL) agents transition from controlled research environments to safety-critical real-world applications—such as autonomous driving or drone navigation—the need for formal safety guarantees becomes paramount. However, current verification methods face a significant scalability challenge. Exhaustive testing is often infeasible due to infinite or astronomically large state spaces. Conversely, traditional "black-box" testing methods, like fuzzing, are effective at uncovering bugs but fail to provide rigorous proofs of safety. This paper addresses this gap by asking: Can we rigorously identify which states actually matter for safety and focus our formal verification budget there?

The IMT Framework

The authors propose a model-based approach called IMT (Importance-driven Model-based Testing). Unlike standard testing that treats all states equally, IMT focuses on the "frontiers" where decisions have the highest impact on safety outcomes. The framework operates in an iterative loop designed to bridge the gap between exhaustive verification and random sampling.

Overview of the Importance-driven Model-based Testing (IMT) framework.
  1. Safety Estimates: The system maintains two bounds for every state: an optimistic estimate (the best possible safety outcome if the agent plays perfectly from here) and a pessimistic estimate (the worst possible outcome if the agent makes the worst possible choices in unknown states).
  2. Importance Ranking: It calculates "importance" by looking at the difference a decision makes. If every action leads to a safe outcome, the state is low importance. If one action leads to a goal and another to a cliff, that state is high importance.
  3. Policy Sampling: The framework queries the actual RL policy only for the highest-ranked states.
  4. MDP Restriction: Once a decision is sampled, that part of the environment model (the Markov Decision Process or MDP) is "restricted" to that specific action. This narrows the gap between the optimistic and pessimistic estimates.
  5. Clustering (Scalability Boost): For massive environments, the authors group similar states together. They test a small fraction of the cluster and, if safe, assume the whole cluster is safe (a "conservative evaluation").

Experimental Evaluation

The researchers evaluated IMT across three distinct environments: a Slippery Gridworld, a UAV Reach-Avoid Task (25,517 states), and Atari Skiing (roughly 2.2 million states).

Performance comparison of IMT against baselines in terms of verified states and safety estimates.

In the Slippery Gridworld, IMT achieved complete verification of the state space by sampling the policy only 33 times. In contrast, random testing required over 1,000 queries and still failed to find all safety violations. In the UAV task, IMT was significantly faster than standard model-based testing; for instance, at a noise level of 0.1, IMT verified the policy in 269 seconds, while the baseline took 1,793 seconds. On the Atari Skiing task, IMT with clustering successfully partitioned the 2.2-million-state space into safe and unsafe regions, demonstrating the framework's scalability to high-dimensional inputs.

Key Insights and Ideas

  • Decisions aren't created equal: In many RL tasks, the agent spends most of its time in "boring" states where any reasonable action is fine. Safety hazards are usually concentrated in specific "frontiers."
  • Formal Proofs via Pessimism: The most powerful feature of IMT is that if the pessimistic estimate meets the safety threshold, the policy is formally verified for that state. You don't need to test every path; you just need to prove that even with "worst-case" behavior in the remaining unknown states, the agent remains safe.
  • Explainability as a byproduct: By ranking state importance, IMT naturally highlights the "critical decisions" of a policy, helping humans understand where a model is fragile or robust.

Conclusion and Future Work

IMT offers a scalable path toward formal verification of Deep RL policies by prioritizing high-stakes decisions. While the current framework is designed for deterministic policies and is dependent on the accuracy of the underlying MDP model, it represents a significant step forward in making RL verification practical for real-world systems. Future research will focus on extending this approach to stochastic policies and utilizing deep clustering techniques for more complex vision-based tasks.

Summary updated

BibTeX
@inproceedings{pranger2024test,
  author = {Stefan Pranger and Hana Chockler and Martin Tappler and Bettina Könighofer},
  title = {{Test Where Decisions Matter: Importance-driven Testing for Deep Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=TwrnhZfD6a},
}
Figure