You May Not Need Attention

Ofir Press, Noah A. SmitharXiv 2018

Abstract

In Neural Machine Translation (NMT), how far can we get without attention and without separate encoding and decoding? To answer that question, we introduce a recurrent neural translation model that does not use attention and does not have a separate encoder and decoder. Our eager translation model is low-latency, writing target tokens as soon as it reads the first source token, and uses constant memory during decoding. It performs on par with the standard attention-based model of Bahdanau et al. (2014), and better on long sentences.

Introduction

Neural Machine Translation (NMT) has traditionally relied on two architectural pillars: the attention mechanism and the encoder-decoder separation. Standard models follow a "wait-and-see" approach where the encoder must process an entire source sentence before the decoder begins generating output. While effective, this paradigm introduces significant latency and memory complexity, as attention mechanisms typically require memory that grows linearly with sentence length.

This paper challenges these conventions by introducing an "eager" translation model. By ditching the traditional split and the attention layer, the authors demonstrate that a single recurrent stream can achieve competitive translation quality with constant memory usage and significantly lower latency.

The Eager Translation Model

Architecture and Eager Feasibility

Unlike traditional NMT systems, the Eager Translation Model is structured as a single multi-layer LSTM. At each timestep, the model receives a concatenated input consisting of the current source word and the previous target word. It then predicts the next target word immediately.

The Eager Translation Model architecture, processing source and target tokens simultaneously through a stacked LSTM.

To make this "eager" approach feasible, the target sequence must be aligned such that a target word $t_j$ is never required before its corresponding source word $s_i$ has been read. The authors achieve this through a preprocessing step:

  1. Alignment: An off-the-shelf tool (fast_align) identifies word correspondences.
  2. Padding: "Empty" tokens ($\epsilon$) are inserted into the target sequence to delay outputs until the necessary source context has been consumed.

This ensures the model "crams" the necessary prefix of the sentence into its dynamic LSTM state, updating it incrementally rather than waiting for a complete global representation.

Decoding Enhancements

To optimize the model during inference, two specific decoding techniques were implemented:

  • Padding Limit: A constraint on the number of consecutive $\epsilon$ tokens the model can produce to prevent infinite loops or excessive delays.
  • Source Padding Injection (SPI): The artificial addition of padding to the input side just before the end-of-sentence token. This provides the model with additional computational steps (or "thinking time") to finalize the translation of complex phrases.

Experimental Evaluation

The model was evaluated on the WMT 2014 benchmarks for English $\leftrightarrow$ French and English $\leftrightarrow$ German. The authors compared their eager model against a standard Bahdanau-style attention-based reference model.

Results and Performance

The eager model achieved highly competitive BLEU scores, nearly matching the reference model on standard benchmarks (e.g., 28.47 vs 28.56 on FR $\to$ EN). However, the most striking result was the model's performance on long sequences.

BLEU score comparison across different sentence lengths, highlighting the Eager Model's superiority on long sequences.

As shown in the evaluation table, while the attention-based model's performance degrades on very long sentences (81+ words), the eager model remains robust, significantly outperforming the reference (27.44 vs 22.10 BLEU in FR $\to$ EN). This suggests that local, incremental processing avoids the "blurring" effect that can plague global attention signals in long contexts.

Furthermore, the eager model demonstrated superior efficiency, processing approximately three times more source tokens per second than the OpenNMT reference model during inference.

Discussion and Conclusion

While the eager model excels at long-sequence translation and low-latency applications, it does face limitations. It struggles with very short sentences (1-10 words) where the $\epsilon$ padding structure may be overly disruptive. Additionally, the model's performance is heavily dependent on the quality of initial word alignments, and training convergence is slower than traditional models.

Despite these trade-offs, the Eager Translation Model proves that attention is not a strict requirement for high-quality NMT. Its constant memory footprint and high inference speed make it a compelling candidate for real-time translation tasks where resource efficiency is paramount.

Summary updated

BibTeX
@misc{press2018you,
  author = {Ofir Press and Noah A. Smith},
  title = {{You May Not Need Attention}},
  year = {2018},
  eprint = {1810.13409},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1810.13409},
}
Figure