Learning Automata-Based Task Knowledge Representation from Large-Scale Generative Language Models

Yunhao Yang, Jean-Raphaël Gaglione, Ufuk Topcu · DOI

Abstract

This paper introduces GLM2FSA, a framework designed to bridge the gap between the vast, unstructured knowledge of Large Language Models (LLMs) and the formal, verifiable requirements of autonomous control systems. By transforming natural language task descriptions into Finite State Automata (FSAs), GLM2FSA enables the automated generation of machine-executable controllers. The framework incorporates a formal verification loop using Linear Temporal Logic (LTL) and model checking to identify and correct logical inconsistencies or safety risks in the LLM's output, ensuring the resulting state machines are robust, reliable, and safe for deployment.

Introduction

In robotics and autonomous systems, tasks are traditionally represented as Finite State Automata (FSAs). These formal structures are highly valued for being machine-understandable and amenable to rigorous safety verification. However, manual construction of FSAs is labor-intensive and requires significant domain expertise. Conversely, Generative Language Models (GLMs) possess extensive world knowledge and can generate step-by-step instructions for diverse tasks, yet their outputs are often unreliable, prone to hallucinations, and lack the structure required for direct control integration.

GLM2FSA addresses this challenge by providing an algorithmic pipeline to convert natural language instructions into structured, verifiable state machines.

The GLM2FSA Pipeline

The GLM2FSA methodology consists of three primary stages designed to extract, structure, and verify task knowledge.

Overview of the GLM2FSA pipeline, illustrating the flow from natural language input to the construction and visualization of a finite state automaton.

1. Knowledge Extraction (GLM2Step)

The system prompts a GLM (such as text-davinci-003) to decompose a high-level task (e.g., "cross the road") into a hierarchy of steps and substeps. This hierarchical approach allows the system to capture both broad objectives and granular execution details.

2. Semantic Parsing and FSA Construction

Using semantic parsing tools like spaCy, the algorithm processes the textual steps to extract key verb phrases. It distinguishes between actions (what the agent performs) and conditions (environmental propositions that must be satisfied). These elements are then mapped into an FSA where states represent task steps and transitions are triggered by environmental conditions.

A formal representation of an FSA transition, where transitions between states are governed by logical propositions and associated actions.

3. Verification and Iterative Refinement

To ensure reliability, the generated FSA is checked against user-defined safety specifications using Linear Temporal Logic (LTL) and the NuSMV model checker. If the FSA fails a check, the system generates a counterexample—a specific sequence of events leading to a failure. This counterexample is used to re-prompt the GLM, forcing it to refine its instructions to account for the identified edge case or safety risk.

Case Studies and Results

The framework was evaluated across several domains to demonstrate its versatility:

  • Common Sense Safety: In a road-crossing scenario, the initial GLM output failed to account for traffic lights. The verification loop identified this risk, and the subsequent refinement ensured the agent waits for both a green light and clear traffic.
  • Technical Procedures: The system successfully generated FSAs for troubleshooting hardware, such as rebooting a WiFi router.
  • Specialized Knowledge: GLM2FSA demonstrated the ability to represent complex cryptographic protocols, such as Secure Multi-Party Computation (MPC), which typically require deep technical expertise to model manually.

Key Insights

  • Automated Oracles: GLM2FSA replaces the need for human experts in the automaton learning loop by using the GLM as a knowledge oracle.
  • Formal Guardrails: By treating the GLM as a "noisy" source, the framework uses formal methods to filter out hallucinations and ensure safety.
  • Efficiency: Hierarchical pruning allows the system to expand only the necessary steps to satisfy safety requirements, keeping the resulting controllers efficient.

Conclusion and Future Work

GLM2FSA provides a scalable path toward generating verifiable controllers from natural language. Future research will focus on automating the mapping between the GLM's vocabulary and the formal world model, as well as moving toward a fully closed-loop autonomous refinement system that requires minimal human intervention.

Summary updated

BibTeX
@inproceedings{yang2025learning,
  author = {Yunhao Yang and Jean-Raphaël Gaglione and Ufuk Topcu},
  title = {{Learning Automata-Based Task Knowledge Representation from Large-Scale Generative Language Models}},
  booktitle = {NeuS},
  year = {2025},
}
Figure