UDM_cleaned_docs / README.md
oklenAI's picture
dataset card
58c214a verified
|
Raw History Blame Contribute Delete
7.45 kB
---
task_categories:
- text-generation
language:
- en
tags:
- math
- information-extraction
- pretraining
- model-generated
size_categories:
- 1M<n<10M
configs:
- config_name: default
data_files:
- split: corpus
path: data/corpus-*.parquet
---
# UDM cleaned docs
**6,029,052 web pages reduced to just their mathematical content**, extracted verbatim by [oklenAI/udm_doc_extract_qwen3.5_2B](https://huggingface.co/oklenAI/udm_doc_extract_qwen3.5_2B) — a 2B model distilled from GPT-5.6.
Every row is **model output**, not human-curated text. The `extract` field is what the model returned for that page; the source page text is not included. Read *Two repetition flags* below before filtering — the obvious flag is not the one you want.
## How it was built
| step | pages | |
|---|---:|---|
| `TeraflopAI/udml2-labeled`, keeping `score >= 2` | 13,514,716 | the 0–7 scale lives in `score` (`__label__N`), **not** in `quality_label`, which only ever takes {4, 5} |
| after exact-content dedup | **6,029,052** | 55.39% of the filtered pool is duplicated **across shards**; within any single shard only ~2% is, because the source is globally shuffled before sharding |
Extraction ran greedy (no sampling, no repetition penalty) under vLLM 0.28.0 with a per-page token budget of `min(24576, 1.25 x input_tokens + 256, 40960 - input_tokens)`. Sizing the budget to the page rather than to a constant matters: extraction length scales with input, so a flat cap silently truncates exactly the long pages. **Input-side truncation hit 1 page out of 6,029,052.**
## Schema
| column | type | meaning |
|---|---|---|
| `content_id` | string | `p_` + `sha256(source page utf-8)[:24]`. Joins back to the source dataset — recompute it there, no normalisation, no NFKC. |
| `score` | int8 | quality band 2–7 carried over from the source dataset |
| `nchar` | int32 | characters in the **source page** |
| `in_tok` / `out_tok` | int32 | tokens in / out |
| `trunc` | bool | source page was truncated on the input side |
| `extract` | string | **the payload** — mathematical content, verbatim |
| `rep20` | float32 | 20-gram repeat rate over the whole extract |
| `degenerate` | bool | `rep20 > 0.30` — **over-inclusive, see below** |
| `rep_tail` | float32 | 20-gram repeat rate over the **last 300 words** (0.0 where `degenerate` is false) |
| `loop` | bool | `rep_tail >= 0.70` — **this is the defect flag** |
## Two repetition flags, and why the obvious one is wrong
A high whole-document repeat rate has two completely different causes, and they need opposite treatment:
- **the model looped** — greedy decoding locks onto a short n-gram and repeats it until the token budget runs out. Broken output.
- **the page repeats itself** — a forum thread quoting the same code block, a worksheet built from a template, a page that prints its theory section twice. The model transcribed it faithfully. **Good output.**
`rep20 > 0.30` cannot tell these apart. `rep_tail` can, because a genuine loop is still looping when the budget runs out while a repetitive *page* is still producing new text at the end. The split is bimodal, not a continuum — sampled non-loop pages score exactly 0.000 — so the threshold is not delicate.
| | pages | of corpus | of flagged |
|---|---:|---:|---:|
| flagged `degenerate` (`rep20 > 0.30`) | 66,198 | 1.098% | 100% |
| — **`loop`**, the model actually broke | 38,764 | 0.643% | 58.6% |
| — page was repetitive, extraction is fine — **keep these** | 27,434 | 0.455% | 41.4% |
So **filter on `loop`, not on `degenerate`** — about a third of `degenerate` is good extraction of repetitive source pages, and worksheets and problem sets are exactly the pages this corpus is for. Nothing was deleted; both flags ship so you can choose.
Looping is strongly length-dependent:
| source page length | pages | `degenerate` | `loop` |
|---|---:|---:|---:|
| <5k chars | 2,980,959 | 0.329% | 0.156% |
| 5-20k chars | 2,201,674 | 1.233% | 0.717% |
| >=20k chars | 846,419 | 3.454% | 2.164% |
## Corpus statistics
| | |
|---|---:|
| pages | 6,029,052 |
| parquet files (zstd) | 117, 13.14 GB |
| source page length | median 5,084, mean 9,319, p90 24,702, max 49,998 chars |
| pages over 20,000 chars | 13.93% |
| input tokens | 18,588,607,640 |
| output tokens | 12,542,804,450 (0.675 x input) |
| empty extractions | 34 (0.001%) |
`score` distribution: **2** 10.7%, **3** 35.5%, **4** 10.7%, **5** 27.9%, **6** 8.7%, **7** 6.5%
## Usage
```python
from datasets import load_dataset
ds = load_dataset("oklenAI/UDM_cleaned_docs", split="corpus", streaming=True)
clean = (r for r in ds if not r["loop"]) # drop the ~0.6% the model broke on
```
The split is called `corpus`, not `train` — this is extracted document text, not anyone's training split.
## How faithful is it?
Faithfulness here means **agreement with the teacher**, GPT-5.6-Sol, called exactly as it was called to build the model's training data. It does not measure whether the teacher was right.
449 pages were drawn **from this corpus itself** — not from the model's evaluation set — in three length bands, and re-extracted by the teacher:
| | short (n=150) | medium (n=150) | long (n=149) |
|---|---:|---:|---:|
| charF1 vs teacher | 0.9693 | 0.9286 | 0.8811 |
| contiguous-span coverage | 0.9891 | 0.9831 | 0.9767 |
| strict order preservation | 99.28% | 93.79% | 92.14% |
| boilerplate residue | 0.67% | 4.00% | 3.36% |
| share with 20-gram repeat > 0.3 | 0.00% | 0.67% | 2.01% |
| empty-output rate | 0.00% | 0.00% | 0.00% |
Two things worth reading off this table. Long-page charF1 on production pages is **0.8811**, slightly *above* the 0.8668 the model card reports on its held-out long ruler — the corpus is not harder than the ruler said it would be. And the repetition tail shows up independently: 2.01% of these 149 long pages exceed a 0.3 repeat rate, against 3.454% measured over all 846,419 long pages in the corpus. Those two are consistent rather than equal — at n=149 the sample simply cannot resolve a rate this small — but the check was run by different code on a different sample and still lands in the same place.
## Limits
- **Student, not oracle.** Every fidelity number is agreement with GPT-5.6. Nothing here was audited against the source pages by a human.
- **Long pages are measurably harder.** charF1 0.8811 on long pages vs 0.9693 on short ones, and the loop rate is 13.9x higher in the >=20k band than in the <5k band.
- **Formula-token excess.** The teacher check shows 21.48% excess notation tokens on long pages. The prompt mandates notation repair, so this is not that share of hallucination — but measure repetition directly rather than trusting token counts as a proxy.
- **Nothing beyond ~50,000 characters.** The source pool tops out at 49,998 chars.
- **English only**, and only pages the source dataset already labelled as mathematical.
- **Empty output is a valid answer** where a page carries no substantive math; the observed empty rate is 0.001%.
## Provenance and licensing
Page text originates from `TeraflopAI/udml2-labeled`, which declares no license. This derived corpus adds only the extraction; check the upstream dataset before redistributing or training on it.
Extraction model: [oklenAI/udm_doc_extract_qwen3.5_2B](https://huggingface.co/oklenAI/udm_doc_extract_qwen3.5_2B). The prompt used is shipped with the model as `extract_prompt.txt`.