arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2503.02130cs.LGcs.AIcs.CL
收藏

Forgetting Transformer:带有遗忘门的 Softmax 注意力

Forgetting Transformer: Softmax Attention with a Forget Gate

Mila(米拉研究所);Université de Montréal(蒙特利尔大学);MakerMaker AI(MakerMaker人工智能公司);Google DeepMind(谷歌DeepMind)

Zhixuan Lin, Evgenii Nikishin, Xu Owen He, Aaron Courville

AI总结:

本文提出 Forgetting Transformer (FoX),通过以数据相关方式降低未归一化注意力分数将遗忘门融入 Transformer,在长上下文建模等任务上优于 Transformer 且兼容 FlashAttention,同时保留卓越长上下文能力。

摘要:

现代循环序列模型的一个关键组件是遗忘门。虽然 Transformer 没有显式的循环形式,但我们表明,可以通过以数据相关的方式降低未归一化的注意力分数,将遗忘门自然地融入 Transformer 中。我们将这种注意力机制命名为 Forgetting Attention,并将由此产生的模型命名为 Forgetting Transformer (FoX)。我们表明,FoX 在长上下文语言建模、长度外推和短上下文下游任务上优于 Transformer,同时在长上下文下游任务上与 Transformer 表现相当。此外,它与 FlashAttention 算法兼容,且不需要任何位置嵌入。多项分析(包括大海捞针测试)表明,FoX 也保留了 Transformer 相对于 Mamba-2、HGRN2 和 DeltaNet 等循环序列模型的卓越长上下文能力。我们还引入了一种“Pro”块设计,该设计结合了循环序列模型中一些常见的架构组件,并发现它显著提升了 FoX 和 Transformer 的性能。我们的代码可在 https://github.com/zhixuan-lin/forgetting-transformer 获取。

英文摘要:

An essential component of modern recurrent sequence models is the forget gate. While Transformers do not have an explicit recurrent form, we show that a forget gate can be naturally incorporated into Transformers by down-weighting the unnormalized attention scores in a data-dependent way. We name this attention mechanism Forgetting Attention and the resulting model the Forgetting Transformer (FoX). We show that FoX outperforms the Transformer on long-context language modeling, length extrapolation, and short-context downstream tasks, while performing on par with the Transformer on long-context downstream tasks. Moreover, it is compatible with the FlashAttention algorithm and does not require any positional embeddings. Several analyses, including the needle-in-the-haystack test, show that FoX also retains the Transformer's superior long-context capabilities over recurrent sequence models such as Mamba-2, HGRN2, and DeltaNet. We also introduce a "Pro" block design that incorporates some common architectural components in recurrent sequence models and find it significantly improves the performance of both FoX and the Transformer. Our code is available at https://github.com/zhixuan-lin/forgetting-transformer.

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

↑