Sparse and Constrained Attention for Neural Machine Translation

Chaitanya Malaviya, Pedro Ferreira, André F. T. Martins

Abstract

Chaitanya Malaviya, Pedro Ferreira, André F. T. Martins. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers).

2018.

Introduction

Neural Machine Translation (NMT) systems, while often more fluent than traditional statistical models, frequently suffer from "adequacy" issues. Specifically, they are prone to coverage problems: over-generation (repeating source words) and under-generation (skipping source words). These issues stem from the standard "softmax" attention mechanism, which is dense—assigning non-zero probability to every source word at every step. This makes it difficult for the model to effectively "turn off" attention to a word once it has been translated. Previous solutions often involved complex "coverage vectors" that increased model parameters and complexity.

Methods: Constrained Sparsemax

The authors propose constrained sparsemax, a "plug-and-play" attention transformation that combines sparsity with fertility constraints. This approach builds on two existing concepts:

  1. Sparsemax: Unlike softmax, sparsemax uses a Euclidean projection onto the probability simplex, naturally producing zero probabilities for irrelevant words.
  2. Constrained Softmax: This introduces an upper bound, or "fertility" limit, on the total attention a source word can receive across all time steps.

Constrained Sparsemax combines these into a single transformation that is both sparse and bounded. It is end-to-end differentiable and utilizes an efficient $O(J)$ algorithm for forward propagation.

Comparison of attention mechanisms on the probability simplex and their effect on word fertilities.

To manage the "attention budget," the model requires fertility bounds. The authors explored three strategies: CONSTANT (fixed limits), GUIDED (learned from external aligners), and PREDICTED (using a Bi-LSTM tagger). A "Sink Token" with infinite fertility was also introduced to prevent the model from stalling when the target sentence length exceeds the sum of source word fertilities.

Experimental Results

The proposed methods were evaluated on three language pairs: German-English (DE-EN), Japanese-English (JA-EN), and Romanian-English (RO-EN). To measure coverage issues specifically, the authors introduced the REP-score (n-gram repetitions) and DROP-score (untranslated source words).

Performance comparison across German-English, Japanese-English, and Romanian-English translation tasks.

As shown in the results table, constrained sparsemax (csparsemax) consistently achieved the best REP and DROP scores across all language pairs. In the DE-EN task, it reduced the repetition score from 3.37 (standard softmax) to 2.67. Furthermore, it matched or exceeded the translation quality of standard softmax and complex coverage vector models in terms of BLEU and METEOR scores.

Conclusion

Constrained sparsemax offers a mathematically elegant solution to coverage problems in NMT without the need for architecture bloat or additional recurrent units. By treating attention as a finite "budget" and allowing for sparse selections, the model produces cleaner, more interpretable alignments and more accurate translations. Future work includes scaling these methods to larger datasets and integrating fertility prediction directly into the end-to-end training loop.

Summary updated

BibTeX
@inproceedings{malaviya2018sparse,
  author = {Chaitanya Malaviya and Pedro Ferreira and André F. T. Martins},
  title = {{Sparse and Constrained Attention for Neural Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2018},
  url = {https://openreview.net/forum?id=IddeTz1Oz_w},
}
Figure