liyucheng commited on
Commit
8243c17
1 Parent(s): 8bb28e2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +421 -337
README.md CHANGED
@@ -1,337 +1,421 @@
1
- ---
2
- license: mit
3
- dataset_info:
4
- - config_name: multi_turn_choice_eng
5
- features:
6
- - name: context
7
- dtype: string
8
- - name: multi_turns
9
- list:
10
- - name: answer
11
- dtype: string
12
- - name: input
13
- dtype: string
14
- - name: options
15
- sequence: string
16
- - name: id
17
- dtype: int64
18
- splits:
19
- - name: train
20
- num_bytes: 46482955
21
- num_examples: 58
22
- download_size: 28590613
23
- dataset_size: 46482955
24
- - config_name: multi_turn_kv
25
- features:
26
- - name: id
27
- dtype: int64
28
- - name: context
29
- dtype: string
30
- - name: multi_turns
31
- list:
32
- - name: answer
33
- dtype: string
34
- - name: input
35
- dtype: string
36
- splits:
37
- - name: train
38
- num_bytes: 20071200
39
- num_examples: 100
40
- download_size: 18278186
41
- dataset_size: 20071200
42
- - config_name: multi_turn_many_shot
43
- features:
44
- - name: context
45
- dtype: string
46
- - name: multi_turns
47
- list:
48
- - name: answer
49
- dtype: string
50
- - name: input
51
- dtype: string
52
- - name: id
53
- dtype: int64
54
- - name: task
55
- dtype: string
56
- splits:
57
- - name: train
58
- num_bytes: 4734315
59
- num_examples: 54
60
- download_size: 99406
61
- dataset_size: 4734315
62
- - config_name: multi_turn_mf
63
- features:
64
- - name: id
65
- dtype: int64
66
- - name: context
67
- sequence: int64
68
- - name: multi_turns
69
- list:
70
- - name: answer
71
- dtype: int64
72
- - name: input
73
- dtype: string
74
- splits:
75
- - name: train
76
- num_bytes: 24065100
77
- num_examples: 100
78
- download_size: 3766479
79
- dataset_size: 24065100
80
- - config_name: multi_turn_prefix_suffix
81
- features:
82
- - name: context
83
- dtype: string
84
- - name: multi_turns
85
- list:
86
- - name: answer
87
- dtype: string
88
- - name: input
89
- dtype: string
90
- splits:
91
- - name: train
92
- num_bytes: 17498600
93
- num_examples: 100
94
- download_size: 16417345
95
- dataset_size: 17498600
96
- - config_name: multi_turn_qa_chn
97
- features:
98
- - name: context
99
- dtype: string
100
- - name: multi_turns
101
- list:
102
- - name: answer
103
- dtype: string
104
- - name: input
105
- dtype: string
106
- - name: id
107
- dtype: int64
108
- splits:
109
- - name: train
110
- num_bytes: 180437341
111
- num_examples: 35
112
- download_size: 115936454
113
- dataset_size: 180437341
114
- - config_name: multi_turn_qa_eng
115
- features:
116
- - name: context
117
- dtype: string
118
- - name: multi_turns
119
- list:
120
- - name: answer
121
- dtype: string
122
- - name: input
123
- dtype: string
124
- - name: id
125
- dtype: int64
126
- splits:
127
- - name: train
128
- num_bytes: 58359967
129
- num_examples: 69
130
- download_size: 35648660
131
- dataset_size: 58359967
132
- - config_name: multi_turn_repoqa
133
- features:
134
- - name: context
135
- dtype: string
136
- - name: id
137
- dtype: int64
138
- - name: multi_turns
139
- list:
140
- - name: answer
141
- dtype: string
142
- - name: code_ratio
143
- dtype: float64
144
- - name: description
145
- dtype: string
146
- - name: end_byte
147
- dtype: int64
148
- - name: end_line
149
- dtype: int64
150
- - name: func
151
- dtype: string
152
- - name: global_end_byte
153
- dtype: int64
154
- - name: global_end_line
155
- dtype: int64
156
- - name: global_start_byte
157
- dtype: int64
158
- - name: global_start_line
159
- dtype: int64
160
- - name: input
161
- dtype: string
162
- - name: name
163
- dtype: string
164
- - name: path
165
- dtype: string
166
- - name: start_byte
167
- dtype: int64
168
- - name: start_line
169
- dtype: int64
170
- - name: lang
171
- dtype: string
172
- - name: repo
173
- dtype: string
174
- splits:
175
- - name: train
176
- num_bytes: 24847710
177
- num_examples: 88
178
- download_size: 4427455
179
- dataset_size: 24847710
180
- - config_name: multi_turn_repoqa_and_kv
181
- features:
182
- - name: context
183
- dtype: string
184
- - name: id
185
- dtype: int64
186
- - name: multi_turns
187
- list:
188
- - name: answer
189
- dtype: string
190
- - name: code_ratio
191
- dtype: float64
192
- - name: description
193
- dtype: string
194
- - name: end_byte
195
- dtype: int64
196
- - name: end_line
197
- dtype: int64
198
- - name: func
199
- dtype: string
200
- - name: global_end_byte
201
- dtype: int64
202
- - name: global_end_line
203
- dtype: int64
204
- - name: global_start_byte
205
- dtype: int64
206
- - name: global_start_line
207
- dtype: int64
208
- - name: input
209
- dtype: string
210
- - name: name
211
- dtype: string
212
- - name: path
213
- dtype: string
214
- - name: start_byte
215
- dtype: int64
216
- - name: start_line
217
- dtype: int64
218
- - name: task
219
- dtype: string
220
- - name: lang
221
- dtype: string
222
- - name: repo
223
- dtype: string
224
- splits:
225
- - name: train
226
- num_bytes: 25019328
227
- num_examples: 88
228
- download_size: 8583611
229
- dataset_size: 25019328
230
- - config_name: multi_turn_summary
231
- features:
232
- - name: context
233
- dtype: string
234
- - name: multi_turns
235
- list:
236
- - name: answer
237
- dtype: string
238
- - name: input
239
- dtype: string
240
- - name: id
241
- dtype: int64
242
- splits:
243
- - name: train
244
- num_bytes: 28622955
245
- num_examples: 70
246
- download_size: 14245669
247
- dataset_size: 28622955
248
- - config_name: multi_turn_summary_with_needles
249
- features:
250
- - name: context
251
- dtype: string
252
- - name: multi_turns
253
- list:
254
- - name: answer
255
- dtype: string
256
- - name: input
257
- dtype: string
258
- - name: task
259
- dtype: string
260
- - name: id
261
- dtype: int64
262
- splits:
263
- - name: train
264
- num_bytes: 28629718
265
- num_examples: 70
266
- download_size: 14233712
267
- dataset_size: 28629718
268
- - config_name: multi_turn_vt
269
- features:
270
- - name: index
271
- dtype: int64
272
- - name: input
273
- dtype: string
274
- - name: length
275
- dtype: int64
276
- - name: multi_turns
277
- list:
278
- - name: answer
279
- sequence: string
280
- - name: input
281
- dtype: string
282
- splits:
283
- - name: train
284
- num_bytes: 42549030
285
- num_examples: 90
286
- download_size: 2160077
287
- dataset_size: 42549030
288
- configs:
289
- - config_name: multi_turn_choice_eng
290
- data_files:
291
- - split: train
292
- path: multi_turn_choice_eng/train-*
293
- - config_name: multi_turn_kv
294
- data_files:
295
- - split: train
296
- path: multi_turn_kv/train-*
297
- - config_name: multi_turn_many_shot
298
- data_files:
299
- - split: train
300
- path: multi_turn_many_shot/train-*
301
- - config_name: multi_turn_mf
302
- data_files:
303
- - split: train
304
- path: multi_turn_mf/train-*
305
- - config_name: multi_turn_prefix_suffix
306
- data_files:
307
- - split: train
308
- path: multi_turn_prefix_suffix/train-*
309
- - config_name: multi_turn_qa_chn
310
- data_files:
311
- - split: train
312
- path: multi_turn_qa_chn/train-*
313
- - config_name: multi_turn_qa_eng
314
- data_files:
315
- - split: train
316
- path: multi_turn_qa_eng/train-*
317
- - config_name: multi_turn_repoqa
318
- data_files:
319
- - split: train
320
- path: multi_turn_repoqa/train-*
321
- - config_name: multi_turn_repoqa_and_kv
322
- data_files:
323
- - split: train
324
- path: multi_turn_repoqa_and_kv/train-*
325
- - config_name: multi_turn_summary
326
- data_files:
327
- - split: train
328
- path: multi_turn_summary/train-*
329
- - config_name: multi_turn_summary_with_needles
330
- data_files:
331
- - split: train
332
- path: multi_turn_summary_with_needles/train-*
333
- - config_name: multi_turn_vt
334
- data_files:
335
- - split: train
336
- path: multi_turn_vt/train-*
337
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ dataset_info:
4
+ - config_name: multi_turn_choice_eng
5
+ features:
6
+ - name: context
7
+ dtype: string
8
+ - name: multi_turns
9
+ list:
10
+ - name: answer
11
+ dtype: string
12
+ - name: input
13
+ dtype: string
14
+ - name: options
15
+ sequence: string
16
+ - name: id
17
+ dtype: int64
18
+ splits:
19
+ - name: train
20
+ num_bytes: 46482955
21
+ num_examples: 58
22
+ download_size: 28590613
23
+ dataset_size: 46482955
24
+ - config_name: multi_turn_kv
25
+ features:
26
+ - name: id
27
+ dtype: int64
28
+ - name: context
29
+ dtype: string
30
+ - name: multi_turns
31
+ list:
32
+ - name: answer
33
+ dtype: string
34
+ - name: input
35
+ dtype: string
36
+ splits:
37
+ - name: train
38
+ num_bytes: 20071200
39
+ num_examples: 100
40
+ download_size: 18278186
41
+ dataset_size: 20071200
42
+ - config_name: multi_turn_many_shot
43
+ features:
44
+ - name: context
45
+ dtype: string
46
+ - name: multi_turns
47
+ list:
48
+ - name: answer
49
+ dtype: string
50
+ - name: input
51
+ dtype: string
52
+ - name: id
53
+ dtype: int64
54
+ - name: task
55
+ dtype: string
56
+ splits:
57
+ - name: train
58
+ num_bytes: 4734315
59
+ num_examples: 54
60
+ download_size: 99406
61
+ dataset_size: 4734315
62
+ - config_name: multi_turn_mf
63
+ features:
64
+ - name: id
65
+ dtype: int64
66
+ - name: context
67
+ sequence: int64
68
+ - name: multi_turns
69
+ list:
70
+ - name: answer
71
+ dtype: int64
72
+ - name: input
73
+ dtype: string
74
+ splits:
75
+ - name: train
76
+ num_bytes: 24065100
77
+ num_examples: 100
78
+ download_size: 3766479
79
+ dataset_size: 24065100
80
+ - config_name: multi_turn_prefix_suffix
81
+ features:
82
+ - name: context
83
+ dtype: string
84
+ - name: multi_turns
85
+ list:
86
+ - name: answer
87
+ dtype: string
88
+ - name: input
89
+ dtype: string
90
+ splits:
91
+ - name: train
92
+ num_bytes: 17498600
93
+ num_examples: 100
94
+ download_size: 16417345
95
+ dataset_size: 17498600
96
+ - config_name: multi_turn_qa_chn
97
+ features:
98
+ - name: context
99
+ dtype: string
100
+ - name: multi_turns
101
+ list:
102
+ - name: answer
103
+ dtype: string
104
+ - name: input
105
+ dtype: string
106
+ - name: id
107
+ dtype: int64
108
+ splits:
109
+ - name: train
110
+ num_bytes: 180437341
111
+ num_examples: 35
112
+ download_size: 115936454
113
+ dataset_size: 180437341
114
+ - config_name: multi_turn_qa_eng
115
+ features:
116
+ - name: context
117
+ dtype: string
118
+ - name: multi_turns
119
+ list:
120
+ - name: answer
121
+ dtype: string
122
+ - name: input
123
+ dtype: string
124
+ - name: id
125
+ dtype: int64
126
+ splits:
127
+ - name: train
128
+ num_bytes: 58359967
129
+ num_examples: 69
130
+ download_size: 35648660
131
+ dataset_size: 58359967
132
+ - config_name: multi_turn_repoqa
133
+ features:
134
+ - name: context
135
+ dtype: string
136
+ - name: id
137
+ dtype: int64
138
+ - name: multi_turns
139
+ list:
140
+ - name: answer
141
+ dtype: string
142
+ - name: code_ratio
143
+ dtype: float64
144
+ - name: description
145
+ dtype: string
146
+ - name: end_byte
147
+ dtype: int64
148
+ - name: end_line
149
+ dtype: int64
150
+ - name: func
151
+ dtype: string
152
+ - name: global_end_byte
153
+ dtype: int64
154
+ - name: global_end_line
155
+ dtype: int64
156
+ - name: global_start_byte
157
+ dtype: int64
158
+ - name: global_start_line
159
+ dtype: int64
160
+ - name: input
161
+ dtype: string
162
+ - name: name
163
+ dtype: string
164
+ - name: path
165
+ dtype: string
166
+ - name: start_byte
167
+ dtype: int64
168
+ - name: start_line
169
+ dtype: int64
170
+ - name: lang
171
+ dtype: string
172
+ - name: repo
173
+ dtype: string
174
+ splits:
175
+ - name: train
176
+ num_bytes: 24847710
177
+ num_examples: 88
178
+ download_size: 4427455
179
+ dataset_size: 24847710
180
+ - config_name: multi_turn_repoqa_and_kv
181
+ features:
182
+ - name: context
183
+ dtype: string
184
+ - name: id
185
+ dtype: int64
186
+ - name: multi_turns
187
+ list:
188
+ - name: answer
189
+ dtype: string
190
+ - name: code_ratio
191
+ dtype: float64
192
+ - name: description
193
+ dtype: string
194
+ - name: end_byte
195
+ dtype: int64
196
+ - name: end_line
197
+ dtype: int64
198
+ - name: func
199
+ dtype: string
200
+ - name: global_end_byte
201
+ dtype: int64
202
+ - name: global_end_line
203
+ dtype: int64
204
+ - name: global_start_byte
205
+ dtype: int64
206
+ - name: global_start_line
207
+ dtype: int64
208
+ - name: input
209
+ dtype: string
210
+ - name: name
211
+ dtype: string
212
+ - name: path
213
+ dtype: string
214
+ - name: start_byte
215
+ dtype: int64
216
+ - name: start_line
217
+ dtype: int64
218
+ - name: task
219
+ dtype: string
220
+ - name: lang
221
+ dtype: string
222
+ - name: repo
223
+ dtype: string
224
+ splits:
225
+ - name: train
226
+ num_bytes: 25019328
227
+ num_examples: 88
228
+ download_size: 8583611
229
+ dataset_size: 25019328
230
+ - config_name: multi_turn_summary
231
+ features:
232
+ - name: context
233
+ dtype: string
234
+ - name: multi_turns
235
+ list:
236
+ - name: answer
237
+ dtype: string
238
+ - name: input
239
+ dtype: string
240
+ - name: id
241
+ dtype: int64
242
+ splits:
243
+ - name: train
244
+ num_bytes: 28622955
245
+ num_examples: 70
246
+ download_size: 14245669
247
+ dataset_size: 28622955
248
+ - config_name: multi_turn_summary_with_needles
249
+ features:
250
+ - name: context
251
+ dtype: string
252
+ - name: multi_turns
253
+ list:
254
+ - name: answer
255
+ dtype: string
256
+ - name: input
257
+ dtype: string
258
+ - name: task
259
+ dtype: string
260
+ - name: id
261
+ dtype: int64
262
+ splits:
263
+ - name: train
264
+ num_bytes: 28629718
265
+ num_examples: 70
266
+ download_size: 14233712
267
+ dataset_size: 28629718
268
+ - config_name: multi_turn_vt
269
+ features:
270
+ - name: index
271
+ dtype: int64
272
+ - name: input
273
+ dtype: string
274
+ - name: length
275
+ dtype: int64
276
+ - name: multi_turns
277
+ list:
278
+ - name: answer
279
+ sequence: string
280
+ - name: input
281
+ dtype: string
282
+ splits:
283
+ - name: train
284
+ num_bytes: 42549030
285
+ num_examples: 90
286
+ download_size: 2160077
287
+ dataset_size: 42549030
288
+ configs:
289
+ - config_name: multi_turn_choice_eng
290
+ data_files:
291
+ - split: train
292
+ path: multi_turn_choice_eng/train-*
293
+ - config_name: multi_turn_kv
294
+ data_files:
295
+ - split: train
296
+ path: multi_turn_kv/train-*
297
+ - config_name: multi_turn_many_shot
298
+ data_files:
299
+ - split: train
300
+ path: multi_turn_many_shot/train-*
301
+ - config_name: multi_turn_mf
302
+ data_files:
303
+ - split: train
304
+ path: multi_turn_mf/train-*
305
+ - config_name: multi_turn_prefix_suffix
306
+ data_files:
307
+ - split: train
308
+ path: multi_turn_prefix_suffix/train-*
309
+ - config_name: multi_turn_qa_chn
310
+ data_files:
311
+ - split: train
312
+ path: multi_turn_qa_chn/train-*
313
+ - config_name: multi_turn_qa_eng
314
+ data_files:
315
+ - split: train
316
+ path: multi_turn_qa_eng/train-*
317
+ - config_name: multi_turn_repoqa
318
+ data_files:
319
+ - split: train
320
+ path: multi_turn_repoqa/train-*
321
+ - config_name: multi_turn_repoqa_and_kv
322
+ data_files:
323
+ - split: train
324
+ path: multi_turn_repoqa_and_kv/train-*
325
+ - config_name: multi_turn_summary
326
+ data_files:
327
+ - split: train
328
+ path: multi_turn_summary/train-*
329
+ - config_name: multi_turn_summary_with_needles
330
+ data_files:
331
+ - split: train
332
+ path: multi_turn_summary_with_needles/train-*
333
+ - config_name: multi_turn_vt
334
+ data_files:
335
+ - split: train
336
+ path: multi_turn_vt/train-*
337
+ ---
338
+
339
+ # SCBench
340
+
341
+ [[Paper]]()
342
+ [[Code]](https://github.com/microsoft/MInference/SCBench)
343
+
344
+ ![SCBench](./data/framework.png)
345
+
346
+ 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.
347
+
348
+ ## Dataset
349
+
350
+ ![SCBench](./data/overview.png)
351
+
352
+ SCBench covers 12 diverse tasks that test four key long-context capabilities: string retrieval, semantic retrieval, global information processing, and multi-tasking.
353
+
354
+ ### String Retrieval
355
+ - **Retr.KV**: Tests key-value lookup in large JSON objects with random, incompressible content
356
+ - **Retr.Prefix-Suffix**: Evaluates finding strings with specific prefix and suffix patterns
357
+ - **Retr.MultiHop**: Assesses multi-hop variable tracing capabilities in long inputs
358
+
359
+ ### Semantic Retrieval
360
+ - **Code.RepoQA**: Function retrieval from large codebases based on natural language descriptions
361
+ - **Language QA**: Includes English QA, Chinese QA, and multi-choice questions on long texts
362
+ - Requires semantic understanding on length inputs
363
+
364
+ ### Global Information Processing
365
+ - **Many-shot ICL**: Tests in-context learning with hundreds of examples
366
+ - **Math.Find**: Statistical tasks on large arrays
367
+ - **En.Sum**: Summarization of documents
368
+ - Requires global information processing or aggregation
369
+
370
+ ### Multi-Tasking
371
+ - **Mix.Sum+NIAH**: Combines summarization with needle-in-haystack search
372
+ - **Mix.RepoQA+KV**: Integrates code function retrieval with key-value lookup
373
+ - Requires multi-tasking or multi-step reasoning
374
+
375
+ ## Two Shared Context Modes
376
+ The benchmark evaluates these tasks across two shared context modes:
377
+ - **Multi-turn Mode**: Caches context within single sessions
378
+ - **Multi-request Mode**: Shares context across multiple sessions
379
+
380
+ ## Compared to previous long-context benchmarks
381
+
382
+ ![SCBench](./data/comparison.png)
383
+
384
+ 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.
385
+
386
+ ## Results and Findings
387
+
388
+ ![SCBench](./data/results.png)
389
+
390
+ Our SCBench reveals that the following key insights:
391
+
392
+ ### Finding 1: Sub-O(n) Memory is Problematic in Multi-Request/Multi-Turn Decoding
393
+ - Sparse decoding methods with sub-O(n) memory perform well on first queries but lose accuracy in subsequent requests
394
+ - Methods maintaining O(n) memory with sub-O(n²) computation during pre-filling can better approximate full attention accuracy across multiple queries
395
+
396
+ ### Finding 2: Task Performance Shows Varying Decline Patterns
397
+ - Sparse KV cache methods excel in tasks requiring global information processing
398
+ - O(n) memory is essential for tasks involving exact match retrieval
399
+
400
+ ### Finding 3: Performance vs Compression Rate
401
+ - All methods show performance degradation as compression rates increase
402
+ - Sub-O(n) memory methods exhibit significant drop at 1/4 compression rate
403
+ - Methods like RetrievalAttention and KIVI that maintain O(n) memory with sparse decoding show better resilience at higher compression rates
404
+
405
+ ### Finding 4: Issues with Long-Generation Scenarios
406
+ - Attention distribution shifts significantly as generation length and number of rounds increase
407
+ - This out-of-distribution (OOD) issue impacts performance even for O(n) memory methods
408
+
409
+ ### Finding 5: Dynamic vs Static Patterns
410
+ - Dynamic sparse patterns generally outperform static patterns
411
+
412
+ ## Citation
413
+
414
+ ```bibtex
415
+ @article{li2024scbench,
416
+ title={SCBench: A KV cache-centric analysis of long-context methods},
417
+ 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},
418
+ journal={arXiv preprint arXiv:2407.02490},
419
+ year={2024}
420
+ }
421
+ ```