arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.02703cs.CLcs.AIcs.LG
收藏

选择性注意力提升Transformer性能

Selective Attention Improves Transformer

Google Research(谷歌研究)

Yaniv Leviathan, Matan Kalman, Yossi Matias

AI总结:

本文提出一种无需参数的选择性注意力机制,通过减少对无关上下文的关注,在多种规模下提升语言建模性能,并大幅降低推理内存需求。

摘要:

注意力上下文中的非必要元素会降低性能。我们引入了选择性注意力(Selective Attention),这是对标准注意力机制的一种简单且无需参数的修改,能够减少对非必要元素的注意力。选择性注意力在多种模型规模和上下文长度下,持续提升了语言建模和下游任务的性能。例如,在C4数据集上使用语言建模目标训练的选择性注意力Transformer,其语言建模性能与拥有约2倍多头数量和注意力模块参数的标准Transformer相当。选择性注意力还允许减小注意力上下文缓冲区的大小,从而在推理过程中显著降低内存和计算需求。例如,在C4上训练的上下文大小为512、1,024和2,048的Transformer,配备选择性注意力后,其注意力模块所需内存分别比未配备选择性注意力的Transformer少16倍、25倍和47倍,同时保持相同的验证困惑度。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