wikillm

Paper · 2020-12-31 · cs.CL

The Pile: An 800GB Dataset of Diverse Text for Language Modeling

The Pile: an 825 GiB English corpus of 22 weighted sources (academic, code, legal, web, books, dialogue), built by per-source processing, holdout and exact-document dedup, plus documentation. GPT-2/GPT-3 perplexity is reported in bits per UTF-8 byte. 1.3B-parameter models trained on it beat CC-100 and raw Common Crawl on Pile components and WikiText (author-reported).

Dataset curationLanguage model pretrainingdatasetpretraining-dataevaluation

arXivPDFCodeMarkdown15 min read

AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Language models learn from large piles of text, and most of the big ones have relied mostly on a single web crawl. This paper releases the Pile, a roughly 825 GiB English text collection built from 22 different sources: scientific papers, code, court opinions, patents, books, email, chat logs, subtitles and more. Some sources are deliberately given more weight so that the careful writing in them is seen more than once during training.

The authors also tested it. 1.3B-parameter models trained on the Pile did better than models trained on other web-based collections, both on the Pile's own parts and on a standard word-prediction benchmark. They also documented the data in detail, including its bias, profanity and consent issues, so that users can decide what to use it for.

TL;DR

The Pile is a fixed, documented mixture of 22 English text sources with a per-source epoch weight. Use it when you want a broad, multi-domain pretraining corpus. The paper reports that the authors' 1.3B models beat CC-100 and raw Common Crawl on the Pile components. Several sources carry consent or terms-of- service caveats that the paper itself documents, so check Table 5 before reuse.

Problem

Large language models were mostly trained on Common Crawl derivatives. The authors argue that mixing many smaller, high-quality and diverse sources gives better cross-domain knowledge and downstream generalisation §1. They also note that no large training dataset of that time had been documented in depth by its creators §6.

Method

The Pile has three parts: the constituent datasets §2, the way they are mixed and split app. D, and an evaluation protocol §3, §4. The paper also gives extensive documentation §6.

1. Constituent datasets §2 tab. 1 app. C. Twenty-two components are used: Pile-CC, PubMed Central, Books3, OpenWebText2, ArXiv, GitHub, FreeLaw, Stack Exchange, USPTO Backgrounds, PubMed Abstracts, Project Gutenberg (PG-19), OpenSubtitles, Wikipedia (en), DeepMind Mathematics, Ubuntu IRC, BookCorpus2, EuroParl, HackerNews, YouTube Subtitles, PhilPapers, NIH ExPorter and Enron Emails. Each component is processed separately; the per-component steps are in app. C. The authors filtered for English in several components app. C.1 §5.2.

2. Epoch weights tab. 1 §2 app. D. Each component gets a weight expressed as the number of passes ("epochs") over it in one full pass over the Pile. Higher-quality components get more than one epoch. Wikipedia has 3.0 epochs, and the other components have 1.0 to 2.5 tab. 1.

3. Mixing app. D. Documents are drawn at random from the components until the target size is reached. The draw probability for a component is proportional to its number of documents times its epoch weight app. D. The output is written as 30 interleaved piles app. D.

Pseudocode
# Mix components into the Pile  [app. D]  [tab. 1]
def draw_pile_document(components, epochs, num_docs, rng):
    # Weight of each component: documents times epochs  [app. D]
    weights = [num_docs[c] * epochs[c] for c in components]
    # Pick one component at random with those weights  [app. D]
    component = rng.choices(components, weights=weights, k=1)[0]
    # Return the next document of the chosen component  [app. D]
    return next_document(component)

4. Holdout and leakage removal app. D §3.1. About 10 GiB is held out; about 2 GiB of it is used for validation and test splits, and the rest is kept in reserve app. D. Training documents that appear verbatim in the held-out data are removed app. D.

