Abstract
Reinforcement Learning (RL) agents often struggle with safety during the exploration phase, as the standard trial-and-error approach can lead to catastrophic failures in real-world environments. While formal shielding techniques provide safety guarantees, they traditionally require perfect environment models and are often restricted to discrete state spaces. This paper extends Approximate Model-based Shielding (AMBS) to high-dimensional, continuous environments. By integrating shielding with a learned world model (DreamerV3), we demonstrate that agents can navigate pixel-based environments with formal probabilistic safety guarantees. Our results on the Safety Gym benchmark show a significant reduction in safety violations during training without sacrificing long-term performance.
Introduction
Reinforcement Learning has achieved remarkable success in complex tasks, yet its deployment in safety-critical systems remains limited. The primary bottleneck is the lack of safety guarantees during the learning process; an agent must often experience a failure to learn to avoid it. In robotics or autonomous driving, this is unacceptable.
Shielding is a formal methods-based technique that acts as a supervisory layer, monitoring an agent's proposed actions and overriding them if they are predicted to violate a safety property. However, classical shielding relies on a complete and correct mathematical model of the environment. Recent work on Approximate Model-based Shielding (AMBS) relaxed this requirement by learning the model from data, but it remained limited to tabular or discrete settings. This research bridges that gap, applying AMBS to continuous, vision-based environments where states are represented as pixels and actions are fluid forces.
Methodology
World Model and Latent Shielding
The framework is built upon DreamerV3, a state-of-the-art model-based RL algorithm. The agent learns a world model that encodes high-dimensional observations (3x64x64 pixels) into a compact latent space. To ensure safety, the shield "imagines" multiple future trajectories from the current latent state using Monte Carlo sampling. If the probability of a safety violation—defined by a propositional logic formula—exceeds a predefined threshold ($\Delta$), the shield intervenes. Upon intervention, the shield executes an action from a pre-learned backup safe policy to steer the agent away from danger.
Probabilistic Safety Guarantees
A core contribution of this work is the establishment of sample complexity bounds for continuous systems (Theorem 2). The authors prove that if the learned world model is sufficiently accurate (measured via KL divergence from the true environment dynamics), a finite number of Monte Carlo samples is sufficient to guarantee safety within a specific error margin ($\epsilon$). This demonstrates that formal probabilistic guarantees, typically reserved for simple discrete systems, can be mathematically extended to complex latent space models.
Policy Gradient Penalties
To prevent the agent from repeatedly attempting unsafe actions—a phenomenon where the task policy and shield "fight" for control—the authors introduced three penalty techniques to integrate safety directly into the policy gradient:
- PENL (Penalty Critic): A standard penalty-based approach using a safety critic.
- PLPG (Probabilistic Logic Policy Gradient): This method re-normalizes action probabilities based on their predicted safety, guiding the agent toward safer regions of the action space.
- COPT (Counter-example Guided Policy Optimization): This technique identifies "counter-example" traces (paths that lead to violations) and scales their gradients to zero, effectively discouraging the agent from exploring those trajectories.
Experimental Setup
The researchers evaluated the AMBS framework using the Safety Gym benchmark, focusing on three vision-based tasks with increasing complexity:
- PointGoal1: A 2D vehicle navigating around hazardous areas.
- PointGoal2: A more crowded environment with additional obstacles (vases).
- CarGoal1: A vehicle with complex 3D dynamics that are significantly harder to control.
In all experiments, the agents operated solely on raw pixel observations rather than ground-truth coordinates, testing the robustness of the latent representation.
Key Results and Discussion
Violation Reduction
Across all tested environments, AMBS variants demonstrated a dramatic reduction in safety violations compared to the baseline (DreamerV3 combined with an Augmented Lagrangian approach). In the PointGoal1 task, violations were reduced by over 50%. This suggests that the shield effectively blocks unsafe actions before they manifest in the real environment.
Stability and Performance
While shielded agents initially converge more slowly due to the restricted exploration of "dangerous" high-reward areas, they eventually achieve episode returns comparable to unshielded, "unsafe" baselines. Furthermore, the sophisticated penalty techniques (PLPG and COPT) proved essential for long-term stability. In 10-million-frame runs, these methods maintained stable convergence, whereas simpler penalty methods like PENL tended to diverge as the task complexity increased.
The Safety-Performance Trade-off
The study highlights an inherent trade-off: strict safety constraints can limit the speed of learning. However, by using safety-aware gradients, the agent eventually learns to avoid the shield's intervention, resulting in a policy that is both high-performing and inherently safer.
Conclusion and Future Work
This paper demonstrates that it is possible to bring formal safety guarantees to continuous, vision-based RL through Approximate Model-based Shielding. By leveraging latent space imagination and establishing theoretical bounds on model accuracy, the authors provide a path toward safer autonomous systems.
Limitations remain, particularly the heavy dependency on the world model's accuracy; if the model fails to represent a specific hazard, the shield cannot intervene. Future work will focus on refining the theoretical bounds for partially observable (POMDP) settings and reducing the computational overhead of simulating multiple imagined futures at every timestep.
Summary updated