Datasets:

Modalities:
Text
ArXiv:
Libraries:
Datasets
davidlvxin commited on
Commit
7956e94
1 Parent(s): 4a90f81

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +76 -35
README.md CHANGED
@@ -16,13 +16,14 @@ size_categories:
16
 
17
  # Introduction
18
 
19
- **LongBench** is the first benchmark for bilingual, multitask, and comprehensive assessment of **long context understanding** capabilities of large language models. LongBench includes different languages (Chinese and English) to provide a more comprehensive evaluation of the large models' multilingual capabilities on long contexts. In addition, LongBench is composed of six major categories and twenty different tasks, covering key long-text application scenarios such as multi-document QA, single-document QA, summarization, Few-shot learning, code completion, and synthesis tasks.
20
 
21
  We are fully aware of the potentially high costs involved in the model evaluation process, especially in the context of long context scenarios (such as manual annotation costs or API call costs). Therefore, we adopt a fully automated evaluation method, aimed at measuring and evaluating the model's ability to understand long contexts at the lowest cost.
22
 
23
- LongBench includes 13 English tasks, 5 Chinese tasks, and 2 code tasks, with the average length of most tasks ranging from 5k to 15k.
24
 
25
  Github Repo for LongBench: https://github.com/THUDM/LongBench
 
26
 
27
  # How to use it?
28
 
@@ -31,24 +32,35 @@ Github Repo for LongBench: https://github.com/THUDM/LongBench
31
  ```python
32
  from datasets import load_dataset
33
 
34
- datasets = ["hotpotqa", "2wikimqa", "musique", "dureader", "narrativeqa", "qasper", "multifieldqa_en", \
35
- "multifieldqa_zh", "gov_report", "qmsum", "vcsum", "trec", "nq", "triviaqa", "lsht", "passage_count", \
36
- "passage_retrieval_en", "passage_retrieval_zh", "lcc", "repobench-p"]
37
 
38
  for dataset in datasets:
39
  data = load_dataset('THUDM/LongBench', dataset, split='test')
40
  ```
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  #### Data Format
43
 
44
- All data in **LongBench** are standardized to the following format:
45
 
