Skip to main content
QUICK REVIEW

[Paper Review] Learning Deterministic Weighted Automata with Queries and Counterexamples

Gail Garfinkel Weiss, Yoav Goldberg|arXiv (Cornell University)|Oct 30, 2019
Machine Learning and AlgorithmsComputer Science24 citations
TL;DR

This paper presents WL*, a query-based algorithm for learning probabilistic deterministic finite automata (PDFAs) from black-box language models like RNNs, using membership and equivalence queries with a tolerance-based comparison of conditional probabilities. It achieves better word error rate (WER) and NDCG than spectral methods while producing compact, interpretable, and deterministic models that match RNN behavior within a user-defined tolerance.

ABSTRACT

We present an algorithm for extraction of a probabilistic deterministic finite automaton (PDFA) from a given black-box language model, such as a recurrent neural network (RNN). The algorithm is a variant of the exact-learning algorithm L*, adapted to a probabilistic setting with noise. The key insight is the use of conditional probabilities for observations, and the introduction of a local tolerance when comparing them. When applied to RNNs, our algorithm often achieves better word error rate (WER) and normalised distributed cumulative gain (NDCG) than that achieved by spectral extraction of weighted finite automata (WFA) from the same networks. PDFAs are substantially more expressive than n-grams, and are guaranteed to be stochastic and deterministic - unlike spectrally extracted WFAs.

Motivation & Objective

  • To develop a method for extracting interpretable, deterministic, and stochastic PDFAs from black-box language models such as trained RNNs.
  • To address the limitations of spectral learning and n-gram models in capturing non-local dependencies and ensuring stochasticity and determinism.
  • To enable anytime termination during extraction while preserving correctness guarantees and local similarity to the target model.
  • To extend the L* algorithm to the weighted, probabilistic setting with tolerance for noisy or approximate comparisons.
  • To provide a general-purpose framework applicable to any weighted finite automaton, including transformers, not just RNNs.

Proposed method

  • Adaptation of the L* algorithm to the weighted, probabilistic setting by introducing conditional probability queries and equivalence checks with a tolerance threshold.
  • Use of membership queries to obtain the probability of the next token given a sequence prefix, and equivalence queries to validate hypotheses against the target model.
  • Employment of a local tolerance $ t \in [0,1] $ to compare probability vectors, allowing merging of similar states and reducing automaton size.
  • Construction of an observation table using conditional probabilities to avoid vanishing probabilities in low-probability regions.
  • Integration of anytime termination by allowing extraction to stop early with guarantees on local similarity to the target model.
  • Use of a tolerance-based comparison that is non-transitive, requiring careful handling during PDFA construction from the observation table.

Experimental results

Research questions

  • RQ1Can a query-based learning algorithm effectively extract a probabilistic deterministic finite automaton (PDFA) from a black-box RNN language model?
  • RQ2How can the L* algorithm be adapted to handle weighted, probabilistic automata with noisy or approximate probability estimates?
  • RQ3What is the impact of introducing a tolerance threshold on the size and accuracy of the extracted PDFA?
  • RQ4How does the extracted PDFA compare to spectral learning and n-gram baselines in terms of WER and NDCG on synthetic and real-world language tasks?
  • RQ5Can the algorithm be terminated early while still maintaining correctness and local similarity guarantees?

Key findings

  • WL* successfully reconstructed PDFAs with identical structure to the original target in approximately one minute for Tomita grammar-based RNNs, achieving perfect or near-perfect WER and NDCG.
  • On UHL languages, WL* achieved WER = 0.0 and NDCG = 1.0 across all three test cases, outperforming spectral learning and n-grams.
  • For UHL 1, WL* achieved WER = 0.0 and NDCG = 1.0 in 15 seconds with a PDFA of size 9, while spectral learning required 56 seconds and a larger model (k=150).
  • For UHL 2, WL* achieved WER = 0.0 and NDCG = 1.0 in 73 seconds with a PDFA of size 5, significantly outperforming n-grams (WER = 0.12, NDCG = 0.94) and spectral learning (WER = 0.002).
  • For UHL 3, WL* achieved WER = 0.0 and NDCG = 1.0 in 55 seconds with a PDFA of size 4, while spectral learning required 71 seconds and a larger model (k=17).
  • n-grams performed strongly on simple, local languages but failed on non-local languages, highlighting the advantage of PDFAs for capturing long-range dependencies.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.