Safe Reinforcement Learning Using Probabilistic Shields (Invited Paper)

Nils Jansen, Bettina Könighofer, Sebastian Junges, Alex Serban, Roderick Bloem

TL;DR

This paper introduces a "probabilistic shield" to make reinforcement learning (RL) agents safer during exploration by ensuring safety constraints are met with high probability. By leveraging formal verification techniques on a simplified model of the environment, they efficiently compute safety probabilities and construct shields that guide RL agents away from unsafe actions while still allowing for performance optimization.

What Problem Does This Paper Address?

Reinforcement learning (RL) agents learn by trial and error, exploring their environment to discover optimal strategies. However, this exploration phase can lead to undesirable or even dangerous actions, especially in safety-critical applications like robotics or autonomous driving. Existing "safety shields" often enforce strict safety, potentially hindering exploration and learning. This paper addresses the challenge of balancing safety with efficient learning by developing a probabilistic approach to shielding, allowing for a controlled level of risk during exploration.

Methods

The core of the proposed solution is a probabilistic shield. Here's a breakdown of their approach:

  • Probabilistic Shields: Instead of strictly forbidding unsafe actions, the shield allows actions that have a probability of violating safety constraints below a certain threshold ($\delta$). This threshold is adaptive, allowing for more or less permissive shielding.
  • Markov Decision Processes (MDPs): The environment is modeled as an MDP, which is a standard framework for decision-making under uncertainty.
  • Formal Verification (Model Checking): To determine the safety probabilities of actions, the authors employ model checking. This technique analyzes a formal model of the system to verify properties.
  • Safety-Relevant MDP Quotient: To overcome scalability issues with model checking on large MDPs, they construct a "safety-relevant MDP quotient." This is a significantly smaller, simplified model that captures only the essential aspects for safety analysis.
  • Behavior Models for Adversaries: For scenarios with multiple agents (adversaries), they learn probabilistic models of their behavior, often using RL on smaller instances of the environment. These learned models are then used to construct the safety-relevant MDP.
  • Separation of Concerns: The approach separates the safety aspect (handled by the shield and formal verification) from the performance objective (handled by the RL agent). This allows for analyzing safety on a smaller, dedicated model.
  • Iterative Weakening: To further balance safety and performance, they propose an "iterative weakening" mechanism. If the RL agent's progress stalls, the shield can be made more permissive to allow for more exploration, and then tightened again once progress is made.

Datasets

The paper does not explicitly mention using pre-existing datasets for training. Instead, they generate their own data by:

  • Learning Adversary Behavior: They observe the behavior of adversaries in "similar, but smaller arenas" to learn their probabilistic models. This is done using RL.
  • Case Studies: They evaluate their approach on two specific case studies:
  • PAC-MAN: They use instances of the classic PAC-MAN game as an arena.
  • Service Robots in a Warehouse: They create a warehouse floor plan with corridors and machines as their second case study.

Key Insights and Ideas

  • Probabilistic Safety is Sufficient: For many real-world scenarios, absolute safety is not achievable or is overly restrictive. A probabilistic guarantee (e.g., "safety violations occur with less than 1% probability") is often more practical and allows for better learning.
  • Scalability via Abstraction: The key to making formal verification practical for complex RL problems is to reduce the state space. The "safety-relevant MDP quotient" is a crucial abstraction that allows model checking to be applied to problems that would otherwise be intractable.
  • Shielding as a Teacher: The probabilistic shield acts as an intelligent "teacher" for the RL agent, guiding it towards safe exploration without completely dictating its actions. This allows the RL agent to still optimize its performance objective.
  • Trade-offs are Explicit: The paper highlights the inherent trade-off between safety and performance. Their adaptive shielding mechanisms (like iterative weakening) provide a way to manage this trade-off dynamically during runtime.

Key Results

The paper demonstrates the effectiveness of their probabilistic shielding approach through experiments on PAC-MAN and a service robot warehouse scenario.

  • Improved Learning Efficiency: In both case studies, shielded RL agents learned significantly faster, requiring "orders of magnitude fewer episodes" to achieve good performance compared to unshielded agents.
  • Superior Performance: Shielded agents consistently achieved higher average scores and win rates. For example, in PAC-MAN, win rates improved dramatically from near zero to over 80% for some configurations.
  • Reduced Safety Violations: The probabilistic shield effectively prevented the agent from taking actions that would lead to safety violations, as demonstrated by the improved win rates and the qualitative observations in the videos.
  • Scalability Achieved: Despite the inherent complexity of the problem, their approach, combined with optimizations like piecewise construction and abstractions, allowed them to perform model checking on MDPs with millions of states.

Limitations and Future Work

  • Limitations:
    • Model Approximation: The learned behavior models for adversaries are approximations of the real world. Errors in these models can accumulate over longer horizons.
  • Finite Horizon: For tractability and to mitigate approximation errors, they often focus on finite-horizon properties, meaning guarantees are primarily for the immediate future.
  • Model-Based Shield Construction: The shield itself is constructed using model-based techniques (model checking). This requires a model of the environment, which might not always be available or accurate.
  • Future Work:
    • Deep Recurrent Neural Networks: Extend the approach to use deep recurrent neural networks for decision-making, which are more powerful for complex sequential tasks.
  • Model-Free Shield Learning: Explore learning shields directly from data, without relying on explicit model-based verification. This could further improve scalability and applicability to fully unknown environments.
  • Application to More Domains: Apply the probabilistic shielding concept to a wider range of complex arcade games and robotic applications.

Summary updated

BibTeX
@inproceedings{jansen2020safe,
  author = {Nils Jansen and Bettina Könighofer and Sebastian Junges and Alex Serban and Roderick Bloem},
  title = {{Safe Reinforcement Learning Using Probabilistic Shields (Invited Paper)}},
  booktitle = {CONCUR},
  year = {2020},
  doi = {10.4230/lipics.concur.2020.3},
}

Loading related content...

Figure