SCBench:長文脈メソッドのKVキャッシュ中心分析
SCBench: A KV Cache-Centric Analysis of Long-Context Methods
December 13, 2024
著者: Yucheng Li, Huiqiang Jiang, Qianhui Wu, Xufang Luo, Surin Ahn, Chengruidong Zhang, Amir H. Abdi, Dongsheng Li, Jianfeng Gao, Yuqing Yang, Lili Qiu
cs.AI
要旨
長い文脈を持つLLMは、多くの下流アプリケーションを可能にしましたが、計算とメモリの効率に関連する重要な課題も導入しました。これらの課題に対処するために、長い文脈推論のための最適化が開発され、KVキャッシュを中心としています。ただし、既存のベンチマークはしばしば単一リクエストで評価され、実世界でのKVキャッシュの完全なライフサイクルを無視しています。この見落としは特に重要であり、KVキャッシュの再利用は、vLLMやSGLangなどのLLM推論フレームワーク、およびOpenAI、Microsoft、Google、AnthropicなどのLLMプロバイダーで広く採用されています。このギャップを埋めるために、私たちはSCBench(SharedContextBench)を導入しました。これは、KVキャッシュ中心の視点から長い文脈手法を評価する包括的なベンチマークです。具体的には、SCBenchは、共有コンテキストを持つテスト例を使用し、12のタスクと2つの共有コンテキストモードをカバーする4つの長い文脈能力のカテゴリを対象としています。これにより、Gated Linear RNN、Mamba-Attentionハイブリッドなどの8つのカテゴリの長い文脈ソリューションについて、KVキャッシュ中心の包括的な分析を提供します。評価は8つの長い文脈LLMで行われます。私たちの調査結果は、サブO(n)メモリ手法がマルチターンシナリオで苦戦する一方、O(n)メモリとサブO(n^2)プリフィリング計算を持つ疎な符号化が堅調に機能することを示しています。動的スパース性は、静的パターンよりも表現力豊かなKVキャッシュを提供し、ハイブリッドアーキテクチャのレイヤーレベルのスパース性は、強力なパフォーマンスとともにメモリ使用量を削減します。さらに、長い生成シナリオでの注意分布のシフト問題を特定しました。https://aka.ms/SCBench.
English
Long-context LLMs have enabled numerous downstream applications but also
introduced significant challenges related to computational and memory
efficiency. To address these challenges, optimizations for long-context
inference have been developed, centered around the KV cache. However, existing
benchmarks often evaluate in single-request, neglecting the full lifecycle of
the KV cache in real-world use. This oversight is particularly critical, as KV
cache reuse has become widely adopted in LLMs inference frameworks, such as
vLLM and SGLang, as well as by LLM providers, including OpenAI, Microsoft,
Google, and Anthropic. To address this gap, we introduce
SCBench(SharedContextBench), a comprehensive benchmark for evaluating
long-context methods from a KV cachecentric perspective: 1) KV cache
generation, 2) KV cache compression, 3) KV cache retrieval, 4) KV cache
loading. Specifically, SCBench uses test examples with shared context, ranging
12 tasks with two shared context modes, covering four categories of
long-context capabilities: string retrieval, semantic retrieval, global
information, and multi-task. With it, we provide an extensive KV cache-centric
analysis of eight categories long-context solutions, including Gated Linear
RNNs, Mamba-Attention hybrids, and efficient methods such as sparse attention,
KV cache dropping, quantization, retrieval, loading, and prompt compression.
The evaluation is conducted on 8 long-context LLMs. Our findings show that
sub-O(n) memory methods suffer in multi-turn scenarios, while sparse encoding
with O(n) memory and sub-O(n^2) pre-filling computation perform robustly.
Dynamic sparsity yields more expressive KV caches than static patterns, and
layer-level sparsity in hybrid architectures reduces memory usage with strong
performance. Additionally, we identify attention distribution shift issues in
long-generation scenarios. https://aka.ms/SCBench.Summary
AI-Generated Summary