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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Li, Yucheng, Jiang, Huiqiang, Wu, Qianhui, Luo, Xufang, Ahn, Surin, Zhang, Chengruidong, Abdi, Amir H., Li, Dongsheng, Gao, Jianfeng, Yang, Yuqing, Qiu, Lili
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866929752188649472
author Li, Yucheng
Jiang, Huiqiang
Wu, Qianhui
Luo, Xufang
Ahn, Surin
Zhang, Chengruidong
Abdi, Amir H.
Li, Dongsheng
Gao, Jianfeng
Yang, Yuqing
Qiu, Lili
author_facet Li, Yucheng
Jiang, Huiqiang
Wu, Qianhui
Luo, Xufang
Ahn, Surin
Zhang, Chengruidong
Abdi, Amir H.
Li, Dongsheng
Gao, Jianfeng
Yang, Yuqing
Qiu, Lili
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2412_10319
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle SCBench: A KV Cache-Centric Analysis of Long-Context Methods
Li, Yucheng
Jiang, Huiqiang
Wu, Qianhui
Luo, Xufang
Ahn, Surin
Zhang, Chengruidong
Abdi, Amir H.
Li, Dongsheng
Gao, Jianfeng
Yang, Yuqing
Qiu, Lili
Computation and Language
Machine Learning
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.
title SCBench: A KV Cache-Centric Analysis of Long-Context Methods
topic Computation and Language
Machine Learning
url https://arxiv.org/abs/2412.10319