arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.20326cs.CLcs.AIcs.LG
收藏

超越加速 -- 利用KV缓存进行采样与推理

Beyond Speedup -- Utilizing KV Cache for Sampling and Reasoning

Department of Computer Science and Engineering, The Chinese University of Hong Kong(香港中文大学计算机科学与工程系);Huawei Technologies Co., Ltd.(华为技术有限公司)

Zeyu Xing, Xing Li, Hui-Ling Zhen, Mingxuan Yuan, Sinno Jialin Pan

AI总结:

本文提出将KV缓存作为轻量级表示用于采样与推理,展示了其在链式嵌入和快速/缓慢思考切换任务中的有效性,显著提升了推理效率。

摘要:

KV缓存通常只用于加速自回归解码,但它们编码了可以用于下游任务的上下文信息,且无需额外成本。我们提出将KV缓存视为一种轻量级表示,从而避免重新计算或存储完整的隐藏状态。尽管比专用嵌入式表示弱,但基于KV的表示在两个关键应用中已被证明足够:(i) 链式嵌入,其中它们在Llama-3.1-8B-Instruct和Qwen2-7B-Instruct上实现了竞争性或更优的性能;以及(ii) 快速/缓慢思考切换,其中它们使Qwen3-8B和DeepSeek-R1-Distil-Qwen-14B能够实现自适应推理,减少生成的token数量高达5.7倍,同时仅造成最小的精度损失。我们的发现确立了KV缓存作为免费、有效的采样和推理的基质,为LLM推理中的表示重用开辟了新的方向。代码:https://github.com/cmd2001/ICLR2026_KV-Embedding

英文摘要:

KV caches, typically used only to speed up autoregressive decoding, encode contextual information that can be reused for downstream tasks at no extra cost. We propose treating the KV cache as a lightweight representation, eliminating the need to recompute or store full hidden states. Despite being weaker than dedicated embeddings, KV-derived representations are shown to be sufficient for two key applications: \textbf{(i) Chain-of-Embedding}, where they achieve competitive or superior performance on Llama-3.1-8B-Instruct and Qwen2-7B-Instruct; and \textbf{(ii) Fast/Slow Thinking Switching}, where they enable adaptive reasoning on Qwen3-8B and DeepSeek-R1-Distil-Qwen-14B, reducing token generation by up to $5.7\times$ with minimal accuracy loss. Our findings establish KV caches as a free, effective substrate for sampling and reasoning, opening new directions for representation reuse in LLM inference. Code: https://github.com/cmd2001/ICLR2026_KV-Embedding.

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

↑