Demonstration Informed Specification Search

Marcell Vazquez-Chanlatte, Ameesh Shah, Gil Lederman, Sanjit A. SeshiaarXiv 2021

Abstract

This paper considers the problem of learning temporal task specifications, e.g. automata and temporal logic, from expert demonstrations. Task specifications are a class of sparse memory augmented rewards with explicit support for temporal and Boolean composition. Three features make learning temporal task specifications difficult: (1) the (countably) infinite number of tasks under consideration; (2) an a-priori ignorance of what memory is needed to encode the task; and (3) the discrete solution space - typically addressed by (brute force) enumeration. To overcome these hurdles, we propose Demonstration Informed Specification Search (DISS): a family of algorithms requiring only black box access to a maximum entropy planner and a task sampler from labeled examples. DISS then works by alternating between conjecturing labeled examples to make the provided demonstrations less surprising and sampling tasks consistent with the conjectured labeled examples. We provide a concrete implementation of DISS in the context of tasks described by Deterministic Finite Automata, and show that DISS is able to efficiently identify tasks from only one or two expert demonstrations.

Introduction

In traditional Inverse Reinforcement Learning (IRL), the goal is to infer a reward function from an expert's demonstrations. However, reward functions often fail to compose well, require a priori knowledge of relevant historical features (memory), and are sensitive to minor environmental changes.

To address these limitations, researchers have shifted toward learning formal task specifications, such as Boolean logic or Deterministic Finite Automata (DFAs). These specifications explicitly encode memory and temporal constraints. However, this shift introduces a significant challenge: the search space of automata is discrete, countably infinite, and lacks natural gradients. Previous methods typically relied on brute-force enumeration or blind random mutations, which are inefficient for complex tasks.

Figure 1: Learning formal task specifications (automata) from expert demonstrations in a gridworld environment.

The DISS Algorithm

The core contribution of this work is Demonstration Informed Specification Search (DISS). DISS reframes the learning problem into an iterative series of supervised learning tasks, using a "surprise gradient" to guide the search through the discrete space of specifications.

Figure 2: The Demonstration Informed Specification Search (DISS) loop.

The algorithm operates through a four-step loop:

  1. Maximum Causal Entropy Agent Model: The expert is assumed to follow a Maximum Entropy policy for a given task. This allows the algorithm to quantify the "surprise" (negative log-likelihood) of a demonstration under a hypothesized task.
  2. Proxy Surprise Gradient: Since the task space is discrete, DISS uses a "prefix tree" of demonstrations and maps discrete tasks to continuous "pivot values" (expected values of deviating from the demonstration). The gradient of surprise with respect to these values is computable and provides a direction for improvement.
  3. Surprise Guided Sampling (SGS): Using the gradient, the algorithm identifies where the expert's behavior was most surprising. It then generates counterfactual paths and labels them as positive or negative examples to constrain the next hypothesized task.
  4. Simulated Annealing: A SAT-based identifier finds tasks consistent with the accumulated labeled examples. Simulated annealing explores this space, balancing task complexity (Occam's razor) with explanatory power.

Experimental Evaluation

The authors evaluated DISS in a stochastic 8x8 gridworld environment where an agent is subject to random "wind" pushes. The goal was to infer DFAs over colored tiles from just one or two expert demonstrations.

DISS significantly outperformed baselines, including prior-ordered enumeration. In incremental experiments, the algorithm identified ground-truth DFAs in fewer than six iterations. Qualitatively, DISS successfully learned complex, memory-dependent rules, such as requiring an agent to visit a "drying tile" after entering water before proceeding to a goal. It also correctly identified "sink states" (e.g., lava) by generating appropriate negative example paths during the search.

Discussion and Conclusion

DISS demonstrates that gradient-based guidance is possible in traditionally gradient-less discrete domains by shifting focus to the continuous policy space of the agent. By using counterfactuals as constraints, the algorithm effectively tells the search: "Make the action the agent actually took look less optimal."

Despite its success, the approach has limitations. The reliance on a black-box Maximum Entropy planner is computationally expensive, limiting DISS to smaller state spaces. Furthermore, demonstrations are fundamentally ambiguous; if two tasks yield the same optimal policy in a specific environment, they cannot be distinguished without further exploration. Future work will focus on model-free approximations of planners and expanding to more expressive formalisms like push-down automata.

Summary updated

BibTeX
@misc{vazquezchanlatte2021demonstration,
  author = {Marcell Vazquez-Chanlatte and Ameesh Shah and Gil Lederman and Sanjit A. Seshia},
  title = {{Demonstration Informed Specification Search}},
  year = {2021},
  eprint = {2112.10807},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.10807},
}
Figure