A universal policy wrapper with guarantees
Anton Bolychev, Georgiy Malaniya, Grigory Yaremenko, Anastasia Krasnaya, Pavel Osinenko
TL;DR
The paper presents CALF-Wrapper, a universal runtime policy wrapper that guarantees goal-reaching by dynamically switching between a high-performing base RL policy and a safe fallback policy guided by the base policy's value function. The approach provides formal guarantees (Theorems 1 and 2) without requiring online constrained optimization or explicit system dynamics, and it is implemented as a lightweight Gymnasium wrapper that can be plugged into existing RL workflows. Theoretical analysis shows that the wrapper eventually relies on the fallback policy, inheriting its goal-reaching properties, while empirical results on Pendulum-v1 and CartPoleSwingup demonstrate controllable trade-offs between safety and performance via Conservative, Balanced, and Brave modes. The work offers a practical, deployable method to inject safety guarantees into a broad class of RL systems, expanding the applicability of RL to safety-critical settings.
Abstract
We introduce a universal policy wrapper for reinforcement learning agents that ensures formal goal-reaching guarantees. In contrast to standard reinforcement learning algorithms that excel in performance but lack rigorous safety assurances, our wrapper selectively switches between a high-performing base policy -- derived from any existing RL method -- and a fallback policy with known convergence properties. Base policy's value function supervises this switching process, determining when the fallback policy should override the base policy to ensure the system remains on a stable path. The analysis proves that our wrapper inherits the fallback policy's goal-reaching guarantees while preserving or improving upon the performance of the base policy. Notably, it operates without needing additional system knowledge or online constrained optimization, making it readily deployable across diverse reinforcement learning architectures and tasks.
