Introduction
Reinforcement learning (RL) agents often face significant risks when operating in real-world environments. Traditional trial-and-error learning can lead to catastrophic failures, such as a robotic arm colliding with its surroundings. To mitigate these risks, "shielding" techniques have been developed to act as a safety filter between the agent and the environment. However, conventional shielding relies on manually defined, mathematically precise models of environment dynamics, which are difficult to construct for complex, high-dimensional, or stochastic settings.
This paper introduces latent shielding, a novel approach where the agent learns its own internal world model to anticipate and block unsafe actions. By leveraging learned abstractions, latent shielding enables safety-aware RL in visual environments without requiring a priori environment models. This approach drastically reduces safety violations during both training and testing in complex, high-dimensional environments.
Methodology
The core of the proposed method is Approximate Bounded Prescience Shielding (ABPS), built upon the Dreamer architecture. The system consists of three primary components:
- Safety RSSM (SRSSM): The agent learns a Recurrent State-Space Model (RSSM) from interaction data. This latent world model is augmented with a violation prediction head—a neural network trained to predict if a latent state violates safety specifications.
- Latent Shielding: Before executing an action, the shield uses the SRSSM to "imagine" multiple future trajectories. If the predicted probability of a safety violation exceeds a threshold $\epsilon$, the shield overrides the agent's action with a safe alternative.
- Shield Introduction Schedule (SIS): To avoid the "Catch-22" where an uninitialized shield prevents the exploration needed to learn a good world model, the authors use a schedule. The shield is initially disabled, allowing the agent to explore and refine its model before the shield is gradually phased in.
Experimental Evaluation
The authors evaluated latent shielding on two distinct benchmarks:
- Visual Grid World (VGW): A navigation task using 64x64x3 pixel observations where the agent must reach a goal while avoiding red "unsafe" zones.
- Cliff Driver (CD): A stochastic environment where an agent controls a car's acceleration and must stop at a cliff edge. The environment includes "stuck" controls to simulate real-world unpredictability.
Key Results
In the Visual Grid World, the latent shielded agent significantly outperformed the unshielded Dreamer baseline. It achieved higher test rewards (15,067 vs. 13,148) and a 7x reduction in safety violations (0.30 vs. 2.25). Compared to model-free approaches like Constrained Policy Optimization (CPO), latent shielding reduced training-time violations by over an order of magnitude (e.g., 1,262 vs. 16,455 for CPO).
In the stochastic Cliff Driver environment, the latent shield even outperformed traditional Bounded Prescience Shielding (BPS) that had access to the ground-truth simulator. This suggests that learned models can better capture the nuances of stochasticity than some exact abstractions.
Discussion and Conclusion
Latent shielding demonstrates that learned abstractions can effectively replace handcrafted models for safety-critical RL. By sampling trajectories based on the agent's policy, the method remains computationally efficient while providing robust safety in high-dimensional visual spaces.
A notable trade-off is the loss of formal safety guarantees. Since the shield relies on a learned neural approximation, it cannot provide the same level of verifiable assurance as symbolic methods. Future research will focus on developing more sophisticated shield introduction schedules and exploring ways to re-introduce formal verification into latent world models.
Summary updated