--- license: odc-by language: - en pretty_name: FinePDFs-Edu — English, Pre-tokenized & Length-Bucketed (for continuous pretraining) size_categories: - 10M **Attribution.** This dataset is a derivative database of **FinePDFs-Edu** by **Hugging Face** > (Hynek Kydlíček, Guilherme Penedo, Leandro von Werra). It is redistributed under the same > **Open Data Commons Attribution License (ODC-By) v1.0**, and use remains subject to the > **Common Crawl Terms of Use**. See [License](#license) and [Citation](#citation). --- ## At a glance | | | |---|---| | **Source dataset** | [`HuggingFaceFW/finepdfs-edu`](https://huggingface.co/datasets/HuggingFaceFW/finepdfs-edu), config `eng_Latn`, split `train` | | **Language** | English (`eng_Latn`), LID-confident only | | **Content** | Token IDs only (`uint32`) — **no raw text is stored** | | **Tokenizer** | [`jet-ai/Jet-Nemotron-2B`](https://huggingface.co/jet-ai/Jet-Nemotron-2B) (Qwen2.5-family vocab, size 151,936) | | **Documents kept** | **18,198,668** (of 23,023,372 raw `eng_Latn` docs → **79.0%** retained) | | **Total tokens** | **≈ 90.81 billion** (`90,809,325,729`), mean ≈ 4,990 tokens/doc | | **On-disk size** | ≈ 340 GiB | | **Layout** | 10 length buckets × 32 partitions (`p00`–`p31`), rolling ≤ ~1.5 GB shards | | **License** | [ODC-By v1.0](https://opendatacommons.org/licenses/by/1-0/) + [Common Crawl ToU](https://commoncrawl.org/terms-of-use) | --- ## Intended use - **Primary:** distributed **continuous / continual pretraining** and mid-training of LLMs on a clean, educational-quality English corpus that is already tokenized and length-organized. - **Length bucketing** makes it cheap to: - build fixed-length packed batches with minimal padding waste, - run **long-context** training stages by drawing from the `32768`/`65536`/`131072`/`262144`/`beyond` buckets, - apply length-based curricula or per-bucket mixing weights. - The bundled `processed_spec.txt` maps every stored document back to its **original FinePDFs-Edu id**, enabling deduplication, provenance, joins back to source metadata, and — importantly — [honoring removal / opt-out requests](#data-removal-opt-out--pii). ### Out of scope / limitations - This is **not** a standard `datasets`-loadable dataset and the **Dataset Viewer is disabled** — the files are raw token streams (see [File format](#file-format)), not Parquet/Arrow. - Token IDs are **specific to the `jet-ai/Jet-Nemotron-2B` tokenizer**. They are only meaningful with that tokenizer; a different tokenizer will decode to garbage. - Only **English** is included; the other 68 FinePDFs-Edu languages are excluded here. - Educational-quality filtering and PDF extraction are inherited from the source and carry the source's known limitations (OCR/extraction noise, classifier imperfections, residual PII — see below). --- ## How the data was produced The corpus was produced by the following reproducible pipeline: 1. **Load** `HuggingFaceFW/finepdfs-edu`, config **`eng_Latn`**, split `train` (23,023,372 documents). 2. **Filter to confident English** (all conditions required): - `language == "eng_Latn"` - `page_average_lid == "eng_Latn"` - `page_average_lid_score >= 0.90` *(LID confidence threshold)* - `token_count >= 1` 3. **Tokenize** each surviving document with `AutoTokenizer.from_pretrained("jet-ai/Jet-Nemotron-2B", trust_remote_code=True)` using `add_special_tokens=False`, then **append a single EOS token** (`151643`, `<|endoftext|>`). No BOS token is added; no padding is stored. 4. **Bucket** each document by its final token count (text tokens + EOS) into length buckets. 5. **Shard & write** as raw little-endian `uint32` bytes into 32 partitions, rolling to a new file at ~1.5 GB. Documents within each shard are concatenated and separated only by their trailing EOS. --- ## Statistics Retained **18,198,668** documents / **≈ 90.81B** tokens from **23,023,372** raw `eng_Latn` documents. | Bucket | Sequence length (tokens, inclusive) | Documents | |---|---|---:| | `1024` | 1 – 1,024 | 7,811,084 | | `2048` | 1,025 – 2,048 | 3,557,339 | | `4096` | 2,049 – 4,096 | 2,536,902 | | `8192` | 4,097 – 8,192 | 2,150,060 | | `16384` | 8,193 – 16,384 | 1,192,685 | | `32768` | 16,385 – 32,768 | 560,185 | | `65536` | 32,769 – 65,536 | 235,401 | | `131072` | 65,537 – 131,072 | 98,452 | | `262144` | 131,073 – 262,144 | 39,142 | | `beyond` | > 262,144 | 17,418 | | **Total** | | **18,198,668** | A bucket named `N` holds documents whose token length is **≤ N** and **> the previous bound**. --- ## Repository layout ``` finepdfs-edu-32/ ├── README.md # this dataset card ├── dataset_stats.txt # raw count, LID threshold, per-bucket counts ├── processed_spec.txt # per-document manifest (see schema below) ├── 1024/ p00_00000.npy … p31_00000.npy ├── 2048/ p00_00000.npy … p31_00000.npy ├── 4096/ … ├── 8192/ … ├── 16384/ p00_00000.npy, p00_00001.npy, … # larger buckets roll into multiple files per partition ├── 32768/ … ├── 65536/ … ├── 131072/ … ├── 262144/ … └── beyond/ p00_00000.npy … p31_00000.npy ``` - `pXX` = partition index (`00`–`31`); `_NNNNN` = rolling shard index within that (bucket, partition), a new file starting every ~1.5 GB. - The `.npy` extension is a **naming convention only** — these are **raw binary token dumps with no NumPy header**. Do **not** use `np.load()`; use `np.fromfile` / `np.memmap` (below). ### File format - **dtype:** little-endian `uint32` (4 bytes/token) — required because the vocabulary (151,936) exceeds `uint16`. - **structure:** documents concatenated back-to-back; each document ends with **exactly one EOS token (`151643`)**. No BOS, no padding, no per-document header. - To recover document boundaries, split on the EOS id. --- ## Usage ### 1. Stream the flat token stream (typical for CPT) For continuous pretraining you usually just want a long stream of tokens to pack into fixed-length sequences. The shards are already shuffled and EOS-separated, so you can consume them directly: ```python import numpy as np DTYPE = np.uint32 tokens = np.memmap("1024/p00_00000.npy", dtype=DTYPE, mode="r") # zero-copy, lazy # feed `tokens` into your packing / sequence-chunking pipeline ``` ### 2. Recover individual documents (split on EOS) ```python import numpy as np DTYPE = np.uint32 EOS_ID = 151643 # <|endoftext|> for the jet-ai/Jet-Nemotron-2B tokenizer tokens = np.memmap("4096/p00_00000.npy", dtype=DTYPE, mode="r") eos_pos = np.where(tokens == EOS_ID)[0] starts = np.concatenate(([0], eos_pos[:-1] + 1)) docs = [tokens[s:e] for s, e in zip(starts, eos_pos)] # each doc EXCLUDES its trailing EOS # use tokens[s:e + 1] instead if you want to keep the EOS ``` ### 3. Decode back to text (sanity check) ```python from transformers import AutoTokenizer tok = AutoTokenizer.from_pretrained("jet-ai/Jet-Nemotron-2B", trust_remote_code=True) print(tok.decode(docs[0], skip_special_tokens=True)) ``` ### `processed_spec.txt` schema Pipe-delimited, one header line then one row per stored document: ``` rel_path | original_id | processed_token_count 1024/p00_00000.npy | | 691 ``` - `rel_path` — bucket/shard file the document was written to. - `original_id` — the document's **`id` in `HuggingFaceFW/finepdfs-edu`**. Use it to join back to source metadata (`url`, `date`, `fw_edu_scores`, …) and to action removal requests. - `processed_token_count` — token count **including** the appended EOS (this determines the bucket). --- ## License This derivative is released under the **Open Data Commons Attribution License (ODC-By) v1.0**, matching the source. Use of the underlying content also remains subject to the **Common Crawl Terms of Use**. - ODC-By v1.0 license text: - Common Crawl Terms of Use: ODC-By is a permissive **attribution** license: it permits copying, modification, creation of derivative databases, and redistribution. There is **no share-alike** obligation. To comply you must: 1. **Attribute** the source — credit **FinePDFs-Edu / Hugging Face** and preserve their [citation](#citation). 2. **Preserve notices** — keep the ODC-By license and this attribution intact in any further redistribution, and link or include the license text. 3. **Honor removals** — propagate opt-out / PII-removal requests downstream (see below). Because there is no share-alike clause, a downstream user *may* relicense their own further derivative; keeping `odc-by` is the simplest compliant choice and is what this repository does. --- ## Data removal, opt-out & PII This corpus inherits the personal-data characteristics of FinePDFs-Edu / Common Crawl and may contain residual personally identifiable information despite upstream anonymization. **We honor removal and opt-out requests and propagate them downstream.** - **To remove content from the source (FinePDFs / FinePDFs-Edu):** Hugging Face provides a **PII removal / opt-out form** — usable if you find your **PII**, your **copyrighted work**, or (as a **webmaster**) **your website** in the data. See the "Personal and Sensitive Information" section of the [FinePDFs-Edu dataset card](https://huggingface.co/datasets/HuggingFaceFW/finepdfs-edu) for the current form link. Removals accepted upstream should be re-pulled here. - **To remove content from *this* derivative:** open a discussion on this repository's [Community tab](https://huggingface.co/datasets/tturing/finepdfs-edu-32/discussions). Because `processed_spec.txt` maps every stored document to its original FinePDFs-Edu `id`, a flagged document can be located and its tokens deleted from the affected shard(s). Please include the `original_id` (the ``) or the source URL. If you build on this dataset, please carry this section forward and keep honoring the same requests. --- ## Citation Please cite the original FinePDFs work (keep this citation in any redistribution): ```bibtex @misc{kydlicek2025finepdfs, title={FinePDFs}, author={Hynek Kydl{\'\i}{\v{c}}ek and Guilherme Penedo and Leandro von Werra}, year={2025}, publisher = {Hugging Face}, journal = {Hugging Face repository}, howpublished = {\url{https://huggingface.co/datasets/HuggingFaceFW/finepdfs_edu}} } ``` If you use this pre-tokenized, length-bucketed derivative specifically, you may additionally cite it as: ```bibtex @misc{finepdfs_edu_pretokenized, title = {FinePDFs-Edu — English, Pre-tokenized & Length-Bucketed}, note = {Derivative of HuggingFaceFW/finepdfs-edu (eng_Latn), tokenized with jet-ai/Jet-Nemotron-2B and bucketed by sequence length}, year = {2025}, howpublished = {\url{https://huggingface.co/datasets/tturing/finepdfs-edu-32}} } ``` --- ## Acknowledgements Built on **FinePDFs-Edu** by Hugging Face. FinePDFs is, at release, the largest publicly available corpus sourced exclusively from PDFs (~3T tokens across ~475M documents in 1,733 languages); FinePDFs-Edu is its educational-quality subset. All credit for the underlying data collection, extraction, and filtering belongs to the FinePDFs authors and Hugging Face.