arXiv:2508.10395cs.LG2025-08被引 3

用输入激活重计算代替键值缓存,大幅降低大模型推理内存占用。

XQuant: Breaking the Memory Wall for LLM Inference with KV Cache Rematerialization

  • 用输入激活X替代标准键值缓存,运行时动态重算键值。
  • 相比FP16基线最高省7.7倍内存,困惑度损失小于0.1。
  • 跨层相似性优化实现10倍内存压缩,适合部署资源受限场景。

尽管大语言模型推理已成为众多下游应用的关键负载,但其庞大的内存占用和带宽需求使其高效推理极具挑战。近年来,计算能力持续超越内存容量与带宽,这一趋势在现代GPU上尤为明显,加剧了大模型推理的瓶颈。为此,我们提出XQuant,利用计算能力提升的趋势,通过低比特量化实现内存消耗量级下降,相较当前最先进的键值缓存量化方法具有显著精度优势。该方法不缓存标准键值对,而是量化并缓存层输入激活X,推理时动态重计算键值。相比传统键值缓存,直接节省2倍内存。使用XQuant,相较于FP16基线最高实现约7.7倍内存节省,且困惑度下降小于0.1。进一步地,基于输入嵌入X在不同层间具有高度相似性的观察,我们提出XQuant-CL,实现极致压缩。在多个模型上,该方法相较FP16基线最多实现10倍内存节省,仅产生0.01困惑度损失;或实现12.5倍内存节省,困惑度损失仅0.1。XQuant利用硬件计算能力的快速增长,突破内存瓶颈,超越现有键值缓存量化方法,在多种模型上接近FP16精度。

原文摘要 · Abstract (English)

Although LLM inference has emerged as a critical workload for many downstream applications, efficiently inferring LLMs is challenging due to the substantial memory footprint and bandwidth requirements. In parallel, compute capabilities have steadily outpaced both memory capacity and bandwidth over the last few decades, a trend that remains evident in modern GPU hardware and exacerbates the challenge of LLM inference. As such, new algorithms are emerging that trade increased computation for reduced memory operations. To that end, we present XQuant, which takes advantage of this trend, enabling an order-of-magnitude reduction in memory consumption through low-bit quantization with substantial accuracy benefits relative to state-of-the-art KV cache quantization methods. We accomplish this by quantizing and caching the layer input activations X, instead of using standard KV caching, and then rematerializing the Keys and Values on-the-fly during inference. This results in an immediate 2$\times$ memory savings compared to KV caching. By applying XQuant, we achieve up to $\sim 7.7\times$ memory savings with $<0.1$ perplexity degradation compared to the FP16 baseline. Furthermore, our approach leverages the fact that X values are similar across layers. Building on this observation, we introduce XQuant-CL, which exploits the cross-layer similarity in the X embeddings for extreme compression. Across different models, XQuant-CL attains up to 10$\times$ memory savings relative to the FP16 baseline with only 0.01 perplexity degradation, and 12.5$\times$ memory savings with only $0.1$ perplexity degradation. XQuant exploits the rapidly increasing compute capabilities of hardware platforms to eliminate the memory bottleneck, while surpassing state-of-the-art KV cache quantization methods and achieving near-FP16 accuracy across a wide range of models.

大模型推理内存优化量化KV缓存

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。