Pseudocode
# Remove training documents that match a held-out document  [app. D]
def remove_holdout_copies(train_docs, holdout_docs):
    # Fingerprint every held-out document  [code: processing_scripts/dedupe_train.py#L40-L45]
    seen = {sha256(doc) for doc in holdout_docs}
    # Keep only training documents whose fingerprint is unseen  [app. D]
    return [doc for doc in train_docs if sha256(doc) not in seen]

5. Deduplication app. D. Document-level near-duplicate removal with MinHash LSH is applied only to OpenWebText2 and Pile-CC; Pile-wide deduplication was not performed for memory reasons app. D. The paper reports a duplicate rate of 28% for OpenWebText2 and 26% for Pile-CC app. D.

6. Evaluation §3.1 §3.2 app. E.2. Models are scored in bits per UTF-8 byte (BPB), which makes results comparable across tokenisers §3.1. The formula is given in the Hyperparameters table. Perplexity is computed per document, not over concatenated text §3.2 app. E.2.

7. Relative GPT-3 difficulty proxy §3.3. To estimate how much GPT-3 underperforms on each component, the paper compares GPT-3 and a GPT-2 model trained on the Pile, each measured relative to OpenWebText2. The equation is below §3.3.

Pseudocode
# Relative difficulty of a component vs OpenWebText2  [§3.3]
def relative_gap(component, loss_gpt3, loss_gpt2_pile):
    # Gap between the component and OpenWebText2 for GPT-3  [§3.3]
    gpt3_gap = loss_gpt3[component] - loss_gpt3["owt2"]
    # Same gap for the GPT-2 model trained on the Pile  [§3.3]
    pile_gap = loss_gpt2_pile[component] - loss_gpt2_pile["owt2"]
    # Lower values mean GPT-3 does relatively better  [§3.3] [fig. 3]
    return gpt3_gap - pile_gap

8. Documentation §6 app. E app. F. The paper documents the data using datasheets and data statements §6.1. It adds topic models §6.2, profanity §6.3, co-occurrence bias §6.4, author consent tiers §6.5, legal discussion §7.1, and dataset samples app. F.

Hyperparameters

Values stated in the paper. Anything not listed was not stated.

NameValueWhereNotes
Total raw size825.18 GiB§2 tab. 1Before up- and down-sampling
Total effective size1254.20 GiBtab. 1Sum of raw size times epochs
Number of components22§2
Epoch weight, Wikipedia (en)3.0tab. 1Highest weight
Epoch weight, Gutenberg (PG-19)2.5tab. 1See Pitfalls: conflicts with app. D
Epoch weight, Pile-CC1.0tab. 1
Epoch weight, most others1.5 or 2.0tab. 1Per component, see table
Output piles30app. DInterleaved output
Held-out dataabout 10 GiBapp. D2 GiB used for validation and test
Validation split0.1% of data§3.1Sampled uniformly at random
Test split0.1% of data§3.1Sampled uniformly at random
MinHash hash functions10app. DDeduplication of OWT2 and Pile-CC
MinHash Jaccard threshold0.5app. D"approximate Jaccard similarity of 0.5"
Pile-CC WARC chunks3679 chunks, 22 sampledapp. C.1WARC files from 2013 to 2020
Pile-CC classifierfastText, n-gram size 2app. C.1Positive class: OpenWebText2
Pareto threshold α3app. C.1 tab. 6Kept ratio 0.2390 at α = 3
GitHub star thresholdmore than 100app. C.6Repository selection
GitHub repo size limitunder 1 GBapp. C.6See Pitfalls on the search bounds
GitHub file size limit100 kBapp. C.6See Paper vs code
GitHub hard time limit300 sapp. C.6Clone and extraction
GitHub sampled size95.0 GiB of 630.64 GiBapp. C.6
Stack Exchange answerstop 3, at least 3 upvotesapp. C.8Prefixes "Q:" and "A:"
BookCorpus2 books17,868app. C.16Original BookCorpus: 11,038
EuroParl minimum length200 charactersapp. C.17Shorter documents discarded
PhilPapers minimum length1000 charactersapp. C.20
HackerNews story id range1 to 24531712app. C.18About 2006-10-09 to 2020-09-20
YouTube videos173,651app. C.191000 video IDs per search term
Perplexity context1024 (GPT-2), 2048 (GPT-3)app. E.2Segment length
Perplexity subsampleone-tenth of test set§3.2 app. E.2Full test set for Ubuntu IRC, BookCorpus2, PhilPapers
GPT-3 size mappingada, babbage, curie, davinci = 2.7B, 6.7B, 13B, 175B§3.2 fn.Assumed by the authors
Tokens per byte, Pile0.29335 GPT-2 tokens per byte§3.1Per-component values in app. D
Bits per byte formulaBPB = (L_T / L_B) × ℓ / ln 2§3.1L_T tokens, L_B bytes, ℓ NLL in nats
Size-controlled subsampleabout 40 GB per dataset§4.1 tab. 3Deduplicated against eval sets
Decontamination13-gram overlap filter§4.1Same as GPT-3
Benchmark model size1.3 billion parameters§4.1"architecturally-identical" to GPT-3 family
LDA topics16§6.2Gensim, online LDA
Language identificationfastText; Pile 97.4% English§5.2
Training optimiser, learning rate, batch size, steps, tokenizer for trainingnot stated§4.1

