3-Way Composition of Weighted Finite-State Transducers

Cyril Allauzen, Mehryar Mohri

Abstract

Weighted Finite-State Transducers (WFSTs) are fundamental to modern language and speech processing. However, the standard approach of composing multiple transducers in a pairwise fashion often results in a "state explosion" at intermediate steps, consuming excessive time and memory. This paper introduces a direct 3-way composition algorithm that bypasses intermediate results, offering orders-of-magnitude performance improvements for complex modeling tasks like speech recognition and machine learning.

The Bottleneck of Pairwise Composition

In applications like automatic speech recognition (ASR), multiple models—such as acoustic models, pronunciation dictionaries, and language models—must be combined. The traditional method uses pairwise composition: to combine three transducers ($T_1, T_2, T_3$), researchers first compute $T_{12} = T_1 \circ T_2$, and then compute $T_{12} \circ T_3$.

The primary issue is that the intermediate transducer $T_{12}$ can be massive—sometimes containing hundreds of millions of states—even if the final result $T_{123}$ is quite small. This intermediate explosion often makes high-order models computationally prohibitive.

Direct 3-Way Composition

The proposed algorithm computes the result of $T_1 \circ T_2 \circ T_3$ in a single pass. Instead of exploring pairs of states, the algorithm identifies states as triplets $(q_1, q_2, q_3)$ and explores them simultaneously.

Example of composition state exploration and resulting transducer.

This approach leverages a "bridge" effect: in many 3-way compositions, the middle transducer ($T_2$) acts as a dictionary or connector. By looking at all three transducers at once, the algorithm only constructs the portions of the "bridge" that actually connect $T_1$ to $T_3$, drastically reducing the explored state space. Additionally, the algorithm can utilize "lateral" or "central" strategies to optimize exploration based on the relative sizes of the input transducers.

The 3-Way Epsilon Filter

A critical challenge in WFST composition is the handling of epsilon ($\epsilon$) transitions—empty strings that do not consume input or output. Without proper filtering, the algorithm can generate multiple redundant paths for the same sequence, leading to incorrect weights and inefficient models.

The authors' key innovation is a novel 3-way $\epsilon$-filter. Remarkably, they found that the complex logic required to ensure a single unique path for any sequence of $\epsilon$ matches can be pre-compiled into a small, fixed finite automaton ($W$).

The epsilon filter $W$ encoded as a finite automaton to ensure unique path generation.

This "filter as an automaton" approach allows the 3-way logic to be integrated into existing WFST libraries (like OpenFST) with minimal overhead. Unlike standard 2-way filters, which are often biased, the 3-way filter is inherently symmetric, making it more robust for different transducer topologies.

Key Results and Applications

The algorithm was evaluated on two real-world tasks: $n$-gram kernels for sequence prediction and complex edit-distance models for measuring string similarity. The empirical results demonstrate that 3-way composition is a transformative improvement:

  • Edit Distance: For a complex task involving transpositions, the 3-way algorithm achieved a 150x speedup, completing in 3.8 seconds compared to 586.1 seconds for the standard approach.
  • $n$-gram Kernels: The 3-way approach was consistently about 8x faster than the standard method across various kernel sizes (from $n=2$ to $n=7$).
  • Complexity: The theoretical worst-case complexity was reduced from a quadratic-like dependency on intermediate results to a leaner $O(|T|_Q \min(d(T_1)d(T_3), d(T_2)) + |T|_E)$, where $d(\cdot)$ represents the maximum out-degree.

Conclusion

By treating composition as a single 3-way operation rather than a sequence of 2-way steps, this research provides a powerful tool for scaling WFST-based models. While future work may explore scaling to 4-way or 5-way compositions, the current 3-way algorithm already offers a significant leap in efficiency for the most common modeling pipelines in language processing.

Summary updated

BibTeX
@inproceedings{allauzen2008way,
  author = {Cyril Allauzen and Mehryar Mohri},
  title = {{3-Way Composition of Weighted Finite-State Transducers}},
  booktitle = {CIAA},
  year = {2008},
  url = {https://openreview.net/forum?id=_vJ7tjgcXZK},
}
Figure