Logical Specifications-guided Dynamic Task Sampling for Reinforcement Learning Agents

Yash Shukla, Tanushree Burman, Abhishek Kulkarni, Robert Wright, Alvaro Velasquez, Jivko Sinapov

Introduction

Reinforcement Learning (RL) has demonstrated remarkable success in solving complex control tasks. However, agents often struggle with high sample complexity, requiring millions of interactions to learn behaviors in environments with sparse rewards or long-horizon objectives. This challenge is particularly acute in tasks requiring a specific sequence of actions, such as navigating a hazardous environment to collect keys and unlock doors. While formal methods like Linear Temporal Logic (LTL) have been employed to guide agents, they often suffer from manual reward engineering, inefficient exploration of redundant paths, and heavy reliance on prior knowledge of environment dynamics.

This paper introduces Logical Specifications-guided Dynamic Task Sampling (LSTS), a framework designed to accelerate learning for complex, long-horizon tasks. LSTS translates high-level logical goals into a structured roadmap of sub-tasks and utilizes an adaptive "Teacher-Student" approach to prioritize learning the most promising paths, significantly reducing the required environment interactions.

Methodology

The LSTS framework decomposes the learning process into three distinct stages:

1. Logical Decomposition

The high-level objective is defined using SPECTRL, a formal specification language. This specification is automatically converted into a Directed Acyclic Graph (DAG). In this graph, each node represents a state of logical progress, and each edge represents a specific sub-task or transition (e.g., moving from a state of "no key" to "possessing Key 1"). By incorporating the current DAG node into the agent's state representation, the framework transforms a non-Markovian, history-dependent task into a Markovian one solvable by standard RL algorithms.

2. Teacher-Student Learning

The framework employs a hierarchical learning structure:

  • The Student: A standard RL agent (e.g., PPO or DDPG-HER) tasked with mastering individual sub-tasks defined by the DAG edges.
  • The Teacher: A high-level strategist that uses Q-learning to decide which sub-task the Student should practice next. The Teacher's objective is to maximize the overall success rate of reaching the final goal state while minimizing interactions.

3. Dynamic Sampling and Pruning

A key innovation of LSTS is its ability to dynamically adjust the curriculum. The Teacher monitors the Student's success rate across different sub-tasks. If a sub-task is found to be excessively difficult or leads to a redundant path that does not contribute to the optimal solution, the Teacher stops sampling it. This pruning ensures that the agent's exploration is focused on the most efficient trajectories.

The LSTS framework: (a) the Gridworld environment and (b) its corresponding logical DAG derived from a SPECTRL formula.

Additionally, the authors propose LSTSct (Continuous Training). Unlike standard LSTS, which might reset after a sub-task, LSTSct allows the agent to immediately transition to the next sub-task within the same episode upon completion of a goal. This facilitates "strong transfer" of knowledge and further boosts sample efficiency.

Experimental Evaluation

The authors evaluated LSTS against six state-of-the-art baselines, including DIRL (Compositional RL from logical Specifications) and QRM (Q-Learning for Reward Machines), across four diverse domains:

  1. Gridworld (Mini-grid): Navigation and hazard avoidance.
  2. TurtleBot Navigation: Continuous control for a simulated robot in a partially observable environment.
  3. Panda Arm Manipulation: Robotic arm pushing objects to targets.
  4. Search and Rescue: A high-complexity environment with 24 distinct paths and deep planning horizons.

Results and Analysis

LSTS consistently outperformed all baselines in both convergence speed and final success rates. In the Gridworld domain, LSTS reached a 95% success rate approximately 1.34 million interactions faster than the best baseline.

Learning curves illustrating the success rate of various sub-task transitions over time. The Teacher dynamically shifts focus as the Student masters earlier stages of the DAG.

The most significant performance gap was observed in the Search and Rescue domain. Due to the extreme complexity and long horizon, most baselines failed to achieve any success (0% success rate). In contrast, LSTS achieved an 87% success rate, demonstrating the power of logical decomposition and dynamic pruning in navigating vast state spaces.

Conclusion

LSTS represents a significant step forward in combining formal logic with reinforcement learning. By automating the creation of a task curriculum and dynamically pruning unpromising paths, it addresses the core issue of sample complexity in long-horizon tasks. Future work will focus on relaxing the dependency on perfect labeling functions and exploring "soft bias" mechanisms to maintain exploration of unlikely but potentially optimal paths in non-stationary environments.

Summary updated

BibTeX
@inproceedings{shukla2024logical,
  author = {Yash Shukla and Tanushree Burman and Abhishek Kulkarni and Robert Wright and Alvaro Velasquez and Jivko Sinapov},
  title = {{Logical Specifications-guided Dynamic Task Sampling for Reinforcement Learning Agents}},
  booktitle = {ICAPS},
  year = {2024},
  doi = {10.1609/icaps.v34i1.31514},
}
Figure