Abstract
Transformer models have set new benchmarks in natural language processing but suffer from high inference latency due to the sequential nature of auto-regressive decoding. This paper introduces the Attention Refinement Network (ARN), a lightweight architecture designed to mitigate this bottleneck. ARN leverages the observed computational redundancy across decoder layers by reusing attention weights and merging self-attention with cross-attention into a parallel operation. Experimental results on neural machine translation (NMT) benchmarks demonstrate that ARN achieves an average 1.35x speedup (up to 2.24x in specific configurations) with negligible impact on translation quality, maintaining BLEU scores within 0.16 points of the baseline.
Introduction
Despite their success, Transformers are computationally expensive during inference. The primary bottleneck is auto-regressive decoding, where tokens are generated one by one, requiring repeated passes through multiple stacked layers. Each pass involves heavy dot-product attention operations that contribute significantly to latency.
Analysis of internal representations reveals a high degree of computational redundancy. By measuring the cosine similarity between the inputs and outputs of decoder sub-layers, it is observed that representations often remain over 90% similar across successive layers. This suggests that the model performs substantial computation to achieve only incremental refinements.
Methods
The Attention Refinement Network (ARN) addresses these inefficiencies through two primary architectural modifications:
1. Weighted Residual Network (ARN Module)
Rather than recalculating full dot-product attention at every layer, ARN treats the decoder as a refinement process. In a block of $N$ layers, only the initial layer performs standard attention. Subsequent layers "reconstruct" the attention output by fusing "high-level" features (reused attention weights from the first layer) with "low-level" features (outputs from the preceding layer). This fusion is governed by a learned, sparse weight matrix ($\alpha$), allowing the model to inherit information efficiently while maintaining representational capacity.
2. Merged Attention Operations
In standard decoders, self-attention and cross-attention are executed sequentially. ARN merges these into a single parallel operation. Given the high similarity between representations at these stages, simultaneous computation reduces the sequential execution time per decoding step without sacrificing significant accuracy.
Experimental Evaluation
The proposed model was evaluated on several translation benchmarks, including WMT14 (En→De, En→Fr) and WMT17 (ten directions including Finnish, German, Czech, and Russian).
Key Results
- Inference Speed: ARN achieved an average speedup of 1.35x across tasks. In deep-encoder/shallow-decoder configurations, speedups reached up to 2.24x.
- Translation Quality: The average drop in BLEU score was minimal (-0.16), indicating that the approximation techniques used in ARN do not compromise model performance.
- Efficiency: ARN requires fewer parameters than standard Transformers and outperforms existing acceleration methods like Average Attention Networks (AAN) and Shared Attention Networks (SAN).
Conclusion
The Attention Refinement Network demonstrates that the inherent redundancy in Transformer decoders can be exploited to significantly improve inference speed. By parallelizing attention types and reusing weights through a weighted residual mechanism, ARN provides a practical solution for deploying high-performance NMT models in latency-sensitive environments. Future work may extend these refinement principles to the encoder or optimize kernels for specialized hardware.
Summary updated