ChatPaper.aiChatPaper

Q-Filters: QKジオメトリを活用した効率的なKVキャッシュ圧縮

Q-Filters: Leveraging QK Geometry for Efficient KV Cache Compression

March 4, 2025
著者: Nathan Godey, Alessio Devoto, Yu Zhao, Simone Scardapane, Pasquale Minervini, Éric de la Clergerie, Benoît Sagot
cs.AI

要旨

自己回帰型言語モデルは、生成時に過去の隠れ状態を再計算する必要をなくし、処理を高速化するためのKey-Value(KV)キャッシュに依存しています。しかし、モデルサイズやコンテキスト長が増大するにつれ、このKVキャッシュはメモリのボトルネックとなり、生成中にそのサイズを制限する圧縮手法が求められています。本論文では、アテンションスコアをアテンションマップを計算することなく効率的に近似することを可能にする、Query(Q)ベクトルとKey(K)ベクトルの驚くべき特性を発見しました。我々は、Q-Filtersというトレーニング不要のKVキャッシュ圧縮手法を提案します。これは、単一のコンテキスト非依存の射影に基づいて、重要度の低いKey-Valueペアをフィルタリングするものです。多くの代替手法とは異なり、Q-FiltersはFlashAttentionと互換性があり、アテンション重みへの直接アクセスを必要としません。長文コンテキスト設定での実験結果は、Q-Filtersが検索タスクにおいてSnapKVのようなアテンションベースの圧縮手法と競合し、生成設定ではStreaming-LLMのような効率的な圧縮スキームを一貫して上回ることを示しています。特に、Q-Filtersは、針を干し草の山から探すタスクにおいてx32の圧縮レベルで99%の精度を達成し、テキスト生成においてStreaming-LLMと比較して生成時のパープレキシティ低下を最大65%削減しました。
English
Autoregressive language models rely on a Key-Value (KV) Cache, which avoids re-computing past hidden states during generation, making it faster. As model sizes and context lengths grow, the KV Cache becomes a significant memory bottleneck, which calls for compression methods that limit its size during generation. In this paper, we discover surprising properties of Query (Q) and Key (K) vectors that allow us to efficiently approximate attention scores without computing the attention maps. We propose Q-Filters, a training-free KV Cache compression method that filters out less crucial Key-Value pairs based on a single context-agnostic projection. Contrarily to many alternatives, Q-Filters is compatible with FlashAttention, as it does not require direct access to attention weights. Experimental results in long-context settings demonstrate that Q-Filters is competitive with attention-based compression methods such as SnapKV in retrieval tasks while consistently outperforming efficient compression schemes such as Streaming-LLM in generation setups. Notably, Q-Filters achieves a 99% accuracy in the needle-in-a-haystack task with a x32 compression level while reducing the generation perplexity drop by up to 65% in text generation compared to Streaming-LLM.

Summary

AI-Generated Summary

PDF92March 5, 2025