Neural Attention Search Linear: Towards Adaptive Token-Level Hybrid Attention Models
AI 摘要
NAtS-L提出了一种token级别的混合注意力机制,自动选择线性或softmax注意力。
主要贡献
- 提出NAtS-L框架,实现token级别的混合注意力。
- 自动搜索最优的Gated DeltaNet和softmax注意力组合。
- 在长文本场景下,平衡了效率和表达能力。
方法论
通过搜索算法,针对不同token动态选择线性注意力(Gated DeltaNet)或softmax注意力,实现混合注意力机制。
原文摘要
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.