| --- |
| license: apache-2.0 |
| pretty_name: "LongBench" |
| language: |
| - code |
| - en |
| - zh |
| task_categories: |
| - question-answering |
| - summarization |
| - text-classification |
| - text-generation |
| task_ids: |
| - extractive-qa |
| - open-domain-qa |
| - document-question-answering |
| - news-articles-summarization |
| - dialogue-generation |
| - multi-class-classification |
| - language-modeling |
| - text2text-generation |
| tags: |
| - longbench |
| - long-context |
| - benchmark |
| - evaluation |
| - multilingual |
| - bilingual |
| - question-answering |
| - summarization |
| - code |
| - llm |
| - large-language-models |
| size_categories: |
| - 1K<n<10K |
| source_datasets: |
| - original |
| configs: |
| - config_name: narrativeqa |
| data_files: |
| - split: test |
| path: data/narrativeqa/test-00000-of-00001.parquet |
| - config_name: qasper |
| data_files: |
| - split: test |
| path: data/qasper/test-00000-of-00001.parquet |
| - config_name: multifieldqa_en |
| data_files: |
| - split: test |
| path: data/multifieldqa_en/test-00000-of-00001.parquet |
| - config_name: multifieldqa_zh |
| data_files: |
| - split: test |
| path: data/multifieldqa_zh/test-00000-of-00001.parquet |
| - config_name: hotpotqa |
| data_files: |
| - split: test |
| path: data/hotpotqa/test-00000-of-00001.parquet |
| - config_name: 2wikimqa |
| data_files: |
| - split: test |
| path: data/2wikimqa/test-00000-of-00001.parquet |
| - config_name: musique |
| data_files: |
| - split: test |
| path: data/musique/test-00000-of-00001.parquet |
| - config_name: dureader |
| data_files: |
| - split: test |
| path: data/dureader/test-00000-of-00001.parquet |
| - config_name: gov_report |
| data_files: |
| - split: test |
| path: data/gov_report/test-00000-of-00001.parquet |
| - config_name: qmsum |
| data_files: |
| - split: test |
| path: data/qmsum/test-00000-of-00001.parquet |
| - config_name: multi_news |
| data_files: |
| - split: test |
| path: data/multi_news/test-00000-of-00001.parquet |
| - config_name: vcsum |
| data_files: |
| - split: test |
| path: data/vcsum/test-00000-of-00001.parquet |
| - config_name: trec |
| data_files: |
| - split: test |
| path: data/trec/test-00000-of-00001.parquet |
| - config_name: triviaqa |
| data_files: |
| - split: test |
| path: data/triviaqa/test-00000-of-00001.parquet |
| - config_name: samsum |
| data_files: |
| - split: test |
| path: data/samsum/test-00000-of-00001.parquet |
| - config_name: lsht |
| data_files: |
| - split: test |
| path: data/lsht/test-00000-of-00001.parquet |
| - config_name: passage_count |
| data_files: |
| - split: test |
| path: data/passage_count/test-00000-of-00001.parquet |
| - config_name: passage_retrieval_en |
| data_files: |
| - split: test |
| path: data/passage_retrieval_en/test-00000-of-00001.parquet |
| - config_name: passage_retrieval_zh |
| data_files: |
| - split: test |
| path: data/passage_retrieval_zh/test-00000-of-00001.parquet |
| - config_name: lcc |
| data_files: |
| - split: test |
| path: data/lcc/test-00000-of-00001.parquet |
| - config_name: repobench-p |
| data_files: |
| - split: test |
| path: data/repobench-p/test-00000-of-00001.parquet |
| - config_name: qasper_e |
| data_files: |
| - split: test |
| path: data/qasper_e/test-00000-of-00001.parquet |
| - config_name: multifieldqa_en_e |
| data_files: |
| - split: test |
| path: data/multifieldqa_en_e/test-00000-of-00001.parquet |
| - config_name: hotpotqa_e |
| data_files: |
| - split: test |
| path: data/hotpotqa_e/test-00000-of-00001.parquet |
| - config_name: 2wikimqa_e |
| data_files: |
| - split: test |
| path: data/2wikimqa_e/test-00000-of-00001.parquet |
| - config_name: gov_report_e |
| data_files: |
| - split: test |
| path: data/gov_report_e/test-00000-of-00001.parquet |
| - config_name: multi_news_e |
| data_files: |
| - split: test |
| path: data/multi_news_e/test-00000-of-00001.parquet |
| - config_name: trec_e |
| data_files: |
| - split: test |
| path: data/trec_e/test-00000-of-00001.parquet |
| - config_name: triviaqa_e |
| data_files: |
| - split: test |
| path: data/triviaqa_e/test-00000-of-00001.parquet |
| - config_name: samsum_e |
| data_files: |
| - split: test |
| path: data/samsum_e/test-00000-of-00001.parquet |
| - config_name: passage_count_e |
| data_files: |
| - split: test |
| path: data/passage_count_e/test-00000-of-00001.parquet |
| - config_name: passage_retrieval_en_e |
| data_files: |
| - split: test |
| path: data/passage_retrieval_en_e/test-00000-of-00001.parquet |
| - config_name: lcc_e |
| data_files: |
| - split: test |
| path: data/lcc_e/test-00000-of-00001.parquet |
| - config_name: repobench-p_e |
| data_files: |
| - split: test |
| path: data/repobench-p_e/test-00000-of-00001.parquet |
| --- |
| |
| # LongBench |
|
|
| ## Dataset Summary |
|
|
| LongBench is a bilingual, multitask benchmark for evaluating long-context understanding in large language models. It covers long-text application scenarios including single-document question answering, multi-document question answering, summarization, few-shot learning, synthetic long-context tasks, and code completion. |
|
|
| This Hugging Face dataset repository repackages locally downloaded LongBench JSONL files into a clean, typed, data-only Hugging Face dataset layout with one configuration per task. The goal of this repackaging is ease of use, reproducibility, dataset viewer compatibility, efficient loading, and convenient downstream evaluation. The dataset content, task design, and original benchmark are attributed to the LongBench authors and the THUDM LongBench project. |
|
|
|
|
| This repository keeps the LongBench records in their original task-level shape while publishing them as typed Parquet configs. The split is always `test`; the configuration name is the LongBench task name. That means the benchmark can be loaded with plain `load_dataset(...)` calls, without the legacy dataset script or a manual `data.zip` step. |
|
|
| The `language` metadata above is intentionally limited to Hub-valid values. Row-level LongBench labels are preserved in the data and include natural languages (`en`, `zh`) plus code labels (`python`, `java`, `csharp`) for the completion tasks. |
|
|
| This repackaging also adds token counts to every row: `input_tokens`, `context_tokens`, and `total_tokens`, computed with `cl100k_base`. LongBench is specifically about long-context behavior, so the added counts make it easier to filter by real prompt size, inspect outliers, and compare tasks without guessing from the original mixed `length` field. |
|
|
| ## Original Source and Attribution |
|
|
| - Original project: [https://github.com/THUDM/LongBench](https://github.com/THUDM/LongBench) |
| - Paper: [https://arxiv.org/abs/2308.14508](https://arxiv.org/abs/2308.14508) |
| - Original authors: Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, Yuxiao Dong, Jie Tang, and Juanzi Li. |
| - This repository: `GinkgoQ/LongBench` |
| - Packaging contribution: typed Parquet configs, Hub-valid metadata, local build metadata, and per-row `cl100k_base` token counts. |
| - Attribution note: the benchmark design and source records remain LongBench. |
|
|
| ## Dataset Structure |
|
|
| Each LongBench task is exposed as a separate Hugging Face configuration. Every configuration has a single `test` split. |
|
|
| ### Schema |
|
|
| | Field | Type | Description | |
| |---|---|---| |
| | `input` | `string` | The model-facing question, prompt, instruction, query, or task input. | |
| | `context` | `string` | The long-context document, passage set, dialogue, code context, or retrieved evidence. | |
| | `answers` | `list[string]` | Gold reference answer or answer candidates. | |
| | `length` | `int32` | Source-provided context length metadata. | |
| | `input_tokens` | `int32` | Number of `cl100k_base` tokens in `input`. Added by this repackaging. | |
| | `context_tokens` | `int32` | Number of `cl100k_base` tokens in `context`. Added by this repackaging. | |
| | `total_tokens` | `int32` | Number of `cl100k_base` tokens in `input` plus `context`, counted with one newline separator when `input` is non-empty. Added by this repackaging. | |
| | `dataset` | `string` | Original dataset/task label from LongBench. | |
| | `language` | `string` | Source-provided language label. | |
| | `all_classes` | `list[string]` | Candidate class labels when applicable. Empty for tasks where this is not used. | |
| | `_id` | `string` | Original example identifier, preserved when available. | |
|
|
| ### Configurations |
|
|
| | Configuration | Task Group | Examples | Languages | Mean Source Length | Mean Tokens | Max Tokens | |
| |---|---|---:|---|---:|---:|---:| |
| | `narrativeqa` | Single-Document QA | 200 | `en` | 18404.94 | 29790.89 | 65293 | |
| | `qasper` | Single-Document QA | 200 | `en` | 3618.7 | 4932.52 | 21129 | |
| | `multifieldqa_en` | Single-Document QA | 150 | `en` | 4558.7 | 6951.12 | 14962 | |
| | `multifieldqa_zh` | Single-Document QA | 200 | `zh` | 6700.68 | 7296.32 | 14962 | |
| | `hotpotqa` | Multi-Document QA | 200 | `en` | 9149.22 | 12812.86 | 16346 | |
| | `2wikimqa` | Multi-Document QA | 200 | `en` | 4885.31 | 7133.24 | 16356 | |
| | `musique` | Multi-Document QA | 200 | `en` | 11017.66 | 15595.57 | 16353 | |
| | `dureader` | Multi-Document QA | 200 | `zh` | 15768.04 | 17605.0 | 32255 | |
| | `gov_report` | Summarization | 200 | `en` | 8169.36 | 10242.25 | 51394 | |
| | `qmsum` | Summarization | 200 | `en` | 10545.94 | 13868.7 | 30389 | |
| | `multi_news` | Summarization | 200 | `en` | 2113.49 | 2609.06 | 13935 | |
| | `vcsum` | Summarization | 200 | `zh` | 15147.02 | 16896.71 | 49027 | |
| | `trec` | Few-Shot Learning | 200 | `en` | 5176.36 | 6768.22 | 11382 | |
| | `triviaqa` | Few-Shot Learning | 200 | `en` | 8209.3 | 11771.0 | 23349 | |
| | `samsum` | Few-Shot Learning | 200 | `en` | 6258.35 | 9155.56 | 17981 | |
| | `lsht` | Few-Shot Learning | 200 | `zh` | 22332.62 | 26322.06 | 51727 | |
| | `passage_count` | Synthetic Tasks | 200 | `en` | 11140.59 | 14898.67 | 28965 | |
| | `passage_retrieval_en` | Synthetic Tasks | 200 | `en` | 9287.97 | 12471.94 | 15188 | |
| | `passage_retrieval_zh` | Synthetic Tasks | 200 | `zh` | 6745.15 | 7765.06 | 10736 | |
| | `lcc` | Code Completion | 500 | `csharp`, `java`, `python` | 1235.28 | 3165.98 | 30150 | |
| | `repobench-p` | Code Completion | 500 | `java`, `python` | 4205.93 | 10813.41 | 39128 | |
| | `qasper_e` | LongBench-E | 224 | `en` | 4620.48 | 6218.5 | 21129 | |
| | `multifieldqa_en_e` | LongBench-E | 150 | `en` | 4558.7 | 6951.12 | 14962 | |
| | `hotpotqa_e` | LongBench-E | 300 | `en` | 6657.96 | 9470.88 | 16329 | |
| | `2wikimqa_e` | LongBench-E | 300 | `en` | 6146.54 | 8874.2 | 16333 | |
| | `gov_report_e` | LongBench-E | 300 | `en` | 7140.79 | 8160.53 | 27686 | |
| | `multi_news_e` | LongBench-E | 294 | `en` | 5999.31 | 7883.37 | 38322 | |
| | `trec_e` | LongBench-E | 300 | `en` | 6259.26 | 8181.84 | 17185 | |
| | `triviaqa_e` | LongBench-E | 300 | `en` | 6684.6 | 9693.12 | 36228 | |
| | `samsum_e` | LongBench-E | 300 | `en` | 6170.48 | 9035.07 | 18223 | |
| | `passage_count_e` | LongBench-E | 300 | `en` | 6117.3 | 8232.71 | 22952 | |
| | `passage_retrieval_en_e` | LongBench-E | 300 | `en` | 6115.38 | 8185.44 | 14490 | |
| | `lcc_e` | LongBench-E | 300 | `csharp`, `java`, `python` | 5546.3 | 13516.84 | 49200 | |
| | `repobench-p_e` | LongBench-E | 300 | `java`, `python` | 6067.31 | 15312.48 | 41008 | |
|
|
| ## Task Groups |
|
|
| ### Single-Document QA |
|
|
| - Configurations: `narrativeqa`, `qasper`, `multifieldqa_en`, `multifieldqa_zh` |
| - Examples: **750** |
| ### Multi-Document QA |
|
|
| - Configurations: `hotpotqa`, `2wikimqa`, `musique`, `dureader` |
| - Examples: **800** |
| ### Summarization |
|
|
| - Configurations: `gov_report`, `qmsum`, `multi_news`, `vcsum` |
| - Examples: **800** |
| ### Few-Shot Learning |
|
|
| - Configurations: `trec`, `triviaqa`, `samsum`, `lsht` |
| - Examples: **800** |
| ### Synthetic Tasks |
|
|
| - Configurations: `passage_count`, `passage_retrieval_en`, `passage_retrieval_zh` |
| - Examples: **600** |
| ### Code Completion |
|
|
| - Configurations: `lcc`, `repobench-p` |
| - Examples: **1000** |
| ### LongBench-E |
|
|
| - Configurations: `qasper_e`, `multifieldqa_en_e`, `hotpotqa_e`, `2wikimqa_e`, `gov_report_e`, `multi_news_e`, `trec_e`, `triviaqa_e`, `samsum_e`, `passage_count_e`, `passage_retrieval_en_e`, `lcc_e`, `repobench-p_e` |
| - Examples: **3668** |
|
|
| ## Languages |
|
|
| Row-level labels: `csharp`, `en`, `java`, `python`, `zh` |
|
|
| Hub metadata labels: `code`, `en`, `zh` |
|
|
| Code labels preserved in rows: `csharp`, `java`, `python` |
|
|
| ## Source Dataset Labels |
|
|
| `2wikimqa`, `2wikimqa_e`, `dureader`, `gov_report`, `gov_report_e`, `hotpotqa`, `hotpotqa_e`, `lcc`, `lcc_e`, `lsht`, `multi_news`, `multi_news_e`, `multifieldqa_en`, `multifieldqa_en_e`, `multifieldqa_zh`, `musique`, `narrativeqa`, `passage_count`, `passage_count_e`, `passage_retrieval_en`, `passage_retrieval_en_e`, `passage_retrieval_zh`, `qasper`, `qasper_e`, `qmsum`, `repobench-p`, `repobench-p_e`, `samsum`, `samsum_e`, `trec`, `trec_e`, `triviaqa`, `triviaqa_e`, `vcsum` |
|
|
| ## Token Counts |
|
|
| Token counts are generated during packaging with `cl100k_base`: |
|
|
| - `input_tokens`: tokens in the task input or question. |
| - `context_tokens`: tokens in the long context. |
| - `total_tokens`: tokens in the combined input/context prompt. |
|
|
| Across this build, the mean `total_tokens` is **10450.43** and the largest row has **65293** tokens. |
|
|
| ## Loading |
|
|
| Load one task: |
|
|
| ```python |
| from datasets import load_dataset |
| |
| dataset = load_dataset("GinkgoQ/LongBench", "narrativeqa", split="test") |
| print(dataset) |
| print(dataset[0]) |
| ``` |
|
|
| Load multiple tasks: |
|
|
| ```python |
| from datasets import load_dataset |
| |
| tasks = [ |
| "narrativeqa", |
| "qasper", |
| "multifieldqa_en", |
| "multifieldqa_zh", |
| "hotpotqa", |
| "2wikimqa", |
| "musique", |
| "dureader", |
| "gov_report", |
| "qmsum", |
| "multi_news", |
| "vcsum", |
| "trec", |
| "triviaqa", |
| "samsum", |
| "lsht", |
| "passage_count", |
| "passage_retrieval_en", |
| "passage_retrieval_zh", |
| "lcc", |
| "repobench-p", |
| "qasper_e", |
| "multifieldqa_en_e", |
| "hotpotqa_e", |
| "2wikimqa_e", |
| "gov_report_e", |
| "multi_news_e", |
| "trec_e", |
| "triviaqa_e", |
| "samsum_e", |
| "passage_count_e", |
| "passage_retrieval_en_e", |
| "lcc_e", |
| "repobench-p_e" |
| ] |
| |
| datasets_by_task = { |
| task: load_dataset("GinkgoQ/LongBench", task, split="test") |
| for task in tasks |
| } |
| ``` |
|
|
| Load all available configurations dynamically: |
|
|
| ```python |
| from datasets import get_dataset_config_names, load_dataset |
| |
| repo_id = "GinkgoQ/LongBench" |
| configs = get_dataset_config_names(repo_id) |
| |
| datasets_by_task = { |
| config: load_dataset(repo_id, config, split="test") |
| for config in configs |
| } |
| ``` |
|
|
| ## Example Record |
|
|
| ```json |
| { |
| "input": "...", |
| "context": "...", |
| "answers": ["..."], |
| "length": 12345, |
| "input_tokens": 12, |
| "context_tokens": 6789, |
| "total_tokens": 6802, |
| "dataset": "narrativeqa", |
| "language": "en", |
| "all_classes": [], |
| "_id": "..." |
| } |
| ``` |
|
|
| ## Intended Use |
|
|
| This dataset is intended for: |
|
|
| * Long-context language model evaluation |
| * Benchmarking retrieval-augmented and long-context systems |
| * Comparing performance across long-document QA, multi-document QA, summarization, classification, synthetic reasoning, and code-completion tasks |
| * Reproducible evaluation workflows using the Hugging Face `datasets` library |
|
|
| ## Out-of-Scope Use |
|
|
| This dataset should not be used as the sole evidence for claims about general model safety, factuality, robustness, legal compliance, medical reliability, or deployment readiness. It is an evaluation benchmark and should be combined with domain-specific tests when used for production model assessment. |
|
|
| ## Data Fields |
|
|
| ### `input` |
|
|
| The model-facing user query, prompt, question, task instruction, or completion prefix. |
|
|
| ### `context` |
|
|
| The long context provided to the model. Depending on the task, this may contain documents, passages, reports, dialogue, retrieved evidence, or source code. |
|
|
| ### `answers` |
|
|
| Reference answer list. Some tasks may include multiple valid answers. |
|
|
| ### `length` |
|
|
| Source-provided length metadata. |
|
|
| ### `input_tokens` |
| |
| Number of `cl100k_base` tokens in `input`, added by this packaging script. |
|
|
| ### `context_tokens` |
| |
| Number of `cl100k_base` tokens in `context`, added by this packaging script. |
|
|
| ### `total_tokens` |
| |
| Number of `cl100k_base` tokens in the combined input/context prompt. When `input` is non-empty, the counter uses `input + "\n" + context`; otherwise it counts `context`. |
|
|
| ### `dataset` |
|
|
| Original dataset or task label. |
|
|
| ### `language` |
|
|
| Source-provided language metadata. |
|
|
| ### `all_classes` |
| |
| Candidate labels for classification-style tasks. Empty when not applicable. |
| |
| ### `_id` |
|
|
| Original example identifier when available. If an identifier was missing in a local source row, this build pipeline generated a deterministic fallback identifier using the task name and row index. |
|
|
| ## Build Details |
|
|
| This repository was generated automatically from local JSONL files using a validation and conversion pipeline. |
|
|
| * Build timestamp UTC: `2026-05-24T08:44:19.240990+00:00` |
| * Source directory: `/home/arman/project/LongBench/LongBench_data/data` |
| * Number of configurations: **34** |
| * Total examples: **8418** |
| * File format: Parquet |
| * Split: `test` |
| * Schema: fixed typed schema shared by all configurations |
| * Validation mode: `strict` |
| * Max shard size: `500MB` |
| * Token count method: `cl100k_base` |
|
|
| ## Processing Pipeline |
|
|
| The build pipeline performs the following steps: |
|
|
| 1. Detects available LongBench JSONL files. |
| 2. Validates task names against the known LongBench task list. |
| 3. Reads each JSONL file line by line. |
| 4. Validates JSON syntax and row object type. |
| 5. Normalizes all original fields into a consistent Hugging Face schema. |
| 6. Adds `input_tokens`, `context_tokens`, and `total_tokens` with `cl100k_base`. |
| 7. Preserves the original LongBench fields. |
| 8. Converts each task into a typed Hugging Face `Dataset`. |
| 9. Writes each task as Parquet under `data/<config>/test-*.parquet`. |
| 10. Generates this dataset card dynamically from the detected files and statistics. |
| 11. Generates `dataset_infos.json` and `build_metadata.json`. |
| 12. Optionally creates the Hugging Face dataset repository. |
| 13. Uploads the generated repository folder to the Hugging Face Hub. |
| 14. Optionally performs a remote smoke test with `load_dataset`. |
|
|
| ## Validation Notes |
|
|
| The build script supports strict and non-strict modes. |
|
|
| In strict mode, the script fails if required fields are missing, if `input` or `context` are empty, if `length` is negative, or if list-like fields cannot be normalized. |
|
|
| In non-strict mode, the script preserves maximum compatibility by filling missing optional values with deterministic defaults where possible. |
|
|
| ## Citation |
|
|
| If you use this repackaged dataset, cite the original LongBench paper: |
|
|
| ```bibtex |
| @article{bai2023longbench, |
| title={LongBench: A Bilingual, Multitask Benchmark for Long Context Understanding}, |
| author={Bai, Yushi and Lv, Xin and Zhang, Jiajie and Lyu, Hongchang and Tang, Jiankai and Huang, Zhidian and Du, Zhengxiao and Liu, Xiao and Zeng, Aohan and Hou, Lei and Dong, Yuxiao and Tang, Jie and Li, Juanzi}, |
| journal={arXiv preprint arXiv:2308.14508}, |
| year={2023} |
| } |
| ``` |
|
|
| ## License |
|
|
| This repository uses the license metadata `apache-2.0`. Users should verify licensing and redistribution requirements against the original LongBench project and any upstream datasets included in LongBench before public redistribution or commercial usage. |
|
|
| ## Acknowledgements |
|
|
| All benchmark design, task construction, and source data attribution belong to the LongBench authors and the THUDM LongBench project. This repository only repackages the source files for easier loading and use through the Hugging Face Hub. |
|
|