Safe Reinforcement Learning with Preference-based Constraint Inference
Authors: Chenglin Li, Grant Ruan, Hua Geng
Organizations: Department of Automation, Tsinghua University, Beijing, China · Laboratory for Information & Decision Systems, Massachusetts Institute of Technology, Cambridge, MA, USA
Safe reinforcement learning (RL) is a standard paradigm for safety-critical decision making. However, real-world safety constraints can be complex, subjective, and even hard to explicitly specify. Existing works on constraint inference rely on restrictive assumptions or extensive expert demonstrations, which are not realistic in many real-world applications. How to cheaply and reliably learn these constraints is the major challenge we focus on in this study. While inferring constraints from human preferences offers a data-efficient alternative, we identify popular Bradley-Terry (BT) models fail to capture the asymmetric, heavy-tailed nature of safety costs, resulting in risk underestimation. It is still rare in the literature to understand the impacts of BT models on the downstream policy learning. To address the above knowledge gaps, we propose a novel approach namely Preference-based Constrained Reinforcement Learning (PbCRL). We introduce a novel dead zone mechanism into preference modeling and theoretically prove that it encourages heavy-tailed cost distributions, thereby achieving better constraint alignment. Additionally, we incorporate a Signal-to-Noise Ratio (SNR) loss to encourage exploration by cost variances, which is found to benefit policy learning. Further, two-stage training strategy is deployed to lower online labeling burdens while adaptively enhancing constraint satisfaction. Empirical results demonstrate that PbCRL achieves superior alignment with true safety requirements and outperforms state-of-the-art baselines in terms of safety and reward. Our work explores a promising and effective way for constraint inference in Safe RL, with great potential in various safety-critical applications.
Figures & tables
Figure 1: Cost distributions: (a) Ground truth: heavy-tailed with expectation (solid line) exceeding safety threshold (dashed line), indicating unsafe. (b) BT model: symmetric with underestimated expectation below the threshold, induces a Type II Error where the model falsely believes the constraint is satisfied. (c) Our model: similar heavy-tailed distribution, better approximate expectation of ground truth cost.
Tasks (Threshold)
Metrics
PPO-Lag (Oracle)
PbCRL (Ours)
RLSF
PPO-BT
HalfCheetah (5)
Return
2619±124
2367±138
2084±126
2494±195
Cost
4.82±0.91
4.66±1.03
3.26±0.78
5.58±2.14
Walker2d (5)
Return
3057±142
2659±133
2415±120
2807±156
Cost
4.88±1.02
4.62±0.97
3.66±0.85
4.91±1.11
Humanoid (5)
Return
5876±210
5247±149
4816±180
5948±225
Cost
5.03±1.93
4.85±1.21
4.05±1.12
5.89±2.05
Table 1: Empirical results on Safety Gymnasium tasks. The best method using learned constraints is highlighted in bold .
Figure 2: Average episode return and cost of four algorithms on robotic navigation tasks. Dashed lines are safety thresholds.
Tasks
PbCRL (Ours)
RLSF
PPO-BT
W2
Bias
W2
Bias
W2
Bias
Goal
16.8
1.5
68.1
11.8
42.7
6.9
Push
20.3
0.1
82.4
14.9
36.5
6.8
Button
44.3
2.5
165.5
35.7
78.8
10.78
Table 2: W2 and Bias between converged cost and threshold
Task(Threshold)
M
PPO-Lag(Oracle)
PbCRL(Ours)
RLSF
PPO-BT
Block (0.1)
R
39.1±0.1
36.4±0.3
31.8±0.3
38.5±0.6
C
0.05±0.01
0.07±0.01
0.05±0.01
0.12±0.02
Lane (0.1)
R
51.6±0.9
51.4±0.5
44.9±0.8
51.5±0.8
C
0.01±0.01
0.08±0.01
0.06±0.01
0.14±0.02
Table 3: Results on driving scenarios, R: Return, C: Cost
Metric
PPO
RLSF
Safe RLHF
PbCRL (Ours)
Win Rate (Helpful) ↑
72.5%
60.4%
79.4%
80.7%
Win Rate (Harmless) ↑
60.7%
54.2%
76.5%
82.1%
Reward ↑
2.78
1.31
4.05
4.22
Cost ↓
−0.57
1.10
−2.97
−3.03
Table 4: Results on Language Model Alignment
Tasks
M
δ=0
δ=0.1
δ=1
δ=2
Goal (20)
W2
38.9
33.5
16.8
29.1
R
24.55±1.01
24.79±1.18
23.41±1.08
22.51±1.05
C
28.05±2.55
27.46±1.89
18.50±2.03
16.49±2.18
Push (35)
W2
36.1
35.8
20.3
23.6
R
4.15±0.55
3.81±0.21
3.20±0.38
2.96±0.35
C
42.50±5.50
40.26±2.15
34.86±3.13
30.91±1.78
Table 5: Ablation study on dead zone parameter δ
M
PbCRL
PPO-BT (varying d )
d=20
d=20
d=18
d=15
d=10
R
23.41±1.08
24.26±0.99
23.86±1.21
23.15±1.05
18.27±1.13
C
18.50±2.03
26.97±2.62
24.08±2.87
20.82±2.05
14.02±1.95
Table 6: Ablation study on varying safety threshold offsets
Metrics
ζ=10−2
ζ=10−3 (Ours)
ζ=10−5
ζ=0
Return (Mid)
3.8±2.2
22.9±1.5
22.5±1.3
22.1±1.1
Cost (Mid)
17.9±8.1
18.4±2.3
24.5±2.5
24.8±2.8
Return (End)
6.5±1.8
23.4±1.1
20.6±1.6
20.7±1.4
Cost (End)
21.9±5.9
18.5±2.0
19.2±2.2
18.4±2.6
Table 7: Ablation study on SNR loss weight ζ
Tasks
Metrics
PbCRL-Offline
PbCRL
Goal (20)
Return
24.79±1.75
23.41±1.08
Cost
22.70±0.84
18.50±2.03
Push (35)
Return
3.77±0.67
3.20±0.38
Cost
37.48±5.00
34.86±3.13
Table 8: Ablation study on two-stage training strategy
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 3: Locomotion Environments in Safety Gymnasium
Figure 4: Navigation Environments in Safety Gymnasium
Figure 5: Autonomous Driving Environments
Figure 6: Average episode return (Row 1), cost (Row 2) and learned cost (Row 3) of four algorithms on Goal (left), Push (middle) and Button (right) tasks. Dashed lines are safety thresholds.
Tasks (Threshold)
Metrics
PPO-Lag (Oracle)
PbCRL (Ours)
RLSF
PPO-BT
Goal (20)
Return
23.50±1.14
23.41±1.08
5.78±1.07
24.26±0.99
Cost
20.70±1.91
18.50±2.03
8.20±2.21
26.97±2.62
Learned Cost
N/A
0.50±1.26
89.52±8.07
0.12±1.36
Accuracy
N/A
87%±2%
83%±2%
85%±1%
Push (35)
Return
4.77±0.67
3.20±0.38
1.07±0.35
4.09±0.57
Cost
36.17±5.00
34.86±3.13
20.05±3.56
41.85±5.65
Appendix
Table 9: Empirical results on three navigation tasks in Safety Gymnasium
Tasks
PbCRL (Ours)
RLSF
PPO-BT
W2
Bias
W2
Bias
W2
Bias
Goal
16.8
1.5
68.1
11.8
42.7
6.9
Push
20.3
0.1
82.4
14.9
36.5
6.8
Button
44.3
2.5
165.5
35.7
78.8
10.78
Appendix
Table 10: Evaluation metrics: W2 distance and Bias between converged cost and threshold
Figure 7: Cost distribution in Goal task. Solid line: expectation; Black dashed line: safety threshold.
Task
Metric
PPO-Lag (Oracle)
PbCRL (Ours)
RLSF
PPO-BT
HalfCheetah
Reward
2803
2565
2316
2687
Cost
20.78
20.25
14.52
22.50
Walker2d
Reward
3075
2790
2587
2853
Cost
19.54
17.84
13.87
20.43
Humanoid
Reward
6248
5761
5483
6103
Cost
19.68
19.20
17.27
21.84
Appendix
Table 11: Performance Comparison with Uniform Cost Threshold (20) across Tasks
Task (Threshold)
Metrics
δ=0 (No)
δ=0.1 (Small)
δ=1 (Medium) (Ours)
δ=2 (Large)
Goal (20)
W2 distance
38.9
33.5
16.8
29.1
Reward
24.55±1.01
24.79±1.18
23.41±1.08
22.51±1.05
Cost
28.05±2.55
27.46±1.89
18.50±2.03
16.49±2.18
Accuracy
84%±2%
85%±2%
87%±3%
88%±2%
Push (35)
W2 distance
36.1
35.8
20.3
23.6
Reward
4.15±0.55
3.81±0.21
3.20±0.38
2.96±0.35
Appendix
Table 12: Ablation studies on dead zone parameter δ
Metrics
ζ=10−2
ζ=10−3 (Ours)
ζ=10−5
ζ=0
Return (Mid)
3.8±2.2
22.9±1.5
22.5±1.3
22.1±1.1
Cost (Mid)
17.9±8.1
18.4±2.3
24.5±2.5
24.8±2.8
Return (End)
6.5±1.8
23.4±1.1
20.6±1.6
20.7±1.4
Cost (End)
21.9±5.9
18.5±2.0
19.2±2.2
18.4±2.6
Appendix
Table 13: Ablation study on SNR loss weight ζ
Figure 8: Ablation study on the two-stage training strategy in Goal (Row 1) and Push (Row 2) tasks.
Task
Noise Level
PbCRL (Ours)
PPO-BT
Goal
0% (Clean)
16.8
42.7
5%
24.5
53.4
10%
36.8
60.1
30%
82.8
79.6
Block
0% (Clean)
5.9
6.0
5%
6.9
6.9
Appendix
Table 14: W2 distance under different preference label noise levels in robotic ( Goal ) and driving ( Block ) tasks.