Abstract
The Multiple Structural Priors Guided Self Attention Network (MS-SAN) addresses the inherent "position-independence" of standard Transformers by explicitly injecting linguistic structure into the attention mechanism. By assigning different structural masks—including word distance, sequential order, and dependency tree paths—to individual attention heads, the model captures both local context and complex hierarchical relationships. Evaluated on NLI and sentiment classification tasks, MS-SAN demonstrates superior performance and parameter efficiency compared to standard SANs and even provides a performance boost when integrated with BERT.
Introduction
Self-Attention Networks (SANs) have become the backbone of modern NLP, yet they lack the inherent inductive biases found in traditional architectures like RNNs or CNNs. While positional encodings provide a basic sense of order, they do not capture the multi-faceted structural relationships of natural language. Previous attempts to introduce structural bias often relied on a single type of mask. The authors of MS-SAN argue that a single prior is insufficient; instead, they propose a multi-mask approach to capture the full complexity of linguistic interactions.
Methods: Multi-Mask Based Multi-Head Attention
The core innovation of MS-SAN is the Multi-Mask Based Multi-Head Attention (MM-MH Attention). Unlike standard multi-head attention where all heads operate on the same input space, MM-MH Attention assigns specific structural priors to different heads via masking.
Structural Masks
The model utilizes three primary types of structural information:
- Direction Masks: These split heads into "forward" and "backward" views, mimicking the bidirectional processing of a Bi-LSTM.
- Word Distance Masks: These penalize attention between physically distant words, encouraging certain heads to focus on local syntactic phrases.
- Dependency Distance Masks: By utilizing a syntax tree, the model calculates the distance between words based on grammatical relationships. This allows the model to connect words that are physically far apart but semantically linked, such as a subject and its distant verb.
Fusion Gate
To integrate the structurally-guided attention output with the original input, MS-SAN employs a learnable Fusion Gate instead of a simple residual connection. This gate dynamically determines the optimal balance between the original input features and the new structural information.
Key Results and Insights
MS-SAN was evaluated on Natural Language Inference (SNLI, MNLI) and Sentiment Classification (SST-2, SST-5) datasets.
- Performance Gains: MS-SAN achieved 87.0% accuracy on SNLI, significantly outperforming the standard Transformer baseline (82.2%).
- Complementary Priors: Ablation studies confirmed that combining all three mask types yields the best results, suggesting that sequential, local, and hierarchical information provide non-overlapping benefits.
- BERT Enhancement: Adding MS-SAN on top of BERT-large improved performance to 88.2% on SNLI and 95.1% on SST-2, indicating that explicit structural guidance remains valuable even for large-scale pretrained models.
- Efficiency: The model is highly parameter-efficient, outperforming previous distance-based SANs while using roughly 60% fewer parameters in the attention components.
Conclusion and Future Work
MS-SAN demonstrates that explicitly guiding self-attention with linguistic priors leads to more robust language understanding. While the current implementation relies on static masks from an external dependency parser, future work could explore making these structural relationships learnable. Additionally, the success of MS-SAN suggests a path toward "model reduction," where smaller models can achieve high performance by leveraging the "cheat sheet" of linguistic structure.
Summary updated