Bayesian Attention Modules

Xinjie Fan, Shujian Zhang, Bo Chen, Mingyuan Zhou
10/20/2020
stat.MLcs.LGcs.NE
transformer-attentionbayesian

Official code: zhougroup/BAM (37 stars, Python, MIT, last commit 2020-12-14).

Abstract

Attention modules, as simple and effective tools, have not only enabled deep neural networks to achieve state-of-the-art results in many domains, but also enhanced their interpretability. Most current models use deterministic attention modules due to their simplicity and ease of optimization.

Show full abstract

Stochastic counterparts, on the other hand, are less popular despite their potential benefits. The main reason is that stochastic attention often introduces optimization issues or requires significant model changes. In this paper, we propose a scalable stochastic version of attention that is easy to implement and optimize. We construct simplex-constrained attention distributions by normalizing reparameterizable distributions, making the training process differentiable. We learn their parameters in a Bayesian framework where a data-dependent prior is introduced for regularization. We apply the proposed stochastic attention modules to various attention-based models, with applications to graph node classification, visual question answering, image captioning, machine translation, and language understanding. Our experiments show the proposed method brings consistent improvements over the corresponding baselines.

View on arXivView PDF

Code Implementations(1)

zhougroup/BAMOfficial100%
MIT

Bayesian Attention Modules

378Python, Jupyter NotebookOct 19, 20205 years agoMIT

Similar Papers

Cite this paper

@article{fan2020bayesian,
  title  = {Bayesian Attention Modules},
  author = {Xinjie Fan and Shujian Zhang and Bo Chen and Mingyuan Zhou},
  year   = {2020},
  eprint = {2010.10604},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2010.10604}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2010.10604.svg)](https://codeofpaper.com/paper/2010.10604)

Discussion