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

KV-CAR: 使用自编码器和KV重用的KV缓存压缩

KV-CAR: KV Cache Compression using Autoencoders and KV Reuse in Large Language Models

Elmore Family School of Electrical and Computer Engineering, Purdue University, West Lafayette, IN(电气与计算机工程系,普渡大学,西拉法叶,印第安纳州)

Sourjya Roy, Shrihari Sridharan, Surya Selvam, Anand Raghunathan

AI总结:

KV-CAR通过自编码器和KV重用技术,有效压缩KV缓存,减少内存占用,提升大语言模型推理效率。

摘要:

随着大型语言模型(LLMs)在规模和上下文长度上的增长,键值(KV)缓存的内存需求已成为自回归解码过程中的主要瓶颈。KV缓存随着序列长度和嵌入维度的增长而增长,通常超过模型本身的内存占用,并限制了可实现的批量大小和上下文窗口。为了解决这一挑战,我们提出了KV CAR,一种统一且架构无关的框架,可以显著减少KV缓存的存储需求,同时保持模型的保真度。KV CAR结合了两种互补的技术。首先,一个轻量级的自编码器学习了键和值张量在嵌入维度上的紧凑表示,在存储到KV缓存之前压缩它们,并在检索时恢复它们。其次,一个基于相似性的重用机制识别了在相邻层中特定注意力头的KV张量的重用机会。这些方法在不改变Transformer架构的情况下,减少了KV张量中的维度和结构冗余。在GPT 2和TinyLLaMA模型上对WikiText、C4、PIQA和Winogrande数据集的评估表明,KV CAR实现了高达47.85%的KV缓存内存减少,对困惑度和零样本准确率的影响很小。在NVIDIA A40 GPU上的系统级测量显示,减少的KV足迹直接转化为推理过程中更长的序列长度和更大的批量大小。这些结果突显了KV CAR在实现内存高效的LLM推理方面的有效性。

英文摘要:

As Large Language Models (LLMs) scale in size and context length, the memory requirements of the key value (KV) cache have emerged as a major bottleneck during autoregressive decoding. The KV cache grows with sequence length and embedding dimension, often exceeding the memory footprint of the model itself and limiting achievable batch sizes and context windows. To address this challenge, we present KV CAR, a unified and architecture agnostic framework that significantly reduces KV cache storage while maintaining model fidelity. KV CAR combines two complementary techniques. First, a lightweight autoencoder learns compact representations of key and value tensors along the embedding dimension, compressing them before they are stored in the KV cache and restoring them upon retrieval. Second, a similarity driven reuse mechanism identifies opportunities to reuse KV tensors of specific attention heads across adjacent layers. Together, these methods reduce the dimensional and structural redundancy in KV tensors without requiring changes to the transformer architecture. Evaluations on GPT 2 and TinyLLaMA models across Wikitext, C4, PIQA, and Winogrande datasets demonstrate that KV CAR achieves up to 47.85 percent KV cache memory reduction with minimal impact on perplexity and zero shot accuracy. System level measurements on an NVIDIA A40 GPU show that the reduced KV footprint directly translates into longer sequence lengths and larger batch sizes during inference. These results highlight the effectiveness of KV CAR in enabling memory efficient LLM inference.

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

↑