Proceedings of the First Workshop on Neural Machine Translation

Raphael Shu, Hideki Nakayama, Jan Niehues, Eunah Cho, Thanh-Le Ha, Alex Waibel, Michael Denkowski, Graham Neubig, Chris Dyer, Yoav Goldberg, Austin Matthews, Waleed Ammar, Antonios Anastasopou- Los, Miguel Ballesteros, David Chiang, Daniel Clothiaux, Trevor Cohn, Kevin Duh, Manaal Faruqui, Cynthia Gan, Dan Garrette, Yangfeng Ji, Lingpeng Kong, Adhiguna Kuncoro, Gaurav Ku- Mar, Chaitanya Malaviya, Paul Michel, Yusuke Oda, Matthew Richardson, Philipp Koehn, Rebecca Knowles, Marine Carpuat, Yogarshi Vyas, Xing Niu, Markus Freitag, S. Raphael, Koichiro Yoshino, Foster, George, Goto, Larkin, Samuel, Morishita, Makoto, Nakamura, Satoshi, Nakayama Hideki, Graham, Oda Yusuke, Sudoh, Katsuhito, Tanaka, Yoshino Koichiro, Ondrej Bojar, Rajen Chatterjee, Christian Federmann, Barry Haddow, Johannes Leveling, Christof Monz, Pavel Pecina, Matt Post, Herve Saint-Amand, Cettolo, S Niehues, L Stker, M Bentivogli, Federico, Thanh-Le Le, Matthias Sperber, Mohammed Mediani, Kyunghyun Cho, Bart Van Merrinboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, Yoshua Bengio, D William, Jonathan Clark, Alon Lavie, Noah Smith, Philip ArthurOpenalex Unknown 2017 · OpenAlex

Introduction

In the realm of Neural Machine Translation (NMT), the attention mechanism has become an indispensable component for achieving high-quality translations. By allowing the model to focus on specific parts of the source sentence while generating each word of the target sentence, attention mechanisms have significantly improved the handling of long-range dependencies and complex word reorderings. However, this performance comes at a high computational cost. Standard "soft attention" models compute a score for every single encoder state at every decoding step, leading to a computational complexity of $O(N \times M)$, where $N$ and $M$ are the lengths of the source and target sequences, respectively.

Researchers from the University of Tokyo have addressed this bottleneck by investigating the "vision span" of attention models. In their paper, they propose a novel Flexible Attention framework that dynamically adjusts the window of encoder states considered during translation, effectively reducing redundant computations without sacrificing significant accuracy.

The Problem: Computational Redundancy

The primary issue with global soft attention is its inherent redundancy. When a model translates a specific word or phrase, it rarely needs to consider the entire source sentence. Most of the time, the relevant information is localized. For instance, in a 50-word sentence, calculating 2,500 attention scores is often unnecessary because the model only needs to "look" at a small subset of those words to generate the next token.

This problem is exacerbated in character-level translation, where sequences can be hundreds or even thousands of characters long. As the field moves toward more granular representations, the $O(N \times M)$ complexity becomes a massive barrier to real-time deployment.

The Solution: Flexible Attention

The proposed Flexible Attention framework allows the model to learn how much of the source sentence it needs to see at any given moment. Unlike previous "Local Attention" models that use a fixed-size window, Flexible Attention is dynamic.

Key Components of the Framework

  1. Center Tracking: The model maintains a "center of attention," which is typically the position in the source sentence that was most relevant in the previous decoding step.
  2. Position-Based Penalty: To encourage focus, the model applies a penalty to source words based on their distance from the current center. This penalty increases exponentially as the distance grows.
  3. The Gating Function ($g(t)$): This is the core innovation. A small neural network layer predicts a gating value at each step. This value determines the "zoom level" of the attention. A high gating value creates "tunnel vision," restricting the model to a very narrow window. A low gating value allows the model to "zoom out" and consider a wider range of words, which is crucial for handling languages with significantly different word orders.
  4. Thresholding and Efficiency: During inference, the model can skip the computation for any source words whose penalty exceeds a certain threshold. This directly reduces the number of mathematical operations required.
  5. Optimized Training: The authors introduced a specific loss function that penalizes large vision spans, encouraging the model to be as efficient as possible while maintaining translation quality.

