| --- |
| license: mit |
| dataset_info: |
| - config_name: multi_turn_choice_eng |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| - name: options |
| sequence: string |
| - name: id |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 46482955 |
| num_examples: 58 |
| download_size: 28590613 |
| dataset_size: 46482955 |
| - config_name: multi_turn_kv |
| features: |
| - name: id |
| dtype: int64 |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 20071200 |
| num_examples: 100 |
| download_size: 18278186 |
| dataset_size: 20071200 |
| - config_name: multi_turn_many_shot |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| - name: id |
| dtype: int64 |
| - name: task |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 4734315 |
| num_examples: 54 |
| download_size: 99406 |
| dataset_size: 4734315 |
| - config_name: multi_turn_mf |
| features: |
| - name: id |
| dtype: int64 |
| - name: context |
| sequence: int64 |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: int64 |
| - name: input |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 24065100 |
| num_examples: 100 |
| download_size: 3766479 |
| dataset_size: 24065100 |
| - config_name: multi_turn_prefix_suffix |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 17498600 |
| num_examples: 100 |
| download_size: 16417345 |
| dataset_size: 17498600 |
| - config_name: multi_turn_qa_chn |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| - name: id |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 180437341 |
| num_examples: 35 |
| download_size: 115936454 |
| dataset_size: 180437341 |
| - config_name: multi_turn_qa_eng |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| - name: id |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 58359967 |
| num_examples: 69 |
| download_size: 35648660 |
| dataset_size: 58359967 |
| - config_name: multi_turn_repoqa |
| features: |
| - name: context |
| dtype: string |
| - name: id |
| dtype: int64 |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: code_ratio |
| dtype: float64 |
| - name: description |
| dtype: string |
| - name: end_byte |
| dtype: int64 |
| - name: end_line |
| dtype: int64 |
| - name: func |
| dtype: string |
| - name: global_end_byte |
| dtype: int64 |
| - name: global_end_line |
| dtype: int64 |
| - name: global_start_byte |
| dtype: int64 |
| - name: global_start_line |
| dtype: int64 |
| - name: input |
| dtype: string |
| - name: name |
| dtype: string |
| - name: path |
| dtype: string |
| - name: start_byte |
| dtype: int64 |
| - name: start_line |
| dtype: int64 |
| - name: lang |
| dtype: string |
| - name: repo |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 24847710 |
| num_examples: 88 |
| download_size: 4427455 |
| dataset_size: 24847710 |
| - config_name: multi_turn_repoqa_and_kv |
| features: |
| - name: context |
| dtype: string |
| - name: id |
| dtype: int64 |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: code_ratio |
| dtype: float64 |
| - name: description |
| dtype: string |
| - name: end_byte |
| dtype: int64 |
| - name: end_line |
| dtype: int64 |
| - name: func |
| dtype: string |
| - name: global_end_byte |
| dtype: int64 |
| - name: global_end_line |
| dtype: int64 |
| - name: global_start_byte |
| dtype: int64 |
| - name: global_start_line |
| dtype: int64 |
| - name: input |
| dtype: string |
| - name: name |
| dtype: string |
| - name: path |
| dtype: string |
| - name: start_byte |
| dtype: int64 |
| - name: start_line |
| dtype: int64 |
| - name: task |
| dtype: string |
| - name: lang |
| dtype: string |
| - name: repo |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 25019328 |
| num_examples: 88 |
| download_size: 8583611 |
| dataset_size: 25019328 |
| - config_name: multi_turn_summary |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| - name: id |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 28622955 |
| num_examples: 70 |
| download_size: 14245669 |
| dataset_size: 28622955 |
| - config_name: multi_turn_summary_with_needles |
| features: |
| - name: context |
| dtype: string |
| - name: multi_turns |
| list: |
| - name: answer |
| dtype: string |
| - name: input |
| dtype: string |
| - name: task |
| dtype: string |
| - name: id |
| dtype: int64 |
| splits: |
| - name: train |
| num_bytes: 28629718 |
| num_examples: 70 |
| download_size: 14233712 |
| dataset_size: 28629718 |
| - config_name: multi_turn_vt |
| features: |
| - name: index |
| dtype: int64 |
| - name: input |
| dtype: string |
| - name: length |
| dtype: int64 |
| - name: multi_turns |
| list: |
| - name: answer |
| sequence: string |
| - name: input |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 42549030 |
| num_examples: 90 |
| download_size: 2160077 |
| dataset_size: 42549030 |
| configs: |
| - config_name: multi_turn_choice_eng |
| data_files: |
| - split: train |
| path: multi_turn_choice_eng/train-* |
| - config_name: multi_turn_kv |
| data_files: |
| - split: train |
| path: multi_turn_kv/train-* |
| - config_name: multi_turn_many_shot |
| data_files: |
| - split: train |
| path: multi_turn_many_shot/train-* |
| - config_name: multi_turn_mf |
| data_files: |
| - split: train |
| path: multi_turn_mf/train-* |
| - config_name: multi_turn_prefix_suffix |
| data_files: |
| - split: train |
| path: multi_turn_prefix_suffix/train-* |
| - config_name: multi_turn_qa_chn |
| data_files: |
| - split: train |
| path: multi_turn_qa_chn/train-* |
| - config_name: multi_turn_qa_eng |
| data_files: |
| - split: train |
| path: multi_turn_qa_eng/train-* |
| - config_name: multi_turn_repoqa |
| data_files: |
| - split: train |
| path: multi_turn_repoqa/train-* |
| - config_name: multi_turn_repoqa_and_kv |
| data_files: |
| - split: train |
| path: multi_turn_repoqa_and_kv/train-* |
| - config_name: multi_turn_summary |
| data_files: |
| - split: train |
| path: multi_turn_summary/train-* |
| - config_name: multi_turn_summary_with_needles |
| data_files: |
| - split: train |
| path: multi_turn_summary_with_needles/train-* |
| - config_name: multi_turn_vt |
| data_files: |
| - split: train |
| path: multi_turn_vt/train-* |
| --- |
| |
| # SCBench |
|
|
| [[Paper]](https://drive.google.com/file/d/1_DFu11V7HbktvEMRqMUAWGm7DTkVXlOR/view?usp=drive_link) |
| [[Code]](https://github.com/microsoft/MInference/SCBench) |
|
|
|  |
|
|
| SCBench (SharedContextBench) is a comprehensive benchmark to evaluate efficient long-context methods in a KV cache-centric perspective, analyzing their performance across **the full KV cache lifecycle (generation, compression, retrieval, and loading)** in real-world scenarios where context memory (KV cache) is shared and reused across multiple requests. |
|
|
| ## Dataset |
|
|
|  |
|
|
| SCBench covers 12 diverse tasks that test four key long-context capabilities: string retrieval, semantic retrieval, global information processing, and multi-tasking. |
|
|
| ### String Retrieval |
| - **Retr.KV**: Tests key-value lookup in large JSON objects with random, incompressible content |
| - **Retr.Prefix-Suffix**: Evaluates finding strings with specific prefix and suffix patterns |
| - **Retr.MultiHop**: Assesses multi-hop variable tracing capabilities in long inputs |
|
|
| ### Semantic Retrieval |
| - **Code.RepoQA**: Function retrieval from large codebases based on natural language descriptions |
| - **Language QA**: Includes English QA, Chinese QA, and multi-choice questions on long texts |
| - Requires semantic understanding on length inputs |
|
|
| ### Global Information Processing |
| - **Many-shot ICL**: Tests in-context learning with hundreds of examples |
| - **Math.Find**: Statistical tasks on large arrays |
| - **En.Sum**: Summarization of documents |
| - Requires global information processing or aggregation |
|
|
| ### Multi-Tasking |
| - **Mix.Sum+NIAH**: Combines summarization with needle-in-haystack search |
| - **Mix.RepoQA+KV**: Integrates code function retrieval with key-value lookup |
| - Requires multi-tasking or multi-step reasoning |
|
|
| ## Two Shared Context Modes |
| The benchmark evaluates these tasks across two shared context modes: |
| - **Multi-turn Mode**: Caches context within single sessions |
| - **Multi-request Mode**: Shares context across multiple sessions |
|
|
| ## Compared to previous long-context benchmarks |
|
|
|  |
|
|
| Our SCBench is the first long-context benchmark that covers single-turn, multi-turn, and multi-request scenarios. In addition, our impelmentation also involves KV cache reuse techniques, thereby providing a more comprehensive analysis on the full KV cache lifecycle of efficient long-context methods. |
|
|
| ## Results and Findings |
|
|
|  |
|
|
| Our SCBench reveals that the following key insights: |
|
|
| ### Finding 1: Sub-O(n) Memory is Problematic in Multi-Request/Multi-Turn Decoding |
| - Sparse decoding methods with sub-O(n) memory perform well on first queries but lose accuracy in subsequent requests |
| - Methods maintaining O(n) memory with sub-O(n²) computation during pre-filling can better approximate full attention accuracy across multiple queries |
|
|
| ### Finding 2: Task Performance Shows Varying Decline Patterns |
| - Sparse KV cache methods excel in tasks requiring global information processing |
| - O(n) memory is essential for tasks involving exact match retrieval |
|
|
| ### Finding 3: Performance vs Compression Rate |
| - All methods show performance degradation as compression rates increase |
| - Sub-O(n) memory methods exhibit significant drop at 1/4 compression rate |
| - Methods like RetrievalAttention and KIVI that maintain O(n) memory with sparse decoding show better resilience at higher compression rates |
|
|
| ### Finding 4: Issues with Long-Generation Scenarios |
| - Attention distribution shifts significantly as generation length and number of rounds increase |
| - This out-of-distribution (OOD) issue impacts performance even for O(n) memory methods |
|
|
| ### Finding 5: Dynamic vs Static Patterns |
| - Dynamic sparse patterns generally outperform static patterns |
|
|
| ## Citation |
|
|
| ```bibtex |
| @article{li2024scbench, |
| title={SCBench: A KV cache-centric analysis of long-context methods}, |
| author={Li, Yucheng and Jiang, Huiqiang and Wu, Qianhui and Luo, Xufang and Ahn, Surin and Zhang, Chengruidong and Abdi, Amir H and Li, Dongsheng and Gao, Jianfeng and Yang, Yuqing and Qiu, Lili}, |
| journal={arXiv preprint arXiv:2412.}, |
| year={2024} |
| } |
| ``` |