arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.01219cs.LGcs.CV
收藏

混合top-k注意力:通过可扩展的快速权重实现高效的注意力

Mixture-of-Top-k Attention: Efficient Attention via Scalable Fast Weights

Beijing University of Posts and Telecommunications(北京邮电大学)

Qishuai Wen, Zhiyuan Huang, Xianghan Meng, Wei He, Chun-Guang Li

AI总结:

本文提出MiTA,通过小规模地标查询收集top-k的键值对作为查询感知的变形路由专家,同时压缩N宽度MLP为共享专家,提升注意力机制的灵活性和可扩展性。

摘要:

Transformer中的 vanilla 自注意力机制可以视为一个两层快速权重MLP,其权重由输入动态诱导,隐藏维度等于序列长度N。随着上下文扩展,这样的N宽度MLP的表达能力增加,但对极长序列不可扩展。最近,这种快速权重视角激励了混合专家(MoE)注意力机制,将序列划分为刚性块,将其视为快速权重专家,并稀疏地将token路由到它们。在本文中,我们将此视角提升为一个统一的高效注意力机制框架,将它们解释为通过路由或压缩使快速权重可扩展,并将其组织成五维分类法。然后,我们提出混合top-k注意力(MiTA),它使用少量地标查询收集top-k的注意力键值对作为查询感知和变形路由专家,同时将N宽度MLP压缩为更窄的共享专家。因此,我们的MiTA提升了先前MoE注意力的灵活性,从刚性到变形快速权重专家,以及先前top-k注意力的可扩展性,从查询特定集到可重用的top-k集。我们在视觉任务上进行了广泛实验,展示了MiTA的优越效果和效率,并揭示了有趣性质,如涌现的token修剪效应和从标准注意力的易于泛化。代码可在https://github.com/QishuaiWen/MiTA获取。

英文摘要:

The vanilla self-attention mechanism in Transformers can be viewed as a two-layer fast-weight MLP, whose weights are dynamically induced by inputs and whose hidden dimension is equal to the sequence length $N$. As the context extends, the expressive capacity of such an $N$-width MLP increases, but it becomes unscalable for extremely long sequences. Recently, this fast-weight perspective has motivated the Mixture-of-Experts (MoE) attention mechanism, which partitions the sequence into rigid blocks, treats them as fast-weight experts, and sparsely routes the tokens to them. In this paper, we elevate this perspective to a unifying framework for efficient attention mechanisms, interpreting them as making fast weights scalable through either routing or compression, and organizing them into a five-dimensional taxonomy. Then, we propose Mixture-of-Top-$k$ Attention (MiTA), which employs a small set of landmark queries to gather top-$k$ attended key-value pairs as query-aware and deformable routed experts, while compressing the $N$-width MLP into a narrower shared expert. Consequently, our MiTA improves the flexibility of prior MoE attention from rigid to deformable fast-weight experts, as well as the scalability of prior top-$k$ attention from query-specific set to reusable top-$k$ set. We conduct extensive experiments on vision tasks showing the superior effectiveness and efficiency of our MiTA, and also uncovering intriguing properties such as an emergent token-pruning effect and easy generalization from standard attention. Code is available at https://github.com/QishuaiWen/MiTA.

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

↑