提出一种新型线性注意力机制,提升长文本记忆效率。
Blurry Window Attention

- 用狄利克雷核插值重构模糊键值历史,实现可扩展的记忆存储
- 在长序列任务中,状态效率比滑动窗口高8倍,且性能随状态增大持续提升
- 适合需要长期记忆的长文本生成与检索场景
Transformer语言模型中的Softmax注意力操作在序列长度上具有二次复杂度,并伴随KV缓存状态大小持续增长,成为长上下文场景下的瓶颈。为克服此限制,已提出多种线性复杂度且状态有限的替代架构,如状态空间模型(SSMs)、线性注意力(LA)和有界记忆控制注意力(ABC)。尽管线性模型在语言困惑度上接近Transformer,但在需要信息检索或回忆的任务中仍落后。本文提出一种受SSMs启发的新方法——模糊窗口注意力(Blurry Window Attention, BLA)。BLA通过狄利克雷核插值,从频率窗口重建模糊的键值历史。该方法可视为依赖狄利克雷核分辨率的滑动窗口注意力的推广,或门控槽注意力(GSA)的特例,其中衰减因子由狄利克雷核实现。我们详细阐述了其理论基础与高效实现方式。在多查询关联回忆(MQAR)合成任务中,BLA的状态效率比滑动窗口高出8倍,且与主流线性注意力模型相当;在RegBench合成任务中,仅有BLA和滑动窗口注意力在状态增大时性能持续提升。
原文摘要 · Abstract (English)
The Softmax Attention operation in Transformer language models has a quadratic complexity in the sequence length and a growing state size in the form of KV cache, which becomes a bottleneck in long context scenarios. To overcome this limitation, alternative architectures with linear complexity and finite state size have been introduced, such as State-Space Models (SSMs), Linear Attention (LA), and Attention with Bounded-memory Control (ABC). Though linear models achieve similar language perplexity as Transformers, they are still behind in tasks which require retrieval or recall of specific information. In this work, we introduce Blurry Window Attention (BLA) a novel ABC method inspired by SSMs. BLA stores a frequency window from which a blurry KV history is reconstructed via interpolation using Dirichlet kernels. BLA can be understood as a generalization of Sliding Window Attention (SWA) depending on the Dirichlet kernels resolution or as a special case of the Gated Slot Attention (GSA), where the decay factor is implemented with Dirichlet kernels. We describe in details the theory and efficient implementation of BLA. On the Multi-Query Associate Recall (MQAR) synthetic task, we show that the state efficiency of BLA is 8$\times$ better than SWA and is competitive with popular linear attention models, and in the RegBench synthetic task, only BLA and SWA improve their performance as the state size grows among the linear models we tested.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。