OrthoRank: Token Selection via Sink Token Orthogonality for Efficient LLM inference
作者: Seungjun Shin, Jaehoon Oh, Dokwan Oh
分类: cs.CL, cs.AI, cs.LG
发布日期: 2025-07-05 (更新: 2025-08-16)
备注: ICML 2025 (final version)
💡 一句话要点
OrthoRank:利用Sink Token正交性的Token选择方法,提升LLM推理效率。
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 LLM推理 Token选择 Sink Token 正交性 模型压缩 高效推理
📋 核心要点
- 现有LLM推理效率受限于注意力机制,Sink Token现象导致计算资源浪费,但其与其它Token的深层关系未被充分挖掘。
- OrthoRank通过Sink Token正交性动态选择重要Token,加速推理,核心思想是利用Token向Sink Token移动的速度评估其重要性。
- 实验表明,OrthoRank在困惑度、零样本准确率和LongBench上优于层剪枝方法,并在相同稀疏度下保持了相当的吞吐量。
📝 摘要(中文)
本文研究了大型语言模型(LLM)中注意力机制的关键作用,特别是Sink Token现象。研究发现,Sink Token与其他Token在隐藏状态的相似性随着层深增加而增大,且Sink Token的归一化隐藏状态变化极小,表明其他Token在各层中持续向Sink Token靠拢。基于此,本文提出了一种动态Token选择方法OrthoRank,通过计算Token向Sink Token移动的速度来评估Token的重要性,并将其转化为与Sink Token的正交性。实验结果表明,在相同稀疏度下,OrthoRank相比于层剪枝方法,在困惑度和零样本准确率上表现更优,且在LongBench上取得了更好的性能,同时保持了相当的吞吐量。
🔬 方法详解
问题定义:大型语言模型(LLM)中的注意力机制计算复杂度高,成为推理效率的瓶颈。研究表明,Sink Token在注意力机制中占据主导地位,但其语义作用有限,导致大量计算资源浪费在不重要的Token上。现有方法,如层剪枝,无法有效区分Token的重要性,导致性能下降。因此,需要一种更精细的Token选择方法,以提高LLM的推理效率,同时保持或提升模型性能。
核心思路:OrthoRank的核心思路是利用Sink Token与其他Token在隐藏状态空间中的关系来评估Token的重要性。具体而言,论文观察到随着网络层数的加深,其他Token的隐藏状态逐渐向Sink Token的隐藏状态靠拢。因此,Token向Sink Token移动的速度可以作为其重要性的指标:移动速度越慢(即与Sink Token越正交),Token越重要。
技术框架:OrthoRank的整体框架包括以下步骤:1) 计算Sink Token的隐藏状态:在每一层,计算Sink Token的隐藏状态。2) 计算Token与Sink Token的正交性:对于每个Token,计算其隐藏状态与Sink Token隐藏状态的余弦相似度,并将其转化为正交性度量。3) Token选择:基于计算的正交性度量,选择最重要的Token进行后续计算,丢弃不重要的Token。这个过程在每一层动态进行,允许模型根据上下文调整Token的重要性。
关键创新:OrthoRank的关键创新在于利用Sink Token的正交性来动态选择Token。与传统的层剪枝方法不同,OrthoRank能够更精细地评估每个Token的重要性,并根据其与Sink Token的关系进行选择。这种方法能够更有效地保留重要的Token,同时减少不必要的计算,从而提高推理效率。
关键设计:关键设计包括:1) 正交性度量:使用余弦相似度的倒数作为正交性度量,数值越大表示与Sink Token越正交,Token越重要。2) 动态选择:在每一层都进行Token选择,允许模型根据上下文调整Token的重要性。3) 稀疏度控制:通过设置稀疏度参数,控制每一层保留的Token数量。具体的损失函数和网络结构与原始LLM保持一致,OrthoRank主要作用于推理阶段的Token选择。
🖼️ 关键图片
📊 实验亮点
实验结果表明,OrthoRank在多个基准测试中优于现有的层剪枝方法。例如,在相同稀疏度下,OrthoRank在困惑度和零样本准确率上均有提升。此外,OrthoRank在LongBench上取得了更好的性能,表明其在处理长文本方面具有优势。重要的是,OrthoRank在提高性能的同时,保持了与层剪枝方法相当的吞吐量。
🎯 应用场景
OrthoRank可应用于各种需要高效LLM推理的场景,如移动设备上的自然语言处理、实时对话系统、资源受限的边缘计算设备等。通过减少计算量,OrthoRank能够降低延迟、提高吞吐量,并降低能耗,从而扩展LLM的应用范围。
📄 摘要(原文)
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.