46
  ```json
47
  {
48
- "input": "The input/command for the task, usually short, such as questions in QA, queries in Few-shot tasks, etc.",
49
- "context": "The long context text required for the task, such as documents, cross-file code, few-shot samples in Few-shot tasks",
50
- "answers": "List composed of all standard answers",
51
- "length": "Total length of the first three items of text (counted in characters for Chinese and words for English)",
52
  "dataset": "The name of the dataset to which this piece of data belongs",
53
  "language": "The language of this piece of data",
54
  "all_classes": "All categories in classification tasks, null for non-classification tasks",
@@ -64,44 +76,46 @@ This repository provides data download for LongBench. If you wish to use this da
64
 
65
  | Task | Task Type | Eval metric | Avg len |Language | \#Sample |
66
  | :-------- | :-----------:| :-----------: |:-------: | :-----------: |:--------: |
67
- | HotpotQA | Multi-doc QA | F1 |9,149 |EN |200 |
68
- | 2WikiMultihopQA| Multi-doc QA | F1 |4,885 |EN |200 |
69
- | Musique| Multi-doc QA | F1 |7,798 |EN |200 |
70
  | DuReader| Multi-doc QA | Rouge-L |15,768 |ZH |200 |
71
  | MultiFieldQA-en| Single-doc QA | F1 |4,559 |EN |150 |
72
- | MultiFieldQA-zh| Single-doc QA | F1 |6,771 |ZH |200 |
73
- | NarrativeQA| Single-doc QA | F1 |18,405 |EN |200 |
74
  | Qasper| Single-doc QA | F1 |3,619 |EN |200 |
75
- | GovReport| Summarization | Rouge-L |8,169 |EN |200 |
76
- | QMSum| Summarization | Rouge-L |10,546 |EN |200 |
77
- | VCSUM| Summarization | Rouge-L |15,147 |ZH |200 |
78
- | TriviaQA| Few shot | F1 |8,015 |EN |200 |
79
- | NQ| Few shot | F1 |8,210 |EN |200 |
80
- | TREC| Few shot | Accuracy |5,176 |EN |200 |
81
- | LSHT| Few shot | Accuracy |22,333 |ZH |200 |
82
- | PassageRetrieval-en| Synthetic | Accuracy |9,288 |EN |200 |
 
83
  | PassageCount| Synthetic | Accuracy |11,141 |EN |200 |
84
  | PassageRetrieval-zh | Synthetic | Accuracy |6,745 |ZH |200 |
85
  | LCC| Code | Edit Sim |1,235 |Python/C#/Java |500 |
86
- | RepoBench-P| Code | Edit Sim |5,622 |Python/Java |500 |
87
 
88
  > Note: In order to avoid discrepancies caused by different tokenizers, we use the word count (using Python's split function) to calculate the average length of English datasets and code datasets, and use the character count to calculate the average length of Chinese datasets.
89
 
90
  # Task description
91
-
92
  | Task | Task Description |
93
  | :---------------- | :----------------------------------------------------------- |
94
  | HotpotQA | Answer related questions based on multiple given documents |
95
  | 2WikiMultihopQA | Answer related questions based on multiple given documents |
96
- | Musique | Answer related questions based on multiple given documents |
97
  | DuReader | Answer related Chinese questions based on multiple retrieved documents |
98
  | MultiFieldQA-en | Answer English questions based on a long article, which comes from a relatively diverse field |
99
  | MultiFieldQA-zh | Answer Chinese questions based on a long article, which comes from a relatively diverse field |
100
- | NarrativeQA | Ask questions based on stories or scripts, including understanding of important elements such as characters, plots, themes, etc. |
101
- | Qasper | Ask questions based on a NLP research paper, questions proposed and answered by NLP practitioners |
102
  | GovReport | A summarization task that requires summarizing government work reports |
 
103
  | QMSum | A summarization task that requires summarizing meeting records based on user queries |
104
  | VCSUM | A summarization task that requires summarizing Chinese meeting records |
 
105
  | TriviaQA | Single document question answering task, providing several few-shot examples |
106
  | NQ | Single document question answering task, providing several few-shot examples |
107
  | TREC | A classification task that requires categorizing questions, includes 50 categories in total |
@@ -112,18 +126,45 @@ This repository provides data download for LongBench. If you wish to use this da
112
  | LCC | Given a long piece of code, predict the next line of code |
113
  | RepoBench-P | Given code in multiple files within a GitHub repository (including cross-file dependencies), predict the next line of code |
114
 
115
-
116
  # Task construction
117
-
118
  > Note: For all tasks constructed from existing datasets, we use data from the validation or test set of the existing dataset (except for VCSUM).
119
 
120
- - The tasks of [HotpotQA](https://hotpotqa.github.io/), [2WikiMultihopQA](https://aclanthology.org/2020.coling-main.580/), [Musique](https://arxiv.org/abs/2108.00573), and [DuReader](https://github.com/baidu/DuReader) are built based on the original datasets and processed to be suitable for long context evaluation. Specifically, for questions in the validation set, we select the evidence passage that contains the answer and several distracting articles. These articles together with the original question constitute the input of the tasks.
121
  - The tasks of MultiFiedQA-zh and MultiFieldQA-en consist of long artical data from about 10 sources, including Latex papers, judicial documents, government work reports, and PDF documents indexed by Google. For each long artical, we invite several PhD and master students to annotate, i.e., to ask questions based on the long artical and give the correct answers. To better automate evaluation, we ask the annotators to propose questions with definitive answers as much as possible.
122
- - The tasks of [NarrativeQA](https://arxiv.org/pdf/1712.07040.pdf), [Qasper](https://arxiv.org/pdf/2105.03011.pdf), [GovReport](https://arxiv.org/pdf/2104.02112.pdf), and [QMSum](https://arxiv.org/pdf/2104.05938.pdf) directly use the data provided by the original papers. In the specific construction, we use the template provided by [ZeroSCROLLS](https://www.zero.scrolls-benchmark.com/) to convert the corresponding data into pure text input.
123
  - The [VCSUM](https://arxiv.org/abs/2305.05280) task is built based on the original dataset, and we design a corresponding template to convert the corresponding data into pure text input.
124
- - The tasks of [TriviaQA](https://nlp.cs.washington.edu/triviaqa/) and [NQ](https://ai.google.com/research/NaturalQuestions/) are constructed in the manner of [CoLT5](https://arxiv.org/abs/2303.09752), which provides several examples of question and answering based on documents, and requires the language model to answer related questions based on new documents.
125
- - The tasks of [TREC](https://aclanthology.org/C02-1150.pdf) and [LSHT](http://tcci.ccf.org.cn/conference/2014/dldoc/evatask6.pdf) are built based on the original datasets. For each question in the validation set, we sample several data from the training set to form few-shot examples. These examples together with the questions in the validation set constitute the input for this task.
126
  - The PassageRetrieval-en task is constructed based on English Wikipedia. For each piece of data, we randomly sample 30 paragraphs from English Wikipedia and select one for summarization (using GPT-3.5-Turbo). This task requires the model to give the original paragraph name to which the summary corresponds.
127
  - The PassageCount task is constructed based on the English wiki. For each piece of data, we randomly sample several passages from English Wikipedia, repeat each paragraph at random several times, and finally shuffle the paragraphs. This task requires the model to determine the total number of different paragraphs in the given context.
128
  - The PasskeyRetrieval-zh task is constructed based on [C4](https://arxiv.org/abs/1910.10683). For each piece of data, we randomly sample several Chinese paragraphs from C4 and select one of them for summarization (using GPT-3.5-Turbo). This task requires the model to give the original paragraph name to which the summary corresponds.
129
- - For the [LCC](https://arxiv.org/abs/2306.14893) task, we sample from the original code completion dataset. In the [RepoBench-P](https://arxiv.org/abs/2306.03091) task, we select the most challenging XF-F (Cross-File-First) setting from the original dataset and refer to the Oracle-Filled scenario in the paper. For each original piece of data, we randomly extract multiple cross-file code snippets, including the gold cross-file code snippet, and concatenate them as input, requiring the model to effectively use cross-file code for completion.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  # Introduction
18
 
19
+ **LongBench** is the first benchmark for bilingual, multitask, and comprehensive assessment of **long context understanding** capabilities of large language models. LongBench includes different languages (Chinese and English) to provide a more comprehensive evaluation of the large models' multilingual capabilities on long contexts. In addition, LongBench is composed of six major categories and twenty one different tasks, covering key long-text application scenarios such as single-document QA, multi-document QA, summarization, few-shot learning, synthetic tasks and code completion.
20
 
21
  We are fully aware of the potentially high costs involved in the model evaluation process, especially in the context of long context scenarios (such as manual annotation costs or API call costs). Therefore, we adopt a fully automated evaluation method, aimed at measuring and evaluating the model's ability to understand long contexts at the lowest cost.
22
 
23
+ LongBench includes 14 English tasks, 5 Chinese tasks, and 2 code tasks, with the average length of most tasks ranging from 5k to 15k, and a total of 4,750 test data. For detailed statistics and construction methods of LongBench tasks, please refer [here](task.md). In addition, we provide LongBench-E, a test set with a more uniform length distribution constructed by uniform sampling, with comparable amounts of data in the 0-4k, 4k-8k, and 8k+ length intervals to provide an analysis of the model's performance variations at different input lengths.
24
 
25
  Github Repo for LongBench: https://github.com/THUDM/LongBench
26
+ Arxiv Paper for LongBench: https://arxiv.org/pdf/2308.14508.pdf
27
 
28
  # How to use it?
29
 
 
32
  ```python
