# C4 (2019)

> The Colossal Clean Crawled Corpus: 365 million English web pages, filtered with simple rules.

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

## Key facts

- Category: Text
- Task: Pretraining corpus (cleaned web text)
- Creators: Colin Raffel et al. (Google); public copy by the Allen Institute for AI
- Size: ~365M documents, ~156B tokens, ~305 GB compressed (English)
- Splits: train 364,868,892, validation 364,608
- Input: The text of one web page
- Labels: None (self-supervised)
- License: ODC-BY
- Paper: [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer (T5)](https://arxiv.org/abs/1910.10683)
- Hugging Face: [allenai/c4](https://huggingface.co/datasets/allenai/c4)
- Sampled at Hub revision 1588ec454efa1a09f29cd18ddd04fe05fc8653a2 (2026-11-07)

## Why it matters

What a pretraining dataset actually looks like. C4 took one month of Common Crawl and kept only lines that look like prose. T5 was trained on it, and it became a common ingredient of later corpora. It was also one of the first such datasets to be audited in detail, which showed what simple filters keep and what they throw away.

## Worth knowing

- The rules: keep lines that end in punctuation, drop pages with fewer than three sentences, code braces, "lorem ipsum" or any word from a list of bad words, and remove repeated three-sentence spans.
- A 2021 audit found that the bad-word filter removed text by and about minority groups disproportionately, and that patents.google.com was the most common website.
- It was built from the April 2019 Common Crawl snapshot.

## Get the data

The command fetches the English validation set (~40 MB per shard, 8 shards); the full English training set is about 305 GB.

```bash
# pip install -U huggingface_hub
hf download allenai/c4 --repo-type dataset \
  --include "en/c4-validation.*" \
  --local-dir c4
```

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

ds = load_dataset("allenai/c4", "en")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/allenai/c4@~parquet/en/validation/*.parquet")
print(df.shape)
```

## Related datasets

- [FineWeb](https://huggingface.co/datasets/HuggingFaceFW/fineweb): 2024, 15T tokens of filtered, deduplicated Common Crawl
- [FineWeb-Edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu): 2024, the 1.3T tokens of FineWeb an educational-quality classifier kept
- [The Pile](https://pile.eleuther.ai/): 2020, 825 GB from 22 curated sources
- [WikiText-103](https://huggingface.co/datasets/Salesforce/wikitext): 2016, curated Wikipedia articles (on this site: https://mralbu.github.io/ai-datasets/d/wikitext)

## Landmark papers

- [Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus](https://arxiv.org/abs/2104.08758) (2021)
- [Deduplicating Training Data Makes Language Models Better](https://arxiv.org/abs/2107.06499) (2021)

## Papers on this site that use it

- [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.
- [Chinchilla (2022)](https://mralbu.github.io/ai-datasets/p/chinchilla.md): For a fixed compute budget, train a smaller model on more data; 70 billion parameters on 1.4 trillion tokens beat models four times its size.
- [LLaMA (2023)](https://mralbu.github.io/ai-datasets/p/llama.md): Smaller models trained longer on public data alone, matching models many times their size, with the weights given to researchers.
