Skip to main content
QUICK REVIEW

[Paper Review] Accelerating Neural Transformer via an Average Attention Network

Biao Zhang, Deyi Xiong|arXiv (Cornell University)|May 2, 2018
Natural Language Processing TechniquesComputer Science14 references24 citations
TL;DR

This paper proposes an Average Attention Network (AAN) to accelerate the decoding phase of the neural Transformer by replacing its self-attention mechanism in the decoder with a two-layer structure: an average layer for cumulative history aggregation and a gating layer for enhanced expressiveness. The method enables full parallelization during training via masking and dynamic programming during inference, achieving over 4x faster decoding with negligible performance drop across 12 WMT17 translation tasks.

ABSTRACT

With parallelizable attention networks, the neural Transformer is very fast to train. However, due to the auto-regressive architecture and self-attention in the decoder, the decoding procedure becomes slow. To alleviate this issue, we propose an average attention network as an alternative to the self-attention network in the decoder of the neural Transformer. The average attention network consists of two layers, with an average layer that models dependencies on previous positions and a gating layer that is stacked over the average layer to enhance the expressiveness of the proposed attention network. We apply this network on the decoder part of the neural Transformer to replace the original target-side self-attention model. With masking tricks and dynamic programming, our model enables the neural Transformer to decode sentences over four times faster than its original version with almost no loss in training time and translation performance. We conduct a series of experiments on WMT17 translation tasks, where on 6 different language pairs, we obtain robust and consistent speed-ups in decoding.

Motivation & Objective

  • To address the slow decoding speed of the Transformer due to its auto-regressive, self-attention mechanism in the decoder.
  • To maintain the high training efficiency and strong performance of the Transformer while drastically improving inference speed.
  • To develop a lightweight, parallelizable alternative to self-attention that preserves long-range dependency modeling.
  • To enable efficient, sequential-like decoding with only the previous hidden state, similar to RNNs, but without their recurrent bottleneck.

Proposed method

  • Propose an Average Attention Network (AAN) with two layers: an average layer that computes cumulative averages over previous hidden states, and a gating layer that enhances representation expressiveness.
  • Use a masking technique during training to simulate the causal attention pattern of self-attention, enabling full parallelization.
  • Apply dynamic programming during inference to compute outputs in parallel, avoiding autoregressive generation.
  • Replace the target-side self-attention in the Transformer decoder with AAN while keeping the encoder unchanged.
  • Integrate AAN into the standard Transformer architecture with minimal architectural changes.

Experimental results

Research questions

  • RQ1Can a simple average-based attention mechanism replace self-attention in the Transformer decoder without sacrificing translation quality?
  • RQ2To what extent can the AAN accelerate decoding while maintaining training efficiency and model performance?
  • RQ3Does the AAN generalize across diverse language pairs with varying linguistic complexity and training data scales?
  • RQ4Is the speed-up benefit of AAN consistent across different sequence lengths and translation directions?

Key findings

  • The AAN model achieves over 4x faster decoding than the original Transformer across all 12 language pairs in the WMT17 benchmark.
  • On the En→Tr translation task, the model decodes in just 0.02968 seconds per sentence, which is approximately 1/7th the time of the original Transformer.
  • Translation performance remains nearly identical, with only a 0.53 BLEU point drop on the En→Tr direction compared to the Transformer.
  • The model shows consistent speed-ups across all language pairs, including low-resource ones like En→Lv and En→Cs, indicating language-invariant benefits.
  • The AAN maintains strong performance on long sentences, demonstrating effective long-range dependency modeling despite its simplicity.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.