33
  from datasets import load_dataset
34
 
35
+ datasets = ["narrativeqa", "qasper", "multifieldqa_en", "multifieldqa_zh", "hotpotqa", "2wikimqa", "musique", \
36
+ "dureader", "gov_report", "qmsum", "multi_news", "vcsum", "trec", "triviaqa", "samsum", "lsht", \
37
+ "passage_count", "passage_retrieval_en", "passage_retrieval_zh", "lcc", "repobench-p"]
38
 
39
  for dataset in datasets:
40
  data = load_dataset('THUDM/LongBench', dataset, split='test')
41
  ```
42
+ Similarly, you can load the **LongBench-E** data
43
+ ```python
44
+ from datasets import load_dataset
45
+
46
+ datasets = ["qasper", "multifieldqa_en", "hotpotqa", "2wikimqa", "gov_report", "multi_news", "trec", \
47
+ "triviaqa", "samsum", "passage_count", "passage_retrieval_en", "lcc", "repobench-p"]
48
+
49
+ for dataset in datasets:
50
+ data = load_dataset('THUDM/LongBench', f"{dataset}_e", split='test')
51
+ ```
52
+ Alternatively, you can download the folder from [this link](https://huggingface.co/datasets/THUDM/LongBench/resolve/main/data.zip) to load the data.
53
 
54
  #### Data Format
55
 
56
+ All data in **LongBench** (LongBench-E) are standardized to the following format:
57
 
58
  ```json
