Selective Attention Improves Transformer

Yaniv Leviathan, Matan Kalman, Yossi Matias
10/3/2024
cs.CLcs.AIcs.LG

No confident code implementation found for this paper. 3 possible matches can be shown below.

Abstract

Unneeded elements in the attention's context degrade performance. We introduce Selective Attention, a simple parameter-free change to the standard attention mechanism which reduces attention to unneeded elements. Selective attention consistently improves language modeling and downstream task performance in a variety of model sizes and context lengths. For example, transformers trained with the language modeling objective on C4 with selective attention perform language modeling equivalently to standard transformers with ~2X more heads and parameters in their attention modules. Selective attention also allows decreasing the size of the attention's context buffer, leading to meaningful reductions in the memory and compute requirements during inference. For example, transformers trained on C4 with context sizes of 512, 1,024, and 2,048 need 16X, 25X, and 47X less memory for their attention module, respectively, when equipped with selective attention, as those without selective attention, with the same validation perplexity.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 3 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{leviathan2024selective,
  title  = {Selective Attention Improves Transformer},
  author = {Yaniv Leviathan and Matan Kalman and Yossi Matias},
  year   = {2024},
  eprint = {2410.02703},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.02703v2},
  journal = {ICLR 2024 2024}
}

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/2410.02703.svg)](https://codeofpaper.com/paper/2410.02703)

Discussion