Results

Author-reported. All numbers come from the paper's own runs. Models: GPT-2 (small to xl) and GPT-3 (ada to davinci) for perplexity §3.2; 1.3B-parameter models trained from scratch on each dataset for §4 tab. 3 tab. 4.

Test perplexity of GPT-2 and GPT-3 on Pile components, bits per UTF-8 byte tab. 2. One-tenth of each test set, scored per document. Bold in the paper marks the best model per row (davinci in every row).

ComponentGPT-2 smallGPT-2 mediumGPT-2 largeGPT-2 xlGPT-3 adaGPT-3 babbageGPT-3 curieGPT-3 davinci
Pile-CC1.08780.99920.95820.93550.92120.84830.78490.7070
PubMed Central1.07590.97880.93340.90440.86330.77920.71500.6544
Books31.19591.10631.05881.02870.97780.90050.82840.7052
OpenWebText21.11111.00730.95390.91710.87270.79210.71990.6242
ArXiv1.35481.23051.17781.13811.03040.92590.84530.7702
Github1.79121.31801.79091.64860.87610.73350.64150.5635
FreeLaw1.05120.93210.90170.87470.82260.73810.66670.6006
Stack Exchange1.29811.10751.08061.05041.00960.88390.80040.7321
USPTO Backgrounds0.82880.75640.72020.69690.67990.62300.57520.5280
PubMed Abstracts0.95240.85790.81080.78100.81300.73820.67730.6201
Gutenberg (PG-19)1.26551.11401.08201.08290.97760.87490.79300.7115
OpenSubtitles1.24651.16571.13241.11291.11161.04880.98750.9130
Wikipedia (en)1.12851.02130.97950.96550.87570.78630.70470.5953
DM Mathematics2.69112.54482.48332.43772.32492.20152.10672.0228
Ubuntu IRC1.84661.71871.64271.60241.31391.19681.09950.9915
BookCorpus21.12951.04981.00610.97830.97540.90410.84350.7788
EuroParl2.31772.02041.87701.76501.04750.93630.84150.7519
HackerNews1.44331.27941.31431.33611.17361.08751.01750.9457
YoutubeSubtitles2.03871.84121.73551.66941.34071.18761.06390.9469
PhilPapers1.32031.21631.16881.13271.03620.95300.88020.8059
NIH ExPorter0.90990.83230.79460.76940.79740.73260.67840.6239
Enron Emails1.58881.41191.45351.42221.26341.16851.09901.0201
The Pile1.22531.09281.08281.04680.96310.87180.79800.7177

Scaling: the authors fit a line to GPT-3 family perplexity on the Pile with coefficient −0.1674 and intercept 2.5516 §3.2 fig. 2. The paper states that GPT-2 and GPT-3 were not trained on the Pile §3.2.

