Safe Reinforcement Learning via Shielding under Partial Observability

Steven Carr, Nils Jansen, Sebastian Junges, Ufuk Topcu

Abstract

This paper introduces a framework for Safe Reinforcement Learning (RL) in partially observable environments by integrating "shielding" with deep RL. By using a partial model of the environment to track possible states (belief supports), the framework provides a mechanism that guarantees safety during exploration and accelerates the learning process in complex, sparse-reward tasks.

Introduction

Reinforcement Learning agents typically learn through trial and error. However, in safety-critical applications like autonomous driving or robotics, a single error can be catastrophic. While "Safe RL" aims to prevent these disasters, most existing methods assume the agent has perfect information about its state (Markov Decision Processes).

In real-world settings, agents often face Partial Observability (POMDPs), receiving only noisy or incomplete sensor data. In these scenarios, an agent struggles not only with decision-making but also with state estimation. Previous shielding techniques, which act as a "guardian angel" to block unsafe moves, had not been effectively integrated with modern deep RL for these partially observable scenarios until now.

Methodology: The Knowledge Interface

The core of the proposed approach is a "Knowledge Interface" that sits between the agent and the environment. This interface consists of two main components derived from a partial model of the environment:

  1. Belief Support State Estimator: Rather than calculating exact probabilities for every possible state—a computationally expensive task—this estimator tracks the set of all possible states the agent could occupy, given its history of actions and observations.
  2. The Shield: Based on the current belief support, the shield identifies "winning regions"—sets of states from which safety can be formally guaranteed. If the RL agent suggests an action that could lead to an unsafe ("AVOID") state or a region where safety can no longer be maintained, the shield blocks it and forces a safe alternative.
The high-level architecture of the shielded RL framework, showing the interaction between the Agent, Environment, and the Knowledge Interface containing the State Estimator and Shield.

Key Innovation: The shield only requires a partial model (the transition graph) rather than exact probabilities or reward functions. This makes it practical for real-world applications where exact transition dynamics are often unknown.

Experimental Evaluation

The approach was evaluated on six challenging grid-based POMDP environments with sparse rewards: Refuel, Obstacle, Avoid, Evade, Intercept, and Rocks. These tasks require navigating noisy environments, dodging moving robots, or catching adversaries while avoiding hazards. The authors integrated this shield with several state-of-the-art deep RL algorithms, including DQN, PPO, SAC, and REINFORCE.

Key Results and Insights

  • Zero Violations: In all experimental evaluations, shielded agents recorded zero safety violations during the entire training process. In contrast, unshielded agents failed thousands of times (e.g., averaging ~3,153 violations for REINFORCE).
  • Safety as a Learning Heuristic: Surprisingly, the shield does more than just ensure safety; it acts as a powerful guide. By blocking "dead-end" regions that contain no rewards, the shield prevents the agent from wasting time exploring useless areas, significantly speeding up convergence.
  • Performance Boost: In the Obstacle domain, an unshielded random policy crashed 95% of the time. The shielded agent not only survived but reached the goal consistently, achieving much higher average rewards faster than unshielded counterparts.
Performance plots across various POMDP environments. The shielded agents (solid lines) demonstrate faster convergence and higher average rewards compared to unshielded baselines (dashed lines).

Conclusion and Future Work

This work demonstrates that belief supports are sufficient to compute robust shields for POMDPs. By providing an agent with "don't go there" information via the shield, safety can be guaranteed even under uncertainty. While the method currently depends on a transition graph model, future work will explore model-based distance measures and contingency plans to help agents navigate even more complex, dynamic environments.

Summary updated

BibTeX
@inproceedings{carr2023safe,
  author = {Steven Carr and Nils Jansen and Sebastian Junges and Ufuk Topcu},
  title = {{Safe Reinforcement Learning via Shielding under Partial Observability}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i12.26723},
}
Figure