Simulating Weighted Automata over Sequences and Trees with Transformers

Michael Rizvi, Maude Lizaire, Clara Lacroce, Guillaume Rabusseau
3/12/2024
cs.CLcs.AIcs.CC

No confident code implementation found for this paper.

Abstract

Transformers are ubiquitous models in the natural language processing (NLP) community and have shown impressive empirical successes in the past few years. However, little is understood about how they reason and the limits of their computational capabilities. These models do not process data sequentially, and yet outperform sequential neural models such as RNNs. Recent work has shown that these models can compactly simulate the sequential reasoning abilities of deterministic finite automata (DFAs). This leads to the following question: can transformers simulate the reasoning of more complex finite state machines? In this work, we show that transformers can simulate weighted finite automata (WFAs), a class of models which subsumes DFAs, as well as weighted tree automata (WTA), a generalization of weighted automata to tree structured inputs. We prove these claims formally and provide upper bounds on the sizes of the transformer models needed as a function of the number of states the target automata. Empirically, we perform synthetic experiments showing that transformers are able to learn these compact solutions via standard gradient-based training.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{rizvi2024simulating,
  title  = {Simulating Weighted Automata over Sequences and Trees with Transformers},
  author = {Michael Rizvi and Maude Lizaire and Clara Lacroce and Guillaume Rabusseau},
  year   = {2024},
  eprint = {2403.09728},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.09728v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.09728.svg)](https://codeofpaper.com/paper/2403.09728)

Discussion