Rational Recurrences

Hao Peng, Roy Schwartz, Sam Thomson, Noah A. Smith

Abstract

Modern Recurrent Neural Networks (RNNs) often present a trade-off between the interpretability of classical models and the performance of deep learning. This paper introduces "rational recurrences," a framework that formalizes the connection between efficient gated RNNs and Weighted Finite State Automata (WFSAs). By proving that models like the Simple Recurrent Unit (SRU) are structurally equivalent to WFSAs, the authors provide a principled method for designing new architectures. Their proposed model, RRNN($\mathcal{F}$), leverages this connection to incorporate unigram and bigram features, achieving superior performance on language modeling and text classification benchmarks compared to standard LSTM baselines.

Introduction

In Natural Language Processing (NLP), a persistent gap exists between mathematically transparent models like Weighted Finite State Automata (WFSAs) and high-performing but "black box" gated RNNs (e.g., LSTMs, GRUs). Recent efforts to improve RNN efficiency have led to variants like the Simple Recurrent Unit (SRU) and Quasi-RNN (QRNN), which eliminate complex hidden-to-hidden matrix multiplications. While faster, the underlying computations of these models remained poorly understood. This work addresses this gap by demonstrating that these efficient models are neural implementations of WFSAs, categorized as "rational recurrences."

Rational Recurrences and Taxonomy

A recurrence is defined as "rational" if its hidden state update can be computed via the Forward algorithm of a finite set of WFSAs. The authors prove that RNNs with element-wise hidden state updates—lacking affine transformations of the previous state—are structurally equivalent to WFSAs.

This equivalence allows for a formal taxonomy of existing models. For instance, the standard forget-gate update in an SRU corresponds to a two-state WFSA that effectively "counts" unigram features. As shown in Table 1, various models can be mapped to specific WFSA structures ($\mathcal{B}, \mathcal{C}, \mathcal{D}$), providing a unified theoretical view of diverse architectures.

Table 1: Mapping of modern RNN models to their recurrence functions and corresponding WFSA structures.

Principled Architecture Design: The RRNN

The "rational" framework enables the mechanical derivation of RNN equations from desired WFSA properties. The authors introduce the RRNN($\mathcal{F}$), a model designed to capture both unigram and bigram patterns. By interpolating between different WFSA blueprints, the RRNN can explicitly detect multi-word sequences.

Furthermore, the authors explore the impact of different semirings. While the standard "real" semiring sums scores, a "max-plus" semiring allows the model to perform max-pooling over time, theoretically enhancing pattern detection, though practical results varied.

Table 2: Comparison of RRNN variants, highlighting their ability to capture unigram and bigram features across different semirings.

Evaluation and Results

The models were evaluated on the Penn Treebank (PTB) for language modeling and four binary text classification datasets (Amazon, SST, subj, CR).

Key findings include:

  • Language Modeling: RRNN($\mathcal{F}$) achieved a test perplexity of 66.3 on PTB, significantly outperforming the standard LSTM baseline (71.4) while utilizing less than half the parameters (10M vs. 24M).
  • Text Classification: The RRNN($\mathcal{F}$) model achieved top results on 3 out of 4 datasets, showing particular robustness in low-data regimes like SST and CR, likely due to the effective structural priors of unigram and bigram detection.

Discussion and Conclusion

The rational recurrence framework provides a powerful lens for understanding and designing RNNs. By viewing hidden states as scores assigned by automata, researchers can "read" the logic of a model. However, standard LSTMs and GRUs remain outside this class due to their non-linear hidden-to-hidden transformations, which offer greater expressivity at the cost of interpretability. Future work may explore the interaction of rational properties in deep, multi-layer networks and further refine alternative semirings for specialized tasks.

Summary updated

BibTeX
@inproceedings{peng2018rational,
  author = {Hao Peng and Roy Schwartz and Sam Thomson and Noah A. Smith},
  title = {{Rational Recurrences}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2018},
  doi = {10.18653/v1/d18-1152},
}
Figure