The quadratic computational complexity of softmax transformers has become a bottleneck in long-context scenarios. In contrast, linear attention model families provide a promising direction towards a more efficient sequential model. These linear attention models compress past KV values into a single hidden state, thereby efficiently reducing complexity during both training and inference. However, their expressivity remains limited by the size of their hidden state. Previous work proposed interleaving softmax and linear attention layers to reduce computational complexity while preserving expressivity. Nevertheless, the efficiency of these models remains bottlenecked by their softmax attention layers. In this paper, we propose Neural Attention Search Linear (NAtS-L), a framework that applies both linear attention and softmax attention operations within the same layer on different tokens. NAtS-L automatically determines whether a token can be handled by a linear attention model, i.e., tokens that have only short-term impact and can be encoded into fixed-size hidden states, or require softmax attention, i.e., tokens that contain information related to long-term retrieval and need to be preserved for future queries. By searching for optimal Gated DeltaNet and softmax attention combinations across tokens, we show that NAtS-L provides a strong yet efficient token-level hybrid architecture.


翻译:softmax Transformer 的二次计算复杂度已成为长上下文场景中的瓶颈。相比之下,线性注意力模型族为实现更高效的序列模型提供了一个有前景的方向。这些线性注意力模型将过去的键值对压缩为单个隐藏状态,从而在训练和推理过程中有效降低复杂度。然而,其表达能力仍受限于隐藏状态的大小。先前的研究提出交错使用 softmax 和线性注意力层,以在保持表达能力的同时降低计算复杂度。尽管如此,这些模型的效率仍受其 softmax 注意力层的制约。本文提出神经注意力搜索线性(NAtS-L),一个在同一层内对不同令牌同时应用线性注意力与 softmax 注意力操作的框架。NAtS-L 自动判断一个令牌是可由线性注意力模型处理(即仅具有短期影响且可编码为固定大小隐藏状态的令牌),还是需要 softmax 注意力(即包含与长期检索相关的信息且需为未来查询保留的令牌)。通过在令牌间搜索最优的门控 DeltaNet 与 softmax 注意力组合,我们证明 NAtS-L 提供了一种强大且高效的令牌级混合架构。

0
下载
关闭预览

相关内容

TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
【NeurIPS 2021】流形上的注意力机制:规范等变的Transformer
LinkedIn最新《注意力模型》综述论文大全,20页pdf
专知会员服务
138+阅读 · 2020年12月20日
注意力机制介绍,Attention Mechanism
专知会员服务
172+阅读 · 2019年10月13日
深度学习的下一步:Transformer和注意力机制
云头条
56+阅读 · 2019年9月14日
基于关系网络的视觉建模:有望替代卷积神经网络
微软研究院AI头条
10+阅读 · 2019年7月12日
Attention!注意力机制模型最新综述
专知
65+阅读 · 2019年4月8日
从Seq2seq到Attention模型到Self Attention(一)
量化投资与机器学习
76+阅读 · 2018年10月8日
深度学习中的注意力机制
人工智能头条
16+阅读 · 2017年11月2日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
13+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 2月12日
VIP会员
相关资讯
相关基金
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
13+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员