59
  {
60
+ "input": "The input/command for the task, usually short, such as questions in QA, queries in Few-shot tasks, etc",
61
+ "context": "The long context required for the task, such as documents, cross-file code, few-shot examples in Few-shot tasks",
62
+ "answers": "A List of all true answers",
63
+ "length": "Total length of the first three items (counted in characters for Chinese and words for English)",
64
  "dataset": "The name of the dataset to which this piece of data belongs",
65
  "language": "The language of this piece of data",
66
  "all_classes": "All categories in classification tasks, null for non-classification tasks",
 
76
 
77
  | Task | Task Type | Eval metric | Avg len |Language | \#Sample |
78
  | :-------- | :-----------:| :-----------: |:-------: | :-----------: |:--------: |
79
+ | HotpotQA | Multi-doc QA | F1 |9,151 |EN |200 |
80
+ | 2WikiMultihopQA| Multi-doc QA | F1 |4,887 |EN |200 |
81
+ | MuSiQue| Multi-doc QA | F1 |11,214 |EN |200 |
82
  | DuReader| Multi-doc QA | Rouge-L |15,768 |ZH |200 |
83
  | MultiFieldQA-en| Single-doc QA | F1 |4,559 |EN |150 |
84
+ | MultiFieldQA-zh| Single-doc QA | F1 |6,701 |ZH |200 |
85
+ | NarrativeQA| Single-doc QA | F1 |18,409 |EN |200 |
86
  | Qasper| Single-doc QA | F1 |3,619 |EN |200 |
87
+ | GovReport| Summarization | Rouge-L |8,734 |EN |200 |
88
+ | QMSum| Summarization | Rouge-L |10,614 |EN |200 |
89
+ | MultiNews| Summarization | Rouge-L |2,113 |EN |200 |
90
+ | VCSUM| Summarization | Rouge-L |15,380 |ZH |200 |
91
+ | TriviaQA| Few shot | F1 |8,209 |EN |200 |
92
+ | SAMSum| Few shot | Rouge-L |6,258 |EN |200 |
93
+ | TREC| Few shot | Accuracy |5,177 |EN |200 |
94
+ | LSHT| Few shot | Accuracy |22,337 |ZH |200 |
95
+ | PassageRetrieval-en| Synthetic | Accuracy |9,289 |EN |200 |
96
  | PassageCount| Synthetic | Accuracy |11,141 |EN |200 |
97
  | PassageRetrieval-zh | Synthetic | Accuracy |6,745 |ZH |200 |
98
  | LCC| Code | Edit Sim |1,235 |Python/C#/Java |500 |
99
+ | RepoBench-P| Code | Edit Sim |4,206 |Python/Java |500 |
100
 
101
  > Note: In order to avoid discrepancies caused by different tokenizers, we use the word count (using Python's split function) to calculate the average length of English datasets and code datasets, and use the character count to calculate the average length of Chinese datasets.
102
 
103
  # Task description
 
104
  | Task | Task Description |
105
  | :---------------- | :----------------------------------------------------------- |
106
  | HotpotQA | Answer related questions based on multiple given documents |
107
  | 2WikiMultihopQA | Answer related questions based on multiple given documents |
108
+ | MuSiQue | Answer related questions based on multiple given documents |
109
  | DuReader | Answer related Chinese questions based on multiple retrieved documents |
110
  | MultiFieldQA-en | Answer English questions based on a long article, which comes from a relatively diverse field |
111
  | MultiFieldQA-zh | Answer Chinese questions based on a long article, which comes from a relatively diverse field |
112
+ | NarrativeQA | Answer questions based on stories or scripts, including understanding of important elements such as characters, plots, themes, etc. |
113
+ | Qasper | Answer questions based on a NLP research paper, questions proposed and answered by NLP practitioners |
114
  | GovReport | A summarization task that requires summarizing government work reports |
115
+ | MultiNews | A multi-doc summarization that requires summarizing over multiple news |
116
  | QMSum | A summarization task that requires summarizing meeting records based on user queries |
117
  | VCSUM | A summarization task that requires summarizing Chinese meeting records |
118
+ | SAMSum | A dialogue summarization task, providing several few-shot examples |
119
  | TriviaQA | Single document question answering task, providing several few-shot examples |
120
  | NQ | Single document question answering task, providing several few-shot examples |
121
  | TREC | A classification task that requires categorizing questions, includes 50 categories in total |
 
126
  | LCC | Given a long piece of code, predict the next line of code |
127
  | RepoBench-P | Given code in multiple files within a GitHub repository (including cross-file dependencies), predict the next line of code |
128
 
 
129
  # Task construction
 
130
  > Note: For all tasks constructed from existing datasets, we use data from the validation or test set of the existing dataset (except for VCSUM).
131
 
132
+ - The tasks of [HotpotQA](https://hotpotqa.github.io/), [2WikiMultihopQA](https://aclanthology.org/2020.coling-main.580/), [MuSiQue](https://arxiv.org/abs/2108.00573), and [DuReader](https://github.com/baidu/DuReader) are built based on the original datasets and processed to be suitable for long context evaluation. Specifically, for questions in the validation set, we select the evidence passage that contains the answer and several distracting articles. These articles together with the original question constitute the input of the tasks.
133
  - The tasks of MultiFiedQA-zh and MultiFieldQA-en consist of long artical data from about 10 sources, including Latex papers, judicial documents, government work reports, and PDF documents indexed by Google. For each long artical, we invite several PhD and master students to annotate, i.e., to ask questions based on the long artical and give the correct answers. To better automate evaluation, we ask the annotators to propose questions with definitive answers as much as possible.
134
+ - The tasks of [NarrativeQA](https://arxiv.org/pdf/1712.07040.pdf), [Qasper](https://arxiv.org/pdf/2105.03011.pdf), [GovReport](https://arxiv.org/pdf/2104.02112.pdf), [QMSum](https://arxiv.org/pdf/2104.05938.pdf) and [MultiNews](https://aclanthology.org/P19-1102.pdf) directly use the data provided by the original papers. In the specific construction, we use the template provided by [ZeroSCROLLS](https://www.zero.scrolls-benchmark.com/) to convert the corresponding data into pure text input.
135
  - The [VCSUM](https://arxiv.org/abs/2305.05280) task is built based on the original dataset, and we design a corresponding template to convert the corresponding data into pure text input.
136
+ - The [TriviaQA](https://nlp.cs.washington.edu/triviaqa/) task is constructed in the manner of [CoLT5](https://arxiv.org/abs/2303.09752), which provides several examples of question and answering based on documents, and requires the language model to answer related questions based on new documents.
137
+ - The tasks of [SAMSum](https://aclanthology.org/D19-5409.pdf), [TREC](https://aclanthology.org/C02-1150.pdf) and [LSHT](http://tcci.ccf.org.cn/conference/2014/dldoc/evatask6.pdf) are built based on the original datasets. For each question in the validation set, we sample several data from the training set to form few-shot examples. These examples together with the questions in the validation set constitute the input for this task.
138
  - The PassageRetrieval-en task is constructed based on English Wikipedia. For each piece of data, we randomly sample 30 paragraphs from English Wikipedia and select one for summarization (using GPT-3.5-Turbo). This task requires the model to give the original paragraph name to which the summary corresponds.
139
  - The PassageCount task is constructed based on the English wiki. For each piece of data, we randomly sample several passages from English Wikipedia, repeat each paragraph at random several times, and finally shuffle the paragraphs. This task requires the model to determine the total number of different paragraphs in the given context.
140
  - The PasskeyRetrieval-zh task is constructed based on [C4](https://arxiv.org/abs/1910.10683). For each piece of data, we randomly sample several Chinese paragraphs from C4 and select one of them for summarization (using GPT-3.5-Turbo). This task requires the model to give the original paragraph name to which the summary corresponds.
141
+ - For the [LCC](https://arxiv.org/abs/2306.14893) task, we sample from the original code completion dataset. In the [RepoBench-P](https://arxiv.org/abs/2306.03091) task, we select the most challenging XF-F (Cross-File-First) setting from the original dataset and refer to the Oracle-Filled scenario in the paper. For each original piece of data, we randomly extract multiple cross-file code snippets, including the gold cross-file code snippet, and concatenate them as input, requiring the model to effectively use cross-file code for completion.
142
+
143
+ # LongBench-E statistics
144
+ | Task | Task Type | \#data in 0-4k | \#data in 4-8k | \#data in 8k+|
145
+ | :--------- | :-----------:| :-----------: |:---------: | :-------------: |
146
+ | HotpotQA | Multi-doc QA | 100 |100 |100 |
147
+ | 2WikiMultihopQA| Multi-doc QA | 100 |100 |100 |
148
+ | MultiFieldQA-en| Single-doc QA | 67 |70 |13 |
149
+ | Qasper| Single-doc QA | 100 |100 |24 |
150
+ | GovReport| Summarization | 100 |100 |100 |
151
+ | MultiNews| Summarization | 100 |100 |94 |
152
+ | TriviaQA| Few shot | 100 |100 |100 |
153
+ | SAMSum| Few shot | 100 |100 |100 |
154
+ | TREC| Few shot | 100 |100 |100 |
155
+ | PassageRetrieval-en| Synthetic | 100 |100 |100 |
156
+ | PassageCount| Synthetic | 100 |100 |100 |
157
+ | LCC| Code | 100 |100 |100 |
158
+ | RepoBench-P| Code | 100 |100 |100 |
159
+
160
+ # Citation
161
+ ```
162
+ @misc{bai2023longbench,
163
+ title={LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding},
164
+ author={Yushi Bai and Xin Lv and Jiajie Zhang and Hongchang Lyu and Jiankai Tang and Zhidian Huang and Zhengxiao Du and Xiao Liu and Aohan Zeng and Lei Hou and Yuxiao Dong and Jie Tang and Juanzi Li},
165
+ year={2023},
166
+ eprint={2308.14508},
167
+ archivePrefix={arXiv},
168
+ primaryClass={cs.CL}
169
+ }
170
+ ```