arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2501.19392cs.LG
收藏

Cache Me If You Must: 大型语言模型的自适应键值量化

Cache Me If You Must: Adaptive Key-Value Quantization for Large Language Models

HSE University(高等经济大学)

Alina Shutova, Vladimir Malinovskii, Vage Egiazarian, Denis Kuznedelev, Denis Mazur, Nikita Surkov, Ivan Ermakov, Dan Alistarh

AI总结:

本文提出AQUA-KV,一种基于紧凑适配器利用键值依赖的自适应量化方法,在Llama 3.2上实现每值2-2.5比特的近乎无损压缩,显著提升压缩率并保持高精度。

摘要:

大型语言模型(LLM)的高效实际部署依赖于键值(KV)缓存来处理和生成长输出,从而减少重复计算的需求。对于大上下文,键值缓存可能占用数十GB的设备内存,因为它们存储每个令牌和层的向量表示。最近的研究表明,缓存的向量可以通过量化、剪枝或合并进行压缩,但这些技术往往在较高压缩率下损害质量。在这项工作中,我们旨在通过利用两个观察来改进键和值压缩:1)不同层之间键和值的固有依赖关系,以及2)内部网络状态的高压缩机制。我们提出了AQUA-KV,一种用于键值缓存的自适应量化方法,它依赖紧凑的适配器来利用键和值之间的现有依赖关系,并旨在“最优地”压缩无法预测的信息。AQUA-KV显著提高了压缩率,同时在最先进的LLM家族上保持高精度。在Llama 3.2 LLM上,我们实现了每值2-2.5比特的近乎无损推理,困惑度和LongBench分数的相对误差低于1%。AQUA-KV是一次性的、简单且高效的:它可以在单个GPU上1-6小时内完成校准,即使对于70B模型也是如此。

英文摘要:

Efficient real-world deployments of large language models (LLMs) rely on Key-Value (KV) caching for processing and generating long outputs, reducing the need for repetitive computation. For large contexts, Key-Value caches can take up tens of gigabytes of device memory, as they store vector representations for each token and layer. Recent work has shown that the cached vectors can be compressed through quantization, pruning or merging, but these techniques often compromise quality towards higher compression rates. In this work, we aim to improve Key & Value compression by exploiting two observations: 1) the inherent dependencies between keys and values across different layers, and 2) high-compression mechanisms for internal network states. We propose AQUA-KV, an adaptive quantization for Key-Value caches that relies on compact adapters to exploit existing dependencies between Keys and Values, and aims to "optimally" compress the information that cannot be predicted. AQUA-KV significantly improves compression rates, while maintaining high accuracy on state-of-the-art LLM families. On Llama 3.2 LLMs, we achieve near-lossless inference at 2-2.5 bits per value with under $1\%$ relative error in perplexity and LongBench scores. AQUA-KV is one-shot, simple, and efficient: it can be calibrated on a single GPU within 1-6 hours, even for 70B models.

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

↑