Sparse Attention with Linear Units

Open Access
Authors
Publication date 2021
Book title 2021 Conference on Empirical Methods in Natural Language Processing
Book subtitle EMNLP 2021 : proceedings of the conference : November 7-11, 2021
ISBN (electronic)
  • 9781955917094
Event 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021
Pages (from-to) 6507-6520
Number of pages 14
Publisher Stroudsburg, PA: The Association for Computational Linguistics
Organisations
  • Interfacultary Research - Institute for Logic, Language and Computation (ILLC)
Abstract

Recently, it has been argued that encoder-decoder models can be made more interpretable by replacing the softmax function in the attention with its sparse variants. In this work, we introduce a novel, simple method for achieving sparsity in attention: we replace the softmax activation with a ReLU, and show that sparsity naturally emerges from such a formulation. Training stability is achieved with layer normalization with either a specialized initialization or an additional gating function. Our model, which we call Rectified Linear Attention (ReLA), is easy to implement and more efficient than previously proposed sparse attention mechanisms. We apply ReLA to the Transformer and conduct experiments on five machine translation tasks. ReLA achieves translation performance comparable to several strong baselines, with training and decoding speed similar to that of the vanilla attention. Our analysis shows that ReLA delivers high sparsity rate and head diversity, and the induced cross attention achieves better accuracy with respect to source-target word alignment than recent sparsified softmax-based models. Intriguingly, ReLA heads also learn to attend to nothing (i.e. 'switch off') for some queries, which is not possible with sparsified softmax alternatives.

Document type Conference contribution
Note With supplementary video
Language English
Published at https://doi.org/10.18653/v1/2021.emnlp-main.523
Other links https://github.com/bzhangGo/zero https://www.scopus.com/pages/publications/85127401315
Downloads
2021.emnlp-main.523 (Final published version)
Supplementary materials
Permalink to this page
Back