Convolutional Self-Attention Networks

Baosong Yang, Longyue Wang, Derek F. Wong, Lidia S. Chao, Zhaopeng Tu

Abstract

Self-Attention Networks (SANs) are the cornerstone of modern Transformer architectures, yet they often struggle with capturing local phrasal patterns and lack interaction between independent attention heads. This paper introduces Convolutional Self-Attention Networks (CSANs), which enhance the standard Transformer by applying 1D and 2D convolutional windows to the attention mechanism. This "local-first" approach allows the model to prioritize neighboring context and enables cross-head feature exploitation without adding new learnable parameters. Experimental results on WMT14, WMT17, and WAT17 benchmarks show that CSANs significantly improve translation quality, particularly for long n-grams, while maintaining the training efficiency of the vanilla Transformer.

Introduction

While SANs excel at capturing long-range dependencies, they suffer from two primary structural "blind spots": Locality Ignorance and Isolated Heads. Standard SANs attend to all tokens in a sequence with equal priority, which can disperse attention and cause the model to overlook immediate local context crucial for linguistic understanding. Furthermore, multi-head attention projects inputs into isolated subspaces, failing to exploit complementary information across adjacent features. Previous attempts to address these issues often relied on complex, parameter-heavy CNN layers. CSANs propose a parameter-free alternative that modifies the attention scope to bridge these gaps.

Methodology

The core innovation of CSANs lies in how the attention context (Keys and Values) is constructed using convolutional windows to restrict or expand the field of view.

Comparison of Vanilla SANs, 1D-Convolutional SANs, and 2D-Convolutional SANs architectures.

1D-CSAN: Capturing Locality

In 1D-CSAN, each query is restricted to a fixed-size window of neighboring elements (e.g., a window of $M+1$ tokens). This effectively performs a 1D convolution over the temporal axis using a parameter-free mask, forcing the model to focus on local phrasal patterns during the early stages of encoding.

2D-CSAN: Enabling Head Interaction

2D-CSAN extends this concept into a second dimension: the attention heads. For a given head, the model attends to a local window of tokens across its own subspace and the subspaces of neighboring heads. This "cross-talk" allows the model to learn more robust features by integrating information from multiple subspaces simultaneously.

Layer-Specific Application

Crucially, these modifications are applied only to the lower layers of the encoder. The authors hypothesize that lower layers should handle surface-level lexical and phrasal information, while higher layers remain unrestricted to capture global semantic dependencies.

Experimental Setup

The model was evaluated on three major Machine Translation benchmarks:

  • WMT14 English-to-German (En⇒De): ~4.5 million sentence pairs.
  • WMT17 Chinese-to-English (Zh⇒En): ~20.62 million sentence pairs.
  • WAT17 Japanese-to-English (Ja⇒En): ~2 million sentence pairs.

Key Results and Analysis

CSANs consistently outperformed the baseline Transformer and other locality-modeling techniques. On WMT14 En-De, the 2D-CSAN achieved a 28.18 BLEU score, a +0.87 improvement over the Transformer-Base baseline.

Impact of window size (M+1) and area size (N+1) on BLEU scores for 1D-CSANs and 2D-CSANs.

Efficiency and Scaling

Unlike methods that add millions of parameters, CSAN is parameter-free and maintains training speeds nearly identical to the vanilla Transformer. Analysis showed that the "Base" version of CSAN performed comparably to the much larger "Transformer-Big" model on certain tasks, highlighting its high parameter efficiency. As shown in the performance curves, tuning the window and area size is critical for optimal BLEU gains.

Phrase Capture

Performance gains were particularly pronounced for longer n-grams, confirming that the convolutional windowing effectively helps the model capture and translate multi-word phrases that standard SANs might miss due to dispersed attention.

Conclusion and Future Work

CSANs provide a simple yet effective way to introduce inductive biases for locality and head interaction into Transformers. While the current implementation uses fixed window sizes and arbitrary head ordering, future research could explore dynamic windowing or functional head grouping to further optimize performance across a broader range of NLP tasks beyond machine translation.

Summary updated

BibTeX
@inproceedings{yang2019convolutional,
  author = {Baosong Yang and Longyue Wang and Derek F. Wong and Lidia S. Chao and Zhaopeng Tu},
  title = {{Convolutional Self-Attention Networks}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/n19-1407},
}
Figure