Size-controlled comparison of 1.3B models tab. 3. Each dataset is deduplicated against all evaluation sets and subsampled to about 40 GB §4.1. WikiText and LAMBADA use the variant of GPT-2 §4.1 tab. 3.

Training dataPile val (BPB)Pile test (BPB)WikiText (ppl)LAMBADA (ppl)LAMBADA (acc, %)
The Pile0.92810.94335.5912.7850.1
CC-100 (en)1.31431.32938.2711.7849.7
Raw CC1.11801.127511.7519.8443.8

The Pile row lists "825 GiB" as dataset size in the paper's table, while the caption and §4.1 say the subsample is about 40 GB tab. 3 §4.1. See Pitfalls.

Per-component BPB on the Pile test set tab. 4. Columns are the training set, rows the evaluation component. The paper marks the best model per row in bold, and the Pile model is best on every row.

Evaluation componentThe PileCC-100 (en)Raw CC (en)
Pile-CC0.99891.08731.0287
PubMed Central0.63321.13110.9120
Books31.07341.22641.1366
OpenWebText20.99381.22221.0732
ArXiv0.79451.81591.2642
Github0.55971.65090.9301
FreeLaw0.69781.02210.9468
Stack Exchange0.81521.54141.1292
USPTO Backgrounds0.67310.87720.8455
PubMed Abstracts0.73131.01930.9718
Gutenberg (PG-19)1.14261.27801.2235
OpenSubtitles1.09091.18271.2139
Wikipedia (en)0.89611.18071.0252
DM Mathematics1.52063.17742.6229
Ubuntu IRC1.40852.12431.5691
BookCorpus21.06131.13461.0914
EuroParl1.12022.71411.4917
HackerNews1.09681.43521.2305
YoutubeSubtitles1.42692.32871.5607
PhilPapers1.12561.42691.2090
NIH ExPorter0.73470.97130.9225
Enron Emails0.83011.33001.0483

Headline text, as stated by the authors: the Pile improves significantly on WikiText and shows negligible change on LAMBADA §4.2. Models trained on the Pile beat both Raw CC and CC-100 on every Pile component, per the authors §4.2. The authors single out significant gains over CC-100 on academic sets (ArXiv, PubMed Central, FreeLaw, PhilPapers), code sets (GitHub, Stack Exchange), EuroParl and DM Mathematics §4.2 fig. 4. They also note that raw Common Crawl beats CC-100 on the Pile and hypothesise that CC-100's perplexity-based filtering is the cause §4.2.

Dataset consent tiers tab. 5. This table is a statement of the authors' own assessment, not legal advice. Columns: Public (freely available on the internet), ToS (obtained consistent with the host's terms of service), Author (authorial consent, or a reasonable expectation of research use) §6.5.

ComponentPublicToSAuthor
Pile-CCyesyes
PubMed Centralyesyesyes
Books3yes
OpenWebText2yes
ArXivyesyesyes
Githubyesyes
FreeLawyesyesyes
Stack Exchangeyesyesyes
USPTOyesyesyes
PubMedyesyesyes
PG-19yesyes
OpenSubtitlesyes
Wikipediayesyesyes
DM Mathyesyesyes
Ubuntu IRCyesyesyes
BookCorpus2yes
EuroParlyesyesyes
HackerNewsyesyes
YTSubtitlesyes
PhilPapersyesyesyes
NIHyesyesyes
Enron Emailsyesyes

The authors state that five components (Books3, OpenWebText2, OpenSubtitles, BookCorpus2 and YouTube Subtitles) were not collected and distributed in a terms-of-service compliant way, and that the authors of those works had no ability to consent §6.5.

Tokens per byte app. D. These values convert between tokens and bytes for each component. They are needed for BPB.

