Finite Automata Extraction Methods
- Finite Automata Extraction (FAE) is a method to construct transparent finite-state models that mimic the behavior of complex, opaque systems.
- It leverages techniques such as query-based active learning, state merging, and symbolic predicate synthesis to extract diverse automata like DFAs, WFAs, and more.
- FAE enhances model interpretability and verification by replacing black-box processes with inspectable and generalizable finite automata frameworks.
Searching arXiv for recent and foundational papers on finite automata extraction. Finite Automata Extraction (FAE) is the task of constructing an explicit finite-state surrogate for an opaque language recognizer, sequence model, program semantics, heap-shape analyzer, or world model. Across the literature, the extracted object may be a deterministic finite automaton (DFA), residual symbolic finite automaton (RSFA), weighted finite automaton (WFA), probabilistic deterministic finite automaton (PDFA), deterministic register automaton (DRA), Mealy machine, or forest automaton, depending on the input domain and the target behavior being modeled. In the black-box setting, FAE typically proceeds either by querying the target system, by clustering or merging observed internal states, or by synthesizing symbolic transition rules from traces. The common objective is to replace an implicit computational process with a finite, inspectable transition system that preserves the relevant acceptance, prediction, or transition behavior sufficiently well for analysis, explanation, verification, or control (Weiss et al., 2017, Chubachi et al., 2019, Merrill et al., 2022, Zhang et al., 2024, Wei et al., 2022, Goel et al., 15 Aug 2025, Hong et al., 24 Nov 2025).
1. Scope and formal objects
FAE is not tied to a single automaton class. In formal-language settings, the target is often a DFA learned from a binary acceptor, with a standard tuple and acceptance defined by whether the state reached after consuming a word lies in (Merrill et al., 2022, Zhang et al., 2024). Query-based symbolic learning generalizes this to symbolic finite automata over an effective Boolean algebra , where transitions are labeled by predicates rather than individual symbols, and to residual symbolic finite automata, in which every state recognizes a residual language (Chubachi et al., 2019).
For quantitative sequence models, especially recurrent neural networks used in natural language processing, the extracted model is often a WFA
or a PDFA when outgoing transition weights form a probability distribution (Wei et al., 2022, Wei et al., 2023, Weiss et al., 2019). In these settings, FAE does not merely reproduce binary acceptance; it attempts to approximate stepwise output distributions, conditional next-token probabilities, or label distributions induced by the source model.
When the alphabet is not finite, finite automata are insufficient. For numeric or continuous data sequences, DRAs extend finite-state control with registers storing values and guards comparing the current input with register contents and constants; this permits patterns depending on order or equality over that ordinary DFAs cannot express (Hong et al., 24 Nov 2025). In world-model learning from gameplay video, the extracted automata are per-sprite Mealy machines
whose transitions encode sprite-type changes and whose outputs encode actions in a domain-specific language (Goel et al., 15 Aug 2025). In heap analysis, forest automata represent sets of tree decompositions of heap graphs, and the extraction problem becomes automatic discovery of reusable sub-automata, called boxes, for repetitive graph patterns (Holik et al., 2013).
This variety suggests that FAE is best understood as a family of finite-state distillation procedures rather than as a single algorithm. A plausible implication is that the decisive modeling choice is the structure one wishes to preserve: Boolean acceptance, symbolic predicates, weighted predictions, numeric comparisons, graph decomposition, or executable transition logic.
2. Query-based learning and exact-learning lineages
A central FAE paradigm is active learning by membership and equivalence queries. In the classical RNN setting, Angluin’s algorithm is used as the learner, while the trained recurrent network acts as an oracle through its acceptance function (Weiss et al., 2017). Membership queries evaluate whether a word is accepted. Equivalence queries are handled by abstraction and counterexample-guided refinement over the RNN hidden-state space: the method builds a finite abstraction of the continuous state space, compares it with the current DFA hypothesis, and either returns a true counterexample or refines the partition if the conflict is attributable to abstraction imprecision (Weiss et al., 2017). The method guarantees that every returned counterexample is true and that every refinement is justified, while the learner always proposes a minimal DFA hypothesis (Weiss et al., 2017).
The same active-learning architecture has been extended to weighted and probabilistic models. For real-valued RNN scorers, WFA extraction uses a weighted extension of grounded in Hankel-style observation tables, while equivalence queries are guided by regression from RNN hidden states to WFA configurations (Okudono et al., 2019). The regression model prioritizes counterexample candidates by hidden-state geometry, which is used to focus search on poorly aligned regions of the learned abstraction (Okudono et al., 2019). For LLMs, a probabilistic variant learns PDFAs from conditional next-token distributions, replacing Boolean row equality with a local tolerance over probability vectors and using observation tables populated by conditional probabilities rather than raw word probabilities (Weiss et al., 2019). The resulting automata are deterministic and stochastic by construction, in contrast to spectrally extracted WFAs, which need not be stochastic (Weiss et al., 2019).
A further development replaces deterministic symbolic automata with RSFAs (Chubachi et al., 2019). In this setting, the minimally adequate teacher provides membership queries and equivalence queries , and the learner maintains an observation table 0 together with a collection of predicate learners over the underlying Boolean algebra (Chubachi et al., 2019). Counterexamples trigger either state refinement, by enlarging the prefix and suffix sets used to approximate residuals, or predicate refinement, by passing violating letters to per-transition predicate learners (Chubachi et al., 2019). Structural conditions specific to residual nondeterminism are enforced before posing equivalence queries, including monotone successor, residual-cover, and row-language consistency conditions (Chubachi et al., 2019).
These methods share a common architecture: a finite hypothesis is proposed, challenged against the target through some form of equivalence test, and revised using counterexamples. What differs is the observation domain—Boolean acceptance, real-valued scores, symbolic predicates, or probabilistic continuations—and the complexity of the abstraction mediating equivalence.
3. State abstraction, clustering, and state merging
A second major lineage extracts automata from observed internal states rather than from formal equivalence queries. In recurrent networks, one influential approach builds a prefix-tree acceptor from labeled prefixes and then merges compatible states according to both acceptance consistency and hidden-state similarity (Merrill et al., 2022). Each prefix 1 induces a PTA node 2, a hidden-state feature vector 3, and a binary accepting label obtained by thresholding the RNN’s per-prefix acceptance probability at 4 (Merrill et al., 2022). Two states may be merged when they have matching acceptance labels and sufficiently high cosine similarity, with tolerance controlled by 5 (Merrill et al., 2022). Because merging can temporarily introduce nondeterminism, determinization and minimization are applied afterward, yielding a smallest DFA for the merged automaton’s language (Merrill et al., 2022).
On the Tomita languages, this state-merging procedure achieved 6 fidelity for languages 1–6 and 7 for language 7 when 8 and the PTA size was 9 (Merrill et al., 2022). The extracted minimal DFA sizes matched the ground truth for languages 1–6, while language 7 exhibited higher variance (Merrill et al., 2022). The paper also reports that continued training after the network had already reached approximately 0 development accuracy improved extraction, because the RNN’s internal state space became more compressed and more amenable to cosine-based merging (Merrill et al., 2022). This suggests that FAE can reveal not only what a model computes, but also how its internal geometry changes during optimization.
Transformer extraction cannot rely on an explicit recurrent transition function, so the state-abstraction problem is reformulated. Encoder-only Transformers are treated as black-box acceptors, while a continuous-state surrogate automaton, the DCSA, is trained so that its prefix-wise state evolution aligns with the Transformer’s final 1 representations (Zhang et al., 2024). Representation alignment combines a label-consistency loss with an 2 discrepancy term between Transformer representations and DCSA states (Zhang et al., 2024). A partition of the DCSA state space then induces a DFA abstraction, and 3 is used pedagogically with approximate equivalence queries derived from sampling and comparison with the DCSA-induced abstraction (Zhang et al., 2024). Reported fidelities include 4 on several regular languages and near-perfect agreement even on cases where the Transformer itself did not learn the ground-truth language well, such as parity, where 5 but 6 (Zhang et al., 2024).
Across these approaches, the extracted automaton is shaped by the geometry of learned representations. A plausible implication is that the quality of a finite-state surrogate depends not only on the target function being regular or approximately regular, but also on whether the hidden-state manifold organizes itself into stable, mergeable equivalence classes.
4. Large alphabets, symbolic predicates, and residual nondeterminism
When the alphabet is very large or infinite, explicit symbol-by-symbol transition learning becomes impractical. Symbolic automata address this by labeling transitions with predicates over a Boolean algebra, so that one transition can denote a large character class (Chubachi et al., 2019). In the RSFA framework, the alphabet is a domain 7 and transitions are enabled by 8 for predicates 9 (Chubachi et al., 2019). The target denotation for a transition from 0 to 1 is
2
and this set is learned by a predicate learner delegated to the underlying Boolean algebra (Chubachi et al., 2019).
Residuality is essential here. In reduced RFAs and RSFAs, states correspond to prime residuals, yielding automata that can be exponentially smaller than minimal DFAs (Chubachi et al., 2019). The RSFA learner exploits two forms of succinctness simultaneously: fewer states than deterministic symbolic automata, and predicate-labeled transitions that compress many symbol-specific edges into single symbolic edges (Chubachi et al., 2019). The paper gives worst-case bounds of at most 3 equivalence queries and 4 membership queries, where 5, 6 is the maximum counterexample length, and 7 bound the underlying predicate learner’s costs (Chubachi et al., 2019).
Empirically, the RSFA learner and the deterministic symbolic learner of Argyros–D’Antoni were both implemented on top of the open-source symbolicautomata library, and tested on 8 random nondeterministic SFAs over the full 32-bit integer alphabet (Chubachi et al., 2019). The reported result is that the RSFA learner consistently asked far fewer equivalence and membership queries than the deterministic learner, even though the RSFA worst-case bounds are higher (Chubachi et al., 2019). The paper attributes this partly to the smaller number of states and partly to the fact that RSFA transitions admit a range of acceptable predicates between simplified and saturated semantics, allowing predicate learners to converge with fewer splits (Chubachi et al., 2019).
This symbolic-residual viewpoint clarifies a recurrent theme in FAE: nondeterminism is not merely a representational convenience. In some settings it directly reduces learning cost by enlarging the space of transition predicates compatible with the target language.
5. Weighted, probabilistic, and natural-language extraction
Natural-language tasks impose two difficulties absent from regular-language benchmarks: large vocabularies and context-sensitive outputs. In response, several works extract WFA-like models from RNNs by clustering output traces into a finite state set and learning per-token transition matrices (Wei et al., 2022, Wei et al., 2023). The extracted WFA propagates a state distribution
9
and maps it to a label distribution through a matrix of state centers (Wei et al., 2022, Wei et al., 2023).
A recurring problem is transition sparsity: many state-token pairs are never observed because vocabulary items follow a Zipfian distribution (Wei et al., 2022, Wei et al., 2023). Both papers address this by complementing missing rows using a distance-weighted mixture over observed rows from semantically similar abstract states, combined with a self-transition component controlled by a parameter 0 (Wei et al., 2022, Wei et al., 2023). They further introduce a context-aware adjustment
1
which injects a simple memory of previous state distributions through self-loop bias (Wei et al., 2022, Wei et al., 2023). Two data-augmentation tactics—synonym replacement and replacement by 2—expand the observed dynamics of rare words (Wei et al., 2022, Wei et al., 2023).
On the QC and Toxic datasets, these changes improved Consistency Rate with the RNN from 3 to 4 and from 5 to 6, respectively, relative to a common uniform-fill baseline without context or augmentation (Wei et al., 2022). The companion work additionally proposes Transition Matrix Embeddings, which vectorize per-token transition matrices into task-oriented word representations suitable for explanation, pretraining, and adversarial example generation (Wei et al., 2023). Reported improvements include CR from approximately 7 to approximately 8 and Jensen–Shannon divergence from approximately 9 to approximately 0 on QC and Toxic, respectively, for the full empirical-filling, context-aware, augmented pipeline (Wei et al., 2023).
Probabilistic language-model extraction takes a more query-theoretic route. The PDFA learner of (Weiss et al., 2019) observes conditional probabilities 1 and compares observation-table rows up to a tolerance 2 under an 3 metric (Weiss et al., 2019). Hypothesis construction requires clustering rows into cliques satisfying both pairwise 4-equality and determinism constraints (Weiss et al., 2019). The extracted automaton is stochastic and deterministic by construction, and on unbounded-history benchmark languages the method reconstructs the exact PDFA structure where 5-gram models fail (Weiss et al., 2019).
Taken together, these results show that FAE for natural language is less about exact recovery of a minimal recognizer and more about preserving predictive structure under data sparsity, large alphabets, and context dependence. This suggests a shift from exact-language identification toward faithful, analyzable surrogates of learned sequential decision boundaries.
6. Infinite domains, programs, heaps, and world models
Several works extend FAE far beyond standard language recognition. For numeric data sequences, DRAs provide a finite-state model with registers and guards over 6 (Hong et al., 24 Nov 2025). A 7-register automaton maintains finitely many stored values and accepts based on deterministic transitions whose guards compare the current input with registers and constants (Hong et al., 24 Nov 2025). The paper combines passive SMT-based synthesis, local-search synthesis, and active learning with RALib, and then composes the extracted DRA with register automata with accumulators that compute distances such as Hamming, Manhattan, edit, DTW, and last-letter distances (Hong et al., 24 Nov 2025). For fixed 8, local robustness checking is polynomial-time, via reductions from bounded projected coverability to shortest path in a weighted graph (Hong et al., 24 Nov 2025). The framework yields PAC-style agreement guarantees and either certifies local robustness or returns a concrete counterexample sequence (Hong et al., 24 Nov 2025).
In imperative semantics, FAE appears as abstraction from small-step operational semantics to a finite automaton (Baklanova et al., 2014). A zipper-based semantics preserves execution context explicitly as a pair of a focused statement and a context path, avoiding the loss of control-flow information that would occur if identical subterms were collapsed naively (Baklanova et al., 2014). The resulting automaton has finite node set because the syntax tree is finite, while silent administrative steps are represented by NoAct transitions and later eliminated by 9-closure (Baklanova et al., 2014). The paper proves a simulation from the operational semantics to the generated automaton and a further simulation from the original automaton to its 0-closed form (Baklanova et al., 2014).
Heap-shape analysis uses forest automata, where the extraction problem is automatic discovery of boxes—finite automata encoding repetitive graph motifs such as list segments or skip-list levels (Holik et al., 2013). The method identifies optimal knots, splits automata around their entry points, constructs boxes from the extracted subgraphs, and folds them back into higher-level forest automata (Holik et al., 2013). This fully automated analysis handles structures as complex as skip lists and avoids manual provision of box abstractions (Holik et al., 2013).
A distinct direction is neuro-symbolic world modeling from gameplay video (Goel et al., 15 Aug 2025). Here, perception first maps frames to symbolic sprite grids using a MarioNette-derived VAE with background subtraction and a reconstruction weight 1 (Goel et al., 15 Aug 2025). Program synthesis then performs greedy local search over if-then clauses in the Retro Coder DSL, minimizing a batch-wise predictive absolute error
2
with 3 (Goel et al., 15 Aug 2025). The result is one Mealy-machine-like program per sprite type (Goel et al., 15 Aug 2025). On Pac-Man and River Raid under low data, FAE achieved very low FID and used far fewer conditions than the symbolic baseline GEL, for example 4 conditions versus 5 on Pac-Man and 6 versus 7 on River Raid (Goel et al., 15 Aug 2025).
These examples show that FAE is increasingly used wherever a sequential or stateful process can be approximated by finite control enriched with the right symbolic interfaces: registers for numbers, boxes for graph motifs, or DSL actions for world dynamics.
7. Evaluation criteria, advantages, and limitations
FAE methods are evaluated by markedly different criteria depending on the target. Query-learning work emphasizes exactness, number of membership and equivalence queries, and compactness of the extracted automaton (Weiss et al., 2017, Chubachi et al., 2019, Weiss et al., 2019). State-merging and representation-alignment work emphasizes fidelity to the source model, recovery of minimal automata where applicable, and sensitivity to hyperparameters such as merge tolerance 8 or clustering resolution (Merrill et al., 2022, Zhang et al., 2024). Natural-language WFA extraction uses Consistency Rate and distributional discrepancies such as Jensen–Shannon divergence (Wei et al., 2022, Wei et al., 2023). World-model extraction evaluates predictive image quality and next-frame error through FID and absolute-error-derived prediction metrics (Goel et al., 15 Aug 2025).
A shared advantage is inspectability. Extracted automata expose states, transitions, guards, predicates, or clauses that can be analyzed formally or edited directly (Weiss et al., 2017, Chubachi et al., 2019, Merrill et al., 2022, Zhang et al., 2024, Hong et al., 24 Nov 2025, Goel et al., 15 Aug 2025). Another is computational leverage: WFAs and PDFAs offer efficient inference relative to the source RNN, and symbolic automata allow reasoning about huge alphabets without explicit enumeration (Okudono et al., 2019, Weiss et al., 2019, Chubachi et al., 2019). Several papers also use FAE diagnostically, for example to reveal that Transformers learn complex non-minimal surrogates for periodic languages, or that RNNs trained beyond convergence compress hidden-state geometry in ways favorable to extraction (Zhang et al., 2024, Merrill et al., 2022).
The limitations are equally consistent. Exact equivalence queries are rarely available in practical black-box settings, so many systems substitute sampling, conformance testing, or approximate teachers (Zhang et al., 2024, Chubachi et al., 2019, Hong et al., 24 Nov 2025). Extraction quality can depend strongly on clustering choices, tolerance parameters, or the hidden-state geometry induced by training (Merrill et al., 2022, Wei et al., 2022, Wei et al., 2023). Natural-LLMs create transition sparsity and context-loss problems (Wei et al., 2022, Wei et al., 2023). Symbolic methods require an effective Boolean algebra and a strong predicate learner (Chubachi et al., 2019). DRA robustness checking is polynomial only for a fixed number of registers (Hong et al., 24 Nov 2025). Gameplay-world extraction depends on perception quality and is limited by the expressiveness of the DSL, which currently lacks explicit time constructs, stochasticity, off-screen spawning, and robust handling of large multi-cell sprites (Goel et al., 15 Aug 2025).
The broader picture is that FAE has moved from a narrow problem of recovering DFAs from RNN acceptors to a general methodology for synthesizing finite-state surrogates across symbolic, statistical, and neuro-symbolic systems. This suggests that future progress will depend less on a single canonical automaton model than on better matches between task structure and extracted state formalism: symbolic predicates for huge alphabets, weighted transitions for probabilistic outputs, registers for numeric memory, and executable rule languages for interactive environments.