# SQuAD (2016)

> 100k+ questions about Wikipedia paragraphs; the answer is a span of the text.

Page: https://mralbu.github.io/ai-datasets/d/squad

## Key facts

- Category: Text
- Task: Extractive question answering (reading comprehension)
- Creators: Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, Percy Liang (Stanford)
- Size: 107,785 questions on 536 Wikipedia articles (98,169 public)
- Splits: train 87,599, validation 10,570
- Input: A Wikipedia paragraph and a question about it
- Labels: Answer text and its character offset in the paragraph
- License: CC BY-SA 4.0
- Paper: [SQuAD: 100,000+ Questions for Machine Comprehension of Text](https://arxiv.org/abs/1606.05250)
- Homepage: https://rajpurkar.github.io/SQuAD-explorer/
- Hugging Face: [rajpurkar/squad](https://huggingface.co/datasets/rajpurkar/squad)
- Sampled at Hub revision 7b6d24c440a36b6815f21b70d25016731768db1f (2026-11-07)

## Why it matters

The benchmark of the "reading comprehension" era. Its public leaderboard drove a fast run of attention models (BiDAF and others) and then BERT, whose ensembles passed the human baseline in 2018. Framing QA as span selection is still common in information extraction.

## Worth knowing

- Every answer is a substring of the paragraph, so a model only has to point at a start and an end position.
- Validation questions have several reference answers from different annotators (usually three); scoring takes the best match.
- Scored with exact match and token-level F1. Humans scored 86.8 F1 on the test set in the original paper (about 91 on the later leaderboard).
- SQuAD 2.0 (2018) added 50k unanswerable questions, because models had learned to always pick some plausible span.

## Get the data

```bash
# pip install -U huggingface_hub
hf download rajpurkar/squad --repo-type dataset \
  --local-dir squad
```

```python
from datasets import load_dataset   # pip install datasets

ds = load_dataset("rajpurkar/squad", "plain_text")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/rajpurkar/squad@~parquet/plain_text/validation/*.parquet")
print(df.shape)
```

## Related datasets

- [SQuAD 2.0](https://huggingface.co/datasets/rajpurkar/squad_v2): 2018, adds unanswerable questions
- [Natural Questions](https://huggingface.co/datasets/google-research-datasets/natural_questions): 2019, real Google search questions (on this site: https://mralbu.github.io/ai-datasets/d/natural-questions)
- [HotpotQA](https://huggingface.co/datasets/hotpotqa/hotpot_qa): 2018, questions that need two paragraphs (on this site: https://mralbu.github.io/ai-datasets/d/hotpotqa)
- [CNN/DailyMail](https://huggingface.co/datasets/abisee/cnn_dailymail): 2015, cloze questions from news highlights, the reading benchmark before SQuAD (on this site: https://mralbu.github.io/ai-datasets/d/cnn-dailymail)
- [MS MARCO](https://huggingface.co/datasets/microsoft/ms_marco): 2016, real Bing queries answered from web passages (on this site: https://mralbu.github.io/ai-datasets/d/ms-marco)

## Landmark papers

- [Bidirectional Attention Flow for Machine Comprehension (BiDAF)](https://arxiv.org/abs/1611.01603) (2016)
- [BERT: Pre-training of Deep Bidirectional Transformers](https://arxiv.org/abs/1810.04805) (2018)

## Papers on this site that use it

- [BiDAF (2016)](https://mralbu.github.io/ai-datasets/p/bidaf.md): A reader that lets the question and the passage attend to each other at every word, then points to the answer span.
- [BERT (2018)](https://mralbu.github.io/ai-datasets/p/bert.md): Pretrain a Transformer to fill in masked words, then fine-tune it for almost any language task.
- [T5 (2019)](https://mralbu.github.io/ai-datasets/p/t5.md): Every language task written as text in, text out, and a careful study of which pretraining choices actually matter.
- [DPR (2020)](https://mralbu.github.io/ai-datasets/p/dpr.md): Find the passage that answers a question by comparing learned embeddings, not shared words.
