2025-03-10 · 进阶 · 机器学习 · 自然语言处理

Forgetting Transformer: Softmax Attention with a Forget Gate

提出了一种名为“遗忘Transformer”(FoX)的新型Transformer变体,通过引入遗忘门机制,在长上下文语言建模、长度外推和短上下文下游任务中优于Transformer,同时保持了Transformer的长上下文检索能力。

更新于 2026-11-18。作者:Zhixuan Lin、Evgenii Nikishin、Xu Owen He、Aaron Courville。

中文摘要

现代循环序列模型的一个关键组件是遗忘门。虽然Transformer没有显式的循环形式,但我们展示了一种通过以数据依赖的方式降低未归一化注意力分数的自然方法,将遗忘门融入Transformer。我们称这种注意力机制为“遗忘注意力”,并将由此产生的模型称为“遗忘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 the 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.

解读

一句话总结

提出了一种名为“遗忘Transformer”(FoX)的新型Transformer变体,通过引入遗忘门机制,在长上下文语言建模、长度外推和短上下文下游任务中优于Transformer,同时保持了Transformer的长上下文检索能力。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt