Safe Policy Optimization with Local Generalized Linear Function Approximations

Akifumi Wachi, Yunyue Wei, Yanan Sui

Introduction

Reinforcement Learning (RL) is notoriously "brave"—to find the optimal policy, an agent must explore its environment, which inherently involves making mistakes. However, in safety-critical applications like autonomous driving or robotics, a single mistake (e.g., a crash) is unacceptable.

Existing "Safe RL" methods typically fall into two camps, both with significant drawbacks:

  1. Constraint-based methods (e.g., CPO): These algorithms attempt to minimize crashes but frequently violate safety constraints during the learning phase.
  2. Regularity-based methods (e.g., Gaussian Processes): These provide strict safety guarantees but assume the environment is "smooth" (Lipschitz continuous). In the real world, safety isn't always smooth—a robot might be perfectly safe one centimeter away from a cliff and doomed the next. Furthermore, these methods scale cubically with the number of samples, making them computationally impractical for large-scale problems.

To bridge the gap between theoretical safety guarantees and practical scalability, researchers have developed SPO-LF (Safe Policy Optimization with Local features). This novel algorithm guarantees safety throughout the entire training process without relying on restrictive smoothness assumptions.

Comparison of existing safe exploration vs. the proposed SPO-LF method.

The SPO-LF Approach

SPO-LF stands for Safe Policy Optimization with Local Generalized Linear Function Approximations. Instead of assuming safety is a smooth function of spatial coordinates, the agent uses local "features" (such as LiDAR or camera sensor data) to predict safety.

Key Mechanisms

  • Feature-Based Safety via GLMs: The algorithm uses Generalized Linear Models (GLMs)—a flexible framework encompassing linear and logistic regression—to map sensor features to safety and reward values. This allows the agent to handle abrupt, non-smooth changes in safety (like a sudden wall) and generalize knowledge about hazards across different areas.
  • Near-sighted vs. Far-sighted Observations: The agent collects direct reward and safety data from its current location (near-sighted). Crucially, it also uses sensors to observe the features of neighboring states (far-sighted). This dual-observation model allows the agent to predict if a future state is safe before taking a step.
  • Pessimistic and Optimistic Safe Sets: The algorithm maintains a "pessimistic" safe region (where it is almost certain it won't crash) to restrict movement, alongside an "optimistic" region used to plan potential exploration.
  • Event-Triggered Safe Expansion (ETSE): A common failure mode in safe RL is the agent getting "stuck" in a small, safe, but low-reward corner due to uncertainty. ETSE detects when the agent's optimal path is blocked by this uncertainty and temporarily shifts its objective to "expand the safe zone" rather than purely maximizing rewards.

Experimental Validation

The researchers evaluated SPO-LF on two primary benchmarks: a modified Gym-MiniGrid (a 25x25 grid world with 5-dimensional feature vectors) and Safety-Gym (a complex environment with continuous state/action spaces where a robot navigates a hazard-filled field).

Key Findings

  • Zero Safety Violations: In the rigorous Safety-Gym experiments, SPO-LF was the only algorithm to achieve zero safety violations during training. Standard baselines like CPO and PPO-Lagrangian frequently collided with hazards while learning.
  • Superior Scalability: Traditional Gaussian Process methods scale cubically with the number of samples ($O(N^3)$). In contrast, SPO-LF scales cubically with the number of features ($O(d^3)$). Because the feature dimension is usually small and fixed, SPO-LF successfully ran in massive environments (e.g., 150x150 grids) where GP-based methods computationally stalled.
  • High Sample Efficiency: In grid world environments, SPO-LF reached near-optimal rewards significantly faster than other theoretically-guaranteed safe methods.
  • Competitive Performance: Despite adhering to strict safety constraints, SPO-LF achieved cumulative rewards comparable to state-of-the-art deep safe RL methods that permitted crashes during training.

Limitations and Future Directions

While SPO-LF represents a significant step forward, it has limitations. To apply the algorithm to the continuous Safety-Gym environment, the researchers had to discretize the space into a grid. Future work will need to address continuous spaces more natively.

Additionally, the algorithm's safety guarantee inherently relies on the quality of the provided features; if sensors miss a critical hazard-defining feature, the GLM may miscalculate the safety boundary. Finally, the current theoretical proofs assume deterministic state transitions, making the extension to stochastic (random) environments a vital next step for real-world deployment.

Summary updated

BibTeX
@inproceedings{wachi2021safe,
  author = {Akifumi Wachi and Yunyue Wei and Yanan Sui},
  title = {{Safe Policy Optimization with Local Generalized Linear Function Approximations}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=DWvcqoRAQP8},
}
Figure