Automaton-Based Representations of Task Knowledge from Generative Language Models

Yunhao Yang, Cyrus Neary, Ufuk Topcu

TL;DR

This paper introduces GLM2FSA, a novel algorithm that automatically generates formal, verifiable finite state automata (FSAs) representing task knowledge from natural language descriptions. This bridges the gap between flexible, human-readable instructions and the precise, executable representations needed for sequential decision-making and formal verification, enabling safer integration of large language models into autonomous systems.

What Problem Does This Paper Address?

Building robust systems for sequential decision-making often relies on high-level task knowledge represented as automata. However, acquiring this knowledge is challenging. While large language models (LLMs) like GPT-3 can generate rich textual task descriptions, these outputs are not directly usable for formal verification or execution in control systems. They lack the structured, formal representation required for safety-critical applications. This paper addresses the critical need to translate the informal, flexible knowledge from LLMs into formal, verifiable automaton-based representations.

Methods

The core of the paper is the GLM2FSA algorithm, which operates in two main stages:

  1. Extracting Textual Knowledge: GLM2FSA queries a GLM (specifically GPT-3's Davinci-002/003 models) with a natural language task description. It iteratively prompts the GLM to break down the task into hierarchical steps and substeps. This process can be guided by keywords and can be refined based on feedback.
  2. Building FSAs from Textual Knowledge: The extracted textual steps are then parsed using semantic parsing techniques. Verb phrases are identified and classified as either actions (VPA) or conditions (VPC). These are used to construct a finite state automaton (FSA). The algorithm defines rules for creating states, transitions (default, direct, conditional, and self-transitions), atomic propositions (conditions), and output symbols (actions) based on the parsed text.

A key innovation is the integration of formal verification and refinement. The generated FSAs can be formally verified against user-defined specifications using model checking. If verification fails, counterexamples are used to guide the refinement of the GLM's input prompts, leading to an iterative process of improving the automaton. This includes both manual refinement (user-guided prompt modification) and automated refinement (hierarchical expansion of substeps).

Datasets

The paper does not explicitly mention training datasets for the GLM itself, as it leverages pre-trained LLMs (GPT-3 Davinci-002/003). The evaluation is performed on a variety of tasks, including:

  • Commonsense Tasks: "Cross the road" (with and without traffic lights).
  • Highly Specialized Tasks: "Secure multi-party computation."
  • Practical Tasks: "Booking a dental appointment," "WiFi troubleshooting."

These tasks serve as benchmarks for demonstrating GLM2FSA's ability to extract and represent knowledge across different domains.

Key Insights and Ideas

  • Bridging the LLM-Formal Gap: The most significant insight is the successful demonstration that LLMs can be a source of formalizable knowledge, not just unstructured text. GLM2FSA provides a concrete mechanism to achieve this.
  • Verifiable LLM Outputs: By generating FSAs, the outputs of LLMs become amenable to formal verification. This is crucial for building trustworthy autonomous systems, especially in safety-critical domains.
  • Iterative Refinement is Essential: The paper highlights that LLM outputs, while impressive, are not perfect. The proposed verification-guided refinement loop is vital for catching and correcting potential errors, ambiguities, or missing information in the LLM-generated knowledge.
  • Hierarchical Task Decomposition: The ability to automatically decompose tasks into hierarchical steps and substeps is a powerful feature, allowing for the generation of FSAs with varying levels of detail.
  • Domain-Specific Knowledge Extraction: GLM2FSA proves effective even for highly specialized domains like secure multi-party computation, suggesting its broad applicability beyond common sense tasks.

Key Results

  • GLM2FSA successfully constructs FSAs representing controllers for sequential decision-making tasks from brief natural language descriptions.
  • The generated FSAs are formally verifiable against user-defined specifications.
  • The verification-guided refinement process effectively identifies and corrects errors in the LLM-generated controllers, leading to improved performance and robustness.
  • Experimental case studies demonstrate the algorithm's capability on both commonsense and highly specialized tasks, including "crossing the road," "secure multi-party computation," and "WiFi troubleshooting."
  • The paper showcases how counterexamples from verification can guide manual prompt refinement and how automated substep expansion can iteratively improve the controller.

Limitations and Future Work

  • LLM Ambiguity and Synonyms: The paper acknowledges that LLMs can output different phrases for the same concept, leading to potential mismatches with external models or specifications. They propose a GLM-based synonym matching mechanism to address this.
  • Scalability of Refinement: While automated refinement through substep expansion is proposed, the paper notes that it might lead to unnecessarily large automata if not managed carefully. Pruning techniques are suggested to mitigate this.
  • Completeness of Specifications: The effectiveness of verification and refinement relies on comprehensive task specifications. The paper implies that defining these specifications remains a user's responsibility.
  • Future Work: The authors suggest further exploration of automated refinement techniques and the application of GLM2FSA to more complex and diverse domains. They also highlight the potential for using GLM2FSA as a component in larger autonomous systems.

Summary updated

BibTeX
@inproceedings{yang2025automaton,
  author = {Yunhao Yang and Cyrus Neary and Ufuk Topcu},
  title = {{Automaton-Based Representations of Task Knowledge from Generative Language Models}},
  booktitle = {NeuS},
  year = {2025},
}
Figure