LTL-Constrained Policy Optimization with Cycle Experience Replay

Ameesh Shah, Cameron Voloshin, Chenxi Yang, Abhinav Verma, Swarat Chaudhuri, Sanjit A. Seshia

Abstract

Reinforcement Learning (RL) agents often struggle with complex, long-horizon constraints specified by Linear Temporal Logic (LTL) due to the inherent sparsity of the reward signal. Standard approaches frequently fail to balance logical satisfaction with the maximization of external scalar rewards. We introduce Cycle Experience Replay (CyclER), a method that decomposes LTL specifications into accepting cycles within a Limit Deterministic Büchi Automaton (LDBA). By retroactively rewarding progress along these cycles and integrating quantitative semantics, CyclER provides a dense, structured feedback mechanism. Evaluations across several continuous control environments show that CyclER consistently achieves higher satisfaction rates and better reward optimization compared to state-of-the-art baselines.

Introduction

In many real-world applications, RL agents must adhere to complex rules beyond simple goal-reaching. Linear Temporal Logic (LTL) offers a formal way to specify these rules, such as "visit regions A, B, and C infinitely often while avoiding region D." However, optimizing policies under such constraints is challenging because logical satisfaction is typically a sparse, binary outcome. Agents often converge to local optima that maximize immediate scalar rewards while ignoring the long-term logical requirements. This paper introduces CyclER to bridge the gap between logical specifications and deep reinforcement learning.

Methodology

The core of CyclER is the transformation of LTL constraints into a roadmap for the agent. The process involves several key technical pillars:

  1. Automaton-Based Rewards: The LTL formula is converted into a Limit Deterministic Büchi Automaton (LDBA)—essentially a flowchart where "accepting states" must be visited infinitely often to satisfy the logic.
  2. Identifying Cycles: CyclER pre-calculates all minimal "Accepting Initial Paths" (getting to the success loop) and "Accepting Cycles" (the loops themselves) within the LDBA.
  3. Retroactive Reward Shaping: Instead of waiting for the agent to hit an accepting state, CyclER looks at a completed episode and counterfactually asks: "Which of our success cycles did the agent make the most progress on?" It then retroactively assigns rewards based on that progress.
The CyclER pipeline: An LTL-derived automaton is decomposed into specific accepting cycles, each assigned a normalized reward based on its length and progress.

To further densify the reward, CyclER incorporates Quantitative Semantics (QS). This provides a continuous "distance-to-satisfaction" metric. For instance, if the next step in a cycle is to enter a green zone, the agent receives a reward proportional to its proximity to that zone, but only when that specific transition is logically relevant. This prevents the agent from being misled by irrelevant environmental features.

Experimental Setup

The performance of CyclER was evaluated in three distinct continuous control domains:

  • FlatWorld: A 2D navigation task where the agent must visit colored regions in a specific oscillating pattern while collecting "bonus" rewards.
  • ZonesEnv: Based on the MuJoCo-powered Safety-Gymnasium, requiring a robot to navigate between four colored goal regions.
  • ButtonsEnv: A more challenging task where the agent must press specific buttons in order while avoiding moving obstacles ("gremlins").

Key Results and Discussion

CyclER significantly outperformed state-of-the-art baselines like LCER (which uses unshaped rewards) and other logic-based reward shaping methods (TLTL, BHNR).

A sample trajectory in the FlatWorld environment, where the agent successfully navigates a complex path to satisfy the LTL constraint.

Key findings include:

  • Consistency: In all three domains, CyclER was the only method that consistently learned to visit accepting states multiple times (averaging 1.8 to 2.6 visits per trajectory), whereas baselines often achieved 0.0 visits.
  • Efficiency: In "LTL-only" settings, CyclER converged to satisfying policies much faster than unshaped baselines.
  • Dual-Optimization: CyclER successfully balanced the two goals. For example, in FlatWorld, it achieved a high MDP reward (~45.3) while maintaining a high satisfaction rate, whereas the baseline either ignored the logic to get a high reward or failed at both.

Conclusion

Cycle Experience Replay addresses the fundamental challenge of reward sparsity in LTL-constrained RL. By leveraging the automaton's structure to create a dense, cycle-based reward signal, CyclER enables agents to learn complex, infinite-horizon behaviors in continuous state and action spaces. Future work will explore scaling this approach to even more intricate logical specifications and multi-task learning scenarios.

Summary updated

BibTeX
@article{shah2025ltl,
  author = {Ameesh Shah and Cameron Voloshin and Chenxi Yang and Abhinav Verma and Swarat Chaudhuri and Sanjit A. Seshia},
  title = {{LTL-Constrained Policy Optimization with Cycle Experience Replay}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
}
Figure