KVTuner: Sensitivity-Aware Layer-wise Mixed Precision KV Cache Quantization for Efficient and Nearly Lossless LLM Inference

要約

KVキャッシュの量子化は、LLMSの有効性を維持しながら、長いコンテキストと大規模なバッチサイズのシナリオで、大規模な言語モデル(LLMS)推論のスループットとレイテンシを改善できます。
ただし、現在の方法には、KVキャッシュの量子化に対するレイヤーごとの感受性、オンラインの微調整された意思決定の高いオーバーヘッド、さまざまなLLMSおよび制約に対する柔軟性が低いという3つの未解決の問題があります。
したがって、KVキャッシュ量子化エラーに対するレイヤーワイズトランスの注意パターンの固有の相関を徹底的に分析し、量子化エラー削減のための値キャッシュよりも重要なキャッシュが重要である理由を研究します。
さらに、単純なハードウェアにやさしいレイヤーワイズKV量子量化精度ペアを適応的に検索するためのシンプルでありながら効果的なフレームワークKVTunerを提案します。
オフラインキャリブレーションの計算コストを削減するために、レイヤー内KV精度ペアの剪定と層間クラスタリングを利用して、検索スペースを削減します。
実験結果は、LLAMA-3.1-8B-InstructなどのLLMのQWEN2.5-7B-intructのような高感度モデルの場合のLLMのほぼ損失のない3.25ビットの混合精度KVキャッシュ量子化を達成できることを示しています。
最大推論スループットは、さまざまなコンテキスト長にわたるKV8量子化と比較して38.3%改善できます。
コードと検索された構成は、https://github.com/cmd2001/kvtunerで入手できます。

要約(オリジナル)

KV cache quantization can improve Large Language Models (LLMs) inference throughput and latency in long contexts and large batch-size scenarios while preserving LLMs effectiveness. However, current methods have three unsolved issues: overlooking layer-wise sensitivity to KV cache quantization, high overhead of online fine-grained decision-making, and low flexibility to different LLMs and constraints. Therefore, we thoroughly analyze the inherent correlation of layer-wise transformer attention patterns to KV cache quantization errors and study why key cache is more important than value cache for quantization error reduction. We further propose a simple yet effective framework KVTuner to adaptively search for the optimal hardware-friendly layer-wise KV quantization precision pairs for coarse-grained KV cache with multi-objective optimization and directly utilize the offline searched configurations during online inference. To reduce the computational cost of offline calibration, we utilize the intra-layer KV precision pair pruning and inter-layer clustering to reduce the search space. Experimental results show that we can achieve nearly lossless 3.25-bit mixed precision KV cache quantization for LLMs like Llama-3.1-8B-Instruct and 4.0-bit for sensitive models like Qwen2.5-7B-Instruct on mathematical reasoning tasks. The maximum inference throughput can be improved by 38.3% compared with KV8 quantization over various context lengths. Our code and searched configurations are available at https://github.com/cmd2001/KVTuner.

arxiv情報

著者 Xing Li,Zeyu Xing,Yiming Li,Linping Qu,Hui-Ling Zhen,Wulong Liu,Yiwu Yao,Sinno Jialin Pan,Mingxuan Yuan
発行日 2025-02-24 16:36:32+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.CL, cs.LG パーマリンク