Probabilistic Shielding for Safe Reinforcement Learning

Edwin Hamel-De le Court, Francesco Belardinelli, Alexander W. Goodall

Introduction

Reinforcement Learning (RL) has demonstrated remarkable success in complex decision-making tasks. However, its application in safety-critical domains like autonomous driving or industrial robotics is often hindered by the lack of formal safety guarantees. Traditional RL agents learn through trial and error, which in a real-world setting can lead to catastrophic failures during the training phase. This paper presents a scalable probabilistic shielding framework designed to provide strict formal safety guarantees during both training and deployment.

The Challenge of Formal Safety in RL

Existing "Safe RL" methods often rely on Lagrangian-based approaches that satisfy constraints only on average or after extensive training. While these methods reduce risk, they do not prevent the agent from entering unsafe states during exploration. Conversely, methods that offer rigorous mathematical guarantees frequently utilize Linear Programming (LP). While theoretically sound, LP-based methods suffer from poor scalability, making them impractical for environments with large state spaces. There is a clear need for a methodology that is both mathematically rigorous and computationally efficient.

Probabilistic Shielding Methodology

The proposed framework introduces a "shield" that acts as a protective layer between the RL agent and its environment. The core innovations include:

  1. Safety as Probabilistic Avoidance: Safety is defined as the requirement that the agent remains outside of designated "unsafe" states with a probability of at least $p$.
  2. State Space Augmentation: The authors construct a "Shielded MDP" by augmenting the original state space with a "safety level" $q \in [0, 1]$. This variable represents the maximum permissible probability of reaching an unsafe state from the current position.
  3. Scalable Value Iteration: To overcome the limitations of Linear Programming, the framework employs "Sound Value Iteration" algorithms. These provide an inductive $\epsilon$-upper bound on risk, significantly improving scalability for complex environments.
  4. Coherent Action Selection: The shield restricts the agent's action space to "coherent" actions—those where the weighted sum of risks in subsequent states does not exceed the current allowed risk level. This ensures that the agent never selects an action that would violate the global safety threshold.

Experimental Evaluation

The methodology was evaluated across five distinct case studies, ranging from buffer management in media streaming to high-stakes navigation tasks.

Overview of the gridworld and bridge environments used for evaluation, including Colour Bomb (v1 & v2) and Bridge Crossing (v1 & v2).

As shown in the figure above, the environments include:

  • Colour Bomb Gridworld: Navigation tasks where agents must avoid high-probability "bomb" states.
  • Bridge Crossing: A high-stakes scenario where an agent must traverse a narrow path over "lava" (unsafe states).
  • Pacman: A large-scale testbed with over 100,000 states, testing the framework's scalability against ghosts.

Key Results

  • Zero Safety Violations: In all experimental runs, the shielded PPO (PPO-Shield) maintained safety levels strictly within the defined threshold throughout the entire training process, unlike unshielded baselines.
  • Performance and Convergence: PPO-Shield consistently converged to higher rewards than popular baselines like PPO-Lagrangian and Constrained Policy Optimization (CPO). In restrictive environments like Bridge Crossing, baselines often failed to find safe paths entirely.
  • Scalability: By successfully managing the Pacman environment, the framework demonstrated its ability to handle state spaces that are orders of magnitude larger than those manageable by previous LP-based shielding methods.

Conclusion and Future Work

Probabilistic shielding offers a robust path forward for deploying RL in real-world, safety-critical applications. By decoupling safety dynamics from reward dynamics, the shield ensures that agents can explore and learn optimally without risking catastrophic failure.

A current limitation is the requirement for known safety dynamics (the layout and transition probabilities of unsafe states). Future research aims to develop iterative algorithms that can learn these dynamics safely over time, further expanding the applicability of probabilistic shielding to entirely unknown environments.

Summary updated

BibTeX
@inproceedings{court2025probabilistic,
  author = {Edwin Hamel-De le Court and Francesco Belardinelli and Alexander W. Goodall},
  title = {{Probabilistic Shielding for Safe Reinforcement Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i15.33767},
}
Figure