ChatPaper.aiChatPaper

xKV: KVキャッシュ圧縮のためのクロスレイヤーSVD

xKV: Cross-Layer SVD for KV-Cache Compression

March 24, 2025
著者: Chi-Chih Chang, Chien-Yu Lin, Yash Akhauri, Wei-Cheng Lin, Kai-Chiang Wu, Luis Ceze, Mohamed S. Abdelfattah
cs.AI

要旨

長いコンテキストウィンドウを持つ大規模言語モデル(LLM)は強力なアプリケーションを可能にしますが、キーとバリューの状態(KVキャッシュ)を保存するための高いメモリ消費が伴います。最近の研究では、複数の層からのKVキャッシュを共有表現に統合しようと試みましたが、これらのアプローチは高価な事前学習を必要とするか、層間での高いトークンごとのコサイン類似性を仮定しており、これは一般的に実際には成立しません。我々は、KVキャッシュの複数の層間で支配的な特異ベクトルが驚くほどよく整列していることを発見しました。この洞察を活用して、我々はxKVを提案します。これは、グループ化された層のKVキャッシュに特異値分解(SVD)を適用するシンプルなポストトレーニング手法です。xKVは、複数の層のKVキャッシュを共有された低ランク部分空間に統合し、KVキャッシュのサイズを大幅に削減します。広く使用されているLLM(例:Llama-3.1やQwen2.5)を用いたRULER長文コンテキストベンチマークでの広範な評価を通じて、xKVは最先端の層間技術と比べて最大6.8倍の高い圧縮率を達成し、精度を2.7%向上させました。さらに、xKVは新興のマルチヘッド潜在アテンション(MLA)(例:DeepSeek-Coder-V2)と互換性があり、コーディングタスクで性能低下なしに注目すべき3倍の圧縮率を実現しました。これらの結果は、長文コンテキストLLM推論におけるメモリボトルネックに対処するxKVの強力な能力と汎用性を強調しています。我々のコードは以下で公開されています: https://github.com/abdelfattah-lab/xKV。
English
Large Language Models (LLMs) with long context windows enable powerful applications but come at the cost of high memory consumption to store the Key and Value states (KV-Cache). Recent studies attempted to merge KV-cache from multiple layers into shared representations, yet these approaches either require expensive pretraining or rely on assumptions of high per-token cosine similarity across layers which generally does not hold in practice. We find that the dominant singular vectors are remarkably well-aligned across multiple layers of the KV-Cache. Exploiting this insight, we propose xKV, a simple post-training method that applies Singular Value Decomposition (SVD) on the KV-Cache of grouped layers. xKV consolidates the KV-Cache of multiple layers into a shared low-rank subspace, significantly reducing KV-Cache sizes. Through extensive evaluations on the RULER long-context benchmark with widely-used LLMs (e.g., Llama-3.1 and Qwen2.5), xKV achieves up to 6.8x higher compression rates than state-of-the-art inter-layer technique while improving accuracy by 2.7%. Moreover, xKV is compatible with the emerging Multi-Head Latent Attention (MLA) (e.g., DeepSeek-Coder-V2), yielding a notable 3x compression rates on coding tasks without performance degradation. These results highlight xKV's strong capability and versatility in addressing memory bottlenecks for long-context LLM inference. Our code is publicly available at: https://github.com/abdelfattah-lab/xKV.

Summary

AI-Generated Summary

PDF41March 26, 2025