State-wise Safe Reinforcement Learning With Pixel Observations

Simon Sinong Zhan, Yixuan Wang, Qingyuan Wu, Ruochen Jiao, Chao Huang, Qi Zhu · DOI

Introduction

Reinforcement Learning (RL) has demonstrated remarkable success in complex tasks, yet its application in safety-critical real-world domains—such as autonomous driving and robotics—remains limited. Traditional RL often relies on a "trial and error" approach that is unacceptable when a single mistake can lead to catastrophic failure.

Most existing "Safe RL" frameworks utilize Constrained Markov Decision Processes (CMDPs), which typically enforce "soft" constraints by minimizing the average cost over a trajectory. However, real-world safety often demands "hard" state-wise constraints (e.g., "never collide with a hazard"). Furthermore, classical control-theoretic tools like Barrier Functions, which provide these hard guarantees, generally require low-dimensional state information and known system dynamics—requirements that are rarely met when dealing with raw pixel observations and complex, unknown environments.

Methodology: The Latent Barrier Framework

To bridge the gap between deep RL and control theory, this paper introduces a framework that operates within a Latent State Space. By compressing high-dimensional pixel data into a manageable latent representation, the authors enable the application of rigorous safety constraints.

Overview of the proposed framework, showing the transition from real environment trajectories to latent modeling and joint policy/barrier optimization.

The architecture consists of three primary components:

  1. Latent Dynamics Modeling: A VAE-like encoder maps raw images ($O_t$) to latent states ($z_t$). A world model is then learned to predict transitions, rewards ($r_t$), and safety indicators ($\kappa_t$).
  2. Latent Barrier-like Function (LBF): The core innovation is a barrier function $B_\theta$ defined directly on the latent states. It is trained to ensure "forward invariance"—mathematically guaranteeing that if an agent begins in a safe state, the learned policy will prevent it from entering unsafe regions.
  3. Joint Optimization: The latent model, the barrier function, and the policy (actor-critic) are trained simultaneously. The LBF acts as a differentiable safety regularizer, allowing safety-related gradients to directly influence policy updates.

Experimental Evaluation

The framework was evaluated using the Safety Gym benchmark suite, focusing on the SG6 tasks which include various robots (Point, Car, and the complex quadruped Doggo) performing navigation and manipulation tasks (Goal, Push, Button). Agents received $3 \times 64 \times 64$ pixel images from a front-facing camera, providing a realistic sensing challenge.

Key Results and Insights

The proposed method demonstrated significant improvements in safety during the learning process. By using the latent space as a "sandbox," the agent can "imagine" potential hazards and avoid them before they occur in the real environment.

Comparison of Cost Return and Normalized Cost Regret across various Safety Gym tasks. The proposed method (Ours) consistently achieves lower violations compared to baselines like LAMBDA and Safe-SLAC.

Key findings include:

  • Superior Safety Metrics: As shown in the results, the method achieved substantially lower Cost Regret (total violations during training) and Cost Return (average violations per episode) compared to state-of-the-art baselines like LAMBDA and Safe-SLAC.
  • Efficiency of Hard Constraints: Counter-intuitively, enforcing "hard" state-wise constraints via the barrier function led to faster safety convergence than the "soft" cost-averaging used in traditional CMDPs.
  • Robustness to Complex Dynamics: The system proved effective even for the "Doggo" robot, which features non-smooth, contact-rich dynamics that typically challenge traditional control methods.

Limitations and Future Outlook

While the framework marks a significant step forward, it faces challenges regarding partial observability. Since the agent relies on a single front-view camera, hazards outside its field of view may not be accounted for. Additionally, the system's safety is inherently tied to the accuracy of the latent world model.

Future research may explore distribution-based barrier functions to better handle uncertainty by encoding safety over the entire probability distribution of future states, further enhancing robustness in unpredictable environments.

Summary updated

BibTeX
@inproceedings{zhan2024state,
  author = {Simon Sinong Zhan and Yixuan Wang and Qingyuan Wu and Ruochen Jiao and Chao Huang and Qi Zhu},
  title = {{State-wise Safe Reinforcement Learning With Pixel Observations}},
  booktitle = {L4DC},
  year = {2024},
  url = {https://openreview.net/forum?id=RJasVYjgIT},
}
Figure