arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.13542cs.CLcs.AI
收藏

激活感知探测查询:面向长上下文大语言模型推理的高效键值检索

Activation-aware Probe-Query: Effective Key-Value Retrieval for Long-Context LLMs Inference

The Hong Kong University of Science and Technology (Guangzhou)(香港科技大学(广州));The Hong Kong University of Science and Technology(香港科技大学);The Hong Kong Polytechnic University(香港理工大学);South China Normal University(华南师范大学);University College London(伦敦大学学院)

Qingfa Xiao, Jiachuan Wang, Haoyang Li, Cheng Deng, Jiaqi Tang, Shuangyin Li, Yongqi Zhang, Jun Wang, Lei Chen

AI总结:

本文提出免训练的 ActQKV,通过激活偏置构建探测查询并结合跨层信息密度动态截断 KV,以提升长上下文 LLM 推理的检索质量与资源效率。

摘要:

大语言模型(LLM)的最新进展在长上下文任务中展现出卓越性能,但在 GPU 内存有限的情况下,其推理效率面临重大挑战。现有解决方案首先提出滑动窗口方法,以累积一组历史键值(KV)对供复用,随后的改进则在每一步选择性地保留其子集。然而,由于长上下文中的注意力分布稀疏,注意力会被大量候选对分散,因此难以识别和召回相关的 KV 对。此外,我们发现,在每个滑动窗口中选择具有代表性的 token 作为探测查询,以有效表示整个上下文,是一种很有前景的做法,而现有方法忽视了这一途径。因此,我们提出 ActQKV,这是一种免训练、激活感知的方法,可动态确定探测查询,并利用其检索相关 KV 对以进行推理。具体而言,ActQKV 在每个上下文窗口内监控 token 级指标 Activation Bias(激活偏置),从而在预填充阶段恰当构建用于检索的探测查询。为准确召回相关 KV 对并最大限度减少无关 KV 对,我们在解码阶段设计了一种由跨层信息密度引导的动态 KV 截断机制。在 Long-Bench 和 ∞ Benchmarks 上的实验表明,该方法取得了最先进性能,并在推理质量和资源效率方面具有竞争力。

英文摘要:

Recent advances in large language models (LLMs) have showcased exceptional performance in long-context tasks, while facing significant inference efficiency challenges with limited GPU memory. Existing solutions first proposed the sliding-window approach to accumulate a set of historical \textbf{key-value} (KV) pairs for reuse, then further improvements selectively retain its subsets at each step. However, due to the sparse attention distribution across a long context, it is hard to identify and recall relevant KV pairs, as the attention is distracted by massive candidate pairs. Additionally, we found it promising to select representative tokens as probe-Query in each sliding window to effectively represent the entire context, which is an approach overlooked by existing methods. Thus, we propose \textbf{ActQKV}, a training-free, \textbf{Act}ivation-aware approach that dynamically determines probe-\textbf{Q}uery and leverages it to retrieve the relevant \textbf{KV} pairs for inference. Specifically, ActQKV monitors a token-level indicator, Activation Bias, within each context window, enabling the proper construction of probe-Query for retrieval at pre-filling stage. To accurately recall the relevant KV pairs and minimize the irrelevant ones, we design a dynamic KV cut-off mechanism guided by information density across layers at the decoding stage. Experiments on the Long-Bench and $\infty$ Benchmarks demonstrate its state-of-the-art performance with competitive inference quality and resource efficiency.

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

↑