Explainably Safe Reinforcement Learning

Sabine Rieder, Stefan Pranger, Debraj Chakraborty, Jan Kretinsky, Bettina Könighofer

Trust in a decision-making system requires both safety guarantees and the ability to interpret its behavior. This is particularly crucial for learned systems, whose decision-making processes are often highly opaque. This paper introduces a hierarchical framework to make "shielded" Reinforcement Learning (RL) understandable to humans. By breaking down complex safety logic into a three-level hierarchy of compact decision trees, the authors provide clear, case-based explanations for why certain actions are blocked, making safe RL systems significantly more trustworthy without sacrificing performance.

The Problem: The Opacity of Safety Shields

Reinforcement Learning agents are famous for their "black box" nature. In safety-critical applications like autonomous driving or aviation, this opacity is a dealbreaker. To solve this, researchers often use Shielding: a technique where a mathematically verified "shield" sits between the RL agent and the environment, blocking any action that would violate safety constraints.

However, shields introduce their own transparency problem. They are typically implemented as massive lookup tables containing thousands or millions of states. While they guarantee safety, they cannot explain why they just overrode the agent. If a self-driving car suddenly swerves, the human operator needs to know if it was avoiding a hidden obstacle or simply malfunctioning. Previous attempts to use Decision Trees (DTs) to represent shields failed because shields are "non-deterministic" (they allow any action that is safe, not just one). This non-determinism causes the size of the decision trees to explode, making them just as unreadable as the lookup tables they replaced.

The Solution: Hierarchical Safety Explanations

To address this, the authors propose a Hierarchical Safety Explanation framework. Instead of relying on one giant tree, they use three specialized levels to localize and simplify the explanation.

Hierarchical framework for safety explanations showing L1, L2, and L3 decision trees.
  1. Level 1: Risk of States (Design Time): A high-level decision tree classifies the current environment into four human-centric categories: Safe (all actions are fine), Critical (some actions are risky), Dangerous (all actions are risky, but some are "less bad"), and Unsafe (safety already violated).
  2. Level 2: Risk of Actions (Runtime): When the system enters a critical or dangerous state, this level provides a localized decision tree explaining which specific actions are allowed and which are blocked.
  3. Level 3: Consequences of Actions (Runtime): If a user asks, "Why is action A unsafe?", the system generates an Execution Tree. This visual trace shows the most likely sequence of events that would lead to a crash or failure if that action were taken.

The system uses Markov Decision Processes (MDPs) to model the world and Probabilistic Model Checking (specifically value iteration) to calculate the exact risk of every state-action pair.

Evaluation and Key Findings

The researchers evaluated their method on three distinct RL benchmarks: Frozen Lake (grid-world navigation), Highway Cruise Control (high-speed driving and lane switching), and Boeing Taxinet (autonomous aircraft taxiing).

  • Massive Compression: The "aha moment" of the paper is that you don't need to explain the entire shield at once. By localizing the explanation, the decision trees remain small enough for a human to read in seconds. In the Highway scenario, a shield with over 232,000 entries was condensed into a Level 1 tree with just 57 nodes—several orders of magnitude smaller than the original shield.
  • Speed and Accuracy: Computing these explanations is fast. Generating Level 1 and Level 2 trees took between 1.3 and 17.4 seconds, even for complex environments. Furthermore, the trees achieved perfect accuracy in representing the shield's logic, ensuring the explanation never misrepresents the safety system.
  • Zero-Data Overhead: The framework doesn't require any extra training data or labels. It extracts explanations directly from the world model and safety specifications already required to build the shield.
  • Vocabulary of Risk: Partitioning the state space into Safe, Critical, Dangerous, and Unsafe provides a crucial bridge between formal mathematical verification and human intuition.

Limitations and Future Work

While highly effective at compressing shield logic, the framework's clarity depends heavily on user-defined predicates. For example, if a user doesn't provide a "distance to nearest car" feature, the tree might try to explain safety using raw coordinates, which is much harder for humans to parse. The authors identify the automated discovery of these "intelligent predicates" as a key area for future research. Finally, while the trees are demonstrably small, future work will need to include formal user studies to quantify exactly how much these explanations improve human performance and trust in real-world settings.

Summary updated

BibTeX
@inproceedings{rieder2025explainably,
  author = {Sabine Rieder and Stefan Pranger and Debraj Chakraborty and Jan Kretinsky and Bettina Könighofer},
  title = {{Explainably Safe Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=l6hAqx4eoB},
}
Figure