RedPajama v2 Open Dataset with 30T Tokens for Training LLMs
RedPajama V2 is less about โmore dataโ than about standardising the preprocessing layer that every LLM team normally rebuilds from scratch. By packaging a large web corpus together with reusable quality signals, it shifts effort away from one-off scraping and cleaning toward repeatable dataset engineering. For teams building foundation models, the practical value is that filtering logic can be expressed as code against shared annotations rather than embedded in a bespoke pipeline.
The architectural implication is separation of concerns. Raw crawl ingestion, deduplication, scoring, and downstream sampling become distinct stages that can be swapped or recombined. That matters because different model goals rarely want the same data mixture: an instruction-tuned model, a multilingual model, and a research baseline may all require different thresholds, language balances, or duplicate handling. A dataset with precomputed signals reduces the cost of experimentation, but it also makes the selection policy itself a first-class artifact that teams must version and govern.
Operationally, the trade-off is scale versus tractability. A 30T-token corpus is not something most teams will โload and train onโ directly; it is a substrate for building smaller, policy-driven training sets. That pushes requirements onto storage, indexing, and data tooling, especially when applying multiple filters over hundreds of billions of documents. The upside is that the same corpus can support multiple research paths without reprocessing CommonCrawl from scratch each time.
For platform teams, the key takeaway is reuse. Open annotations, open scripts, and a consistent schema make it easier to integrate dataset curation into MLOps workflows, benchmark alternative sampling strategies, and compare training runs on a more defensible basis. The remaining challenge is not access to data volume, but discipline in how data quality decisions are documented, tested, and inherited across projects.
- Over 100 billion text documents with 100+ trillion raw tokens from 84 CommonCrawl dumps;
- 40+ of the most widely used quality annotations pre-computed for a deduplicated 30 trillion tokens subset;
- Five languages: English, French, Spanish, German, and Italian
- All data processing scripts are open source and available on GitHub; all data are available on HuggingFace.
Why RedPajama-Data-v2 and How to Use it?
A central ingredient to state-of-the-art open LLMs like Llama, Mistral, Falcon, MPT, and the RedPajama models is the large amounts of high-quality data that these models are trained on. For example, Llama 2 is trained on 2.4 trillion carefully curated tokens. The most prominent data sources are the crawls made publicly available by CommonCrawl. However, this data is crude and is not ideal for direct use for LLM training due to artifacts arising from the conversion of HTML to plain text, sources of generally low quality, and biases inherent to the distribution of content on the web. Getting the right dataset and data mixture is painful and any LLM developer has to go through the laborious, time-consuming, energy-intensive and expensive steps of processing and filtering this crude data. Although there have been several community projects around this effort, such as C4, RedPajama-1T, Refinedweb (Falcon), Dolma (AI2) and SlimPajama, many of them only cover a small portion of the CommonCrawl crawls; moreover, they represent a very specific way in which data are filtered. With RedPajama-Data-v2, our goal is to lift this burden off the community and provide a pool of web data serving as a base from which high quality datasets for LLM training can be extracted and based on which LLM training data can be thoroughly researched. It provides, to our best knowledge, the most complete coverage on CommonCrawl (with 84 dumps processed). More importantly, we provide 40+ quality annotations โ the result of different ML classifiers on data quality, minhash results that can be used for fuzzy deduplication, or heuristics such as โthe fraction of words that contain no alphabetical characterโ. We provide our best effort implementations of quality annotations used in C4, Gopher, Pretrainerโs Guide, RefinedWeb and Data Selection for Language Models via Importance Resampling. These annotations provide a way for an LLM developer to easily slice and filter the data, combining these into a new data quality pipeline to create their own pre-training dataset. Here are some examples! The following code snippets show how one can implement commonly used filtering rules in combination with the RedPajama-V2 dataset. For example, implementing the Gopher rules and use these to filter out documents that do not comply with the Gopher rules is as easy as:ef gopher_rules_pass(sample) -> bool:
""" function returns True if the sample complies with Gopher rules """
signals = json.loads(sample["quality_signals"])
# rule 1: number of words between 50 and 10'000
word_count = signals["rps_doc_word_count"][0][2]
if word_count < 50 or word_count > 10_000:
return False
# rule 2: mean word length between 3 and 10
mean_word_length = signals["rps_doc_mean_word_length"][0][2]
if mean_word_length < 3 or mean_word_length > 10:
return False
# rule 2: symbol to word ratio below 0.1
symbol_word_ratio = signals["rps_doc_symbol_to_word_ratio"][0][2]
if symbol_word_ratio > 0.1:
return False
# rule 3: 90% of lines need to start without a bullet point
n_lines = signals["ccnet_nlines"][0][2]
n_lines_bulletpoint_start = sum(map(lambda ln: ln[2], signals["rps_lines_start_with_bulletpoint"]))
if n_lines_bulletpoint_start / n_lines > 0.9:
return False
# rule 4: the ratio between characters in the most frequent 2-gram and the total number
# of characters must be below 0.2
top_2_gram_frac = signals["rps_doc_frac_chars_top_2gram"][0][2]
if top_2_gram_frac > 0.2:
return False
# rule 5: ...
return True
ds = load_dataset("togethercomputer/RedPajama-Data-V2", name="sample")
filtered_dataset = list(filter(gopher_rules_pass, ds["train"]))
In the above snippet, we have used the โsampleโ config to load just a subset of the dataset. In case you want to load the full dataset for, e.g., snapshot 2023-14 in English, you can run:
ds_iterator = load_dataset(
"togethercomputer/RedPajama-Data-V2",
partition="head_middle",
snapshots=["2023-14"],
languages=["en"],
name="default"
)
We can also use the rules used in RedPajama-v1 or C4:
def rpv1_rules_pass(sample) -> bool:
""" function returns True if the sample complies with the filtering rules used in RP-V1 """
signals = json.loads(sample["quality_signals"])
# rule 1: the wikipedia reference classifier score must be higher than 0.25
wikiref_score = signals["rps_doc_ml_wikiref_score"][0][2]
if wikiref_score < 0.25:
return False
return True
def c4_rules_pass(sample) -> bool:
""" function returns True if the sample complies with the filtering rules used in C4 """
signals = json.loads(sample["quality_signals"])
# rule 1: at least 3 sentences
num_sentences = signals["rps_doc_num_sentences"][0][2]
if num_sentences < 3:
return False
# rule 2: page may not contain bad words
n_bad_words = signals["rps_doc_ldnoobw_words"][0][2]
if n_bad_words > 0:
return False
# rule 3: page may not contain placeholder "lorem ipsum" text
lorem_ipsum = signals["rps_doc_lorem_ipsum"][0][2]
if lorem_ipsum > 0:
return False
# rule 4: ...
return True
In the current release, we include 40+ quality annotations, but we very much view this as a โlivingโ project where new additions will be made over time as the field moves towards a better understanding of LLM training data. We hope the community provides feedback, and we are looking forward to continuing to enrich our current pool of annotations.
Enjoyed this article? Sign up for our newsletter to receive regular insights and stay connected.
