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

对数线性注意力

Log-Linear Attention

Massachusetts Institute of Technology(麻省理工学院);Princeton University(普林斯顿大学);Together AI;Carnegie Mellon University(卡内基梅隆大学);Mohamed bin Zayed University of AI(穆罕默德·本·扎耶德人工智能大学);GenBio AI

Han Guo, Songlin Yang, Tarushii Goel, Eric P. Xing, Tri Dao, Yoon Kim

AI总结:

本文提出了一种对数线性注意力机制,通过使用以对数方式增长的隐藏状态,平衡了线性注意力的效率与softmax注意力的表达能力,并在Mamba-2和Gated DeltaNet等架构上实现了性能提升。

摘要:

Transformer中的注意力机制是实现准确且可扩展的序列建模的重要基本元素。然而,其二次计算复杂度和线性内存复杂度仍然是显著的瓶颈。线性注意力和状态空间模型能够实现线性时间、常数内存的序列建模,并且可以通过在序列长度上进行矩阵乘法丰富的并行化来高效地进行训练。然而,这些模型本质上仍然是RNNs,因此它们使用固定大小的隐藏状态来建模上下文是一种根本性的限制。本文开发了对数线性注意力,这是一种平衡线性注意力效率和softmax注意力表达能力的注意力机制。对数线性注意力用一个以对数方式增长的隐藏状态集取代固定大小的隐藏状态。我们证明,通过特定的增长函数,对数线性注意力可以具有与之类似的矩阵乘法丰富的并行形式,其计算成本与序列长度呈对数线性关系。对数线性注意力是一种通用框架,可以应用于现有的线性注意力变体之上。作为案例研究,我们实例化了两种最近架构——Mamba-2和门控DeltaNet的对数线性变体,并发现它们在与线性时间变体相比时表现良好。

英文摘要:

The attention mechanism in Transformers is an important primitive for accurate and scalable sequence modeling. Its quadratic-compute and linear-memory complexity however remain significant bottlenecks. Linear attention and state-space models enable linear-time, constant-memory sequence modeling and can moreover be trained efficiently through matmul-rich parallelization across sequence length. However, at their core these models are still RNNs, and thus their use of a fixed-size hidden state to model the context is a fundamental limitation. This paper develops log-linear attention, an attention mechanism that balances linear attention's efficiency and the expressiveness of softmax attention. Log-linear attention replaces the fixed-size hidden state with a logarithmically growing set of hidden states. We show that with a particular growth function, log-linear attention admits a similarly matmul-rich parallel form whose compute cost is log-linear in sequence length. Log-linear attention is a general framework and can be applied on top of existing linear attention variants. As case studies, we instantiate log-linear variants of two recent architectures -- Mamba-2 and Gated DeltaNet -- and find they perform well compared to their linear-time variants.

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

↑