Learning to maintain safety through expert demonstrations in settings with unknown constraints: A Q-learning perspective
Organizations: University of Piraeus, Piraeus, Greece
Abstract
Given a set of trajectories demonstrating the execution of a task safely in a constrained MDP with observable rewards but with unknown constraints and non-observable costs, we aim to find a policy that maximizes the likelihood of demonstrated trajectories trading the balance between being conservative and increasing significantly the likelihood of high-rewarding trajectories but with potentially unsafe steps. Having these objectives, we aim towards learning a policy that maximizes the probability of the most trajectories with respect to the demonstrations. In so doing, we formulate the ``promise" of individual state-action pairs in terms of values, which depend on task-specific rewards as well as on the assessment of states' safety, mixing expectations in terms of rewards and safety. This entails a safe Q-learning perspective of the inverse learning problem under constraints: The devised Safe Inverse Constrained Reinforcement Learning (SafeQIL) algorithm is compared to state-of-the art inverse constraint reinforcement learning algorithms to a set of challenging benchmark tasks, showing its merits.
Figures & tables
| Algorithm | Reward | Cost |
|---|---|---|
| SafeQIL | 5.27 1.85 | 34.22 2.71 |
| ICRL 2 | 23.21 1.28 | 62.60 9.87 |
| ICRL 7 | -0.50 4.93 | 42.80 35.43 |
| VICRL | 21.87 1.20 | 62.97 10.81 |
| SAC-GAIL | 7.17 1.65 | 44.80 18.60 |
| SAC | 27.47 0.21 | 49.15 2.21 |
| Algorithm | Reward | Cost |
|---|---|---|
| SafeQIL | 27.06 4.10 | 29.28 8.41 |
| ICRL 2 | 28.36 17.37 | 177.88 6.70 |
| ICRL 7 | 8.21 17.07 | 34.07 16.74 |
| VICRL | 26.29 0.69 | 5.49 0.81 |
| SAC-GAIL | 11.89 9.55 | 33.95 28.02 |
| SAC | 58.81 0.70 | 392.20 4.38 |
| Algorithm | Reward | Cost |
|---|---|---|
| SafeQIL | -3.81 3.05 | 70.11 72.96 |
| ICRL 2 | 0.31 2.23 | 222.01 173.61 |
| ICRL 7 | -15.83 12.98 | 145.94 23.54 |
| VICRL | -14.12 10.83 | 34.65 23.36 |
| SAC-GAIL | 0.14 4.72 | 98.15 81.54 |
| SAC | 19.49 3.50 | 299.27 20.61 |
| Algorithm | Reward | Cost |
|---|---|---|
| SafeQIL | -0.62 0.65 | 57.20 30.02 |
| ICRL 2 | 0.00 1.73 | 203.10 37.24 |
| ICRL 7 | 1.15 0.49 | 178.81 60.69 |
| VICRL | -9.05 8.58 | 55.80 71.45 |
| SAC-GAIL | 0.76 0.92 | 87.97 10.57 |
| SAC | 1.50 0.01 | 245.36 28.52 |
| Algorithm | Reward | Cost |
|---|---|---|
| Original | 5.27 1.85 | 34.22 2.71 |
| w/o cosine similarity | 3.74 2.52 | 30.25 19.10 |
| w/o constraint term | 4.34 4.41 | 29.02 14.03 |
Appendix figures & tables26 assets
Supplementary material from the paper’s appendix.
Appendix
| Benchmark | Algorithm | Mean Reward | Mean Cost | Cost Drop ( ) | Reward Drop ( ) | Ratio ( ) |
|---|---|---|---|---|---|---|
| SafetyPointGoal1-v0 (SAC: R 27.47, C 49.15) | SafeQIL | 5.27 | 34.22 | 30.4% | 80.8% | 0.38 |
| ICRL 2 | 23.21 | 62.60 | -27.4% | 15.5% | N/A (Unsafe) | |
| ICRL 7 | -0.50 | 42.80 | 12.9% | 101.8% | 0.13 | |
| VICRL | 21.87 | 62.97 | -28.1% | 20.4% | N/A (Unsafe) | |
| SAC-GAIL | 7.17 | 44.80 | 8.9% | 73.9% | 0.12 | |
| SafetyPointCircle2-v0 (SAC: R 58.81, C 392.20) | SafeQIL | 27.06 | 29.28 | 92.5% | 54.0% | 1.71 |
| Benchmark | Algorithm | Pess. Reward ( ) | Pess. Cost ( ) | Robust | Robust | Ratio ( ) |
|---|---|---|---|---|---|---|
| SafetyPointGoal1-v0 (SAC Pess: R 27.26, C 51.36) | SafeQIL | 3.42 | 36.93 | 28.1% | 87.5% | 0.32 |
| ICRL 2 | 21.93 | 72.47 | -41.1% | 19.6% | N/A (Unsafe) | |
| ICRL 7 | -5.43 | 78.23 | -52.3% | 119.9% | N/A (Unsafe) | |
| VICRL | 20.67 | 73.78 | -43.6% | 24.2% | N/A (Unsafe) | |
| SAC-GAIL | 5.52 | 63.40 | -23.4% | 79.7% | N/A (Unsafe) | |
| SafetyPointCircle2-v0 (SAC Pess: R 58.11, C 396.58) | SafeQIL | 22.96 | 37.69 | 90.5% | 60.5% | 1.50 |
| Algorithm | Reward | Cost |
|---|---|---|
| Original | 5.27 1.85 | 34.22 2.71 |
| w/o cosine similarity | 3.74 2.52 | 30.25 19.10 |
| w/o max term | -10.62 7.81 | 15.47 8.67 |
| w/o constraint term | 4.34 4.41 | 29.02 14.03 |
| w/o OOD term | 1.07 0.91 | 44.99 4.95 |
| w/o demonstrations term | -3.71 1.00 | 8.41 3.76 |
| Algorithm | Reward | Cost |
|---|---|---|
| 1x Dataset | ||
| SafeQIL | 5.27 1.85 | 34.22 2.71 |
| ICRL 2 | 23.21 1.28 | 62.60 9.87 |
| ICRL 7 | -0.50 4.93 | 42.80 35.43 |
| VICRL | 21.87 1.20 | 62.97 10.81 |
| SAC-GAIL | 7.17 1.65 | 44.80 18.60 |
| Algorithm | Reward | Cost |
|---|---|---|
| 1x Dataset | ||
| SafeQIL | -0.62 0.65 | 57.20 30.02 |
| ICRL 2 | 0.00 1.73 | 203.10 37.24 |
| ICRL 7 | 1.15 0.49 | 178.81 60.69 |
| VICRL | -9.05 8.58 | 55.80 71.45 |
| SAC-GAIL | 0.76 0.92 | 87.97 10.57 |
| Dataset Size | Algorithm | Mean Reward | Mean Cost | Cost Drop ( ) | Reward Drop ( ) | Ratio ( ) |
|---|---|---|---|---|---|---|
| 1x Dataset (SAC: R 27.47, C 49.15) | SafeQIL | 5.27 | 34.22 | 30.4% | 80.8% | 0.38 |
| ICRL 2 | 23.21 | 62.60 | -27.4% | 15.5% | N/A (Unsafe) | |
| ICRL 7 | -0.50 | 42.80 | 12.9% | 101.8% | 0.13 | |
| VICRL | 21.87 | 62.97 | -28.1% | 20.4% | N/A (Unsafe) | |
| SAC-GAIL | 7.17 | 44.80 | 8.9% | 73.9% | 0.12 | |
| 2x Dataset (SAC: R 27.47, C 49.15) | SafeQIL | 3.17 | 29.50 | 40.0% | 88.5% | 0.45 |
| Dataset Size | Algorithm | Pess. Reward ( ) | Pess. Cost ( ) | Robust | Robust | Ratio ( ) |
|---|---|---|---|---|---|---|
| 1x Dataset (SAC Pess: R 27.26, C 51.36) | SafeQIL | 3.42 | 36.93 | 28.1% | 87.5% | 0.32 |
| ICRL 2 | 21.93 | 72.47 | -41.1% | 19.6% | N/A (Unsafe) | |
| ICRL 7 | -5.43 | 78.23 | -52.3% | 119.9% | N/A (Unsafe) | |
| VICRL | 20.67 | 73.78 | -43.6% | 24.2% | N/A (Unsafe) | |
| SAC-GAIL | 5.52 | 63.40 | -23.4% | 79.7% | N/A (Unsafe) | |
| 2x Dataset (SAC Pess: R 27.26, C 51.36) | SafeQIL | 2.22 | 39.45 | 23.2% | 91.9% | 0.25 |
| Dataset Size | Algorithm | Mean Reward | Mean Cost | Cost Drop ( ) | Reward Drop ( ) | Ratio ( ) |
|---|---|---|---|---|---|---|
| 1x Dataset (SAC: R 1.50, C 245.36) | SafeQIL | -0.62 | 57.20 | 76.7% | 141.3% | 0.54 |
| ICRL 2 | 0.00 | 203.10 | 17.2% | 100.0% | 0.17 | |
| ICRL 7 | 1.15 | 178.81 | 27.1% | 23.3% | 1.16 | |
| VICRL | -9.05 | 55.80 | 77.3% | 703.3% | 0.11 | |
| SAC-GAIL | 0.76 | 87.97 | 64.1% | 49.3% | 1.30 | |
| 2x Dataset (SAC: R 1.50, C 245.36) | SafeQIL | -3.38 | 58.10 | 76.3% | 325.3% | 0.23 |
| Dataset Size | Algorithm | Pess. Reward ( ) | Pess. Cost ( ) | Robust | Robust | Ratio ( ) |
|---|---|---|---|---|---|---|
| 1x Dataset (SAC Pess: R 1.49, C 273.88) | SafeQIL | -1.27 | 87.22 | 68.2% | 185.2% | 0.37 |
| ICRL 2 | -1.73 | 240.34 | 12.2% | 216.1% | 0.06 | |
| ICRL 7 | 0.66 | 239.50 | 12.6% | 55.7% | 0.23 | |
| VICRL | -17.63 | 127.25 | 53.5% | 1283.2% | 0.04 | |
| SAC-GAIL | -0.16 | 98.54 | 64.0% | 110.7% | 0.58 | |
| 2x Dataset (SAC Pess: R 1.49, C 273.88) | SafeQIL | -6.35 | 75.96 | 72.3% | 526.2% | 0.14 |
| Parameter | Value |
| SAC (Actor / Critics) | |
| Actor/Critics Learning Rate | |
| Actor/Critics Optimizer | Adam |
| Discount Factor ( ) | |
| Batch Size | |
| Target Networks Smoothing Coefficient ( ) | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
|---|---|
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| General PPO (Forward Step) | |
| Policy/Critics Learning Rate | |
| Policy/Critics Optimizer | Adam |
| Reward GAE | |
| Reward GAE | |
| Reward Value Function Coefficient | |
| Parameter | Value |
| SAC (Actor / Critics) | |
| Actor/Critics Learning Rate | |
| Actor/Critics Optimizer | Adam |
| Discount Factor ( ) | |
| Batch Size | |
| Target Networks Smoothing Coefficient ( ) | |
Safe RL
Safe reinforcement learning studies how agents can learn and act while respecting safety constraints and limiting harmful outcomes.
See all 215 papers