Experimental Results

The researchers evaluated Flexible Attention on English-Japanese (ASPEC corpus) and German-English (WMT’15) translation tasks, as well as character-based English-Japanese translation.

Vision Span Reduction

The results were striking. The average vision span—the number of source tokens the model actually calculates scores for—was reduced by:

  • 56% for English-Japanese word-level translation.
  • 64% for German-English word-level translation.
  • 46% for character-level English-Japanese translation.

Translation Quality

These efficiency gains were achieved with only a "modest loss" in accuracy. In most tests, the drop in BLEU score (a standard metric for translation quality) was less than 0.5 points. This suggests that the vast majority of the computations performed by global attention models are indeed redundant.

Computational Speed

The practical speedup varied depending on the hardware. On a CPU, the Flexible Attention model was approximately 10% faster than the global attention baseline. However, on GPUs, the speedup was negligible or even slightly negative. This is because GPUs are designed for massive, uniform parallel processing; the overhead of the gating function and the "if-then" logic required to skip computations can offset the savings from doing fewer operations.

Conclusion and Future Directions

The Flexible Attention framework demonstrates that NMT models can be significantly more efficient by dynamically narrowing their focus. While the current implementation shows the most promise for CPU-based inference, it opens the door for more specialized hardware kernels that can better leverage sparse attention patterns.

Furthermore, the authors suggest that the benefits of this approach would be even more pronounced when combined with more complex attention mechanisms, such as Recurrent Attention or Neural Tensor Networks, where the cost per attention score is much higher. By focusing only on what matters, Flexible Attention paves the way for faster, more scalable translation systems.

Summary updated

BibTeX
@inproceedings{shu2017proceedings,
  author = {Raphael Shu and Hideki Nakayama and Jan Niehues and Eunah Cho and Thanh-Le Ha and Alex Waibel and Michael Denkowski and Graham Neubig and Chris Dyer and Yoav Goldberg and Austin Matthews and Waleed Ammar and Antonios Anastasopou- Los and Miguel Ballesteros and David Chiang and Daniel Clothiaux and Trevor Cohn and Kevin Duh and Manaal Faruqui and Cynthia Gan and Dan Garrette and Yangfeng Ji and Lingpeng Kong and Adhiguna Kuncoro and Gaurav Ku- Mar and Chaitanya Malaviya and Paul Michel and Yusuke Oda and Matthew Richardson and Philipp Koehn and Rebecca Knowles and Marine Carpuat and Yogarshi Vyas and Xing Niu and Markus Freitag and Hideki Nakayama and Yusuke Oda and S. Raphael and Koichiro Yoshino and Foster and George and Markus Freitag and Goto and Koehn and Larkin and Samuel and Morishita and Makoto and Nakamura and Satoshi and Nakayama Hideki and Neubig and Graham and Niu and Oda Yusuke and Shu Raphael and Sudoh and Katsuhito and Tanaka and Vyas and Yoshino Koichiro and Ondrej Bojar and Rajen Chatterjee and Christian Federmann and Barry Haddow and Philipp Koehn and Johannes Leveling and Christof Monz and Pavel Pecina and Matt Post and Herve Saint-Amand and Cettolo and S Niehues and L Stker and M Bentivogli and Federico and Eunah Cho and Jan Niehues and Thanh-Le Le and Matthias Sperber and Mohammed Mediani and Alex Waibel and Kyunghyun Cho and Bart Van Merrinboer and Caglar Gulcehre and Dzmitry Bahdanau and Fethi Bougares and Holger Schwenk and Yoshua Bengio and D William and Lewis Christian Federmann and Jonathan Clark and Chris Dyer and Alon Lavie and Noah Smith and Philip Arthur and Graham Neubig and Satoshi Nakamura and Dzmitry Bahdanau and Kyunghyun Cho},
  title = {{Proceedings of the First Workshop on Neural Machine Translation}},
  booktitle = {Openalex Unknown},
  year = {2017},
  doi = {10.18653/v1/w17-32},
}
Figure