Algorithms for Acyclic Weighted Finite-State Automata with Failure Arcs

Anej Svete, Benjamin Dayan, Tim Vieira, Ryan Cotterell, Jason Eisner
1/17/2023
cs.DScs.CL

No official code found. Best implementation: rycolab/failure-backward (5 stars, last commit 2023-07-11).

Abstract

Weighted finite-state automata (WSFAs) are commonly used in NLP. Failure transitions are a useful extension for compactly representing backoffs or interpolation in $n$-gram models and CRFs, which are special cases of WFSAs. The pathsum in ordinary acyclic WFSAs is efficiently computed by the backward algorithm in time $O(|E|)$, where $E$ is the set of transitions. However, this does not allow failure transitions, and preprocessing the WFSA to eliminate failure transitions could greatly increase $|E|$. We extend the backward algorithm to handle failure transitions directly. Our approach is efficient when the average state has outgoing arcs for only a small fraction $s \ll 1$ of the alphabet $Σ$. We propose an algorithm for general acyclic WFSAs which runs in $O{\left(|E| + s |Σ| |Q| T_\text{max} \log{|Σ|}\right)}$, where $Q$ is the set of states and $T_\text{max}$ is the size of the largest connected component of failure transitions. When the failure transition topology satisfies a condition exemplified by CRFs, the $T_\text{max}$ factor can be dropped, and when the weight semiring is a ring, the $\log{|Σ|}$ factor can be dropped. In the latter case (ring-weighted acyclic WFSAs), we also give an alternative algorithm with complexity $\displaystyle O{\left(|E| + |Σ| |Q| \min(1,sπ_\text{max}) \right)}$, where $π_\text{max}$ is the size of the longest failure path.

View on arXivView PDF

Code Implementations(1)

Code accompanying the EMNLP 2022 publication "Algorithms for Acyclic Weighted Finite-State Automata with Failure Arcs".

50PythonOct 22, 20223 years ago

Similar Papers

Cite this paper

@article{svete2023algorithms,
  title  = {Algorithms for Acyclic Weighted Finite-State Automata with Failure Arcs},
  author = {Anej Svete and Benjamin Dayan and Tim Vieira and Ryan Cotterell and Jason Eisner},
  year   = {2023},
  eprint = {2301.06862},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2301.06862v2}
}

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/2301.06862.svg)](https://codeofpaper.com/paper/2301.06862)

Discussion