Integrating LTL Constraints into PPO for Safe Reinforcement Learning
Authors: Maifang Zhang, Hang Yu, Qian Zuo, Cheng Wang, Vaishak Belle, Fengxiang He
Organizations: School of Informatics, University of Edinburgh, Edinburgh EH8 9AB, Scotland. · School of Computer Science, Faculty of Engineering, University of Sydney, Darlington NSW 2008, Australia. · School of Engineering and Physical Sciences, Heriot-Watt University, Edinburgh EH14 4AS, Scotland.
This paper proposes Proximal Policy Optimization with Linear Temporal Logic Constraints (PPO-LTL), a framework that integrates safety constraints written in LTL into PPO for safe reinforcement learning. LTL constraints offer rigorous representations of complex safety requirements, such as regulations that broadly exist in robotics, enabling systematic monitoring of safety requirements. Violations against LTL constraints are monitored by limit-deterministic Büchi automata, and then translated by a logic-to-cost mechanism into penalty signals. The signals are further employed for guiding the policy optimization via the Lagrangian scheme. Extensive experiments on the Zones and CARLA environments show that our PPO-LTL can consistently reduce safety violations, while maintaining competitive performance, against the state-of-the-art methods. The code is at https://github.com/EVIEHub/PPO-LTL.
Figures & tables
Fig. 1 : PPO-LTL: environment states are labeled with atomic propositions, monitored by LTL checkers to generate constraint costs, which are integrated with task rewards for policy optimization.
Method
Reward
Hit Wall Rate
λ
PPO
17.95 ± 0.84
3.7 ± 2.1%
-
PPO-Mask
10.14 ± 2.82
6.0 ± 2.0%
-
PPO-Shielding
15.92 ± 0.55
12.0 ± 2.0%
-
PPO-Lagrangian
23.23 ± 1.51
6.0 ± 2.0%
0.00
PPO-LTL-A
17.86 ± 0.73
4.3 ± 3.5%
0.0048
PPO-LTL-B
18.61 ± 0.67
4.7 ± 3.1%
0.0018
TABLE I : Results in ZonesEnv.
Methods
Collision Rate ↓
Routes ↑
Distance
Speed
Length
Col. Num
Cent. Dev
Cost
λ
PPO
0.262 ± 0.115
0.013 ± 0.008
6.58
0.45
4030
8.0
0.77
-
-
TIRL-PPO
0.173 ± 0.129
0.083 ± 0.111
6.37
0.07
9460
7.3
0.87
-
-
TIRL-SAC
0.336 ± 0.063
0.027 ± 0.011
6.92
0.92
926
57.3
0.12
-
-
PPO-Mask
0.408 ± 0.058
0.010 ± 0.012
2.38
1.06
1338
38.0
0.37
-
-
PPO-Shielding
0.267 ± 0.056
0.072 ± 0.036
18.87
10.63
93
164.3
0.52
-
-
PPO-Lagrangian
0.233 ± 0.089
0.077 ± 0.051
7.78
0.96
6616
103.0
0.60
0.00
0.01
TABLE II : Results in CARLA. Arrows ( ↑,↓ ) indicate the direction where values are strictly better.
Configuration
Collision Rate ↓
Routes ↑
Distance
Speed
Length
Col. Num
Cent. Dev
Cost
λ
Ablation of LTL Components
No collision
0.159 ± 0.027
0.009 ± 0.003
2.71
0.68
4123
11.0
0.64
0.07
0.00
No off-track
0.275 ± 0.129
0.032 ± 0.044
3.29
0.06
10501
5.7
0.62
0.07
0.00
No lane invasion
0.207 ± 0.046
0.024 ± 0.009
6.17
1.98
14323
21.7
0.57
0.06
0.01
Sensitivity of Cost Limit (cl) and Dual Learning Rate ( αλ )
cl = 0.001
0.229 ± 0.153
0.033 ± 0.035
5.19
1.10
4749
21.0
0.78
0.06
0.01
TABLE III : Ablation studies and sensitivity analyses in CARLA.
Cost Limit
αλ
Reward ↑
Hit Wall Rate ↓
λ
0.03
0.008
18.04 ± 1.30
6.7 ± 1.2%
0.0072
0.05
0.010
17.86 ± 0.73
4.3 ± 3.5%
0.0048
0.07
0.015
18.61 ± 0.67
4.7 ± 3.1%
0.0018
0.10
0.020
18.35 ± 1.42
5.7 ± 2.1%
0.0002
TABLE IV : Sensitivity analysis of cost limit and Lagrangian learning rate ( αλ ) in ZonesEnv for PPO-LTL.
In safety-critical domains, reinforcement learning (RL) systems must satisfy strict, zero-cost safety constraints while achieving meaningful task performance. Existing model-free methods can struggle to achieve high safety without substantially compromising task performance. We introduce Safety-Biased Trust Region Policy Optimisation (SB-TRPO), a principled approach to RL with zero-cost constraints, which requires only a fixed fraction of the maximal cost reduction achievable within the trust region, thus retaining flexibility for reward optimisation. We show that the idealised update nevertheless converges to zero cost and maximal reward amongst zero-cost policies in finite MDPs. A practical gradient-based approximation provides local improvements in both safety and reward under suitable gradient alignment. Experiments on Safety Gymnasium demonstrate high safety alongside strong task performance.
Safe reinforcement learning (Safe RL) aims to maximize expected return while satisfying safety constraints, typically modeled as Constrained Markov Decision Processes (CMDPs). While primal-dual methods scale well to deep RL, they often suffer from delayed constraint correction, leading to oscillatory behavior and prolonged safety violations. In this paper, we propose Constraint-Sensitive Policy Optimization (CSPO), a first-order primal-dual method that incorporates local constraint sensitivity into policy updates. CSPO augments the primal objective with a constraint-sensitive correction derived from the shortest signed distance to the safety boundary, enabling smarter recovery steps back to safety, compensating for delayed Lagrange multiplier updates, reducing oscillations near the boundary, and preserving the KKT solutions of the original constrained problem. Experiments on navigation and locomotion benchmarks demonstrate that CSPO achieves faster safety recovery and high reward preservation, resulting in higher constrained returns compared to state-of-the-art primal-dual and penalty-based methods
Reinforcement learning (RL) has emerged as a promising solution to accomplish complex robotic control tasks; however, most of the current work ignores the safety requirements. Safe RL seeks to maximize task performance while satisfying explicit physical constraints, but current algorithms struggle to learn the policy efficiently with precise constraint satisfaction. This work proposes PPO-EAL, a novel first-order constrained policy optimization framework that integrates exact augmented Lagrangian optimization into proximal policy optimization for safe robotic control. By combining clipped policy updates with exact quadratic penalty terms, PPO-EAL achieves theoretically grounded constraint enforcement without requiring impractically large penalty factors. A momentum-regulated multiplier update further improves dual-variable stability, reducing constraint oscillation and unsafe behavior while preserving task performance. We provide exactness and convergence analysis under standard stochastic approximation assumptions. Extensive validation across diverse GPU-accelerated robotic benchmarks-including cart-pole balancing, cart-double-pendulum stabilization, 7-DoF Franka end-effector reaching, and quadrupedal locomotion-demonstrates superior safety precision and reward performance compared with state-of-the-art first-order safe RL baselines. Finally, we demonstrate zero-shot sim-to-real deployment in a contact-rich gear assembly task, where PPO-EAL substantially improves task success, reduces peak contact force, and enhances operational robustness. These results establish PPO-EAL as a general and practically deployable safe RL framework for diverse safety-critical robotic systems.
Jiatao Ding, Songqun Gao, Andrea Del Prete +1
Department of Industrial Engineering, University of Trento, Via Sommarive 9, 38123, Trento, Italy