通过分析令牌与汇点的正交性,实现高效大模型推理的动态选词。
OrthoRank: Token Selection via Sink Token Orthogonality for Efficient LLM inference
- 基于深层隐藏状态中汇点与其他令牌的正交性变化,定义重要性。
- 在相同稀疏度下,相比层剪枝,困惑度更低,零样本准确率更高。
- 特别适合长文本任务,如LongBench,提升推理效率与性能。
注意力机制是大语言模型成功的关键,使模型能够捕捉复杂的令牌依赖关系并隐式分配重要性。近期研究发现,汇点令牌虽语义作用有限,却接收远高于其他令牌的注意力。本文进一步拓展了汇点与其他令牌的关系,不仅关注注意力,还考察其在不同层深度下的隐藏状态相似性。我们观察到:随着层数加深,汇点与其他令牌归一化隐藏状态间的余弦相似度上升,且汇点自身隐藏状态几乎不变,表明其他令牌始终被导向汇点。基于此,提出动态令牌选择方法OrthoRank:在特定层中,以令牌向汇点靠近的速度衡量重要性,转化为与汇点的正交性——越正交则越重要。大量实验表明,在相同稀疏度下,本方法相比层剪枝方法具有更低困惑度、更高零样本准确率,且吞吐量相当,同时在LongBench上表现更优。
原文摘要 · Abstract (English)
Attention mechanisms are central to the success of large language models (LLMs), enabling them to capture intricate token dependencies and implicitly assign importance to each token. Recent studies have revealed the sink token, which receives disproportionately high attention despite their limited semantic role. In this paper, we first expand the relationship between the sink token and other tokens, moving beyond attention to explore their similarity in hidden states, considering the layer depth. We observe that as the layers get deeper, the cosine similarity between the normalized hidden states of the sink token and those of other tokens increases, and that the normalized hidden states of the sink token exhibit negligible changes. These imply that other tokens consistently are directed toward the sink token throughout the layers. Next, we propose a dynamic token selection method, called OrthoRank, using these findings to select important tokens. Specifically, in a certain layer, we define token importance by the speed at which the token moves toward the sink token. This is converted into orthogonality with the sink token, meaning that tokens that are more orthogonal to the sink token are assigned greater importance. Finally, through extensive experiments, we demonstrated that our method results in lower perplexity and higher zero-shot accuracy compared to layer pruning methods at the same sparsity ratio with comparable throughput, while also achieving superior performance on LongBench.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。