ChatPaper.aiChatPaper

SCBench: Een analyse van lange-contextmethoden met een focus op KV-cache.

SCBench: A KV Cache-Centric Analysis of Long-Context Methods

December 13, 2024
Auteurs: 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

Samenvatting

Long-context LLM's hebben tal van downstream toepassingen mogelijk gemaakt, maar hebben ook aanzienlijke uitdagingen geïntroduceerd met betrekking tot computationele en geheugenefficiëntie. Om deze uitdagingen aan te pakken, zijn optimalisaties voor lang-context inferentie ontwikkeld, gericht op de KV-cache. Bestaande benchmarks evalueren echter vaak op basis van enkelvoudige verzoeken, waarbij het volledige levenscyclus van de KV-cache in echt gebruik wordt verwaarloosd. Deze omissie is bijzonder kritiek, aangezien het hergebruik van de KV-cache wijdverbreid is geworden in LLM's inferentiekaders, zoals vLLM en SGLang, evenals bij LLM-providers, waaronder OpenAI, Microsoft, Google en Anthropic. Om deze lacune aan te pakken, introduceren we SCBench (SharedContextBench), een uitgebreide benchmark voor het evalueren van lang-context methoden vanuit een KV-cachegericht perspectief: 1) KV-cache generatie, 2) KV-cache compressie, 3) KV-cache ophalen, 4) KV-cache laden. Specifiek maakt SCBench gebruik van testvoorbeelden met gedeelde context, bestrijkend 12 taken met twee gedeelde contextmodi, die vier categorieën van lang-context mogelijkheden omvatten: string ophalen, semantisch ophalen, globale informatie en multi-taak. Hiermee bieden we een uitgebreide KV-cachegerichte analyse van acht categorieën lang-context oplossingen, waaronder Gated Linear RNN's, Mamba-Attention hybriden, en efficiënte methoden zoals schaarse aandacht, KV-cache verwijdering, kwantisering, ophalen, laden en promptcompressie. De evaluatie wordt uitgevoerd op 8 lang-context LLM's. Onze bevindingen tonen aan dat sub-O(n) geheugenmethoden lijden in multi-turn scenario's, terwijl schaarse encoding met O(n) geheugen en sub-O(n^2) voorvulberekening robuust presteren. Dynamische spaarzaamheid levert expressievere KV-caches op dan statische patronen, en laagniveau spaarzaamheid in hybride architecturen vermindert geheugengebruik met sterke prestaties. Bovendien identificeren we aandachtsverdelingsproblemen in lang-generatiescenario's. 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.
PDF112December 16, 2024