File size: 35,927 Bytes
cb715ae f5f282b cb715ae 9f80578 fdaf637 84a48e2 34b0752 84a48e2 cb715ae 84a48e2 cb715ae 34b0752 4214d2c 84a48e2 34b0752 cb715ae 84a48e2 43250a0 cb715ae 84a48e2 cb715ae 84a48e2 c4b24b2 43250a0 84a48e2 43250a0 84a48e2 cb715ae 4214d2c cb715ae 167a6e2 cb715ae 34b0752 3654bf8 34b0752 f5f282b 6218229 f5f282b 816154f cb715ae 4214d2c 84a48e2 f5f282b 816154f f5f282b 816154f f5f282b cb715ae 84a48e2 cb715ae 34b0752 f5f282b cb715ae 84a48e2 cb715ae f5f282b 4214d2c cb715ae 84a48e2 cb715ae 84a48e2 cb715ae 167a6e2 cb715ae 923e66a 3654bf8 923e66a 4214d2c cb715ae 4214d2c cb715ae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
---
task_categories:
- text-generation
language:
- en
- de
- fr
- es
- it
pretty_name: Red Pajama V2 Dataset
---
### Getting Started
RedPajama-V2 is an open dataset for training large language models. The dataset includes over 100B text
documents coming from 84 CommonCrawl snapshots and processed using
the [CCNet](https://github.com/facebookresearch/cc_net) pipeline. Out of these, there are 30B documents in the corpus
that additionally come with quality signals, and 20B documents that are deduplicated.
Check out our [blog post](XXXXX) for more details on the build process, dataset structure and schema.
To familiarize yourself with the dataset, you can load the sample dataset using:
```python
from datasets import load_dataset
ds = load_dataset("togethercomputer/RedPajama-Data-V2", name="sample")
```
To download a the dataset for a specific combination of `{partition} x {snapshot_id} x {language}`, you can run
```python
from datasets import load_dataset
ds = load_dataset("togethercomputer/RedPajama-Data-V2",
name="sample",
partition="head_middle",
snapshots=["2023-06", "2022-49"],
languages=["en", "de"])
```
Alternatively, you can also directly download the files using the following instructions, using English data from the
`2023-06` snapshot and the `head_middle` partition as an example. The full set of CC snapshots included in the dataset
is given in `_CC_SNAPSHOT_IDS`, and the available partitions are `tail` and `head_middle`. The available language tags
are `en`, `de`, `fr`, `es`, `it`.
```bash
CC_SNAPSHOT="2023-06"
LANG="en"
PARTITION="head_middle"
BASE_URL="https://data.together.xyz/redpajama-data-v2/v1.0.0"
listings_file="${LANG}-${CC_SNAPSHOT}-${PARTITION}.txt"
wget "${BASE_URL}/listings/${listings_file}"
# download documents
while read line; do
url="${BASE_URL}/documents/${line}.json.gz"
dest="documents/${line}.json.gz"
mkdir -p $(dirname $dest)
wget "$url" -O "$dest"
done <"$listings_file"
# download other components
COMPS=("quality_signals" "minhash" "duplicates")
for comp in "${COMPS[@]}"; do
while read line; do
url="${BASE_URL}/${comp}/${line}.${comp}.json.gz"
dest="${comp}/${line}.${comp}.json.gz"
mkdir -p $(dirname $dest)
wget "$url" -O "$dest"
done <"$listings_file"
done
```
A full set of scripts to recreate the dataset, including the quality signals, can be
found [here](https://github.com/togethercomputer/RedPajama-Data).
### Applying Filtering Rules
You can use the quality signals to filter the raw RedPajama-V2 dataset for a given set of rules. For example, consider
the following set of rules used in Gopher:
```python
def 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
```
Filtering the RedPajama-V2 dataset with this set of rules is then as easy as:
```python
ds_iterator = load_dataset(
"togethercomputer/RedPajama-Data-V2",
snapshots=["2023-14"],
languages=["en"],
name="default",
streaming=True
)
filtered_dataset = []
for sample in ds_iterator["train"]:
if not gopher_rules_pass(sample):
continue
filtered_dataset.append(sample)
```
### Dataset Summary
RedPajama-V2 is an open dataset for training large laguage models and includes over 100B text documents. Out of these,
30B documents come with quality annotations. Out of the 30B quality annotated documents, 20B are deduplicated.
#### Quality Annotations
| Annotation Tag | Description | Category | Reference |
|------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|-------------------------------------------------------------------------------------------------------------------------------|
| ccnet_bucket | head, middle or tail bucket of the perplexity score | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| ccnet_language_score | score of the language identification model | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| ccnet_length | number of characters | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| ccnet_nlines | number of lines | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| ccnet_original_length | number of characters before in-document line deduplication | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| ccnet_original_nlines | number of lines before in-document line deduplication | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| ccnet_perplexity | perplexity of an LM trained on Wikipedia | CCNet | [CCNet](https://github.com/facebookresearch/cc_net) |
| rps_doc_books_importance | Given a bag of {1,2}-wordgram model trained on Books p, and a model trained on the source domain q, This is the logarithm of the ratio p(doc)/q(doc). | ML Heuristics | [Importance Resampling (Xie et al.)](https://arxiv.org/abs/2302.03169) |
| rps_doc_openwebtext_importance | Given a bag of {1,2}-wordgram model trained on OpenWebText p, and a model trained on the source domain q, this is the logarithm of the ratio p(doc)/q(doc). | ML Heuristics | [Importance Resampling (Xie et al.)](https://arxiv.org/abs/2302.03169) |
| rps_doc_wikipedia_importance | Given a bag of {1,2}-wordgram model trained on Wikipedia articles p, and a model trained on the source domain q, this is the logarithm of the ratio p(doc)/q(doc). | ML Heuristics | [Importance Resampling (Xie et al.)](https://arxiv.org/abs/2302.03169) |
| rps_doc_ml_wikiref_score | Fasttext classifier prediction for the document being a Wikipedia reference. This is the same fasttext model used in the RedPajama-1T dataset. Only applies to English data.. | ML Heuristics | [LLaMA](https://arxiv.org/abs/2302.13971), [RedPajama-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) |
| rps_doc_ml_palm_score | Fasttext classifier prediction for the document being a Wikipedia article, OpenWebText sample or a RedPajama-V1 book. Only for English data. | ML Heuristics | [PALM](https://arxiv.org/abs/2204.02311), [GLaM](https://arxiv.org/abs/2112.06905) |
| rps_doc_ml_wikipedia_score | Fasttext classifier prediction for the document being a Wikipedia article. This is used for non-English data | ML Heuristics | - |
| rps_doc_curly_bracket | The ratio between the number of occurrences of '{' or '}' and the number of characters in the raw text. | Natural Language | [C4](https://arxiv.org/abs/1910.10683) |
| rps_doc_frac_all_caps_words | The fraction of words in the content that only consist of uppercase letters. This is based on the raw content. | Natural Language | [Pretrainerβs Guide](https://arxiv.org/abs/2305.13169) |
| rps_doc_frac_lines_end_with_ellipsis | The fraction of lines that end with an ellipsis, where an ellipsis is defined as either "..." or "β¦". | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_no_alph_words | The fraction of words that contain no alphabetical character. | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_lorem_ipsum | The ratio between the number of occurrences of 'lorem ipsum' and the number of characters in the content after normalisation. | Natural Language | [C4](https://arxiv.org/abs/1910.10683) |
| rps_doc_mean_word_length | The mean length of words in the content after normalisation. | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_stop_word_fraction | The ratio between the number of stop words and the number of words in the document. Stop words are obtained from the [stopwords-json](https://github.com/6/stopwords-json) repo. | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_symbol_to_word_ratio | The ratio of symbols to words in the content.. Symbols are defined "#", "...", and "β¦". | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_unique_words | The fraction of unique words in the content. This is also known as the degeneracy of a text sample. Calculated based on the normalised content. | Natural Language | [Pretrainerβs Guide](https://arxiv.org/abs/2305.13169) |
| rps_doc_unigram_entropy | The entropy of the unigram distribution of the content. This measures the diversity of the content and is computed using sum(-x / total * log(x / total)) where the sum is taken over counts of unique words in the normalised content. | Natural Language | - |
| rps_doc_word_count | The number of words in the content after normalisation. | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_lines_ending_with_terminal_punctution_mark | Indicates whether a line ends with a terminal punctuation mark. A terminal punctation mark is defined as one of: ".", "!", "?", "β". | Natural Language | [C4](https://arxiv.org/abs/1910.10683) |
| rps_lines_javascript_counts | The number of occurrences of the word "javascript" in each line. | Natural Language | [C4](https://arxiv.org/abs/1910.10683) |
| rps_lines_num_words | The number of words in each line. This is computed based on the normalised text. | Natural Language | [C4](https://arxiv.org/abs/1910.10683) , [RefinedWeb](https://arxiv.org/abs/2306.01116) |
| rps_lines_numerical_chars_fraction | The ratio between the number of numerical characters and total number of characters in each line. This is based on the normalised content. | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116) |
| rps_lines_start_with_bulletpoint | Whether the lines that start with a bullet point symbol. The following set of unicodes are considered a bullet point: \u2022 (bullet point), \u2023 (triangular bullet point), \u25B6 (black right pointing triangle), \u25C0 (black left pointing triangle), \u25E6 (white bullet point), \u25A0 (black square), \u25A1 (white square), \u25AA (black small square), \u25AB (white small square), \u2013 (en dash). | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_lines_uppercase_letter_fraction | The ratio between the number of uppercase letters and total number of characters in each line. This is based on the raw text. | Natural Language | [RefinedWeb](https://arxiv.org/abs/2306.01116) |
| rps_doc_num_sentences | The number of sentences in the content. This is calculated using the regular expression `r'\b[^.!?]+[.!?]*'`. | Natural Language | [C4](https://arxiv.org/abs/1910.10683) |
| rps_doc_frac_chars_dupe_10grams | The fraction of characters in duplicate word 10grams. This operates on the lower-cased, punctuation removed content. It is also ensured that characters in overlapping ngrams are only counted once. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_dupe_5grams | The fraction of characters in duplicate word 5grams. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_dupe_6grams | The fraction of characters in duplicate word 6grams. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_dupe_7grams | The fraction of characters in duplicate word 7grams. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_dupe_8grams | The fraction of characters in duplicate word 8grams. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_dupe_9grams | The fraction of characters in duplicate word 9grams. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_top_2gram | The fraction of characters in the top word 2gram. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_top_3gram | The fraction of characters in the top word 3gram. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_frac_chars_top_4gram | The fraction of characters in the top word 4gram. | Repetitiveness | [RefinedWeb](https://arxiv.org/abs/2306.01116), [Gopher](https://arxiv.org/abs/2112.11446) |
| rps_doc_ldnoobw_words | The number of sequences of words that are contained in the List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words blocklist. The blocklist is obtained from the [LDNOOBW](https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words) repo. | toxicity | [C4](https://arxiv.org/abs/1910.10683) |
| rps_doc_ut1_blacklist | A categorical id corresponding to the list of categories of the domain of the document. Categories are obtained from the UT1 blacklist. The list is obtained from [UT-Capitole](https://dsi.ut-capitole.fr/blacklists/). | toxicictiy | [RefinedWeb](https://arxiv.org/abs/2306.01116) |
#### Document and Token Counts for the Annotated and deduplicated `head_middle` part of the dataset
| | # Documents | Estimated Token count (deduped) |
|-------|-------------|---------------------------------|
| en | 14.5B | 20.5T |
| de | 1.9B | 3.0T |
| fr | 1.6B | 2.7T |
| es | 1.8B | 2.8T |
| it | 0.9B | 1.5T |
| Total | 20.8B | 30.4T |
### Languages
English, German, French, Italian, Spanish
## Dataset Structure
The dataset is structured into four components, each following the same key structure:
```
βββ documents
βββ 2018-43
βββ 0000
βββ en_head.json.gz
βββ ...
βββ it_middle.json.gz
βββ quality_signals
βββ 2018-43
βββ 0000
βββ en_head.signals.json.gz
βββ ...
βββ it_middle.json.gz
βββ duplicates
βββ 2018-43
βββ 0000
βββ en_head.duplicates.parquet
βββ ...
βββ it_middle.duplicates.parquet
βββ minhash
βββ 2018-43
βββ 0000
βββ en_head.minhash.parquet
βββ ...
βββ it_middle.minhash.parquet
```
Documents files, which contain the text, folow the schema defined by CCNet:
```json
{
"url": "...",
"date_download": "2014-08-20T06:48:26Z",
"digest": "sha1:46OPKWZ7MAG5624VYYA3U3YH2MJ727B6",
"length": 1095,
"nlines": 8,
"source_domain": "...",
"title": "...",
"raw_content": "Dear ...",
"cc_segment": "crawl-data/CC-MAIN-2014-35/...",
"original_nlines": 11,
"original_length": 1174,
"line_ids": [
0,
1,
3,
4,
6,
7,
8,
9
],
"language": "en",
"language_score": 0.92,
"perplexity": 217.2,
"bucket": "head"
}
```
The quality signals follow the schema
```json
{
"id": "2018-43/0000/en_head.json.gz/0",
"id_int": 7972430436813205988,
"metadata": {
"cc_segment": "crawl-data/...",
"cc_net_source": "2018-43/0000/en_head.json.gz",
"url": "...",
"source_domain": "...",
"language": "en",
"snapshot_id": "2018-43"
},
"quality_signals": {
"ccnet_original_length": [
[
0,
7033,
8711.0
]
],
...,
"rps_doc_stop_word_fraction": [
[
0,
7033,
0.45121107
]
],
"rps_lines_num_words": [
[
0,
25,
2
],
...,
[
6980,
7033,
10
]
]
}
}
```
where signal scores are encoded as a list of tuples `(start, end, score)`, where `start` and `end` are the locations in
the `raw_content` string where the `score` applies.
## Dataset Creation
The dataset is based on 84 snapshots provided by Common Crawl. Each snapshot was processed using the CCNet pipeline and
split into `head` `middle` `tail` buckets, depending on the perplexity score. In a second step, the documents in the
`head` and `middle` buckets were annotated with the quality signals described above. Finally, the documents were
deduplicated based on the text, using a Bloomfilter. The duplicates were kept in the dataset, but are marked in the
`duplicates` component.
## Citation
To cite RedPajama-V2, please use:
```
@software{together2023redpajama-v2,
author = {Together Computer},
title = {RedPajama: an Open Dataset for Training Large Language Models},
month = October,
year = 2023,
url = {https://github.com/togethercomputer/RedPajama-Data}
}
```
## Acknowledgements
-- TODO --
## License
Please refer to the [Common Crawl Foundation Terms of Use](https://commoncrawl.org/terms-of-use) for the data.
The code used to load and process the dataset is licensed under the Apache 2.0 license.
<!--
### Annotations
#### Annotation process
[More Information Needed]
#### Who are the annotators?
[More Information Needed]
### Personal and Sensitive Information
[More Information Needed]
## Considerations for Using the Data
### Social Impact of Dataset
[More Information Needed]
### Discussion of Biases
[More Information Needed]
### Other Known Limitations
[More Information Needed]
## Additional Information
### Dataset Curators
[More Information Needed]
### Licensing Information
[More Information Needed]
### Citation Information
[More Information Needed]
### Contributions
[More Information Needed]
--> |