RECREG: Recovery-based Shielding for Regular Safety Properties in Reinforcement Learning
Organizations: Department of Computer Science Imperial College London
Abstract
In many real-world scenarios we need to consider formal requirements, such as safety and constraint compliance, to deploy Reinforcement Learning (RL) agents. In this paper we introduce RecReg, a safe RL framework capable of enforcing non-Markovian regular safety properties via recovery-based shielding. RecReg is a unified approach that supports different levels of a priori knowledge and safety guarantees. The paper primarily focuses on building the theoretical foundations for RecReg in the tabular setting, providing rigorous safety and convergence guarantees that are not present in related work. We provide an extensive set of empirical results using the MASA-Safe-RL library, and we outline an extension of RecReg to deep RL domains using SOTA model-based RL. Our empirical results demonstrate that RecReg achieves efficient learning and matches the theory in this paper.
Figures & tables
| Algorithm | Metric | MediaStreaming | BridgeCrossing | ColourBomb…V2 (Prop. 3) | MiniPacman |
|---|---|---|---|---|---|
| RecReg-Exact | Ep. Return | ||||
| Safety Prob. | |||||
| ProbShield | Ep. Return | ||||
| Safety Prob. |
Appendix figures & tables35 assets
Supplementary material from the paper’s appendix.
Appendix
| DreamerV3 | Aug. Lag. | AMBS | Deep-RecReg | PPO-Lag | CPO | ||
|---|---|---|---|---|---|---|---|
| seaquest ( ) | Return | ||||||
| Viol. rate | |||||||
| seaquest ( ) | Return | ||||||
| Viol. rate |
| DreamerV3 | Aug. Lag. | AMBS | Deep-RecReg | ||
|---|---|---|---|---|---|
| PointGoal1 | Return | ||||
| Viol. rate | |||||
| PointGoal2 | Return | ||||
| Viol. rate | |||||
| CarGoal1 | Return | ||||
| Viol. rate |
| Name | Symbol | Value |
|---|---|---|
| Replay capacity | ||
| Batch size | 16 | |
| Batch length | - | 64 |
| Number of envs | - | 8 |
| Train ratio | - | 64 |
| Number of MLP layers | - | 5 |
| Algorithm | Metric | MediaStreaming | BridgeCrossing | BridgeCrossingV2 | Colour…World |
|---|---|---|---|---|---|
| QL | Ep. Return | ||||
| Safety Prob. | |||||
| QL( ) | Ep. Return | ||||
| Safety Prob. | |||||
| RecReg | Ep. Return |
| Algorithm | Metric | ColourBomb…(Prop. 2) | ColourBomb…V2 | ColourBomb…V2 (Prop. 2) | Colour…V2 (Prop. 3) | MiniPacman |
|---|---|---|---|---|---|---|
| QL | ||||||
| QL( ) | ||||||
| RecReg |
| Exact | ModelBased | ModelBased | |
|---|---|---|---|
| & ModelFree | (exact) | (stat. =10,000) | |
| media_streaming | fps | fps | fps |
| bridge_crossing | fps | fps | fps |
| _gridworld (3) | fps | fps | fps |
| mini_pacman | fps | fps | fps |
| Name | Symbol | Value |
|---|---|---|
| Q-Learning (shared) | ||
| Learning rate | ||
| Discount factor | ||
| Exploration type | - | |
| Boltzmann Temp. | ||
| Epsilon start | 1.0 | |
| Name | Symbol | Value |
|---|---|---|
| PPO-Lag, TRPO-Lag, CPO shared (Tabular) | ||
| Actor learning rate (PPO-Lag) | ||
| Critic learning rate (CPO/TRPO-Lag) | ||
| Discount factor | ||
| Cost coefficient | ||
| Cost threshold | - | Variable (c.f., Section D ) |
| Name | Symbol | Value |
| ProbShieldWrapperDisc | ||
| Initial safety bound | 0.01 | |
| Max VI Steps | - | 10,000 |
| VI Cut off | - | |
| Disc. Granularity | - | 20 |
| PPO (underlying algorithm) | ||
Safe RL
Safe reinforcement learning studies how agents can learn and act while respecting safety constraints and limiting harmful outcomes.
See all 209 papers