Skill Machines: Temporal Logic Skill Composition in Reinforcement Learning

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

TL;DR

This paper introduces Skill Machines (SMs), a reinforcement learning framework that allows agents to solve complex, long-horizon tasks specified by Linear Temporal Logic (LTL) zero-shot. By learning a base set of "skill primitives" and composing them both logically (AND, OR, NOT) and temporally (sequences, constraints), agents can instantly execute novel, complex instructions without needing millions of new training samples.

What Problem Does This Paper Address?

Reinforcement Learning (RL) agents are notoriously sample-inefficient. If you want an agent to solve a new task, you typically have to train it from scratch. A holy grail in RL is to build agents that can follow a wide variety of natural language or logical instructions (e.g., "Pick up the blue box, then the red cylinder, but never step on the green tiles") by reusing previously learned behaviors.

However, combining skills is plagued by a dual "curse of dimensionality":

  1. Spatial/Logical Curse: There is a combinatorial explosion of ways to combine goals at a single timestep (e.g., "find an object that is blue AND a box, but NOT heavy").
  2. Temporal Curse: There is an infinite number of ways to sequence these goals over time while maintaining constraints (e.g., "ALWAYS avoid water UNTIL you find a bridge").

Previous works have tackled either spatial composition or temporal composition, but doing both simultaneously without further learning has remained out of reach. If an agent learns a skill to "go to a button", it usually can't reuse that exact skill if a new task suddenly adds the constraint "...while avoiding blue regions," because the original skill's policy might route straight through a blue region.

Methods

Overview of the Skill Machine framework translating LTL specifications into zero-shot policies.

The authors bridge this gap by combining Reward Machines (RMs)—finite state machines that encode the temporal structure of a task—with World Value Functions (WVFs), which allow for the Boolean composition of value functions.

Here is the step-by-step approach:

  1. Skill Primitives with Constraints: The agent first learns a set of base "skill primitives" (e.g., "go to red", "go to blue"). Crucially, the state space for these primitives is augmented with constraints. The agent learns to achieve goals while keeping track of propositions it must always keep true or false.
  2. Reward Machines (RMs): A complex task specified in Linear Temporal Logic (LTL) is translated into an RM.
  3. Skill Machines (SMs): The agent performs value iteration over the RM to figure out the optimal transition to make at any high-level step. It then maps these transitions to a Boolean composition of its skill primitives. This creates a "Skill Machine"—a finite state machine where every state outputs a zero-shot, logically composed value function for the agent to follow.
  4. Few-Shot Fine-Tuning: Because the zero-shot policy is composed of locally optimal skills, it might not be globally optimal. The authors show that standard off-policy RL (like Q-learning) can be seamlessly layered on top of the SM to fine-tune the behavior to perfect optimality with minimal samples.

Datasets

The authors evaluate their approach across three distinct environments to prove its generality:

  • Office Gridworld: A tabular domain where an agent must navigate rooms, deliver coffee/mail, and avoid breaking decorations.
  • Moving Targets Domain: A high-dimensional pixel environment (84x84x3 RGB images) where the agent collects objects of specific shapes and colors. Requires deep RL (CNNs + MLPs).
  • Safety Gym Domain: A continuous state and action space environment where a point-mass robot navigates to cylinders and buttons while avoiding hazard regions. Requires continuous control algorithms (TD3).

Key Insights and Ideas

  • Constraints are the missing link for temporal logic: By forcing base skill primitives to track violated constraints in their state space, the agent can zero-shot compose a policy like "go to A without hitting B" using skills that were trained independently.
  • Provably Satisficing Zero-Shot Behavior: The authors mathematically prove that as long as the environment satisfies a "global reachability assumption" (no irreversible dead-ends), the Skill Machine is guaranteed to output a policy that successfully completes the LTL task zero-shot.
  • Local vs. Global Optimality: A zero-shot composed policy is "recursively optimal" (it takes the best path for the current sub-task), but it might not take the best path for the overall sequence. However, this recursively optimal policy acts as a massive head-start for standard RL algorithms, effectively solving the exploration problem for long-horizon tasks.

Key Results

Learning curves demonstrating the zero-shot performance and rapid convergence of Skill Machines compared to baselines.
  • Zero-Shot Success: Across all three domains, the Skill Machine (SM) agent achieved near-optimal returns without a single step of additional training on the new tasks.
  • Massive Speedups in Few-Shot Learning: When paired with Q-learning (QL-SM), the agent converged to optimal performance orders of magnitude faster than state-of-the-art baselines (including Counterfactual RMs and Hierarchical RMs).
  • Solving the Unsolvable: On the hardest LTL tasks (e.g., Task 4 in the Office Gridworld, which requires a long sequence of deliveries, patrols, and strict constraints), standard Q-learning completely failed to learn. The SM and QL-SM agents solved it effortlessly.

Limitations and Future Work

  • Global Reachability Assumption: The zero-shot theoretical guarantees rely on the assumption that the agent can reach any state from any other state. The authors demonstrate that if this is violated (e.g., an agent steps into an absorbing "trap" state), the zero-shot policy can fail. However, they note that the few-shot RL agent (QL-SM) can still learn to overcome this and find the optimal policy.
  • Sub-optimality of Zero-Shot: Because the zero-shot composition is greedy per sub-task, the resulting trajectories can sometimes be slightly inefficient compared to a globally optimized policy.
  • Future Work: The authors view this as a stepping stone toward deploying generally intelligent agents in the real world, suggesting future work could focus on scaling these techniques to physical robotics where human-specifiable safety constraints and zero-shot execution are paramount.

Summary updated

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