arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2602.08329cs.LGcs.AIcs.ITmath.IT
收藏

通过预处理稀疏性实现近oracle的KV选择用于长上下文推理

Near-Oracle KV Selection via Pre-hoc Sparsity for Long-Context Inference

University College London(伦敦大学学院);Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences (CAS)(深圳先进技术研究院,中国科学院);Chinese University of Hong Kong(香港中文大学);College of Computing & Data Science, Nanyang Technological University(computing 与数据科学学院,南洋理工大学)

Yifei Gao, Lei Wang, Rong-Cheng Tu, Qixin Zhang, Jun Cheng, Dacheng Tao

AI总结:

PrHS通过预处理稀疏性在长上下文推理中实现近oracle的KV选择,有效降低计算和带宽成本,提升推理效率。

摘要:

大规模语言模型(LLM)推理中的核心瓶颈是针对不断增长的关键值(KV)缓存进行注意力计算的成本。尽管近oracle的top-k KV选择可以在保持密集注意力质量的同时显著减少计算和带宽成本,但现有的稀疏方法通常依赖于后验启发式方法,即基于观察到的注意力或代理分数的选取器。这种条件性引入了后验偏差:它倾向于扭曲真实的token重要性并遗漏显著的token,从而影响长距离推理。为了解决这个问题,我们提出了预处理稀疏性(PrHS),它在注意力评分之前选择KV条目并提供明确的准确性控制。设被丢弃条目的注意力质量为delta(丢弃质量)。通过边缘到互信息的分析,我们推导出一个仅依赖丢弃质量的互信息损失上限。这种关系解释了后验启发式方法的失败模式,并通过在提前控制丢弃质量来实现可验证的保证。在PrHS中,我们沿时间、深度和层轴实例化了三个正交的预处理选择器。在LLaMA和Mistral系列上的大量实验验证了PrHS。在GSM8K和CoQA上,PrHS将检索开销减少超过90%,在匹配或更好的准确性下,其检索稀疏性比HShare高3倍。它在LongBench上平均退化小于1%,将注意力FLOPs降低约15%相对于先前的稀疏基线,并在NVIDIA A100-80GB GPU上实现了注意力运算延迟的9.9倍提速和2.8倍更高的吞吐量。

英文摘要:

A core bottleneck in large language model (LLM) inference is the cost of attending over the ever-growing key-value (KV) cache. Although near-oracle top-k KV selection can preserve the quality of dense attention while sharply reducing computation and bandwidth, existing sparse methods generally rely on posterior heuristics, i.e., selectors conditioned on observed attention or proxy scores. Such conditioning introduces posterior bias: it tends to distort true token importance and miss salient tokens, thereby impairing long-range reasoning. To tackle this problem, we propose Pre-hoc Sparsity (PrHS), which selects KV entries before attention scoring and provides explicit accuracy control. Let the attention mass of discarded entries be delta (the dropped mass). Through a marginal-to-mutual-information analysis, we derive an upper bound on the mutual-information loss that depends only on the dropped mass. This relation explains failure modes of posterior heuristics and enables verifiable guarantees by controlling the dropped mass in advance. Within PrHS, we instantiate three orthogonal pre-hoc selectors along the axes of time, depth, and layer. Extensive experiments on LLaMA and Mistral families validate PrHS. Across GSM8K and CoQA, PrHS reduces retrieval overhead by over 90%, achieving 3x higher retrieval sparsity than HShare at matched or better accuracy. It incurs under 1% average degradation on LongBench, lowers attention FLOPs by about 15% versus prior sparse baselines, and yields a 9.9x speedup in attention-operator latency and 2.8x higher throughput on NVIDIA A100-80GB GPUs than the dense baseline.

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

↑