task_categories:question-answering task_categories:other task_ids:open-domain-qa task_ids:closed-domain-qa annotations_creators:no-annotation language_creators:expert-generated multilinguality:monolingual size_categories:100K<n<1M source_datasets:original language:en license:cc-by-4.0 compositionality arxiv:1912.09713 region:us
The CFQ dataset (and it's splits) for measuring compositional generalization.

See https://arxiv.org/abs/1912.09713.pdf for background.

Example usage:
data = datasets.load_dataset('cfq/mcd1')
@inproceedings{Keysers2020,
  title={Measuring Compositional Generalization: A Comprehensive Method on
         Realistic Data},
  author={Daniel Keysers and Nathanael Sch\"{a}rli and Nathan Scales and
          Hylke Buisman and Daniel Furrer and Sergii Kashubin and
          Nikola Momchev and Danila Sinopalnikov and Lukasz Stafiniak and
          Tibor Tihon and Dmitry Tsarkov and Xiao Wang and Marc van Zee and
          Olivier Bousquet},
  booktitle={ICLR},
  year={2020},
  url={https://arxiv.org/abs/1912.09713.pdf},
}
---
annotations_creators:
- no-annotation
language_creators:
- expert-generated
language:
- en
license:
- cc-by-4.0
multilinguality:
- monolingual
pretty_name: Compositional Freebase Questions
size_categories:
- 100K<n<1M
source_datasets:
- original
task_categories:
- question-answering
- other
task_ids:
- open-domain-qa
- closed-domain-qa
paperswithcode_id: cfq
tags:
- compositionality
dataset_info:
- config_name: mcd1
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 37408806
    num_examples: 95743
  - name: test
    num_bytes: 5446503
    num_examples: 11968
  download_size: 267599061
  dataset_size: 42855309
- config_name: mcd2
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 39424657
    num_examples: 95743
  - name: test
    num_bytes: 5314019
    num_examples: 11968
  download_size: 267599061
  dataset_size: 44738676
- config_name: mcd3
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 38316345
    num_examples: 95743
  - name: test
    num_bytes: 5244503
    num_examples: 11968
  download_size: 267599061
  dataset_size: 43560848
- config_name: question_complexity_split
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 39989433
    num_examples: 98999
  - name: test
    num_bytes: 5781561
    num_examples: 10340
  download_size: 267599061
  dataset_size: 45770994
- config_name: question_pattern_split
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 41217350
    num_examples: 95654
  - name: test
    num_bytes: 5179936
    num_examples: 11909
  download_size: 267599061
  dataset_size: 46397286
- config_name: query_complexity_split
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 40270175
    num_examples: 100654
  - name: test
    num_bytes: 5634924
    num_examples: 9512
  download_size: 267599061
  dataset_size: 45905099
- config_name: query_pattern_split
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 40811284
    num_examples: 94600
  - name: test
    num_bytes: 5268358
    num_examples: 12589
  download_size: 267599061
  dataset_size: 46079642
- config_name: random_split
  features:
  - name: question
    dtype: string
  - name: query
    dtype: string
  splits:
  - name: train
    num_bytes: 41279218
    num_examples: 95744
  - name: test
    num_bytes: 5164923
    num_examples: 11967
  download_size: 267599061
  dataset_size: 46444141
---

# Dataset Card for "cfq"

## Table of Contents
- [Dataset Description](#dataset-description)
  - [Dataset Summary](#dataset-summary)
  - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
  - [Languages](#languages)
- [Dataset Structure](#dataset-structure)
  - [Data Instances](#data-instances)
  - [Data Fields](#data-fields)
  - [Data Splits](#data-splits)
- [Dataset Creation](#dataset-creation)
  - [Curation Rationale](#curation-rationale)
  - [Source Data](#source-data)
  - [Annotations](#annotations)
  - [Personal and Sensitive Information](#personal-and-sensitive-information)
- [Considerations for Using the Data](#considerations-for-using-the-data)
  - [Social Impact of Dataset](#social-impact-of-dataset)
  - [Discussion of Biases](#discussion-of-biases)
  - [Other Known Limitations](#other-known-limitations)
- [Additional Information](#additional-information)
  - [Dataset Curators](#dataset-curators)
  - [Licensing Information](#licensing-information)
  - [Citation Information](#citation-information)
  - [Contributions](#contributions)

## Dataset Description

- **Homepage:** [https://github.com/google-research/google-research/tree/master/cfq](https://github.com/google-research/google-research/tree/master/cfq)
- **Repository:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
- **Paper:** https://arxiv.org/abs/1912.09713
- **Point of Contact:** [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
- **Size of downloaded dataset files:** 2.14 GB
- **Size of the generated dataset:** 362.07 MB
- **Total amount of disk used:** 2.50 GB

### Dataset Summary

The Compositional Freebase Questions (CFQ) is a dataset that is specifically designed to measure compositional
generalization. CFQ is a simple yet realistic, large dataset of natural language questions and answers that also
provides for each question a corresponding SPARQL query against the Freebase knowledge base. This means that CFQ can
also be used for semantic parsing.

### Supported Tasks and Leaderboards

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Languages

English (`en`).

## Dataset Structure

### Data Instances

#### mcd1

- **Size of downloaded dataset files:** 267.60 MB
- **Size of the generated dataset:** 42.90 MB
- **Total amount of disk used:** 310.49 MB

An example of 'train' looks as follows.
```
{
  'query': 'SELECT count(*) WHERE {\n?x0 a ns:people.person .\n?x0 ns:influence.influence_node.influenced M1 .\n?x0 ns:influence.influence_node.influenced M2 .\n?x0 ns:people.person.spouse_s/ns:people.marriage.spouse|ns:fictional_universe.fictional_character.married_to/ns:fictional_universe.marriage_of_fictional_characters.spouses ?x1 .\n?x1 a ns:film.cinematographer .\nFILTER ( ?x0 != ?x1 )\n}',
  'question': 'Did a person marry a cinematographer , influence M1 , and influence M2'
}
```

#### mcd2

- **Size of downloaded dataset files:** 267.60 MB
- **Size of the generated dataset:** 44.77 MB
- **Total amount of disk used:** 312.38 MB

An example of 'train' looks as follows.
```
{
  'query': 'SELECT count(*) WHERE {\n?x0 ns:people.person.parents|ns:fictional_universe.fictional_character.parents|ns:organization.organization.parent/ns:organization.organization_relationship.parent ?x1 .\n?x1 a ns:people.person .\nM1 ns:business.employer.employees/ns:business.employment_tenure.person ?x0 .\nM1 ns:business.employer.employees/ns:business.employment_tenure.person M2 .\nM1 ns:business.employer.employees/ns:business.employment_tenure.person M3 .\nM1 ns:business.employer.employees/ns:business.employment_tenure.person M4 .\nM5 ns:business.employer.employees/ns:business.employment_tenure.person ?x0 .\nM5 ns:business.employer.employees/ns:business.employment_tenure.person M2 .\nM5 ns:business.employer.employees/ns:business.employment_tenure.person M3 .\nM5 ns:business.employer.employees/ns:business.employment_tenure.person M4\n}',
  'question': "Did M1 and M5 employ M2 , M3 , and M4 and employ a person 's child"
}
```

#### mcd3

- **Size of downloaded dataset files:** 267.60 MB
- **Size of the generated dataset:** 43.60 MB
- **Total amount of disk used:** 311.20 MB

An example of 'train' looks as follows.
```
{
    "query": "SELECT /producer M0 . /director M0 . ",
    "question": "Who produced and directed M0?"
}
```

#### query_complexity_split

- **Size of downloaded dataset files:** 267.60 MB
- **Size of the generated dataset:** 45.95 MB
- **Total amount of disk used:** 313.55 MB

An example of 'train' looks as follows.
```
{
    "query": "SELECT /producer M0 . /director M0 . ",
    "question": "Who produced and directed M0?"
}
```

#### query_pattern_split

- **Size of downloaded dataset files:** 267.60 MB
- **Size of the generated dataset:** 46.12 MB
- **Total amount of disk used:** 313.72 MB

An example of 'train' looks as follows.
```
{
    "query": "SELECT /producer M0 . /director M0 . ",
    "question": "Who produced and directed M0?"
}
```

### Data Fields

The data fields are the same among all splits and configurations:
- `question`: a `string` feature.
- `query`: a `string` feature.

### Data Splits

| name                      |  train |  test |
|---------------------------|-------:|------:|
| mcd1                      |  95743 | 11968 |
| mcd2                      |  95743 | 11968 |
| mcd3                      |  95743 | 11968 |
| query_complexity_split    | 100654 |  9512 |
| query_pattern_split       |  94600 | 12589 |
| question_complexity_split |  98999 | 10340 |
| question_pattern_split    |  95654 | 11909 |
| random_split              |  95744 | 11967 |

## Dataset Creation

### Curation Rationale

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Source Data

#### Initial Data Collection and Normalization

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

#### Who are the source language producers?

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Annotations

#### Annotation process

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

#### Who are the annotators?

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Personal and Sensitive Information

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

## Considerations for Using the Data

### Social Impact of Dataset

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Discussion of Biases

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Other Known Limitations

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

## Additional Information

### Dataset Curators

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Licensing Information

[More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)

### Citation Information

```

@inproceedings{Keysers2020,
  title={Measuring Compositional Generalization: A Comprehensive Method on
         Realistic Data},
  author={Daniel Keysers and Nathanael Sch"{a}rli and Nathan Scales and
          Hylke Buisman and Daniel Furrer and Sergii Kashubin and
          Nikola Momchev and Danila Sinopalnikov and Lukasz Stafiniak and
          Tibor Tihon and Dmitry Tsarkov and Xiao Wang and Marc van Zee and
          Olivier Bousquet},
  booktitle={ICLR},
  year={2020},
  url={https://arxiv.org/abs/1912.09713.pdf},
}

```


### Contributions

Thanks to [@thomwolf](https://github.com/thomwolf), [@patrickvonplaten](https://github.com/patrickvonplaten), [@lewtun](https://github.com/lewtun), [@brainshawn](https://github.com/brainshawn) for adding this dataset.