Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Sparse Attention with Linear Units

About

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.

Biao Zhang, Ivan Titov, Rico Sennrich• 2021

Related benchmarks

TaskDatasetResultRank
Irregular Time Series ClassificationE-MNIST
Accuracy95.87
33
Irregular Time Series ClassificationPAR
Accuracy88.75
33
Lane-Keeping Trajectory PredictionUdacity Simulator
MSE0.0196
33
Lane-Keeping Action ClassificationOpenAI CarRacing
Accuracy80.16
33
Degradation EstimationPRONOSTIA
MSE58.35
33
Degradation EstimationXJTU-SY
MSE87.8
33
Degradation EstimationHUST
MSE99.38
33
Showing 7 of 7 rows

Other info

Follow for update