about
Selective Attention Improves Transformer (arxiv.org)
1 point by andy12_ on Oct 7, 2024 | hide | past | pdf | 1 comment on HN

In plain words: Normally attention spreads focus across every context word, ones that don't matter included; this tweak dials down attention to those unneeded words, adding no new settings to learn. It matched standard attention with twice the heads and parameters, cutting attention memory up to 47 times.

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.

Yaniv Leviathan, Matan Kalman, Yossi Matias
arXiv:2410.02703 · cs.CL, cs.AI, cs.LG · submitted Oct 3, 2024 · updated Apr 24, 2025
abstract · pdf · html · ICLR 2025

add comment on HN

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 improves language modeling performance in a variety of model sizes and context lengths. For example, a range of transformers trained with the language modeling objective on C4 with selective attention perform 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 with 100M parameters 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