Safe Reinforcement Learning With Dead-Ends Avoidance and Recovery

Xiao Zhang, Hai Zhang, Hongtu Zhou, Chang Huang, Di Zhang, Chen Ye, Junqiao Zhao

TL;DR

This paper introduces DEA-RRL, a novel safe reinforcement learning (RL) framework that decouples task performance from safety. By learning a dedicated "recovery policy" to handle unsafe situations and identifying "dead-end" states (where safety is impossible), DEA-RRL allows the main task policy to explore more aggressively, leading to improved performance with guaranteed safety.

What Problem Does This Paper Address?

Reinforcement learning (RL) has shown remarkable success in various domains, but applying it to real-world scenarios like autonomous driving or robotics is fraught with safety concerns. Traditional RL methods can lead to catastrophic failures during exploration, causing damage to the agent or environment. Existing "safe RL" approaches often resort to overly conservative policies, which severely hinders exploration and limits learning, making them less rewarding. The core challenge is to enable agents to learn effectively and achieve high performance without compromising safety, especially in environments with potentially irreversible dangerous states (dead-ends).

Methods

The proposed framework, DEA-RRL, builds upon the Recovery RL (RRL) [5] and decoupled RL [6] concepts. Key innovations include:

  • Dead-End Identification: DEA-RRL explicitly aims to identify "dead-end" states – states from which no safe action can prevent a future failure. This is a crucial distinction from previous methods that might conservatively label any uncertain state as unsafe.
  • Decoupled Policies: The framework uses two distinct policies:
  • Task Policy ($\pi_{task}$): Focused solely on maximizing task performance (reward).
  • Recovery Policy ($\pi_{rec}$): Dedicated to ensuring safety, trained to avoid unsafe states and recover from dangerous situations.
  • Safety Critic ($Q_{rec}$): A critic network is trained to evaluate the safety of the recovery policy.
  • Behavior Correction Mechanism: During online training, the task policy's actions are checked by the safety critic. If an action is deemed unsafe, the recovery policy takes over to correct the behavior. This mechanism is designed to be "plug-and-play," meaning it can be integrated with various existing RL algorithms.
  • Offline Pre-training: The recovery policy and safety critic are pre-trained on an offline dataset. This allows them to learn robust safety behaviors without risking the agent during initial exploration. The paper uses Expectile Regression for training the safety critic and recovery policy, inspired by Implicit Q-Learning (IQL) [26], to handle out-of-distribution actions.

Datasets

The paper utilizes an offline dataset for pre-training the recovery policy and safety critic. This dataset consists of 2 million transitions, comprising:

  • 1 million transitions from the replay buffer of a Soft Actor-Critic (SAC) [27] training.
  • 1 million transitions generated by interacting with the environment using random actions. This was done to diversify the "failed" transitions, as random actions are more likely to lead to unsafe states. The paper also filters these transitions to keep only the 100 steps preceding a violation, aiming to capture critical safety-relevant information.

Key Insights and Ideas

  • Dead-ends are the true limit of safety: Identifying "dead-end" states, rather than just any potentially unsafe state, allows for a more precise definition of the safe exploration space. This is key to avoiding overly conservative policies.
  • Decoupling is powerful: Separating the task and safety objectives allows the task policy to explore more freely, leading to better performance without sacrificing safety. The recovery policy acts as a safety net.
  • Pre-training for safety is crucial: Learning a robust recovery policy and safety critic offline provides a strong foundation for safe online learning, preventing catastrophic failures early on.
  • Behavior correction can be general: The proposed behavior correction mechanism is designed to be task-independent, suggesting it can be integrated with various RL algorithms to enhance their safety.

Key Results

  • Improved Safety and Performance: DEA-RRL consistently achieved higher asymptotic safety (lower average violation rate) and in-training safety (fewer violations during training) compared to baselines like WCSAC and RRL, while maintaining comparable or even superior task performance (average cumulative reward).
  • Reduced Intervention: The ratio of steps where behavior correction was used (ARR) was significantly lower for DEA-RRL compared to RRL, indicating less interference with the task policy's learning process.
  • Generalizability: When the pre-trained DEA-RRL behavior correction mechanism was combined with other RL algorithms (SAC, IQL), it substantially improved their safety in testing without significant performance degradation.
  • Ablation Studies: Experiments showed that the specific offline training methods (e.g., using MSDP vs. IQL-inspired approaches) and the choice of safety threshold ($E_{safe}$) significantly impact performance and safety, with DEA-RRL demonstrating robustness across different settings.

Limitations and Future Work

  • Offline Data Dependence: The performance of the pre-trained recovery policy and safety critic is dependent on the quality and coverage of the offline dataset.
  • Exploration Difficulty: In very complex environments, the behavior correction mechanism might make exploration more challenging, potentially leading to slightly lower returns initially (as seen in DoggoGoall).
  • Future Work:
    • Adaptive Safety Thresholds: The authors suggest incorporating model-based RL to estimate uncertainty and make the safety threshold ($E_{safe}$) adaptive.
  • Offline Safe RL: Developing an offline RL algorithm that inherently incorporates behavior correction to improve task performance.

Summary updated

BibTeX
@article{zhang2023safe,
  author = {Xiao Zhang and Hai Zhang and Hongtu Zhou and Chang Huang and Di Zhang and Chen Ye and Junqiao Zhao},
  title = {{Safe Reinforcement Learning With Dead-Ends Avoidance and Recovery}},
  journal = {IEEE Robotics Autom. Lett.},
  year = {2023},
}
Figure