arXiv:2503.23294cs.CL2025-03中稿 · the Design, Automa…被引 10

提出Cocktail方法,高效压缩长文本推理的缓存数据

Cocktail: Chunk-Adaptive Mixed-Precision Quantization for Long-Context LLM Inference

  • 按上下文块自适应选择量化精度,快速确定最佳位宽配置
  • 通过重排缓存块,避免混合精度计算导致的硬件效率下降
  • 在多个模型和数据集上显著降低延迟与显存占用,适合长文本场景

近年来,大语言模型能够处理越来越长的上下文。但过长的上下文会导致不可接受的推理延迟和GPU显存占用。现有方法基于词元粒度对大语言模型的键值(KV)缓存进行混合精度量化,搜索过程耗时且计算时硬件效率低。本文提出一种新方法Cocktail,采用块自适应混合精度量化优化KV缓存。Cocktail包含两个模块:块级量化搜索与块级缓存计算。块级量化搜索基于上下文块与查询之间的相似性得分,快速确定最优位宽配置,保持模型精度;块级缓存计算在量化前重排缓存块,避免混合精度量化带来的推理计算硬件效率低下问题。大量实验表明,Cocktail在多种模型与数据集上均优于当前最优的KV缓存量化方法。

原文摘要 · Abstract (English)

Recently, large language models (LLMs) have been able to handle longer and longer contexts. However, a context that is too long may cause intolerant inference latency and GPU memory usage. Existing methods propose mixed-precision quantization to the key-value (KV) cache in LLMs based on token granularity, which is time-consuming in the search process and hardware inefficient during computation. This paper introduces a novel approach called Cocktail, which employs chunk-adaptive mixed-precision quantization to optimize the KV cache. Cocktail consists of two modules: chunk-level quantization search and chunk-level KV cache computation. Chunk-level quantization search determines the optimal bitwidth configuration of the KV cache chunks quickly based on the similarity scores between the corresponding context chunks and the query, maintaining the model accuracy. Furthermore, chunk-level KV cache computation reorders the KV cache chunks before quantization, avoiding the hardware inefficiency caused by mixed-precision quantization in inference computation. Extensive experiments demonstrate that Cocktail outperforms state-of-the-art KV cache quantization methods on various models and datasets.

量化长文本推理优化LLM

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