Introduction
In Natural Language Processing (NLP), particularly in Speech-to-Text tasks, the output of a speech recognizer is often not a single definitive sentence but a collection of hypotheses. These hypotheses are compactly represented as a lattice, which is a Directed Acyclic Graph (DAG) where nodes represent words or sub-word units and edges represent transitions between them.
While Recurrent Neural Networks (RNNs) like LatticeLSTMs have been developed to process these structures, they suffer from significant computational bottlenecks. Their sequential nature and graph-dependent structure make them difficult to parallelize and batch on modern GPUs. This paper proposes a novel approach: extending the Transformer's self-attention mechanism to handle lattice inputs, enabling both higher accuracy and massive speedups.
Methodology
The authors adapt the standard Transformer architecture to lattices through three primary innovations:
1. Lattice Reachability and Probabilistic Masking
In a standard Transformer, every token can attend to every other token. For a lattice, this is inappropriate as it ignores the temporal and logical constraints of the graph. The authors introduce Lattice Reachability Masks, which restrict a node's attention to only those nodes that are reachable within the graph (either forward or backward).
Furthermore, because not all paths in a lattice are equally likely, the authors incorporate "lattice scores" (posterior probabilities) directly into the attention mask. This Probabilistic Masking allows the model to prioritize high-confidence paths while effectively ignoring noise.
2. Lattice Positional Encoding
Transformers lack an inherent sense of order and rely on positional encodings. In a lattice, defining "position" is non-trivial. The authors propose using the longest-path distance from the start node as the position index. This ensures that any node succeeding another in the graph will always have a higher position index, preserving the logical flow of the hypotheses.
Experimental Setup and Results
The model was evaluated on the Fisher–Callhome Spanish–English Speech Translation corpus, which consists of telephone conversations with varying levels of acoustic difficulty.
The results demonstrate the superiority of the Lattice Self-Attention (SA) approach:
- Accuracy: The Lattice SA model achieved 38.73 BLEU on the Fisher dataset, outperforming the previous state-of-the-art LatticeLSTM (38.0) and standard sequential models.
- Efficiency: The self-attentional model achieved a 4x speedup during training compared to LatticeLSTMs. This is primarily due to the Transformer's ability to process all nodes in the lattice simultaneously rather than step-by-step.
- Robustness: By considering the full lattice rather than just the single best hypothesis, the model gained up to 1.74 BLEU points over sequential baselines.
Discussion and Key Insights
A critical mathematical finding of the paper is Path Duplication Invariance. The proposed probabilistic masking ensures that if a lattice contains redundant paths for the same sequence, the model does not "double-count" that information. This makes the model robust to the specific topology of the lattice.
Additionally, the authors found that pre-training on clean, sequential text is vital. Learning the complex structure of a lattice from scratch is difficult; fine-tuning a pre-trained sequential model on lattice data yielded the best results.
Conclusion
By combining the parallel processing power of Transformers with graph-aware masking and positional encoding, the authors have created a highly efficient and accurate model for processing ambiguous speech inputs. This work paves the way for applying self-attention to other complex graph-structured data in NLP.
Reference: Sperber, M., Neubig, G., Pham, N. Q., & Waibel, A. (2019). Self-Attentional Models for Lattice Inputs. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL).
Summary updated