LLMs as Probabilistic Minimally Adequate Teachers for DFA Learning
Lekai Chen, Ashutosh Trivedi, Alvaro Velasquez
TL;DR
This work tackles learning deterministic finite automata (DFA) in the presence of imperfect large language model (LLM) oracles by introducing the probabilistic Minimally Adequate Teacher (pMAT). It combines two prompting strategies, Discrimination and Verification, with a hybrid LearnAnyWay with Passive Refinement (LAPR) algorithm that uses a query cache to correct persistent membership-query errors and leverage counterexamples. Empirical results show significant reductions in query-level error rates and robust DFA recovery under noisy MQ conditions, with LAPR outperforming traditional DFA learners and prior LearnAnyWay variants. The approach provides a practical, theoretically grounded framework for integrating LLMs into automata learning and runtime verification tasks, enabling reliable formal reasoning in the presence of persistent oracle errors.
Abstract
The emergence of intelligence in large language models (LLMs) has inspired investigations into their integration into automata learning. This paper introduces the probabilistic Minimally Adequate Teacher (pMAT) formulation, which leverages a probabilistic oracle that could give persistent errors randomly during answering the membership queries for deterministic finite automata (DFA) learning. Given the tendency of LLMs to produce hallucinatory content, we have developed techniques to improve answer accuracy and ensure the correctness of the learned automata. We propose the $\mathtt{Discrimination}$ prompt as well as the $\mathtt{Verification}$ prompt and explore their advantages over common prompts. Additionally, we compare DFA learning performance between the TTT algorithm and common active learning algorithms. To address the exponential number of persistent errors, we implement a dynamic query cache refinement algorithm that identifies and corrects conflicting queries by combining the active and passive learning algorithms. The empirical results demonstrate the robustness and efficiency of our approach, providing a theoretical foundation for automata learning with LLMs in the loop.
