mikecovlee commited on
Commit
d84f93e
Β·
1 Parent(s): 6e0792c

Unify model card: shared English template, remove internal identifiers

Browse files
Files changed (1) hide show
  1. README.md +85 -114
README.md CHANGED
@@ -1,29 +1,33 @@
1
  ---
2
- library_name: transformers
3
  license: mit
 
4
  pipeline_tag: text-generation
 
5
  tags:
6
- - mixture-of-experts
7
  - moe
 
8
  - pretraining
9
  - text-generation
 
 
10
  datasets:
11
  - HuggingFaceFW/fineweb-edu
12
- - HuggingFaceTB/cosmopedia-v2
13
  - mlfoundations/dclm-baseline-1.0
 
14
  - nvidia/OpenCodeInstruct
 
15
  - wikimedia/wikipedia
16
  ---
17
 
18
- # TinyMixtral v3.0
19
 
20
  **Flagship release.** A Mixtral-style sparse MoE language model: ~477.5M total / ~276.1M active
21
  parameters (top-2 of 4 routed experts), trained from scratch on **8.05B tokens** on a single GPU.
22
 
23
  - HF repo: `mikecovlee/tinymixtral`
24
- - Config: `versions/v3.0/configs/improve_v05b.json`
25
 
26
- ## Architecture
27
 
28
  | Parameter | Value |
29
  |-----------|-------|
@@ -40,109 +44,13 @@ parameters (top-2 of 4 routed experts), trained from scratch on **8.05B tokens**
40
  | **Total params** | **~477.5M** |
41
  | **Active params** | **~276.1M** |
42
 
43
- Design decisions (validated by the P4a/P4b ablation matrix):
44
  - **top-2 routing** β€” top-1 was +12.2–19.5% worse in val PPL at 400M tokens; maintain top-2.
45
  - **QK-Norm kept** β€” neutral at 400M tokens, retained as the trunk default.
46
- - **aux = 1e-3** β€” auxiliary-loss coefficient is insensitive under E4/top-2.
47
  - **LR ladder** `5e-4 / 5e-4 / 4e-4 / 3e-4` across the four segments (5e-4 was the sole
48
  significant factor, βˆ’5.3% val PPL in the matrix).
49
 