ComponentTokens per byte
Pile-CC0.2291
PubMed Central0.3103
Books30.2477
OpenWebText20.2434
ArXiv0.3532
Github0.4412
FreeLaw0.2622
Stack Exchange0.3436
USPTO Backgrounds0.2116
PubMed Abstracts0.2183
Gutenberg (PG-19)0.2677
OpenSubtitles0.2765
Wikipedia (en)0.2373
DM Mathematics0.8137
Ubuntu IRC0.3651
BookCorpus20.2430
EuroParl0.3879
HackerNews0.2627
YoutubeSubtitles0.4349
PhilPapers0.2688
NIH ExPorter0.1987
Enron Emails0.3103

Filtering ratios for the Pile-CC classifier app. C.1 tab. 6. Kept fraction of Common Crawl documents at each Pareto α. α = 3 was chosen.

αFiltering ratio (kept : total)
10.5894
20.3649
30.2390
40.1671
50.1239
60.0974
70.0802
80.0685
90.0602

Other results, in words. The Pile is 97.4% English by fastText §5.2. The mean document length and bytes per token are plotted per component §5.1 fig. 5 fig. 6. Profanity: the Pile as a whole is less profane than Pile-CC by the authors' word-level proxy §6.3 fig. 7. Gender and religion co-occurrence and sentiment are reported as tables and figures in the appendix; the racial sentiment averages are White −0.114, Black −0.148, Asian −0.028, Hispanic −0.024 §6.4.3.

Paper vs code

