Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-Sequence Prediction

Maha Elbayad, Laurent Besacier, Jakob Verbeek

Introduction

Traditional sequence-to-sequence (Seq2Seq) models, widely used in machine translation, typically employ an encoder-decoder architecture. In these systems, an encoder compresses the source sentence into a fixed representation, while a decoder generates the target sequence, often aided by an external attention mechanism. However, this paradigm suffers from "shallow integration"—attention is frequently a simple weighted sum calculated at the end of encoding, meaning source tokens cannot be re-interpreted based on the decoder's progress. Furthermore, managing separate states for the encoder, decoder, and attention interface introduces significant architectural complexity and parameter overhead.

This paper introduces Pervasive Attention, a novel architecture that rethinks translation as a 2D image processing problem. By abandoning the separate encoder-decoder structure in favor of a single, deep 2D Convolutional Neural Network (CNN), the model makes attention a fundamental, pervasive property of every layer.

The Pervasive Attention Architecture

The core innovation of Pervasive Attention is the representation of the translation task on a 2D grid.

The 2D Grid and Convolutions

The model constructs a 2D grid where one axis represents the source tokens and the other represents the target tokens. Each cell $(i, j)$ in this grid is initialized by concatenating the embeddings of the $i$-th target word and the $j$-th source word.

The 2D grid architecture where source and target sequences form the axes, allowing 2D convolutions to capture pervasive attention.

Deep 2D convolutional layers, specifically utilizing the DenseNet architecture, are stacked atop this grid. As information propagates through these layers, each cell learns hierarchical features representing the relationship between specific source-target pairs. Because every layer in the 2D CNN processes both source and target information simultaneously, the model effectively "attends" to the source sequence at every stage of its feature hierarchy.

Masking and Prediction

To maintain the autoregressive property required for generation (ensuring the model does not "see" future target words during training), the researchers employ masked convolutions. To predict the next word, the model collapses the source dimension into a single vector for each target position using max-pooling or average-pooling. Interestingly, max-pooling acts as a natural alignment tool; visualizations of the "energy" contributed by source tokens during pooling recover word alignments similar to traditional attention maps.

Experimental Setup

The model was evaluated on the IWSLT 2014 bilingual dataset for German-to-English (De-En) and English-to-German (En-De) translation. The data, consisting of TED talk transcripts, was pre-processed using Byte Pair Encoding (BPE) to handle subword units and open-vocabulary translation.

Key Results and Analysis

Pervasive Attention achieves competitive accuracy with remarkable parameter efficiency. On the IWSLT De-En task, it reached a BLEU score of 34.18, significantly outperforming standard RNN-based models (29.98) and 1D CNN models (32.31).

Impact of hyperparameters (embedding size, growth rate, and depth) on BLEU score and parameter count.

As shown in the ablation studies above, the model's performance is robust across various configurations of embedding size ($d$), growth rate ($g$), and depth ($L$). Notably, the model achieved these results with only 11M to 22M parameters, whereas a Transformer model requires 46M to 52M parameters to reach a comparable score (34.44). While the model excels on short-to-medium sequences, it lags slightly behind the Transformer on very long sequences (80+ tokens), likely due to the linear growth of the convolutional "field of view" relative to depth.

Conclusion

Pervasive Attention demonstrates that joint encoding of source and target sequences in a 2D framework is a powerful alternative to traditional encoder-decoder models. By treating translation as a 2D image problem, the architecture achieves high-quality results with a simpler, more parameter-efficient design. Future work may explore hybrid models with 1D pre-encoding or extensions to multi-lingual translation.

Summary updated

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