50
- ## Data
51
-
52
- 8.05B unique tokens, zero repetition, split into **four strictly disjoint pools**
53
- (`main_s1..s4` = 2.00 / 1.94 / 2.20 / 1.91B) built by `scripts/make_blend_shards.py`
54
- (hard-linked, inode-verified). Validation always uses `pilot_blend30_val` (2 held-out shards).
55
-
56
- | Source | Share |
57
- |---|---|
58
- | FineWeb-Edu | 44% |
59
- | DCLM web | 20% |
60
- | Cosmopedia (synthetic) | 12.5% |
61
- | Code | 12.5% |
62
- | Math | 6% |
63
- | Wikipedia | 6% |
64
-
65
- ### Reproduce the data pools
66
-
67
- Each pool is assembled from 100M-token `.pt` shards. Two acquisition routes are used: HF `datasets`
68
- streaming via `scripts/prepare_data.py` (clean parquet corpora), and bulk file download via
69
- `scripts/download_*.py` β†’ `scripts/prepare_data_local.py` (large web/code corpora, avoiding slow
70
- streaming reads).
71
-
72
- ```bash
73
- # tokenizer (shared across versions)
74
- python scripts/prepare_tokenizer.py --from-hf TinyLlama/TinyLlama-1.1B-Chat-v1.0 --output tokenizer/
75
-
76
- # FineWeb-Edu (44%) β€” 3rd 3.56B slice of sample-10BT -> fineweb3
77
- python scripts/prepare_data.py --dataset HuggingFaceFW/fineweb-edu --subset sample-10BT \
78
- --tokenizer tokenizer/ --output data/pretrain/fineweb3 \
79
- --skip-tokens 7120000000 --max-tokens 3560000000 --force
80
-
81
- # Cosmopedia v2 (synthetic) β€” 2nd 440M slice -> cosmopedia3
82
- python scripts/prepare_data.py --dataset HuggingFaceTB/cosmopedia-v2 --subset cosmopedia-v2 \
83
- --tokenizer tokenizer/ --output data/pretrain/cosmopedia3 \
84
- --skip-tokens 880000000 --max-tokens 440000000 --force
85
-
86
- # Wikipedia -> r5_wiki
87
- python scripts/prepare_data.py --dataset wikimedia/wikipedia --subset 20231101.en \
88
- --tokenizer tokenizer/ --output data/pretrain/r5_wiki --max-tokens 500000000 --force
89
-
90
- # DCLM web (20%) β€” .jsonl.zst shards -> parquet -> .pt shards
91
- python scripts/download_jsonl_zst.py --repo mlfoundations/dclm-baseline-1.0 \
92
- --subdir global-shard_01_of_10/local-shard_0_of_10 --output data/raw/r5_web --suffix .jsonl.zst
93
- python scripts/zst_jsonl_to_parquet.py --input data/raw/r5_web --output data/raw/r5_web_pq
94
- python scripts/prepare_data_local.py --input data/raw/r5_web_pq --tokenizer tokenizer/ \
95
- --output data/pretrain/r5_web --max-tokens 1600000000 --force --workers 8
96
-
97
- # Code (12.5%) β€” OpenCodeInstruct (text = input + "\n\n" + output)
98
- python scripts/download_parquets.py --repo nvidia/OpenCodeInstruct --subdir <files-dir> \
99
- --output data/raw/r5_code --workers 4
100
- python scripts/columns_to_text_parquet.py --input data/raw/r5_code \
101
- --output data/raw/r5_code_text --columns input output --sep "\n\n"
102
- python scripts/prepare_data_local.py --input data/raw/r5_code_text --tokenizer tokenizer/ \
103
- --output data/pretrain/r5_code --max-tokens 1000000000 --force --workers 8
104
-
105
- # Math (~6%) β€” web-math corpus (columns url/text/date/metadata), same download route:
106
- # download_parquets.py --repo <web-math> --subdir <files-dir> --output data/raw/r5_math
107
- # prepare_data_local.py --input data/raw/r5_math --output data/pretrain/r5_math --max-tokens 500000000
108
- ```
109
-
110
- > Conventions: `download_parquets.py` / `zst_jsonl_to_parquet.py` emit `<name>.parquet.parquet`
111
- > and `prepare_data_local.py` globs `*.parquet.parquet` (keep the double extension when
112
- > normalizing); `prepare_data_local.py` reads the `text` column only, so multi-column pools (code)
113
- > must go through `columns_to_text_parquet.py` first; `download_jsonl_zst.py` takes one subdir per
114
- > run.
115
-
116
- Then assemble the four strictly disjoint pools (Bresenham-interleaved, hard-linked, inode-verified).
117
- `--start/--take` select each source's shard range; every source passes `--val-take 0` because
118
- validation uses the separate `pilot_blend30_val` directory. Shown for `main_s1`:
119
-
120
- ```bash
121
- python scripts/make_blend_shards.py --output data/pretrain/main_s1 \
122
- --source data/pretrain/fineweb3 --start 8 --take 7 --val-take 0 \
123
- --source data/pretrain/p5_web --start 0 --take 2 --val-take 0 \
124
- --source data/pretrain/r5_web --start 0 --take 4 --val-take 0 \
125
- --source data/pretrain/cosmopedia3 --start 0 --take 3 --val-take 0 \
126
- --source data/pretrain/r5_code --start 0 --take 2 --val-take 0 \
127
- --source data/pretrain/r5_math --start 0 --take 1 --val-take 0 \
128
- --source data/pretrain/r5_wiki --start 0 --take 1 --val-take 0
129
- ```
130
-
131
- | Pool | Source shard ranges (100M-token shards) |
132
- |---|---|
133
- | main_s1 (2.00B) | fineweb3[8–14], p5_web[0–1], r5_web[0–3], cosmopedia3[0–2], r5_code[0–1], r5_math[0], r5_wiki[0] |
134
- | main_s2 (1.94B) | fineweb3[15–21], p5_web[2–3], r5_web[4–7], cosmopedia3[4], p5_synth[0], r5_code[2–4], r5_math[1], r5_wiki[1] |
135
- | main_s3 (2.20B) | fineweb3[22–28], p5_web[4–5], r5_web[8–11], p5_synth[1–3], r5_code[5–7], r5_math[2], r5_wiki[2–3] |
136
- | main_s4 (1.91B) | fineweb3[29–35], p5_web[6–7], r5_web[12–15], p5_synth[4–5], r5_code[8–9], r5_math[3–4], r5_wiki[4] |
137
-
138
- `p5_web` is an additional DCLM slice; `p5_synth` shares the Cosmopedia v2 schema.
139
-
140
- Source datasets: FineWeb-Edu [`HuggingFaceFW/fineweb-edu`](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu)
141
- (`sample-10BT`); Cosmopedia v2 [`HuggingFaceTB/cosmopedia-v2`](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia-v2);
142
- DCLM web [`mlfoundations/dclm-baseline-1.0`](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) (`.jsonl.zst`);
143
- code [`nvidia/OpenCodeInstruct`](https://huggingface.co/datasets/nvidia/OpenCodeInstruct);
144
- Wikipedia [`wikimedia/wikipedia`](https://huggingface.co/datasets/wikimedia/wikipedia) (`20231101.en`).
145
-
146
  ## Training
147
 
148
  Four ~2B-token segments, each with its own complete WSD schedule (warmup 700 β†’ stable β†’
@@ -159,11 +67,30 @@ linear decay over the final 10%); the segment boundary is the anneal point.
159
  - batch 48 Γ— 1024 = 49,152 tokens/step, ~14.3k tok/s
160
  - gradient clipping 1.0, AdamW (Ξ²=0.9, 0.95, wd 0.1), hourly keep-last-2 checkpoints
161
 
162
- ## Results (lm-evaluation-harness v0.4.12, 0-shot)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  v3.0 (S4, 8.05B tokens) vs the previous releases:
165
 
166
- | Task | Metric | v3.0 (477M/276M) | 1B MoE 8B (1182M/352M) | v1.1 (432M) | v2.0 beta (498M) |
167
  |------|--------|:---:|:---:|:---:|:---:|
168
  | HellaSwag | acc_norm | **0.335** | 0.329 | 0.308 | 0.326 |
169
  | PIQA | acc | **0.638** | 0.630 | 0.616 | 0.631 |
@@ -175,6 +102,9 @@ v3.0 (S4, 8.05B tokens) vs the previous releases:
175
  | LAMBADA | acc | **0.268** | 0.234 | 0.227 | 0.224 |
176
  | **Mean** | β€” | **0.4250** | 0.425 | 0.409 | 0.397 |
177
 
 
 
 
178
  ### Comparison with similar models
179
 
180
  Same suite and settings, measured locally (lm-evaluation-harness v0.4.12, 0-shot, cuda, bf16):
@@ -204,14 +134,55 @@ Notes:
204
  - Early (10k–14k) and late (32k–34k) val-PPL bumps were transient low-entropy shard effects
205
  that self-healed (36k=16.31 β†’ 38k=15.59); no data-pool change was needed.
206
 
207
- ## Quick Start (training)
208
-
209
- See `versions/v3.0/scripts/run_segment.ps1` (Windows) for the 4-segment launcher, or drive `scripts/train.py`
210
- / `scripts/resume.py` directly. Publishes to HF with `scripts/publish_hf.py`.
211
 
212
  ```python
213
- from transformers import AutoModelForCausalLM
214
- model = AutoModelForCausalLM.from_pretrained(
215
- "mikecovlee/tinymixtral", trust_remote_code=True
216
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  ```
 
 
 
 
 
1
  ---
 
2
  license: mit
3
+ library_name: transformers
4
  pipeline_tag: text-generation
5
+ language: en
6
  tags:
7
+ - tinymixtral
8
  - moe
9
+ - mixture-of-experts
10
  - pretraining
11
  - text-generation
12
+ - custom_code
13
+ model_type: tinymixtral
14
  datasets:
15
  - HuggingFaceFW/fineweb-edu
 
16
  - mlfoundations/dclm-baseline-1.0
17
+ - HuggingFaceTB/cosmopedia-v2
18
  - nvidia/OpenCodeInstruct
19
+ - open-web-math/open-web-math
20
  - wikimedia/wikipedia
21
  ---
22
 
23
+ # tinymixtral β€” v3.0 MoE flagship
24
 
25
  **Flagship release.** A Mixtral-style sparse MoE language model: ~477.5M total / ~276.1M active
26
  parameters (top-2 of 4 routed experts), trained from scratch on **8.05B tokens** on a single GPU.
27
 
28
  - HF repo: `mikecovlee/tinymixtral`
 
29
 
30
+ ## Model details
31
 
32
  | Parameter | Value |
33
  |-----------|-------|
 
44
  | **Total params** | **~477.5M** |
45
  | **Active params** | **~276.1M** |
46
 
47
+ Design decisions (validated by a 400M-token ablation matrix):
48
  - **top-2 routing** β€” top-1 was +12.2–19.5% worse in val PPL at 400M tokens; maintain top-2.
49
  - **QK-Norm kept** β€” neutral at 400M tokens, retained as the trunk default.
50
+ - **aux = 1e-3** β€” the auxiliary-loss coefficient is insensitive in the 4-expert / top-2 ablation.
51
  - **LR ladder** `5e-4 / 5e-4 / 4e-4 / 3e-4` across the four segments (5e-4 was the sole
52
  significant factor, βˆ’5.3% val PPL in the matrix).
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ## Training
55
 
56
  Four ~2B-token segments, each with its own complete WSD schedule (warmup 700 β†’ stable β†’
 
67
  - batch 48 Γ— 1024 = 49,152 tokens/step, ~14.3k tok/s
68
  - gradient clipping 1.0, AdamW (Ξ²=0.9, 0.95, wd 0.1), hourly keep-last-2 checkpoints
69
 
70
+ ### Training data
71
+
72
+ 8.05B unique tokens, zero repetition, drawn from six public corpora and split into **four strictly
73
+ disjoint ~2B-token pools** (no token is seen twice across the four segments). Validation always uses
74
+ a held-out shard set that never appears in training.
75
+
76
+ | Source | HF dataset | Share |
77
+ |---|---|---|
78
+ | FineWeb-Edu | [`HuggingFaceFW/fineweb-edu`](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) (`sample-10BT`) | 44% |
79
+ | DCLM web | [`mlfoundations/dclm-baseline-1.0`](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) | 20% |
80
+ | Cosmopedia v2 (synthetic) | [`HuggingFaceTB/cosmopedia-v2`](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia-v2) | 12.5% |
81
+ | Code | [`nvidia/OpenCodeInstruct`](https://huggingface.co/datasets/nvidia/OpenCodeInstruct) | 12.5% |
82
+ | Math | [`open-web-math/open-web-math`](https://huggingface.co/datasets/open-web-math/open-web-math) | 6% |
83
+ | Wikipedia | [`wikimedia/wikipedia`](https://huggingface.co/datasets/wikimedia/wikipedia) (`20231101.en`) | 6% |
84
+
85
+ Shares are rounded and sum to ~100%.
86
+
87
+ ## Evaluation
88
+
89
+ Measured with `lm-evaluation-harness` v0.4.12, 0-shot (cuda, bf16).
90
 
91
  v3.0 (S4, 8.05B tokens) vs the previous releases:
92
 
93
+ | Task | Metric | v3.0 (477M/276M) | tinymixtral-v1.1-1b (1182M/352M) | tinymixtral-v1.1-0.5b (432M) | tinymixtral-v2.0-beta (498M) |
94
  |------|--------|:---:|:---:|:---:|:---:|
95
  | HellaSwag | acc_norm | **0.335** | 0.329 | 0.308 | 0.326 |
96
  | PIQA | acc | **0.638** | 0.630 | 0.616 | 0.631 |
 
102
  | LAMBADA | acc | **0.268** | 0.234 | 0.227 | 0.224 |
103
  | **Mean** | β€” | **0.4250** | 0.425 | 0.409 | 0.397 |
104
 
105
+ > **Harness note.** The mean above is the **8-task** harness (includes BoolQ); the dense and
106
+ > instruction-tuned cards report a **7-task** mean (excludes BoolQ). The two are not directly comparable.
107
+
108
  ### Comparison with similar models
109
 
110
  Same suite and settings, measured locally (lm-evaluation-harness v0.4.12, 0-shot, cuda, bf16):
 
134
  - Early (10k–14k) and late (32k–34k) val-PPL bumps were transient low-entropy shard effects
135
  that self-healed (36k=16.31 β†’ 38k=15.59); no data-pool change was needed.
136
 
137
+ ## Usage
 
 
 
138
 
139
  ```python
140
+ from transformers import AutoModelForCausalLM, AutoTokenizer
141
+
142
+ model = AutoModelForCausalLM.from_pretrained("mikecovlee/tinymixtral", trust_remote_code=True)
143
+ tokenizer = AutoTokenizer.from_pretrained("mikecovlee/tinymixtral")
144
+
145
+ inputs = tokenizer("The capital of France is", return_tensors="pt")
146
+ out = model.generate(**inputs, max_new_tokens=32, do_sample=False)
147
+ print(tokenizer.decode(out[0], skip_special_tokens=True))
148
+ ```
149
+
150
+ Requires `transformers` and `trust_remote_code=True` (custom `tinymixtral` architecture).
151
+ This is a **base (pretrained) model**; for chat use the instruction-tuned
152
+ [`mikecovlee/tinymixtral-it`](https://huggingface.co/mikecovlee/tinymixtral-it).
153
+
154
+ ## Limitations
155
+
156
+ - Base model: no instruction tuning or safety alignment; not a chat model.
157
+ - Trained on only **8.05B tokens** β€” knowledge tasks (MMLU, ARC-Challenge) are capacity/budget-bound
158
+ and far below models trained on trillions of tokens.
159
+ - English-centric.
160
+
161
+ ## Family
162
+
163
+ - **`mikecovlee/tinymixtral`** β€” this model (477.5M MoE base, v3.0 flagship)
164
+ - [`mikecovlee/tinymixtral-it`](https://huggingface.co/mikecovlee/tinymixtral-it) β€” MoE instruction-tuned (v3.0-it, 3M SFT)
165
+ - [`mikecovlee/tinymistral-276m`](https://huggingface.co/mikecovlee/tinymistral-276m) β€” 276M dense base (iso-active ablation)
166
+ - [`mikecovlee/tinymistral-276m-it`](https://huggingface.co/mikecovlee/tinymistral-276m-it) β€” 276M dense instruction-tuned (3M SFT)
167
+ - [`mikecovlee/tinymixtral-v1.1-1b`](https://huggingface.co/mikecovlee/tinymixtral-v1.1-1b) β€” 1B MoE (earlier flagship)
168
+ - [`mikecovlee/tinymixtral-v1.1-0.5b`](https://huggingface.co/mikecovlee/tinymixtral-v1.1-0.5b) β€” 0.5B-class MoE (data-quality ablation)
169
+ - [`mikecovlee/tinymixtral-v2.0-beta`](https://huggingface.co/mikecovlee/tinymixtral-v2.0-beta) β€” shared-expert experiment (beta)
170
+ - [`mikecovlee/tinymixtral-v1.0`](https://huggingface.co/mikecovlee/tinymixtral-v1.0) β€” legacy (C4)
171
+
172
+ > **Naming.** The MoE family is published under `tinymixtral`; the dense 276M iso-active
173
+ > ablation companions use the `tinymistral` spelling. Both belong to the same project.
174
+
175
+ ## Citation
176
+
177
+ ```bibtex
178
+ @misc{tinymixtral2026,
179
+ title = {TinyMixtral: a small Mixture-of-Experts language-model family},
180
+ author = {Michael Lee},
181
+ year = {2026},
182
+ howpublished = {\url{https://huggingface.co/mikecovlee/tinymixtral}}
183
+ }
184
  ```
185
+
186
+ ## License
187
+
188
+ MIT (Copyright (C) 2026 Michael Lee).