Learning Formal Specifications from Membership and Preference Queries

Ameesh Shah, Marcell Vazquez-Chanlatte, Sebastian Junges, Sanjit A. Seshia

Introduction

For autonomous systems to operate safely and reliably in complex environments, they require formal specifications—precise logical descriptions of their intended behavior. However, translating high-level human intent into formal logic like Linear Temporal Logic (LTL) or Deterministic Finite Automata (DFA) is a significant bottleneck, as it typically requires specialized expertise.

Active learning offers a potential solution by allowing an algorithm to generate behaviors and ask a human "teacher" to label them. Traditionally, this process relies on membership queries, where the teacher must decide if a specific, often complex, trajectory is "correct" or "incorrect." In practice, humans often struggle with these binary labels for complex behaviors but are remarkably adept at providing pairwise preferences (e.g., "Behavior A is better than Behavior B"). This paper introduces a framework that bridges this gap by strategically combining both query types to learn specifications more efficiently.

Methodology

The authors propose a concept-class-agnostic framework for specification mining that leverages the complementary strengths of membership and preference signals. The core of the approach rests on several technical innovations:

Membership Respecting Preferences (MemRePs)

The framework formalizes Membership Respecting Preferences (MemRePs). This logical constraint ensures that preferences are consistent with membership: if behavior $A$ is preferred over behavior $B$, then $B$ cannot be classified as "good" if $A$ is classified as "bad." This link allows preference queries to prune the space of possible specifications even without direct membership labels.

Query Selection via Contextual Multi-Armed Bandits

To decide whether to issue a membership query or a preference query, the algorithm employs a Contextual Multi-Armed Bandit (CMAB) with "expert advice." This mechanism balances the computational cost and the estimated human effort of each query type against the expected reduction in the number of candidate specifications (the hypothesis space).

An example of a Deterministic Finite Automaton (DFA) learned by the framework.

SAT-Based Synthesis and Error Handling

For learning DFAs, the authors extended standard SAT-based identification techniques to incorporate preference constraints. Furthermore, the framework includes a robust error-handling mechanism. By analyzing "unsatisfiable cores" in the underlying logic, the system can identify and ignore inconsistent human feedback, such as preference cycles (e.g., $A \succ B \succ C \succ A$).

Experimental Evaluation

The framework was evaluated across several synthetic benchmarks designed to mimic real-world challenges:

  • Robot Task Specifications: Navigation tasks in grid-worlds requiring specific sequences (e.g., visiting a charging station only after a drying station).
  • Tomita Languages: A standard benchmark set of seven regular languages for DFA learning.
  • Monotone Predicate Families: Representing car-following scenarios where specifications define safe time-gaps.
  • Scaled Modulo DFAs: Used to test the algorithm's scalability as the complexity of the target specification increases.

Key Results

The primary finding is that preference queries can effectively substitute for membership queries, which are often more taxing for human teachers.

The trade-off between membership and preference queries as the relative cost of membership queries increases.

Query Replacement and Efficiency

In DFA learning experiments, the algorithm successfully pivoted to preference queries as the assigned "cost" of membership queries increased. On average, the system could eliminate one difficult membership query by adding approximately 2.03 preference queries. This trade-off is crucial for human-in-the-loop systems where reducing cognitive load is a priority.

Performance Against Baselines

The MemRePs framework outperformed the classic L* algorithm, the gold standard for active automata learning. While L* relies solely on membership and equivalence queries, the proposed approach identified correct specifications using significantly fewer membership labels by exploiting the information density of the preference lattice.

Scalability

The approach demonstrated the ability to scale to DFAs with up to 40 states. However, the results also highlighted a limit: as the target specification grows in complexity, the number of preference queries required to compensate for missing membership labels grows significantly, reflecting their lower individual information content.

Conclusion and Future Work

This research demonstrates that incorporating human-friendly preference queries into formal specification learning is not only possible but highly efficient. By formalizing the relationship between preferences and membership, the authors provide a robust path toward more accessible robot programming.

Future work aims to move beyond simulated oracles to validate the framework with real human subjects. Additionally, the authors plan to extend the implementation to more expressive logics, such as Symbolic Automata, to handle the continuous-state spaces common in advanced robotics.

Summary updated

BibTeX
@inproceedings{shah2023learning,
  author = {Ameesh Shah and Marcell Vazquez-Chanlatte and Sebastian Junges and Sanjit A. Seshia},
  title = {{Learning Formal Specifications from Membership and Preference Queries}},
  booktitle = {NeuS},
  year = {2023},
  doi = {10.48550/arxiv.2307.10434},
}
Figure