Reinforcement Learning With Temporal Logic Rewards

Xiao Li, Cristian-Ioan Vasile, Călin Belta · DOI

Abstract

Reinforcement learning (RL) depends critically on the choice of reward functions used to capture the desired behavior and constraints of a robot. Usually, these are handcrafted by an expert designer and represent heuristics for relatively simple tasks. Real-world applications typically involve more complex tasks with rich temporal and logical structure. In this paper, we take advantage of the expressive power of temporal logic (TL) to specify complex rules the robot should follow and incorporate domain knowledge into learning. We propose Truncated Linear Temporal Logic (TLTL) as a specifications language, which is well-suited for robotics applications, together with quantitative semantics, i.e., robustness degree. We propose an RL approach to learn tasks expressed as TLTL formulae that uses their associated robustness degree as reward functions, instead of manually crafted heuristics. We show in simulated trials that learning is faster and policies obtained using the proposed approach outperform those learned using heuristic rewards. Furthermore, we demonstrate the proposed RL approach in a toast-placing task learned by a Baxter robot.

Introduction

Designing effective reward functions is one of the most challenging aspects of reinforcement learning (RL). While simple distance-based rewards work for basic tasks, real-world robotics requires complex, temporally structured behavior. Hand-coding these rewards often leads to "reward hacking," where an agent finds a way to maximize reward without actually fulfilling the designer's intent. Moreover, balancing multiple reward terms (e.g., speed vs. safety) requires tedious manual tuning of coefficients that often fail to generalize.

Truncated Linear Temporal Logic (TLTL)

The authors introduce Truncated Linear Temporal Logic (TLTL), a formal language designed specifically for finite-time robotic trajectories. TLTL includes standard logical operators (AND, OR, NOT) and temporal operators such as Eventually ($◊$), Always ($□$), Until ($U$), and Then ($T$).

Crucially, TLTL provides a robustness degree ($ρ$) rather than a binary success/failure signal.

  • A positive $ρ$ indicates the task was satisfied; higher values represent a greater "safety margin."
  • A negative $ρ$ indicates failure; lower values represent how far the robot was from succeeding.

This robustness degree is used directly as the reward function, optimized using Relative Entropy Policy Search (REPS).

Experimental Setup

The framework was evaluated on two primary setups:

  1. Simulated 2D Manipulation: A 3-joint arm performing sequential goal-reaching (e.g., visit Red, then Green, then Blue) while avoiding obstacles.
  2. Physical Baxter Robot: A "toast-placing" task requiring the robot to pick up bread, navigate to a toaster slot, and release the gripper at the precise moment while avoiding collisions with the table or toaster exterior.
The Baxter robot setup used for the real-world toast-placing task.

Key Results and Insights

The TLTL-based approach offers several advantages over traditional reward shaping:

  • Bottleneck Identification: Because the robustness of an "AND" formula is the minimum of its components, the RL agent naturally focuses on the specific part of the task closest to failing.
  • Temporal Flexibility: Unlike previous logics, TLTL does not require strict time bounds for every sub-task, allowing the robot to discover the most efficient timing through exploration.
  • Faster Convergence: In simulations, TLTL-based rewards reached optimal performance significantly faster than manually crafted continuous or discrete rewards.
Comparison of learning performance (robustness value over iterations) between TLTL-based rewards and various heuristic reward functions.

In the sequential goal-reaching task, traditional discrete rewards failed to learn a useful policy due to signal sparsity. In contrast, the TLTL policy on the Baxter robot achieved a 100% success rate, whereas heuristic rewards struggled to capture the complex timing required for gripper release.

Conclusion

By replacing ad-hoc reward shaping with formal TLTL specifications, this work provides a principled way to train robots for complex, multi-stage tasks. While some manual scaling of physical predicates is still required, the approach significantly reduces the need for hyperparameter "coefficient hunting" and improves the reliability of learned behaviors.

Summary updated

BibTeX
@inproceedings{li2017reinforcement,
  author = {Xiao Li and Cristian-Ioan Vasile and Călin Belta},
  title = {{Reinforcement Learning With Temporal Logic Rewards}},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year = {2017},
  doi = {10.1109/iros.2017.8206234},
}
Figure