SpeCache: Speculative Key-Value Caching for Efficient Generation of LLMs

要約

トランスベースの大手言語モデル(LLM)はすでに長いテキストタスクで顕著な結果を達成していますが、限られたGPUメモリ(VRAM)リソースは、シーケンスの長さが増加するにつれて、キー値(kV)キャッシュの直線的に成長する需要に対応するのに苦労しており、長いシーケンスにLLMを適用するためのボトルネックになりました。
既存のKVキャッシュ圧縮方法には、KVキャッシュの立ち退き、マージ、または量子化がそのサイズを縮小することが含まれます。
ただし、圧縮により不可逆的な情報が忘れられ、その後のデコードの精度に影響を与える可能性があります。
このホワイトペーパーでは、Specacheを提案します。これは、大きくて簡単に拡張可能なCPUメモリを最大限に活用して、完全なKVキャッシュをオフロードし、VRAMの低ビットKVキャッシュコピーで測定された重要性に基づいて、各デコードステップにKVペアを動的にフェッチします。
CPU-GPU通信によって引き起こされる推論の遅延を回避するために、Specacheは次のトークンが出席するKVペアを投機的に予測し、次のデコードステップの前にプリフェッチと計算の並列化を可能にする次のデコードステップの前にプリフェッチすることができます。
ロングベンチとヘイスタックのベンチマークでの実験では、10倍のKVキャッシュ圧縮率があっても、再トレーニングなしで長いシーケンスの忘却を忘れながら、SpecacheがVRAMの使用量を効果的に削減することを確認します。

要約(オリジナル)

Transformer-based large language models (LLMs) have already achieved remarkable results on long-text tasks, but the limited GPU memory (VRAM) resources struggle to accommodate the linearly growing demand for key-value (KV) cache as the sequence length increases, which has become a bottleneck for the application of LLMs on long sequences. Existing KV cache compression methods include eviction, merging, or quantization of the KV cache to reduce its size. However, compression results in irreversible information forgetting, potentially affecting the accuracy of subsequent decoding. In this paper, we propose SpeCache, which takes full advantage of the large and easily expandable CPU memory to offload the complete KV cache, and dynamically fetches KV pairs back in each decoding step based on their importance measured by low-bit KV cache copy in VRAM. To avoid inference latency caused by CPU-GPU communication, SpeCache speculatively predicts the KV pairs that the next token might attend to, allowing us to prefetch them before the next decoding step which enables parallelization of prefetching and computation. Experiments on LongBench and Needle-in-a-Haystack benchmarks verify that SpeCache effectively reduces VRAM usage while avoiding information forgetting for long sequences without re-training, even with a 10x high KV cache compression ratio.

arxiv情報

著者 Shibo Jie,Yehui Tang,Kai Han,Zhi-Hong Deng,Jing Han
発行日 2025-03-20 14:01:56+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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