Pervasive Attention: 2

Maha Elbayad, Laurent Besacier, Jakob Verbeek

Abstract

Current state-of-the-art machine translation systems are based on encoder-decoder architectures, that first encode the input sequence, and then generate an output sequence based on the input encoding. Both are interfaced with an attention mechanism that recombines a fixed encoding of the source tokens based on the decoder state. We propose an alternative approach which instead relies on a single 2D convolutional neural network across both sequences. Each layer of our network recodes source tokens on the basis of the output sequence produced so far. Attention-like properties are therefore pervasive throughout the network. Our model yields excellent results, outperforming state-of-the-art encoder-decoder systems, while being conceptually simpler and having fewer parameters.

Introduction

In Neural Machine Translation (NMT), the dominant paradigm has long been the "Encoder-Decoder" architecture. In this setup, an encoder processes the source sentence into a latent representation, and a decoder reconstructs it in the target language. An attention mechanism typically acts as a bridge, allowing the decoder to selectively focus on parts of the source encoding.

However, this separation can be limiting. Elbayad et al. (2018) introduced "Pervasive Attention," a model that treats translation as a single 2D image-processing task. By using a unified 2D Convolutional Neural Network (CNN) over the joint grid of source and target sequences, the model integrates attention-like interactions into every layer of the hierarchy.

Methodology: The 2D Grid Approach

The core innovation is representing the translation task as a 2D grid where the X-axis corresponds to source tokens and the Y-axis to target tokens. Each cell $(i, j)$ represents the relationship between the $i$-th source word and the $j$-th target word.

The 2D grid representation of source and target sequences with masked convolutions.

Architecture Details

  • DenseNet Backbone: The model utilizes a Densely Connected Convolutional Network (DenseNet). Each layer receives feature maps from all preceding layers, facilitating gradient flow and feature reuse.
  • Masked 2D Convolutions: To maintain the autoregressive property required for sequence generation, the model employs masked convolutions (e.g., $3 \times 3$ or $5 \times 3$ filters). These masks ensure that predictions for a target word only depend on previously generated words.
  • Pooling for Prediction: To generate the next word, the model collapses the source dimension. While various methods were tested, max-pooling—selecting the strongest signal across source tokens—was found to be highly effective, acting as a form of "hard" attention.

Experimental Setup

The model was evaluated on the IWSLT 2014 bilingual dataset for German-to-English (De-En) and English-to-German (En-De) tasks. Byte Pair Encoding (BPE) was used to manage vocabularies, resulting in approximately 12K German and 9K English tokens.

Results and Discussion

The Pervasive Attention model demonstrated significant improvements in both performance and efficiency:

  • BLEU Scores: On IWSLT De-En, the model achieved 33.81 BLEU, surpassing both RNNsearch (31.02) and a Transformer baseline (32.83).
  • Parameter Efficiency: Remarkably, these results were achieved with only 7 million parameters, compared to the 59 million parameters required by the Transformer baseline.
  • Hyperparameter Sensitivity: Performance scales with model depth and growth rate, as shown in the ablation studies.
Impact of embedding size, growth rate, and depth on BLEU scores.

Conclusion

By rethinking translation as a 2D grid, Pervasive Attention simplifies the NMT architecture while enhancing the depth of interaction between source and target sequences. The model's success with max-pooling suggests that identifying key alignments is often sufficient for high-quality translation. While performance on very long sequences remains a challenge, the efficiency and conceptual simplicity of this 2D CNN approach offer a compelling alternative to traditional encoder-decoder models.

Reference: Elbayad, M., Besacier, L., & Verbeek, J. (2018). Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-Sequence Prediction. CoNLL 2018.

Summary updated

BibTeX
@inproceedings{elbayad2018pervasive,
  author = {Maha Elbayad and Laurent Besacier and Jakob Verbeek},
  title = {{Pervasive Attention: 2}},
  booktitle = {CoNLL},
  year = {2018},
  url = {https://openreview.net/forum?id=Qt7eU2PYdXd},
}
Figure