# WikiText-103 (2016)

> 103 million words from 28,475 good and featured Wikipedia articles, kept whole.

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

## Key facts

- Category: Text
- Task: Language modeling (predict the next word)
- Creators: Stephen Merity, Caiming Xiong, James Bradbury, Richard Socher (MetaMind / Salesforce)
- Size: 28,595 articles (28,475 for training), ~103M training tokens, ~1.8M lines
- Splits: train 1,801,350, validation 3,760, test 4,358
- Input: Running text, one paragraph or heading per line
- Labels: None. The next word is the target.
- License: CC BY-SA 3.0
- Paper: [Pointer Sentinel Mixture Models](https://arxiv.org/abs/1609.07843)
- Hugging Face: [Salesforce/wikitext](https://huggingface.co/datasets/Salesforce/wikitext)
- Sampled at Hub revision b08601e04326c79dfdd32d625aee71d232d685c3 (2026-11-07)

## Why it matters

Before it, the standard language-modeling benchmark was Penn Treebank: about a million words, all lower case, with numbers replaced by N and a 10k-word vocabulary. WikiText-103 is a hundred times bigger and keeps case, punctuation, numbers and whole articles, so models can use long context. Perplexity on it tracked the move from LSTMs to Transformers: Transformer-XL reached 18.3, and GPT-2 reported 17.5 without training on it at all.

## Worth knowing

- Tokens like "@-@", "@,@" and "@.@" mark a hyphen, comma or period inside a word or number, as in "1 @,@ 000".
- Headings look like " = Title = ", with more equals signs for subsections. Blank lines and headings are skipped in the samples below.
- The non-raw version replaces words seen fewer than 3 times with <unk>; this page shows the raw version.
- Validation and test are only 60 articles each, so a test perplexity is computed over about 245k tokens.

## Get the data

```bash
# pip install -U huggingface_hub
hf download Salesforce/wikitext --repo-type dataset \
  --include "wikitext-103-raw-v1/*" \
  --local-dir wikitext
```

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

ds = load_dataset("Salesforce/wikitext", "wikitext-103-raw-v1")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/Salesforce/wikitext@~parquet/wikitext-103-raw-v1/test/*.parquet")
print(df.shape)
```

## Related datasets

- [Penn Treebank (WSJ)](https://catalog.ldc.upenn.edu/LDC99T42): 1993, the earlier ~1M-word benchmark
- [WikiText-2](https://huggingface.co/datasets/Salesforce/wikitext): 2016, a 2M-word subset for quick experiments
- [C4](https://huggingface.co/datasets/allenai/c4): 2019, web-scale pretraining corpus behind T5 (on this site: https://mralbu.github.io/ai-datasets/d/c4)

## Landmark papers

- [Adaptive Input Representations for Neural Language Modeling](https://arxiv.org/abs/1809.10853) (2018)
- [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860) (2019)
- [Language Models are Unsupervised Multitask Learners (GPT-2)](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) (2019)

## Papers on this site that use it

- [GPT-2 (2019)](https://mralbu.github.io/ai-datasets/p/gpt-2.md): A language model trained only on web text that summarizes, translates and answers questions without being trained to.
- [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.
