Physics-model-guided Worst-case Sampling for Safe Reinforcement Learning

Hongpeng Cao, Yanbing Mao, Lui Sha, Marco CaccamoarXiv 2024 · DOI

Introduction

Standard Deep Reinforcement Learning (DRL) has shown remarkable potential in complex control tasks, yet it often fails in "corner cases"—rare, high-risk scenarios where a system approaches its operational limits. In safety-critical applications like autonomous driving or robotics, these failures can be catastrophic. The primary challenge lies in the training distribution: agents are typically initialized in stable states or sampled uniformly, meaning they rarely encounter the boundaries of their safe operating envelope.

This paper introduces a physics-model-guided sampling strategy designed to bridge the gap between high-performance DRL and the rigorous safety requirements of Cyber-Physical Systems (CPS). By systematically identifying and training on worst-case conditions at the edge of safety, the proposed method develops policies that are both robust and data-efficient.

Methodology: The Phy-DRL Framework

The core of the approach is the Phy-DRL (Physics-regulated DRL) framework, which integrates classical control theory with modern reinforcement learning.

The Phy-DRL architecture integrates a residual action policy with physics-model-guided sampling to ensure safety in critical environments.

Residual Action Policy

Instead of relying solely on a neural network, the control action $a$ is decomposed into two components: $a = a_{drl} + a_{phy}$. The $a_{phy}$ term is a model-based "physics" action derived from a known (or linearized) system model $(A, B)$, providing a baseline of stability. The $a_{drl}$ term provides the data-driven flexibility to optimize performance beyond the linear model's capabilities.

Safety Envelope and Worst-case Sampling

Using Lyapunov stability theory and Linear Matrix Inequalities (LMIs), the authors define a Safety Envelope ($\Omega$). This is represented as a hyperellipsoid in the state space: $s^T P s \leq 1$. A "worst-case condition" is formally defined as any state $s$ located exactly on the boundary of this envelope ($s^T P s = 1$).

Instead of random guessing, the proposed sampling algorithm uses an analytical solution based on the eigenvalues and eigenvectors of the safety matrix $P$ to generate points precisely on this boundary. This avoids the "garbage data" problem of random sampling, which often selects physically unrecoverable states.

Experimental Evaluation

The framework was evaluated across four diverse environments:

  1. Cart-Pole System: A benchmark for stabilization and safety invariance.
  2. 2D Quadrotor: Waypoint tracking under strict position and pitch constraints using Safe-Control-Gym.
  3. Quadruped Robot (Simulated): Navigation in Pybullet under varying conditions like snow and wet roads.
  4. Quadruped Robot (Real): Physical deployment for lane tracking and velocity regulation to demonstrate real-world robustness.

Results and Discussion

The results demonstrate that training on the boundary of the safety envelope is key to making that envelope "invariant." If an agent learns to recover from the absolute worst-case starting positions, it inherently maintains safety during normal operation.

Visualization of the safety envelope (blue) and worst-case samples (green) on the boundary, illustrating the targeted sampling strategy.

Key Findings

  • Safety and Efficiency: In cart-pole experiments, worst-case sampling reduced the failure rate to less than 1%, compared to over 90% for random sampling with the same amount of data.
  • Generalization: The quadruped model trained on a single worst-case scenario (forward velocity on snow) successfully generalized to backward velocity on wet roads, significantly outperforming standard PD controllers.
  • Sampling Efficiency: The proposed method reached safe, stable policies in significantly fewer episodes compared to uniform sampling, which often requires orders of magnitude more data to encounter the same corner cases.

Limitations and Future Directions

While effective, the method currently relies on a known physics model. Future research will focus on handling systems with partially unknown or highly non-linear dynamics. Additionally, the authors suggest integrating a "Simplex" architecture—a fault-tolerant setup where a verified controller takes over if the DRL agent's actions risk a safety violation—to mitigate initial training instabilities.

Summary updated

BibTeX
@misc{cao2024physics,
  author = {Hongpeng Cao and Yanbing Mao and Lui Sha and Marco Caccamo},
  title = {{Physics-model-guided Worst-case Sampling for Safe Reinforcement Learning}},
  year = {2024},
  eprint = {2412.13224},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.13224},
}
Figure