|
Download README.md from jncarlo/tinymix: direct link, hf CLI and curl.
- Browser
- Download file 16 kB
-
https://huggingface.co/datasets/jncarlo/tinymix/resolve/main/README.md
- Command line
-
hf download hf://datasets/jncarlo/tinymix/README.md
-
curl -L -o README.md https://huggingface.co/datasets/jncarlo/tinymix/resolve/main/README.md
16 kB
| language: | |
| - en | |
| license: other | |
| license_name: mixed-per-source | |
| license_link: https://huggingface.co/datasets/jncarlo/tinymix#sources-and-licensing | |
| pretty_name: tinymix | |
| size_categories: | |
| - 1M<n<10M | |
| task_categories: | |
| - text-generation | |
| tags: | |
| - small-language-models | |
| - synthetic-data | |
| - curriculum | |
| - tinystories | |
| - babylm | |
| configs: | |
| - config_name: 1M | |
| data_files: | |
| - split: train | |
| path: data/1M/train*.parquet | |
| - split: validation_dialogue | |
| path: data/1M/validation_dialogue.parquet | |
| - split: validation_expository | |
| path: data/1M/validation_expository.parquet | |
| - split: validation_narrative | |
| path: data/1M/validation_narrative.parquet | |
| - config_name: 10M | |
| data_files: | |
| - split: train | |
| path: data/10M/train*.parquet | |
| - split: validation_dialogue | |
| path: data/10M/validation_dialogue.parquet | |
| - split: validation_expository | |
| path: data/10M/validation_expository.parquet | |
| - split: validation_narrative | |
| path: data/10M/validation_narrative.parquet | |
| - config_name: 100M | |
| data_files: | |
| - split: train | |
| path: data/100M/train*.parquet | |
| - split: validation_books | |
| path: data/100M/validation_books.parquet | |
| - split: validation_dialogue | |
| path: data/100M/validation_dialogue.parquet | |
| - split: validation_expository | |
| path: data/100M/validation_expository.parquet | |
| - split: validation_narrative | |
| path: data/100M/validation_narrative.parquet | |
| - split: validation_news | |
| path: data/100M/validation_news.parquet | |
| - split: validation_poetry | |
| path: data/100M/validation_poetry.parquet | |
| - config_name: 1000M | |
| data_files: | |
| - split: train | |
| path: data/1000M/train*.parquet | |
| - split: validation_books | |
| path: data/1000M/validation_books.parquet | |
| - split: validation_dialogue | |
| path: data/1000M/validation_dialogue.parquet | |
| - split: validation_expository | |
| path: data/1000M/validation_expository.parquet | |
| - split: validation_narrative | |
| path: data/1000M/validation_narrative.parquet | |
| - split: validation_news | |
| path: data/1000M/validation_news.parquet | |
| - split: validation_poetry | |
| path: data/1000M/validation_poetry.parquet | |
| # tinymix | |
| Small, **genre-balanced English pretraining corpora** in four sizes (about 1M, 10M, 100M and 1000M words), built for training | |
| very small language models. The mix combines synthetic child-level stories and dialogue, simplified real text, | |
| encyclopedic and didactic text, books, poetry and news, all filtered toward clear, self-contained documents. It is | |
| inspired by TinyStories, SimpleStories, TinyHelen and the BabyLM challenge. | |
| What is different from using those datasets directly: | |
| - **Several kinds of text in one mix** (narrative, dialogue and chat, expository, books, poetry, news), not only stories or only conversations. | |
| - **Four sizes built with the same recipe**, with complexity limits that grow with size. | |
| - **No non-commercial sources.** TinyChat (CC-BY-NC) and the BabyLM corpus (no clear license, includes subtitle and child-speech data) were left out on purpose. | |
| - **Provenance per document** (`source`, `genre`) and **validation splits per genre**, to see which kind of text a model is weak at. | |
| - The whole pipeline is included (`code/`) and every filter decision is documented below. | |
| ## Subsets | |
| | Subset | Train words | Train docs | ~Tokens (BPE) | | |
| |---|---|---|---| | |
| | `1M` | 1.0M | 4,135 | ~1.3M | | |
| | `10M` | 9.96M | 42,117 | ~12.9M | | |
| | `100M` | 99.5M | 338,230 | ~129.3M | | |
| | `1000M` | 994.92M | 3,040,575 | ~1293.4M | | |
| Words are whitespace-separated words in `train`. Each subset also has about 0.5% of the documents per genre held out as `validation_<genre>` splits | |
| (at least one document per genre; the `1M` validation splits are therefore tiny, 4 to 8 documents each, and noisy). | |
| ```python | |
| from datasets import load_dataset | |
| ds = load_dataset("jncarlo/tinymix", "10M") # splits: train, validation_narrative, validation_dialogue, ... | |
| print(ds["train"][0]) # {'text': ..., 'source': 'tinystories', 'genre': 'narrative'} | |
| ``` | |
| Columns: `text` (str), `source` (key of the table below), `genre` (`narrative`, `dialogue`, `expository`, `books`, `poetry`, `news`). | |
| Documents are independent; join them with an end-of-text token when training. Dialogues are formatted one turn per line | |
| (`Mia: ...`, or `User:` / `Assistant:` for assistant chats). | |
| ## Composition | |
| Share of training words by genre: | |
| | Genre | 1M | 10M | 100M | 1000M | | |
| |---|---|---|---|---| | |
| | narrative | 38.0% | 35.0% | 21.0% | 15.0% | | |
| | dialogue | 21.9% | 25.0% | 21.0% | 19.0% | | |
| | expository | 40.1% | 40.0% | 48.0% | 56.0% | | |
| | books | 0% | 0% | 8.0% | 7.0% | | |
| | poetry | 0% | 0% | 1.0% | 1.0% | | |
| | news | 0% | 0% | 1.0% | 2.0% | | |
| Million words per source: | |
| | Source | 1M (M words) | 10M (M words) | 100M (M words) | 1000M (M words) | | |
| |---|---|---|---|---| | |
| | TinyStories V2 (GPT-4 split) | 0.189 | 1.494 | 7.959 | 39.793 | | |
| | SimpleStories | 0.189 | 1.99 | 7.964 | 59.698 | | |
| | Cosmopedia v0.1, `stories` | 0 | 0 | 4.972 | 49.763 | | |
| | TinyDialogues | 0.12 | 1.494 | 6.969 | 19.655 | | |
| | SODA | 0.099 | 0.994 | 8.955 | 83.828 | | |
| | UltraChat 200k | 0 | 0 | 3.974 | 72.915 | | |
| | SmolTalk (everyday-conversations, smol-summarize, smol-rewrite) | 0 | 0 | 0.994 | 12.66 | | |
| | TinyHelen Leaner-Pretrain (book, conversation, textbook, web, wiki) | 0.15 | 1.499 | 9.946 | 33.921 | | |
| | Simple English Wikipedia (20231101.simple) | 0.1 | 0.996 | 9.951 | 21.201 | | |
| | English Wikipedia, lead paragraphs | 0 | 0 | 0 | 32.885 | | |
| | Cosmopedia v2 (SmolLM-Corpus) | 0.1 | 0.996 | 11.944 | 195.975 | | |
| | Cosmopedia v0.1 (wikihow, khanacademy, openstax) | 0.05 | 0.497 | 2.984 | 29.767 | | |
| | tiny-textbooks (`textbook` column) | 0 | 0 | 3.98 | 64.294 | | |
| | FineWeb-Edu (sample-10BT, score >= 4) | 0 | 0 | 8.96 | 179.075 | | |
| | Project Gutenberg (English books) | 0 | 0 | 7.96 | 69.649 | | |
| | Gutenberg Poetry Corpus | 0 | 0 | 0.995 | 9.95 | | |
| | CNN/DailyMail 3.0.0 | 0 | 0 | 0.995 | 19.897 | | |
| The 10M and 100M subsets are within about 1% of their targets (train plus validation splits). In the 10M build, | |
| sources that could not fill their quota with the filters (Simple English Wikipedia, Cosmopedia v0.1) were topped up by | |
| same-genre substitute sources (tiny-textbooks, Cosmopedia v2), capped per source; that is why `tiny-textbooks` appears | |
| there. The 1M subset keeps the 10M proportions except that Cosmopedia stories (not in the 10M mix) were replaced by TinyStories and SimpleStories. | |
| The 1000M subset is also within about 1% of its target. Five sources ran out under the filters before their quota and were | |
| topped up by same-genre substitutes (million words): TinyDialogues by SODA (9.3), SmolTalk by UltraChat (12.3), TinyHelen by | |
| tiny-textbooks (15.9), Simple English Wikipedia by tiny-textbooks (8.7) and English Wikipedia lead paragraphs by Cosmopedia v2 (17.0). | |
| ## How it was built | |
| 1. **Normalisation**: `ftfy`, NFKC, ASCII quotes and dashes, whitespace; URLs, e-mails, phone numbers, code, LaTeX and HTML removed. Documents with any character outside ASCII, Latin-1 and Latin Extended-A letters, common punctuation and a few math symbols are rejected whole (reason `charset` in the build stats). | |
| 2. **Language**: fastText `lid.176`, English with confidence >= 0.9 (skipped for TinyDialogues, whose one-word toddler turns confuse it). | |
| 3. **Quality heuristics**: Gopher-style rules (mean word length, symbol and digit ratio, repeated lines, repeated bigrams, stop words), minimum length, complete ending (drops truncated generations), a short list of LLM tics (`delve`, `tapestry`, ...) and an explicit-content word list. | |
| 4. **Anti-template**: no 4-word opening may exceed 0.5% of a source's documents. | |
| 5. **Deduplication across all sources**: exact hash and MinHash LSH (5-word shingles, Jaccard >= 0.8). | |
| 6. **Complexity control by size** (vocabulary coverage = share of lowercase tokens inside the top-N English words of `wordfreq`): | |
| | | 10M | 100M | 1000M | | |
| |---|---|---|---| | |
| | Reference vocabulary | top 8k | top 15k | top 30k | | |
| | Min vocabulary coverage | 90% | 90% | 90% | | |
| | Max Flesch-Kincaid grade (narrative, news, books) | 5 | 8 | 12 | | |
| | Max Flesch-Kincaid grade (expository) | 9 | 10 | 12 | | |
| | Document length | 80 to 600 words | 80 to 1200 words | 80 to 2000 words | | |
| | Dialogue: mean words per turn | <= 25 | <= 40 | <= 80 | | |
| Assistant chats (`User:` / `Assistant:`) may average up to 4 times the per-turn cap and need at least 2 turns (named dialogues need 4), | |
| because summarisation and rewrite tasks have 2 turns and assistant answers are long. | |
| Documents longer than the maximum are split at paragraph borders. The 1M subset is a prefix slice of the 10M build; 10M, 100M and 1000M were built separately with the same recipe, so they are **not** guaranteed to be subsets of each other (a later fix to the end-of-document check, which wrongly rejected Wikipedia articles that end in a heading, was only applied to sources rebuilt for the 100M run). | |
| 7. **Run safety nets** (used to build the larger subsets without manual tuning): a probe per source picks a starting filter strictness, strictness relaxes in up to three logged steps when yield is too low, and shortfalls go to substitute sources. | |
| Thresholds were calibrated on real data: the first values (95% coverage in the top 5k words, Flesch-Kincaid <= 5 for everything) | |
| accepted only 3% of SimpleStories and 0.6% of Cosmopedia v2, so they were relaxed as described above. | |
| ## Sources and licensing | |
| | Source | License | Role | | |
| |---|---|---| | |
| | [TinyStories V2 (GPT-4 split)](https://huggingface.co/datasets/roneneldan/TinyStories) | CDLA-Sharing-1.0 | child-level stories | | |
| | [SimpleStories](https://huggingface.co/datasets/SimpleStories/SimpleStories) | MIT | varied simple stories | | |
| | [Cosmopedia v0.1, `stories`](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) | Apache-2.0 | everyday stories | | |
| | [TinyDialogues](https://huggingface.co/datasets/styfeng/TinyDialogues) | MIT | child-directed dialogue | | |
| | [SODA](https://huggingface.co/datasets/allenai/soda) | CC-BY-4.0 | social dialogue | | |
| | [UltraChat 200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) | MIT | user/assistant chat | | |
| | [SmolTalk (everyday-conversations, smol-summarize, smol-rewrite)](https://huggingface.co/datasets/HuggingFaceTB/smoltalk) | Apache-2.0 | chat, summaries, rewrites | | |
| | [TinyHelen Leaner-Pretrain (book, conversation, textbook, web, wiki)](https://huggingface.co/datasets/EmpathYang/TinyHelen) | MIT | simplified real text | | |
| | [Simple English Wikipedia (20231101.simple)](https://huggingface.co/datasets/wikimedia/wikipedia) | CC-BY-SA-3.0 / GFDL | encyclopedic, simple | | |
| | [English Wikipedia, lead paragraphs](https://huggingface.co/datasets/wikimedia/wikipedia) | CC-BY-SA-3.0 / GFDL | encyclopedic | | |
| | [Cosmopedia v2 (SmolLM-Corpus)](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus) | Apache-2.0 (corpus: ODC-By) | synthetic textbooks, blogs, stories | | |
| | [Cosmopedia v0.1 (wikihow, khanacademy, openstax)](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) | Apache-2.0 | procedural and didactic | | |
| | [tiny-textbooks (`textbook` column)](https://huggingface.co/datasets/nampdn-ai/tiny-textbooks) | Apache-2.0 | short synthetic lessons | | |
| | [FineWeb-Edu (sample-10BT, score >= 4)](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) | ODC-By-1.0 | educational web | | |
| | [Project Gutenberg (English books)](https://huggingface.co/datasets/manu/project_gutenberg) | Project Gutenberg License (public domain in the US) | classic books | | |
| | [Gutenberg Poetry Corpus](https://huggingface.co/datasets/biglam/gutenberg-poetry-corpus) | CC0-1.0 | poetry stanzas | | |
| | [CNN/DailyMail 3.0.0](https://huggingface.co/datasets/abisee/cnn_dailymail) | Apache-2.0 (articles are (c) CNN / Daily Mail) | news | | |
| **Licensing and attribution.** This repository is a derivative compilation of the datasets above; each document keeps the | |
| license of its `source`. Obligations that matter when redistributing or reusing it: | |
| - Attribution is required for CC-BY / ODC-By / CDLA sources (listed above). | |
| - The Wikipedia parts (`simplewiki`, `enwiki_intro`) are **CC-BY-SA-3.0 / GFDL (share-alike)**. If you need a share-alike-free corpus, filter out those two sources. | |
| - Cosmopedia, SmolTalk, UltraChat, TinyStories, SimpleStories, TinyHelen and tiny-textbooks contain **model-generated text**; check the terms of the generating model (GPT-4, GPT-4o-mini, Mixtral and others) for your use case. | |
| - CNN/DailyMail articles and FineWeb-Edu web pages are third-party content; they are included under the dataset licenses above, which do not transfer rights from the original publishers. | |
| - Project Gutenberg texts had the Project Gutenberg header and footer removed; they are public domain in the United States, check your jurisdiction. | |
| No personal data was added; e-mails, phone numbers and URLs were removed, but residual personal information in web-derived sources cannot be ruled out. | |
| ## Sanity-check training runs | |
| Small GPTs (nanoGPT-style, own byte-level BPE trained on each training set). Each row shows its own parameter count and training tokens, so model sizes differ between rows. Scored in **bits per byte** (lower is better, comparable across tokenizers) on the held-out validation splits of **this** dataset. Baselines take the first 10M / 100M words of a single source with only `ftfy` cleaning. They are out of distribution on the genres they do not cover, so the table shows how much genre coverage matters, not a leaderboard. One seed, no tuning. Rows of different sizes are not comparable with each other. The 1M and 10M sets have no books, news or poetry split, hence n/a. | |
| | Training data | Params | Train tokens | narrative | dialogue | expository | books | news | poetry | | |
| |---|---|---|---|---|---|---|---|---| | |
| | tinymix 1M | 9.59M | 1.71M | 1.683 | 1.830 | 2.276 | n/a | n/a | n/a | | |
| | tinymix 10M | 9.59M | 17.18M | 0.883 | 0.875 | 1.470 | n/a | n/a | n/a | | |
| | TinyStories only, 10M words | 17.41M | 12.05M | 1.111 | 2.512 | 2.708 | n/a | n/a | n/a | | |
| | FineWeb-Edu only, 10M words | 17.41M | 15.71M | 1.639 | 1.769 | 1.565 | n/a | n/a | n/a | | |
| | tinymix 100M | 46.43M | 136.82M | 0.697 | 0.697 | 0.987 | 1.349 | 1.368 | 1.819 | | |
| | FineWeb-Edu only, 100M words | 46.29M | 142.51M | 1.331 | 1.312 | 1.215 | 1.726 | 1.670 | 2.306 | | |
| ## Limitations | |
| - **Not done**: perplexity filtering with an n-gram LM, LLM-judge coherence scoring, semantic deduplication, cluster caps and benchmark decontamination. Expect some residual near-duplicates and some low-quality documents. | |
| - Some `tinyhelen` chunks start mid-thought, because the simplified web and book documents are chunks of longer texts. | |
| - Synthetic sources share model-specific style and topics (names, morals, classroom settings). The anti-template cap reduces this but does not remove it. | |
| - The toxicity filter is a short word list, not a classifier. Chat and web sources can still contain mildly sensitive content. | |
| - English only, mostly simple modern language; it is a poor fit for models meant to handle technical, legal or archaic text. | |
| - Word counts are whitespace words; token counts depend on your tokenizer. | |
| ## Reproduce | |
| `code/` contains the build scripts (`mix.py` quotas and tiers, `sources.py` adapters, `build.py` pipeline, `build_pool.py` for | |
| 1000M, `assemble.py`, `publish.py`, `train.py` for the sanity-check runs) and `requirements.txt`. Building a subset: | |
| `python build.py 10M` (or `python build_pool.py 1000M`), then `python assemble.py 10M`. The build streams the source datasets from the Hub. | |
| ## Acknowledgements | |
| Built on the work behind TinyStories, SimpleStories, TinyDialogues, SODA, UltraChat, SmolTalk and SmolLM-Corpus | |
| (Cosmopedia, FineWeb-Edu), TinyHelen, tiny-textbooks, Project Gutenberg, the Gutenberg Poetry Corpus, Wikipedia and | |
| CNN/DailyMail. Please cite the original datasets when you use this one. | |