Provably Safe, Yet Scalable Reinforcement Learning

Kai S. Yun, Zeyang Li, Navid Azizan

TL;DR

Training robots with reinforcement learning usually forces an uncomfortable choice: move fast and occasionally crash, or use strict mathematical safety guarantees that are computationally intractable for complex systems and make the robot overly timid. PS2-RL breaks this trade-off by first training an RL "backup pilot" to map out an expansive, implicit safety zone online, and then training a primary policy end-to-end through a differentiable safety filter. The result is 100% provable safety and agile performance on systems up to 10 dimensions—no sluggish, over-cautious behavior required.

What Problem Does This Paper Address?

When deploying reinforcement learning (RL) on physical hardware, "mostly safe" isn't good enough. Standard safe RL approaches add soft penalties for breaking rules, which works well on average but offers zero formal guarantees against a catastrophic crash during deployment.

To get strict, mathematical guarantees, engineers use control-invariant sets—certified regions of the state space where the system can stay safe forever, even with limited motor power (like a car whose brakes can actually stop it before a cliff). Computing these sets explicitly (e.g., via Control Barrier Functions or Hamilton-Jacobi reachability) suffers from the curse of dimensionality, scaling terribly beyond a few variables.

A clever workaround called Backup Control Barrier Functions (BCBF) avoids computing the giant safe set upfront. Instead, it starts with a tiny, easily certified "home base" (like hovering stably) and checks online if a deterministic backup policy can steer the robot back to base safely within a short time horizon. However, BCBF shifts the bottleneck: hand-crafted backup policies (like simple linear controllers) are not agile enough to recover from extreme states, leaving the robot trapped in a tiny, overly conservative playground.

Methods

The authors introduce PS2-RL (Provably Safe, yet Scalable RL), a two-phase architecture that plugs into any standard RL algorithm.

Figure 1: Overview of the PS2-RL framework.
  • Phase I: Learning to Recover (New). Instead of hand-designing the backup controller, PS2-RL learns it. They anchor a tiny equilibrium region with a classic certified linear controller, then train a neural safe-arrival policy everywhere else. They introduce a novel safe-arrival value function—an indicator-based objective that rewards the agent $\beta^N$ for reaching the base set safely in $N$ steps, and $0$ if it hits an obstacle. Because it satisfies a standard Bellman equation, off-the-shelf RL can train a time-optimal recovery policy. Crucially, the neural network itself doesn't need formal verification; forward-simulating its trajectory online implicitly defines a valid, enlarged safe set.
  • Phase II: Training Through the Shield (New). With the backup policy frozen, the main task policy is trained to maximize task rewards. Its actions pass through a Control-Invariant Layer (CIL)—a differentiable quadratic program (building on HardNet-CVX) that projects unsafe actions onto the nearest action guaranteed to keep a safe backup trajectory available. Because gradients flow right through this optimization layer, the agent learns with the safety filter in the loop rather than fighting against a post-hoc safety shield.

Datasets

Because this is an online control framework, there are no static datasets. Instead, the authors evaluate PS2-RL in continuous-control simulation environments where reference trajectories intentionally cross into unsafe territory, tempting the agent to violate constraints:

  1. 3D Unicycle Lane-Keeping: Tracking a wide sinusoidal path that weaves outside lane boundaries, under strict steering and acceleration limits.
  2. 10D Agile Quadrotor Powerloop: Executing an acrobatic $360^\circ$ vertical loop and flip under a hard 3-meter altitude ceiling (plus an extended test adding two lateral walls), controlled via thrust and body rates.

