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

Cocktail:面向长上下文LLM推理的块自适应混合精度量化

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

Huazhong University of Science and Technology(华中科技大学);Ping An Technology (Shenzhen) Co., Ltd(平安科技(深圳)有限公司)

Wei Tao, Bin Zhang, Xiaoyang Qu, Jiguang Wan, Jianzong Wang

AI总结:

本文提出Cocktail方法,通过块级量化搜索和块级KV缓存计算优化长上下文LLM推理,在保持精度的同时提升硬件效率,优于现有KV缓存量化方法。

摘要:

最近,大型语言模型(LLMs)已经能够处理越来越长的上下文。然而,过长的上下文可能导致无法忍受的推理延迟和GPU内存占用。现有方法基于token粒度对LLMs中的键值(KV)缓存提出混合精度量化,这在搜索过程中耗时且在计算期间硬件效率低下。本文引入了一种名为Cocktail的新方法,该方法采用块自适应混合精度量化来优化KV缓存。Cocktail由两个模块组成:块级量化搜索和块级KV缓存计算。块级量化搜索基于相应上下文块与查询之间的相似度得分,快速确定KV缓存块的最佳位宽配置,同时保持模型精度。此外,块级KV缓存在量化前对KV缓存块进行重新排序,避免了推理计算中由混合精度量化引起的硬件低效问题。大量实验表明,Cocktail在各种模型和数据集上优于最先进的KV缓存量化方法。

英文摘要:

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.

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

↑