File size: 8,120 Bytes
ca4cb7c 8e196b5 da4e5da 8e196b5 da4e5da 8e196b5 da4e5da 8e196b5 da4e5da 8e196b5 da4e5da ca4cb7c 0c3247d ca4cb7c 0c3247d 873660c 8e196b5 dd199f3 873660c 8e196b5 873660c 081092b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
---
configs:
- config_name: crag_task_1_and_2_subset_1
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_1.jsonl.bz2
- config_name: crag_task_1_and_2_subset_2
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_2.jsonl.bz2
- config_name: crag_task_1_and_2_subset_3
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_3.jsonl.bz2
- config_name: crag_task_1_and_2_subset_4
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_4.jsonl.bz2
- config_name: crag_task_1_and_2_subset_5
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_5.jsonl.bz2
- config_name: crag_task_1_and_2_subset_6
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_6.jsonl.bz2
- config_name: crag_task_1_and_2_subset_7
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_7.jsonl.bz2
- config_name: crag_task_1_and_2_subset_8
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_8.jsonl.bz2
- config_name: crag_task_1_and_2_subset_9
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_9.jsonl.bz2
- config_name: crag_task_1_and_2_subset_10
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_10.jsonl.bz2
- config_name: crag_task_1_and_2_subset_11
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_11.jsonl.bz2
- config_name: crag_task_1_and_2_subset_12
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_12.jsonl.bz2
- config_name: crag_task_1_and_2_subset_13
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_13.jsonl.bz2
- config_name: crag_task_1_and_2_subset_14
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_14.jsonl.bz2
- config_name: crag_task_1_and_2_subset_15
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_15.jsonl.bz2
- config_name: crag_task_1_and_2_subset_16
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_16.jsonl.bz2
- config_name: crag_task_1_and_2_subset_17
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_17.jsonl.bz2
- config_name: crag_task_1_and_2_subset_18
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_18.jsonl.bz2
- config_name: crag_task_1_and_2_subset_19
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_19.jsonl.bz2
- config_name: crag_task_1_and_2_subset_20
data_files: subset/crag_task_1_and_2/crag_task_1_and_2_dev_v4_subset_20.jsonl.bz2
license: cc-by-nc-4.0
task_categories:
- question-answering
- summarization
language:
- en
tags:
- music
- finance
size_categories:
- 1K<n<10K
pretty_name: CRA
---
Datasets are taken from Facebook's [CRAG: Comprehensive RAG Benchmark](https://github.com/facebookresearch/CRAG), see their [arXiv paper](https://arxiv.org/abs/2406.04744) for details about the dataset construction.
# CRAG Sampler
We have added a simple Python tool for performing stratified sampling on CRAG data.
## Installation
### Local Development Install (Recommended)
```bash
git clone https://huggingface.co/Quivr/CRAG.git
cd CRAG
pip install -r requirements.txt # Install dependencies
pip install -e . # Install package in development mode
```
## Quick Start
### Running the example
```bash
python -m examples.basic_sampling
```
# CRAG dataset
CRAG (Comprehensive RAG Benchmark) is a rich and comprehensive factual question answering benchmark designed to advance research in RAG. The public version of the dataset includes:
- 2706 Question-Answer pairs
- 5 domains: Finance, Sports, Music, Movie, and Open domain
- 8 types of questions (see image below): simple, simple with condition, set, comparison, aggregation, multi-hop, post-processing heavy, and false premise

The datasets `crag_task_1_and_2_dev_v4_subsample_*.json.bz2` have been created from the dataset [crag_task_1_and_2_dev_v4.jsonl.bz2](https://github.com/facebookresearch/CRAG/raw/refs/heads/main/data/crag_task_1_and_2_dev_v4.jsonl.bz2?download=) available on CRAG's GitHub repository.
For an easier handling and download of the dataset, we have used our CRAG sampler to split the 2706 rows of the original file in 5 subsamples, following the procedure below:
1. We have created a new label `answer_type`, classifying the answers in 3 categories:
- `invalid` for any answer == "invalid question"
- `no_answer` for any answer == "i don't know"
- `valid` for any other answer
2. We have considered the labels `answer_type`, `domain`, `question_type` and `static_or_dynamic` and performed stratified sampling, splitting the datasets in 5 subsamples. Each subsample has thus the same statistical properties of the full dataset.
We report below the data schema as provided in [CRAG's GitHub repository](https://github.com/facebookresearch/CRAG/blob/main/docs/dataset.md).
## Data Schema
| Field Name | Type | Description |
|------------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interaction_id` | string | A unique identifier for each example. |
| `query_time` | string | Date and time when the query and the web search occurred. |
| `domain` | string | Domain label for the query. Possible values: "finance", "music", "movie", "sports", "open". "Open" includes any factual queries not among the previous four domains. |
| `question_type` | string | Type label about the query. Possible values include: "simple", "simple_w_condition", "comparison", "aggregation", "set", "false_premise", "post-processing", "multi-hop". |
| `static_or_dynamic` | string | Indicates whether the answer to a question changes and the expected rate of change. Possible values: "static", "slow-changing", "fast-changing", and "real-time". |
| `query` | string | The question for RAG to answer. |
| `answer` | string | The gold standard answer to the question. |
| `alt_ans` | list | Other valid gold standard answers to the question. |
| `split` | integer | Data split indicator, where 0 is for validation and 1 is for the public test. |
| `search_results` | list of JSON | Contains up to `k` HTML pages for each query (`k=5` for Task #1 and `k=50` for Task #3), including page name, URL, snippet, full HTML, and last modified time. |
### Search Results Detail
| Key | Type | Description |
|----------------------|--------|---------------------------------------------------------|
| `page_name` | string | The name of the webpage. |
| `page_url` | string | The URL of the webpage. |
| `page_snippet` | string | A short paragraph describing the major content of the page. |
| `page_result` | string | The full HTML of the webpage. |
| `page_last_modified` | string | The time when the page was last modified. | |