Skill Machines: Temporal Logic Composition in Reinforcement Learning

Geraud Nangue Tasse, Devon Jarvis, Steven James, Benjamin Rosman · OpenReview

Abstract

A major challenge in reinforcement learning is specifying tasks in a manner that is both interpretable and verifiable. One common approach is to specify tasks through reward machines -- finite state machines that encode the task to be solved. We introduce skill machines, a representation that can be learned directly from these reward machines that encode the solution to such tasks. We propose a framework where an agent first learns a set of base skills in a reward-free setting, and then combines these skills with the learned skill machine to produce composite behaviours specified by any regular language, such as linear temporal logics. This provides the agent with the ability to map from complex logical task specifications to near-optimal behaviours zero-shot. We demonstrate our approach in both a tabular and high-dimensional video game environment, where an agent is faced with several of these complex, long-horizon tasks. Our results indicate that the agent is capable of satisfying extremely complex task specifications, producing near optimal performance with no further learning. Finally, we demonstrate that the performance of skill machines can be improved with regular offline reinforcement learning algorithms when optimal behaviours are desired.

Introduction

Reinforcement Learning (RL) is notoriously sample-inefficient, often requiring millions of interactions to learn a single task. This challenge is compounded when aiming for "generally intelligent" agents capable of following diverse, high-level instructions. The primary obstacle is the combinatorial explosion of possible goals—the "curse of dimensionality" in language and task specification. While existing methods often address either spatial composition (e.g., "pick up a blue box") or temporal composition (e.g., "pick up a box then move to the door"), they rarely handle both effectively. Furthermore, many temporal methods require learning a new high-level policy for every novel task, necessitating significant additional data.

The Skill Machines Framework

To address these limitations, we introduce Skill Machines (SM), a framework that enables agents to solve complex tasks specified in Linear Temporal Logic (LTL) without learning from scratch. The approach follows a three-tier architecture:

  1. Skill Primitives: The agent first learns a base set of skills (e.g., "reach the green button") in a reward-free setting. These are represented as World Value Functions (WVFs), which can be mathematically combined using Boolean algebra (conjunction, disjunction, and negation).
  2. Constraints: To handle safety or temporal requirements (e.g., "never enter the blue zone"), constraints are integrated into the state space of the primitives, allowing the agent to track condition violations during execution.
  3. Skill Machines (SM): An SM is a finite state machine where each state represents a task phase. Instead of learning a policy for each state, the SM automatically selects a Boolean composition of pre-learned skill primitives based on the LTL specification.
The Skill Machines pipeline: translating LTL specifications into zero-shot solutions via reward and skill machines.

This framework supports zero-shot transfer, where the SM is built directly from an LTL formula, and few-shot learning (QL-SM), which uses off-policy RL to refine behavior if the zero-shot path is sub-optimal.

Experimental Evaluation

We evaluated Skill Machines across three distinct domains: Office Gridworld (tabular sequencing), Moving Targets (high-dimensional pixel observations), and Safety Gym (continuous control with LiDAR sensors).

Performance comparison across various tasks. Skill Machines (SM) achieve near-optimal reward zero-shot, significantly outperforming standard RL and existing logic-based baselines.

Key Results

  • Zero-Shot Success: In the Office Gridworld, Skill Machines achieved near-optimal performance immediately. In contrast, standard baselines like Q-Learning required hundreds of thousands of steps to reach similar performance levels.
  • Superior Efficiency: When combined with minimal learning (QL-SM), our method significantly outperformed state-of-the-art logic-based RL methods, including Counterfactual Reward Machines (CRM) and Hierarchical Reward Machines (HRM).
  • Scalability: The framework successfully generalized to pixel-based inputs and continuous action spaces, demonstrating its robustness beyond simple grid environments.

Discussion and Future Work

A core insight of this work is that logical operators (AND, OR, NOT) map directly to mathematical operations on value functions (min, max, linear transformations). This allows an agent that knows how to "get coffee" and "get mail" to mathematically derive how to "get coffee AND NOT mail."

While Skill Machines are guaranteed to be "satisficing"—eventually solving any possible task—they do rely on a pre-trained "alphabet" of skill primitives. If a task requires a skill outside this base set, the agent cannot compose a solution. Future research will explore integrating this framework with Large Language Models (LLMs) to automatically translate natural language instructions into the LTL formulas that drive Skill Machines, further bridging the gap between symbolic reasoning and low-level control.

Summary updated

BibTeX
@inproceedings{tasse2024skill,
  author = {Geraud Nangue Tasse and Devon Jarvis and Steven James and Benjamin Rosman},
  title = {{Skill Machines: Temporal Logic Composition in Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=qiduMcw3CU},
}
Figure