arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.03111cs.LGcs.AIcs.CL

LoRC:面向LLMs KV缓存且采用渐进式压缩策略的低秩压缩方法

LoRC: Low-Rank Compression for LLMs KV Cache with a Progressive Compression Strategy

Georgia Tech(佐治亚理工学院);Microsoft(微软公司)

Rongzhi Zhang, Kuang Wang, Liyuan Liu, Shuohang Wang, Hao Cheng, Chao Zhang, Yelong Shen

AI总结:

本文提出LoRC方法,通过对LLMs的KV权重矩阵进行低秩近似并结合渐进式压缩策略,在无需重新训练和任务特异性分析的情况下,显著降低GPU内存占用并保持模型性能。

摘要:

键值(KV)缓存是服务基于Transformer的自回归大语言模型(LLMs)的关键组件,它通过存储先前计算的KV向量来加速推理。然而,其内存消耗随序列长度和批量大小线性增长,成为LLM部署中的重大瓶颈。现有缓解该问题的方法包括:(1)在升级(upcycling)阶段集成的高效注意力变体,这需要大量参数调优,因此不适用于预训练LLMs;(2)测试时的KV缓存压缩,主要通过令牌逐出策略实现,但往往忽视层间依赖且可能具有任务特异性。本文引入了一种正交的KV缓存压缩方法。我们提出对KV权重矩阵进行低秩近似,使其能够以即插即用方式集成到现有基于Transformer的LLMs中,无需重新训练模型。为了在权重层面有效压缩KV缓存,我们针对逐层敏感性进行调整,并引入一种渐进式压缩策略,该策略得到了我们关于深层网络中压缩误差如何累积的理论分析的支持。我们的方法设计为无需在升级阶段进行模型调优,也无需在测试阶段进行任务特异性分析。在参数规模从8B到70B的LLaMA模型上跨多种任务进行的大量实验表明,我们的方法在保持性能的同时显著降低了GPU内存占用。

英文摘要:

The Key-Value (KV) cache is a crucial component in serving transformer-based autoregressive large language models (LLMs), enabling faster inference by storing previously computed KV vectors. However, its memory consumption scales linearly with sequence length and batch size, posing a significant bottleneck in LLM deployment. Existing approaches to mitigate this issue include: (1) efficient attention variants integrated in upcycling stages, which requires extensive parameter tuning thus unsuitable for pre-trained LLMs; (2) KV cache compression at test time, primarily through token eviction policies, which often overlook inter-layer dependencies and can be task-specific. This paper introduces an orthogonal approach to KV cache compression. We propose a low-rank approximation of KV weight matrices, allowing for plug-in integration with existing transformer-based LLMs without model retraining. To effectively compress KV cache at the weight level, we adjust for layerwise sensitivity and introduce a progressive compression strategy, which is supported by our theoretical analysis on how compression errors accumulate in deep networks. Our method is designed to function without model tuning in upcycling stages or task-specific profiling in test stages. Extensive experiments with LLaMA models ranging from 8B to 70B parameters across various tasks show that our approach significantly reduces the GPU memory footprint while maintaining performance.

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

↑