Key Insights and Ideas

  • Don't certify the network; certify its rollout: You don't need to mathematically verify the neural safe-arrival policy. As long as the tiny terminal base set is certified, integrating the neural policy forward in time automatically yields a valid, provably invariant safe set.
  • RL nearly maxes out theoretical safety limits: On a 2D slice of the unicycle task, the Phase I learned backup policy recovered 98.18% of the theoretical maximal control-invariant set (computed via expensive numerical reachability), vastly outperforming analytic controllers.
  • Safety without losing expressivity: Slapping a safety filter onto a trained RL agent usually ruins its performance (causing 41–45% worse tracking in the authors' ablations). Training end-to-end through the differentiable CIL preserves universal approximation within the safe policy class, letting the network anticipate and exploit safety boundaries smoothly.
Figure 2: Unicycle recoverability and lane-keeping. (a) Learned and analytic backup-induced sets, the base set, and trajectories of PS2SA and PS2ABP. (b) Projection onto the (y, ψ) plane over v ∈[0, 12] m/s (top) and slice at v = 5 m/s (bottom). (c) Lateral tracking (top) and corresponding backup-induced barrier values (bottom). (d) Learned backup-induced set versus the numerical HJ approximation of the maximal control-invariant set, shown at v = 5 m/s with a longer backup horizon.

Key Results

Across 10 seeds and 1,000 evaluation episodes per seed, PS2-RL achieved 100% safety (zero violations) on all tasks while outperforming all safe baselines:

  • Unicycle: PS2-RL cut lateral tracking error (RMSE) nearly in half compared to using an analytic backup policy (0.53 m vs. 0.97 m) and beat traditional CBF-RL (1.75 m). Soft-constrained baselines like SAC-Lagrangian achieved 0.52 m error, but crashed in 70% of episodes.
  • 10D Quadrotor: PS2-RL expanded near-ceiling recoverability from 35.5% (analytic backup) to 69.3%. Consequently, it achieved a 0.59 m position RMSE—reducing error by ~56% over the analytic backup and ~70% over Model Predictive Shielding.
  • Scalability & Speed: Adding two wall constraints to the quadrotor nearly tripled the optimization inequalities (from 110 to 312), yet inference time only rose from 0.62 ms to 0.82 ms per step on a single V100 GPU.

Limitations and Future Work

PS2-RL's ironclad guarantees rely on having an accurate, deterministic dynamics model (either analytic control-affine equations or a differentiable simulator) so it can forward-integrate backup rollouts and compute sensitivities. Real-world robots face wind gusts, friction quirks, and noisy cameras. Extending this framework to handle uncertain dynamics, disturbances, and perception-based constraints—and testing it on physical hardware—are the key next steps.

Summary updated

Abstract

Safe reinforcement learning (RL) aims to learn policies that optimize rewards while satisfying constraints. Predominant approaches rely on soft-constrained policy optimization, which has achieved empirical success but does not provide formal safety guarantees for the learned policy. In contrast, methods with strict guarantees typically rely on explicit certificate functions, whose construction requires the direct synthesis and verification of control-invariant sets, a process that scales poorly with state dimension and often yields overly conservative behavior. In this paper, we present the Provably Safe, yet Scalable RL (PS2-RL) framework, a novel two-phase architecture for learning provably safe policies in a scalable manner, designed to overcome the key bottlenecks of prior methods. Rather than explicitly computing invariant sets, PS2-RL leverages a learned backup policy to forward-integrate the system dynamics, generating an implicit control-invariant set online. In the first phase, the backup policy is trained with the safe-arrival value function to achieve rapid, safe recovery to the certified base set for invariant-set construction. In the second phase, an RL policy is trained end-to-end through a differentiable projection layer that strictly enforces the safety guarantees induced by the learned backup policy. By maximizing the volume of the implicit control-invariant set in the first phase, the resulting PS2 policy from the second phase is performant and scalable, while maintaining provable safety. Crucially, PS2-RL imposes no restrictions on the underlying RL algorithm and can be plugged into any existing training pipeline. We establish theoretical guarantees for the proposed framework and evaluate it on robotic control tasks with state dimensions up to 10, a regime in which prior provably safe RL methods struggle or become impractical.
BibTeX
@inproceedings{yun2026provably,
  author = {Kai S. Yun and Zeyang Li and Navid Azizan},
  title = {{Provably Safe, Yet Scalable Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=PHVIRBgte1},
}
Figure