Reproduce “Bayesian Attention Modules” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Xinjie Fan, Shujian Zhang, Bo Chen, Mingyuan Zhou
Bayesian Attention Modules (BAMs) introduce a principled probabilistic framework for attention mechanisms, treating attention weights as random variables to quantify uncertainty and enhance expressiveness. The method consistently improves performance and provides more reliable uncertainty estimates across diverse tasks, including graph node classification, visual question answering, image captioning, and language understanding.
Key insights
- Semi-analytic expressions for the KL divergence term significantly reduce gradient variance by leveraging conjugate-like relationships between posteriors and contextual priors.
- A reparameterization method effectively handles the simplex constraint (non-negative, sum-to-one) for attention weights, ensuring differentiability while avoiding issues of previous stochastic attention methods.
- The proposed parameterization generalizes standard deterministic attention, allowing BAMs to reduce to traditional attention as the distribution's variance approaches zero.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.