--- license: mit pretty_name: BART Midtrain language: - en size_categories: - 10K Per-stage filter detail | Stage | In | Out | Kept | Chars kept | |---|---:|---:|---:|---:| | 2 — IA harvest | — | 15,075 | — | — | | 3 — OCRoscope | 15,075 | 13,552 | 89.9% | — | | 4 — clean + prior | 13,552 | 12,791 | 94.4% | 81.7% | | 5 — footer + anachronism | 12,791 | 11,409 | 89.2% | 84.5% | Stage 4 removals: `prior_high` 306, `prior_low` 300, `ocr_artifacts` 155. Stage 5 footer strip: 1,117 of 12,791 documents changed, 1,466 lines removed. Every stage is resumable at shard granularity — a rerun skips output shards already present and continues with the remainder. Stage 4's log-prior table and stage 5's banned-term list are each built once, cached under `_prior/` and `_banned/`, and reused. ## Training mixtures Midtraining ran in **three stages of decay**, following the approach HuggingFace used for SmolLM. Because midtrain documents are much shorter than pretraining documents, we measure the mixture in **tokens**, not documents. We wanted the midtrain data to see fewer than 3 epochs, and used that as the guide for the ratio at each stage. ### `mixtures/v2-by-tokens/` — current | Folder | Target | Achieved | Train tokens | Shards | |---|---:|---:|---:|---:| | `ratio_21` | 21% | **20.96%** | 4,124,391,390 | 66 | | `ratio_45` | 45% | **45.00%** | 2,074,444,767 | 34 | The ratio is enforced by a ratio-tracking interleave, so it holds over *every* prefix of the stream, not just the total. Document boundaries are preserved — nothing is concatenated or split to force the ratio. ### `mixtures/v1-by-docs/` — superseded Named for what they **actually delivered**, not what they targeted: | Folder | Target | Achieved (docs) | Shards | |---|---:|---:|---:| | `ratio_00actual` | 0% | 0.1% | 99 | | `ratio_12actual` | 30% | **11.5%** | 1,263 | | `ratio_25actual` | 60% | **25.1%** | 525 | Kept for reproducibility. Don't train on these. ### Why there are two generations One of the biggest pitfalls on this journey came during our final model run. We assumed midtrain documents would be roughly smaller than the original corpus. We were right — but we didn't realize how *drastically* smaller they were. Because we had built the mixtures by document count rather than token count, the blends under-delivered midtrain content badly: a folder targeting 60% midtrain actually supplied 25%, and one targeting 30% supplied 11.5%. Our final model was already running when we found the bug. That gave us **36 hours** to rebuild the mixtures by token before the run would need them. We got them ready in time — and took away a lesson worth the scare: **verify your intuition.** ## Learning rate schedule We used nanochat's Warmup-Stable-Decay (WSD), beginning decay at roughly **35%** of training. SmolLM, by contrast, starts decaying at around 75%. ## Lineage This corpus is the midtraining counterpart to the BART pretraining series: [bart-dataset-v1](https://huggingface.co/datasets/jbduran/bart-dataset-v1) → [v2](https://huggingface.co/datasets/jbduran/bart-dataset-v2) → [v3](https://huggingface.co/datasets/jbduran/bart-dataset-v3) → **bart-midtrain** Stage 1 of this pipeline draws from v1 by subject tag; all mixtures blend `corpus/` against v3. ## Citation The stage-1 subject extraction derives from Institutional Books 1.0: ```bibtex @misc{institutionalbooks2025, title = {Institutional Books 1.0: A 242B Token Dataset from Harvard Library's Collections, Refined for Accuracy and Usability}, year = {2025}, eprint = {2506.08300}, archivePrefix = {arXiv} } ``` --- Built by [Unbounded Labs](https://unboundedlab.com).