Official repository: https://github.com/EleutherAI/the-pile, linked from the paper's footnote §1 and maintained by the authors' lab. Checked at commit df97f8651ae3da658b19659b3ceaa6a34b0fc014, licence MIT.

  • Epoch weights agree. The paper's epoch column tab. 1 matches the per-component weights in the code, and Pile-CC is added with weight 1.0 pile.py pile.py.
  • Mixing rule agrees. Paper: draw by documents times epochs app. D. Code: weight times documents, normalised pile.py.
  • Holdout fraction disagrees. Paper: validation and test are 0.1% each, about 2 GiB of about 10 GiB held out §3.1 app. D. Code: 1% of each shuffled chunk goes to a holdout directory [code: processing_scripts/pass2_shuffle_holdout.py#L30-L35]. The validation and test split step is not in the files reviewed.
  • Total size constant disagrees. Code's ThePile.size() returns 1200 GiB pile.py. The paper gives 825.18 GiB raw and 1254.20 GiB effective tab. 1.
  • Holdout removal is exact. Paper: remove training documents that appear verbatim in the holdout app. D. Code: SHA-256 of the whole document must match dedupe_train.py. Near-duplicates are not removed by this step.
  • GitHub file limit is characters, not bytes. Paper: 100 kB file limit app. C.6. Code: keeps files with len(text) < 100000 characters [code: processing_scripts/github_reduce.py#L15].
  • Evaluation decontamination. Paper: 13-gram overlap filter as in GPT-3 §4.1. Code: 13-grams from evaluation texts are excluded, and each match removes 200 characters on each side [code: processing_scripts/ablation_dedupe/make_deduped.py#L31-L43].
  • Not in this repository. No code was found in the repository for the Pile-CC extraction (jusText), the OpenWebText2 and Pile-CC MinHash deduplication, pycld2 filtering, or the 1.3B model training. A search of the repository for minhash, datasketch, justext and pycld2 returned nothing. The paper says construction code is public app. C. It may live in other repositories not reviewed here.

Pitfalls

  • Three different sizes. The Pile is 825.18 GiB raw, 1254.20 GiB after epoch weights tab. 1, and the code constant says 1200 GiB [code: the_pile/pile.py#L206-L207]. Say which one you mean.
  • Epoch limits contradict each other. Appendix D says no data was allowed above 3 epochs and that the authors avoided more than 2 epochs app. D. Table 1 lists Wikipedia at 3.0 and Gutenberg at 2.5 tab. 1.
  • Holdout size contradicts itself. Section 3.1 gives 0.1% for each of validation and test. Appendix D says about 10 GiB is held out. The code holds out 1% per chunk pass2_shuffle_holdout.py.
  • Table 3's size column conflicts with its caption. The Pile row says 825 GiB, while the caption and §4.1 say each dataset is subsampled to about 40 GB tab. 3.
  • BPB needs the mean loss in nats per token. The formula is BPB = (L_T / L_B) × ℓ / ln 2, where ℓ is a per-token loss in nats §3.1. The paper does not say explicitly whether ℓ is the mean; treat it as the mean per token. Use the tokens-per-byte values for each component, not the global 0.29335, when reporting per-component BPB §3.1 app. D.
  • Perplexity is per document. Documents are scored one at a time and not concatenated §3.2 app. E.2. Segments are non-overlapping, so early tokens of each segment see less context. Reproducing the paper's numbers needs the same per-document rule app. E.2.
  • GPT-3 sizes are assumptions. The paper assumes ada, babbage, curie and davinci are 2.7B, 6.7B, 13B and 175B parameters §3.2 footnote. The API does not publish sizes.
  • Test evaluation is on one-tenth of the test set for most components §3.2 app. E.2. Three components (Ubuntu IRC, BookCorpus2, PhilPapers) are scored on the full test set app. E.2. Compare numbers only on the same subset.
  • GitHub search bounds in the paper look wrong. The paper says the first query covers repositories between 0 and 5 bytes and returns 965 results app. C.6. That range is almost certainly a unit typo, and the paper does not say what unit was intended. The next-bound formula is given in the same section app. C.6. Do not reuse the bounds without checking the GitHub API.
  • GitHub sampling is lossy. Only 95.0 GiB of 630.64 GiB was kept app. C.6. Repositories exceeding 300 seconds to clone or extract are partially extracted app. C.6.
  • Epoch weighting raises duplication. Components with 2 to 3 epochs are seen two or three times in one pass tab. 1. That affects memorisation and should be considered when interpreting results.
  • Deduplication is partial. Only OpenWebText2 and Pile-CC are deduplicated app. D, so duplicates across components are not removed. The paper says some documents may be duplicated across train, validation and test §3.1.
  • No downstream leakage removal. The authors chose not to remove overlap with downstream benchmarks app. D. Remove overlaps yourself when you evaluate on other benchmarks.
  • Several components are not ToS- or consent-compliant. Five components are flagged in tab. 5 and §6.5. The paper's fair-use argument §7.1 is the authors' view and explicitly not legal advice. Check with counsel before commercial use.
  • Scaling-law fit is on GPT-2 and GPT-3, not on trained Pile models. The line has coefficient −0.1674 and intercept 2.5516 §3.2.
  • The relative-difficulty equation is a proxy. The authors say it can be confounded by dataset-specific scaling effects §3.3. The GPT-2-Pile model is a stand-in because GPT-3 was not retrained §3.3.
  • Cross-reference error in the paper. The text refers to "Section 3.7" for the language classifier §6.3. The language section is §5.2.
  • Training details are missing. The paper trains 1.3B models "based on" GPT-3 but gives no optimiser, learning rate, batch size, step count or training tokenizer §4.1. Mark these as not stated when you implement.
  • Figure-based results are not tabulated. The relative GPT-3 chart fig. 3 and the CC-100 improvement chart fig. 4 have no table in the paper.

Lineage

  • Builds on: the datasets it re-packages. Books3 (Bibliotik), PG-19, OpenSubtitles, OpenWebText, BookCorpus, Wikipedia, DM Mathematics, EuroParl, Enron Emails §2. These are named and cited in the paper but not carded here.
  • Compared against: GPT-2 and GPT-3 perplexity §3.2; CC-100 and raw Common Crawl training §4.2. Not carded here.
  • Superseded by: not stated in this card.

Source and license

Adapted from “The Pile: An 800GB Dataset of Diverse Text for Language Modeling” by Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, Connor Leahy (arXiv:2101.00027), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/EleutherAI/the-pile at commit df97f8651ae3 (MIT). Any quoted code is shown under that license.