Conservative Distributional Reinforcement Learning with Safety Constraints

Hengrui Zhang, Youfang Lin, Sheng Han, Shuo Wang, Kai LvarXiv 2022

Introduction

Reinforcement Learning (RL) has achieved remarkable success in simulated environments, yet its transition to real-world physical systems remains hampered by safety concerns. In domains like robotics or autonomous driving, the traditional "trial and error" approach is prohibitively expensive; a single "error" can lead to catastrophic hardware failure. To address this, researchers utilize Constrained Markov Decision Processes (CMDPs), which seek to maximize cumulative rewards while ensuring that specific safety costs remain below a predefined threshold.

Challenges in Safe Reinforcement Learning

Existing off-policy CMDP algorithms typically struggle with three core issues:

  1. Inaccurate Risk Estimation: Most methods model the expected cost. However, safety is often determined by "tail risks"—rare but severe events that average-cost models fail to capture.
  2. Unsafe Exploration: The inherent need for exploration in RL often leads agents to sample dangerous actions during the learning phase.
  3. Optimization Instability: The use of Lagrange multipliers to balance reward and safety often results in high-frequency oscillations, causing the agent to alternate between overly reckless and excessively timid behavior.

The CDMPO Framework

The authors propose Conservative Distributional Maximum a Posteriori Policy Optimization (CDMPO) to overcome these hurdles through three integrated innovations.

Distributional Cost Modeling

Rather than predicting a scalar mean cost, CDMPO estimates the entire probability distribution of potential costs. This distributional perspective allows the agent to quantify the likelihood of safety violations more accurately, particularly in high-variance or uncertain scenarios.

Conservative Exploration and CDCL

To mitigate risks during training, CDMPO employs a "safety filter" strategy. The agent generates multiple candidate actions and utilizes a cost critic to select the one with the lowest predicted risk. To ensure this critic is reliable, the authors introduce Conservative Distributional C-function Learning (CDCL), a loss function designed to keep the cost critic pessimistic (conservative) regarding potentially risky actions.

Stabilized Lagrangian Updates with WAPID

To address the instability of standard gradient-based Lagrange multiplier updates, CDMPO incorporates a Weighted Average Proportional-Integral-Derivative (WAPID) controller. By treating the constraint satisfaction as a control problem and applying damping through weighted averages, the algorithm achieves a much smoother trade-off between reward maximization and safety adherence.

Experimental Evaluation

The framework was evaluated on the Safety-Gym benchmark, specifically the CarGoal1 and PointGoal1 tasks. These environments require robots to navigate to goals while avoiding hazards, with costs incurred for every collision.

Results and Discussion

CDMPO demonstrates significant improvements over baseline algorithms such as PPO-Lag, TRPO-Lag, and WCSAC.

Training performance of CDMPO compared to SAC-Lag and WCSAC, showing superior reward convergence and lower average episode cost.

As shown in the training curves, CDMPO maintains a consistently lower average episode cost throughout the learning process compared to SAC-Lag and WCSAC, while simultaneously achieving competitive or superior returns. The stability provided by the WAPID controller is evident in the lack of erratic oscillations in the cost metrics.

Box plot of average episode costs across different algorithms. CDMPO is the only method to maintain a median cost below the safety threshold (red dashed line).

The box plot analysis reveals that CDMPO is uniquely effective at keeping the median cost below the safety limit. In contrast, other "safe" baselines frequently violate the threshold. Furthermore, ablation studies highlighted the importance of conservative filtering: the full CDMPO model recorded only 20 safety violations during training, whereas a version without filtering suffered 109 violations.

Conclusion

CDMPO represents a significant step toward "safety-first" reinforcement learning. By combining distributional modeling with conservative action selection and control-theoretic optimization, it provides a robust framework for learning in high-stakes environments. Future work will explore more sophisticated distribution representations, such as Quantile Regression, to further enhance precision in complex autonomous scenarios.

Summary updated

BibTeX
@misc{zhang2022conservative,
  author = {Hengrui Zhang and Youfang Lin and Sheng Han and Shuo Wang and Kai Lv},
  title = {{Conservative Distributional Reinforcement Learning with Safety Constraints}},
  year = {2022},
  eprint = {2201.07286},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.07286},
}
Figure