DeepDFA: Automata Learning through Neural Probabilistic Relaxations

Elena Umili, Roberto Capobianco · DOI

Abstract

Identifying Deterministic Finite Automata (DFA) from labeled traces is a fundamental challenge in grammatical inference. Traditional approaches typically fall into two categories: exact combinatorial methods that lack scalability and noise tolerance, or recurrent neural networks (RNNs) that offer robustness but lack interpretability. This paper introduces DeepDFA, a novel hybrid architecture that bridges this gap. By employing a differentiable probabilistic relaxation of DFA transitions and a temperature annealing schedule, DeepDFA enables gradient-based optimization of formal logic structures. Our results demonstrate that DeepDFA achieves state-of-the-art performance in terms of accuracy, scalability, and noise resilience across various benchmarks.

Introduction

The task of learning a DFA from a set of positive and negative strings is a classic problem in computer science. Historically, researchers have faced a trade-off between symbolic and neural approaches. Combinatorial methods, such as those utilizing SAT solvers or state-merging algorithms, are theoretically sound and can identify minimal DFAs. However, they are computationally expensive and highly sensitive to noise; even a single mislabeled example can lead to failure. Conversely, RNNs are efficient and noise-robust but function as "black boxes," making it difficult to extract the underlying logic they have learned.

DeepDFA addresses these limitations by providing a model that is differentiable during training yet remains transparent and interpretable. It functions as a Probabilistic Finite Automaton (PFA) during the learning phase and converges into a standard DFA for inference, combining the noise-robustness of neural networks with the formal clarity of classical automata.

Methodology

Probabilistic Relaxation and Architecture

The core of DeepDFA is a recurrent architecture where discrete state transitions are relaxed into continuous operations. Instead of a hard transition between states, the model maintains a probability distribution over the state space. Transitions are computed via matrix multiplications, where the transition matrix is conditioned on the input symbol. This structure allows the model to be trained using standard backpropagation.

Temperature Annealing

To transition from a "fuzzy" probabilistic model to a "crisp" logical DFA, DeepDFA utilizes a temperature parameter ($\tau$) within its activation functions (Softmax and Sigmoid). At the beginning of training, a high temperature ($\tau=1$) allows for smooth gradients and broad exploration of the state space. As training progresses, $\tau$ is gradually annealed toward zero. This process forces the activations to become one-hot vectors, effectively discretizing the model's behavior into a deterministic automaton.

Model Minimization

Once training is complete and the model has converged to a discrete state, the resulting DFA may contain redundant states depending on the initial capacity ($Q_{max}$) provided. To ensure the model is as concise as possible, the authors apply the classical Hopcroft algorithm. This post-processing step prunes redundant states, resulting in a minimal DFA that represents the learned language.

Handling Probabilistic Inputs

A unique feature of DeepDFA is its ability to handle "imperfectly grounded" symbols. Unlike traditional DFA induction methods that require discrete input characters, DeepDFA can process input sequences where each element is a probability distribution over the alphabet. This makes it uniquely suited for applications where input data is inherently uncertain, such as sensor data or speech processing.

Experimental Evaluation

Benchmarks and Setup

The authors evaluated DeepDFA against several baselines, including SAT-based DFA inductors and L* extraction from RNNs. The evaluation used:

  • Tomita Languages: Seven standard regular languages of varying complexity.
  • Random DFAs: Synthetic automata with 10 to 30 states and alphabets of 2-3 symbols.
  • Noisy Datasets: Variants of the above datasets with 1% label noise or Gaussian noise applied to the input symbols.

Key Results

  • Accuracy: DeepDFA achieved 100% accuracy on all Tomita benchmarks. On larger random DFAs (up to 30 states), it outperformed SAT-based methods, which frequently timed out or exceeded memory limits.
  • Noise Resilience: While exact methods failed entirely when faced with 1% label noise, DeepDFA maintained near-perfect performance. It also demonstrated superior accuracy compared to extracting DFAs from pre-trained LSTMs or GRUs.
  • Efficiency: DeepDFA proved to be the most efficient method for large-scale automata, often converging in seconds or minutes, whereas other neurosymbolic approaches required significantly more time.
  • Interpretability: Unlike RNN-based extraction, which often yields "bloated" DFAs with hundreds of states, the state counts produced by DeepDFA (after Hopcroft minimization) were remarkably close to the ground truth.

Discussion and Conclusion

DeepDFA represents a significant step forward in neurosymbolic AI. By constraining the neural architecture to follow the formal definition of an automaton, the model requires significantly fewer weights than standard RNNs and remains robust to over-parameterization. Even when the maximum state capacity ($Q_{max}$) is set much higher than necessary, the model effectively ignores unused capacity, which is later removed during minimization.

While the current single-layer recurrent structure is sufficient for regular languages, future work may explore multi-layered extensions to handle more complex linguistic structures. Additionally, the authors suggest that DeepDFA could be highly effective in Non-Markovian Reinforcement Learning, where agents must learn and follow underlying rules to succeed in complex environments.

Summary updated

BibTeX
@inproceedings{umili2024deepdfa,
  author = {Elena Umili and Roberto Capobianco},
  title = {{DeepDFA: Automata Learning through Neural Probabilistic Relaxations}},
  booktitle = {ECAI},
  year = {2024},
  doi = {10.3233/faia240596},
}
Figure