Self-Attentional Models for Lattice Inputs

Matthias Sperber, Graham Neubig, Ngoc-Quan Pham, Alex Waibel

Abstract

Lattices are an efficient and effective method to encode ambiguity of upstream systems in natural language processing tasks, for example to compactly capture multiple speech recognition hypotheses, or to represent multiple linguistic analyses. Previous work has extended recurrent neural networks to model lattice inputs and achieved improvements in various tasks, but these models suffer from very slow computation speeds. This paper extends the recently proposed paradigm of self-attention to handle lattice inputs. Self-attention is a sequence modeling technique that relates inputs to one another by computing pairwise similarities and has gained popularity for both its strong results and its computational efficiency. To extend such models to handle lattices, we introduce probabilistic reachability masks that incorporate lattice structure into the model and support lattice scores if available. We also propose a method for adapting positional embeddings to lattice structures. We apply the proposed model to a speech translation task and find that it outperforms all examined baselines while being much faster to compute than previous neural lattice models during both training and inference.

The Challenge of Ambiguous Inputs

In natural language processing, uncertainty is a constant factor. When an Automatic Speech Recognition (ASR) system processes muffled or noisy audio, it rarely produces a single, definitive transcript. Instead, it generates a lattice—a directed acyclic graph (DAG) where different paths represent competing interpretations of the audio signal.

A sample lattice structure where nodes represent word hypotheses and edges represent transitions with associated probabilities.

Traditionally, researchers have used LatticeLSTMs to process these structures. While effective at capturing the graph topology, LSTMs are inherently sequential and difficult to parallelize. Extending them to lattices exacerbates this slowness because the branching structure breaks standard batching techniques. The Transformer architecture, based on self-attention, offers a solution through its massive parallelization, but it was originally designed for linear sequences. This research addresses how to make self-attention "understand" the complex connectivity and probabilities of a lattice without sacrificing its computational efficiency.

Methodology: Adapting the Transformer

The authors propose three key innovations to adapt the Transformer for lattice inputs:

  1. Lattice Reachability Masks: In a standard Transformer, every token can attend to every other token. In a lattice, this is illogical; a word on one path should not attend to a word on an incompatible, parallel path. The authors introduce masks that restrict attention to "reachable" nodes—predecessors in the forward direction and successors in the backward direction.
  2. Probabilistic Masking: Lattices often include posterior probabilities for edges. The authors incorporate these into the attention mechanism. Instead of a binary mask, they use the log-probability of reaching one node from another, forcing the model to prioritize high-confidence paths.
  3. Longest-Path Positional Encoding: Since a lattice lacks a single linear index, the authors use the longest-path distance from the start node as the position. This ensures that if node A precedes node B on any path, A's position index is strictly smaller than B's, preserving temporal flow.
Forward and backward reachability matrices derived from the lattice structure to guide the self-attention mechanism.

A critical insight in this work is Path Duplication Invariance. The probabilistic masks make the model invariant to lattice topology variations like path duplication. If a lattice contains two identical paths, a simple binary mask would double the influence of those words; the probabilistic approach mathematically cancels this bias, making the model more robust.

Evaluation and Results

The model was evaluated on the Fisher-Callhome Spanish–English Speech Translation corpus, a challenging dataset of telephone conversations with high word error rates. The Lattice Self-Attention (SA) model was compared against sequential LSTMs, sequential Transformers, and the previous state-of-the-art LatticeLSTM.

  • Accuracy: The proposed Lattice SA model achieved 14.74 BLEU on the Callhome test set, surpassing the LatticeLSTM (14.1) and the best sequential baseline (13.0).
  • Speed: This is the most significant result. During training, the Lattice SA model processed 2,963 words/second, compared to just 710 words/second for the LatticeLSTM. This represents a ~4x speedup in training and a substantial boost in inference efficiency.

Conclusion

By introducing reachability masks and adapting positional encodings, this work successfully brings the efficiency of the Transformer to the complex world of lattice-structured inputs. While a gap remains between lattice performance and "oracle" transcripts (the best possible path), this approach provides a scalable, high-performance foundation for processing ambiguous linguistic data. Future work may extend these masking techniques to other non-linear structures, such as tree-structured inputs for syntactic parsing.

Summary updated

BibTeX
@inproceedings{sperber2019self,
  author = {Matthias Sperber and Graham Neubig and Ngoc-Quan Pham and Alex Waibel},
  title = {{Self-Attentional Models for Lattice Inputs}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1115},
}
Figure