TL;DR
This paper introduces the Convolutional Self-Attention Network (CSAN), a novel architecture that enhances standard Self-Attention Networks (SANs) by incorporating convolutional principles. CSAN effectively captures local dependencies within sequences and models interactions between attention heads, leading to improved performance in machine translation without introducing additional parameters.
What Problem Does This Paper Address?
Self-attention networks (SANs) have revolutionized natural language processing (NLP) tasks like machine translation due to their ability to model long-range dependencies and their parallelizability. However, standard SANs have two main limitations: they can overlook local dependencies by treating all input signals equally, and their multi-head attention mechanisms operate independently, missing opportunities for inter-head interaction. This paper aims to address these limitations by enhancing SANs to better capture local context and leverage cross-head relationships.
Methods
The authors propose two variants of their Convolutional Self-Attention Network (CSAN):
- 1D-CSAN: This model restricts the attention scope to a local window of neighboring elements within a single attention head. This is analogous to a 1D convolutional filter applied to the attention mechanism, allowing it to dynamically weigh local context.
- 2D-CSAN: This more advanced variant expands the local window to cover both neighboring elements and neighboring attention heads. This allows the model to capture dependencies not only within a sequence but also across different semantic subspaces represented by different heads.
Crucially, CSAN achieves these improvements by modifying the attention mechanism itself, rather than adding new parameters or layers. The attention weights are dynamically computed based on the context, offering greater flexibility than fixed convolutional filters.
Datasets
The experiments were conducted on the WMT14 English⇒German (En⇒De) translation task. The training corpus consists of 4 million sentence pairs. The authors used standard validation and test sets for evaluation. Byte-pair encoding (BPE) with 32K merge operations was used for pre-processing.
Key Insights and Ideas
- Locality Matters for Attention: The paper strongly supports the idea that explicitly modeling local dependencies, in addition to long-range ones, significantly benefits self-attention mechanisms.
- Inter-Head Interaction is Beneficial: Simply concatenating outputs from independent attention heads misses valuable information. Modeling interactions between heads leads to further performance gains.
- Dynamic Weights Outperform Fixed Filters: CSAN's ability to dynamically compute attention weights based on context provides a more flexible and effective way to capture local features compared to traditional CNNs with fixed kernels.
- Parameter Efficiency: The proposed CSAN models achieve state-of-the-art results without requiring any additional trainable parameters, making them computationally efficient.
Key Results
- 1D-CSAN improved translation performance over the baseline Transformer by +0.52 BLEU points.
- 2D-CSAN achieved the best overall performance, outperforming the baseline by +0.84 BLEU points.
- The proposed models consistently outperformed existing locality-aware approaches when re-implemented within the same Transformer framework.
- The paper also shows that CSAN models are effective across different N-gram granularities, indicating their ability to capture phrasal patterns.
- While the implementation did not show a speedup, theoretically, the computational complexity of each head can be reduced from O(I²) to O(MI), where M is the window size.
Limitations and Future Work
- Window Size Sensitivity: The paper notes that while increasing the local window size (N for 2D-CSAN) initially improves performance, excessively large N can lead to performance degradation, possibly because too many heads might start making "similar contributions."
- Future Work: The authors suggest that CSAN is not limited to translation and can be applied to other sequence modeling tasks such as reading comprehension, language inference, and sentence classification. They also highlight the potential for further exploration of dynamic weight mechanisms.
Summary updated