Text Generation
Transformers
Safetensors
English
mume_gpt
causal-lm
custom_code
math
base-model
Eval Results (legacy)
ks2812 commited on
Commit
6307c7e
·
verified ·
1 Parent(s): 6e18a0a

v0.1.0: MATH0 (owm_val_clean 1.06595, GSM8K 0.91%)

Browse files
CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ Versions are git tags on this repository. Load a fixed version with `from_pretrained("MuseMesh/mume-math-125m", revision="<tag>", trust_remote_code=True)`.
4
+
5
+ ## v0.1.0 (2026-09-29)
6
+
7
+ - Weights of training run `math0_shared32k_d125m_ctx1024` (MATH0 (the Math expert's first run)), step 27,106, 1.33B tokens.
8
+ - owm_val_clean 1.06595, math_test_clean 0.86027, gsm8k_test 1.07016 bits per byte; GSM8K exact match 0.91%.
9
+ - First release. Tokenizer: MuseMesh/mume-tokenizer-32k v0.1.0 (bundled).
LICENSE ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The model weights (model.safetensors) and the tokenizer files (tokenizer.model,
2
+ tokenizer.json) in this repository are licensed under the Creative Commons
3
+ Attribution-NonCommercial 4.0 International licence (CC BY-NC 4.0): https://creativecommons.org/licenses/by-nc/4.0/
4
+
5
+ You may use, share and adapt them for non-commercial purposes (research, teaching, non-profit work) with
6
+ attribution to "Muse Mesh Private Limited". For commercial use contact kushal@muse-mesh.com; an Apache-2.0
7
+ licensed line (a tokenizer trained without non-commercial sources, and models retrained on it) is planned as
8
+ separate repositories.
9
+
10
+ Why: the shared tokenizer's training sample includes Sanskrit text licensed for non-commercial use only
11
+ (GRETIL, CC BY-NC-SA 4.0; Muktabodha, CC BY-NC 4.0) and Sanskrit text without a licence statement. The model
12
+ weights themselves were trained only on ODC-By and MIT licensed data (see README.md, Attribution).
13
+
14
+ The code is licensed separately under Apache-2.0 (see LICENSE-CODE).
15
+
16
+ Copyright 2026 Muse Mesh Private Limited
LICENSE-CODE ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ The Python code in this repository (configuration_mume.py, modeling_mume.py, tokenization_mume.py) is licensed under the
2
+ Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
3
+
4
+ Copyright 2026 Muse Mesh Private Limited
README.md ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - causal-lm
9
+ - custom_code
10
+ - math
11
+ - base-model
12
+ datasets:
13
+ - open-web-math/open-web-math
14
+ - MuseMesh/mume-eval-suites
15
+ model-index:
16
+ - name: mume-math-125m
17
+ results:
18
+ - task:
19
+ type: text-generation
20
+ name: Language modelling
21
+ dataset:
22
+ type: MuseMesh/mume-eval-suites
23
+ name: owm_val
24
+ config: owm_val
25
+ split: test
26
+ metrics:
27
+ - type: bits_per_byte
28
+ name: bits per UTF-8 byte (1,024-token windows, stride 512)
29
+ value: 0.9926
30
+ - task:
31
+ type: text-generation
32
+ name: Language modelling
33
+ dataset:
34
+ type: MuseMesh/mume-eval-suites
35
+ name: gsm8k_test
36
+ config: gsm8k_test
37
+ split: test
38
+ metrics:
39
+ - type: bits_per_byte
40
+ name: bits per UTF-8 byte (1,024-token windows, stride 512)
41
+ value: 1.0702
42
+ - task:
43
+ type: text-generation
44
+ name: Language modelling
45
+ dataset:
46
+ type: MuseMesh/mume-eval-suites
47
+ name: math_test
48
+ config: math_test
49
+ split: test
50
+ metrics:
51
+ - type: bits_per_byte
52
+ name: bits per UTF-8 byte (1,024-token windows, stride 512)
53
+ value: 0.8462
54
+ - task:
55
+ type: text-generation
56
+ name: Language modelling
57
+ dataset:
58
+ type: MuseMesh/mume-eval-suites
59
+ name: owm_val_clean
60
+ config: owm_val_clean
61
+ split: test
62
+ metrics:
63
+ - type: bits_per_byte
64
+ name: bits per UTF-8 byte (1,024-token windows, stride 512)
65
+ value: 1.0659
66
+ - task:
67
+ type: text-generation
68
+ name: Language modelling
69
+ dataset:
70
+ type: MuseMesh/mume-eval-suites
71
+ name: math_test_clean
72
+ config: math_test_clean
73
+ split: test
74
+ metrics:
75
+ - type: bits_per_byte
76
+ name: bits per UTF-8 byte (1,024-token windows, stride 512)
77
+ value: 0.8603
78
+ - task:
79
+ type: text-generation
80
+ name: Math word problems
81
+ dataset:
82
+ type: openai/gsm8k
83
+ name: GSM8K
84
+ config: main
85
+ split: test
86
+ metrics:
87
+ - type: exact_match
88
+ name: exact match, 3-shot, greedy
89
+ value: 0.91
90
+ ---
91
+
92
+ # Mume Math 125M
93
+
94
+ **Mume Math 125M** is a 134M-parameter language model trained from scratch on 1.33B tokens of mathematical web text (OpenWebMath), with the recipe, budget and tokenizer of Mume English 125M v0.2.0. It reads math far better than the English model of the same size (bits per byte on MATH test, clean subset: -62.6%), but solves almost no word problems (GSM8K 0.91%).
95
+
96
+ From [Muse Mesh](https://muse-mesh.com) ([Hugging Face](https://huggingface.co/MuseMesh)). Part of the Muse Mesh English and Math models ([collections](https://huggingface.co/collections/MuseMesh)). Every training run, including the ones not released, is logged at [mume.ai/sansar/runs](https://mume.ai/sansar/runs) (moving to mume.ai/lab).
97
+
98
+ ## Model
99
+
100
+ | | |
101
+ |---|---|
102
+ | Architecture | decoder-only transformer, pre-LayerNorm (LayerNorm without bias), no biases anywhere; GPT-2-small shape |
103
+ | Layers / heads / width | 12 / 12 / 768 (head dim 64); MLP 4x = 3,072 |
104
+ | Positions | rotary (base 10,000; half-split pairing), no position table |
105
+ | Attention | causal SDPA; queries and keys RMS-normalised per head (QK-norm) |
106
+ | MLP activation | squared ReLU |
107
+ | Output head | separate (untied), zero-initialised |
108
+ | Vocabulary | 32,000 ([MuseMesh/mume-tokenizer-32k](https://huggingface.co/MuseMesh/mume-tokenizer-32k) v0.1.0, bundled) |
109
+ | Context | 1,024 tokens |
110
+ | Parameters, total | 134,105,856 |
111
+ | Parameters, non-embedding | 84,953,856 |
112
+ | Token embedding | 24,576,000 |
113
+ | Output head | 24,576,000 |
114
+ | Weights in this repo | bfloat16 safetensors (trained as fp32 master weights under bf16 autocast) |
115
+
116
+ Why this run: The English winner's recipe and budget, unchanged, on mathematical web text.
117
+
118
+ ## Evaluation
119
+
120
+ **Metric**: bits per UTF-8 byte (lower is better): the model's negative log-likelihood of a text divided by the text's UTF-8 byte count, so models with different tokenizers share a denominator. Each set's records are joined with `</s>` into one stream and scored teacher-forced in 1,024-token windows with stride 512 (every scored token after the first window has at least 512 tokens of context); `</s>` carries loss but no bytes. Scored with `scripts/train/eval_bpb.py` on a GPU in bf16 autocast. The sets are frozen and published as [MuseMesh/mume-eval-suites](https://huggingface.co/datasets/MuseMesh/mume-eval-suites).
121
+
122
+ The English model is [MuseMesh/mume-english-125m](https://huggingface.co/MuseMesh/mume-english-125m) v0.2.0 (EN1-full): the same architecture, recipe, tokenizer and token budget, trained on FineWeb instead of OpenWebMath.
123
+
124
+ | set | what | this model | English model | change |
125
+ |---|---|---:|---:|---:|
126
+ | `gsm8k_test` | GSM8K test, 1,319 problems: question, blank line, worked answer (calculator annotations removed) | **1.07016** | 1.20665 | -11.3% |
127
+ | `owm_val` | OpenWebMath shard 113 (never trained on), the first 2,704 documents up to 20 MB | **0.99258** | 1.54392 | -35.7% |
128
+ | `owm_val_clean` | owm_val minus the 1,578 documents that share a copied passage with the training data (1,126 documents) | **1.06595** | 1.57023 | -32.1% |
129
+ | `math_test` | MATH test (Hendrycks), 5,000 problems: problem, blank line, solution | **0.84625** | 2.36162 | -64.2% |
130
+ | `math_test_clean` | math_test minus the 1,246 problems that share a copied passage with the training data (3,754 problems) | **0.86027** | 2.30167 | -62.6% |
131
+
132
+ There is no `gsm8k_clean`: the contamination check found no GSM8K test problem with a copied passage in the training data (0.13% of its 8-grams occur there, scattered), so `gsm8k_test` is already clean.
133
+
134
+ With 512-token windows (stride 256): owm_val 1.0198, gsm8k_test 1.0736, math_test 0.8650 (`eval/bpb_ctx512.json`).
135
+
136
+ **Contamination**, measured before training (lowercase word 8-grams of each set looked up in the whole training slice; a record has a copied passage when 5+ consecutive 8-grams hit): owm_val 1,578 of 2,704 documents (58%; the web repeats pages across shards), MATH test 1,246 of 5,000 problems (25%; solutions copied onto web pages), GSM8K test 0 of 1,319. The `_clean` sets drop every such record. On MATH the clean set moves this model by +1.7% (0.84625 -> 0.86027), so the MATH number is not memorisation. On OpenWebMath the clean subset reads +7.4% higher for this model and +1.7% for the English model, so part of the `owm_val` number does come from copies; quote the `_clean` columns. Against the English model on the clean sets: owm_val_clean -32.1%, math_test_clean -62.6%.
137
+
138
+ ### GSM8K exact match
139
+
140
+ 3-shot, greedy: three worked GSM8K *train* examples ("Question: ...\nAnswer: ... #### N"), then the test question and "Answer:"; up to 200 new tokens, stopping at the next "Question:" or after the `####` line. The prediction is the number after `####` (else the last number); it counts when it equals the gold number. All 1,319 test problems (`scripts/experts/math/gsm8k_exact.py`).
141
+
142
+ | model | right | exact match |
143
+ |---|---:|---:|
144
+ | English model (EN1-full) | 21 / 1,319 | 1.59% |
145
+ | **this model (MATH0)** | 12 / 1,319 | 0.91% |
146
+
147
+ These runs used the fp32 training weights (GPU, bf16 autocast). This repo's bf16 weights, same protocol and GPU: **13 / 1,319 = 0.99%** (greedy decoding of a model this small flips on near-ties, so single problems change).
148
+
149
+ Low single digits is what a 125M base model scores here; the number is the family's first capability metric. A fine-tuned version on the `sft` branch (tag `v0.1.0-sft`) reaches 2.43% and shows why the score stays low (see its card).
150
+
151
+ ### Checked before release
152
+
153
+ - `modeling_mume.py` against the training code (`scripts/train/model.py`), fp32 on CPU, 6 inputs (one evaluation text per set, cropped to 1,024 tokens, and 1,024 random ids): with the same bf16 weights the logits are identical (max |difference| 0); against the fp32 training weights the bf16 storage moves logits by at most 0.205.
154
+ - Bits per byte with `eval_bpb.py`'s scoring on the first 20 records of each set (each cut to 20,000 characters): 1.06580 (training checkpoint, fp32) vs 1.06587 (this repo, bf16 weights) = +0.0063%.
155
+ - The whole `gsm8k_test` set through this repo's model (bf16 weights, fp32 on CPU): 1.07000, against 1.07016 in the table (training checkpoint, GPU bf16 autocast), -0.015%.
156
+ - Tokenizer: `AutoTokenizer(..., trust_remote_code=True)` gives the training ids on 100/100 sample texts and decodes them back exactly on 100/100; on all 58,338 texts of the tokenizer's own check the same holds (see [MuseMesh/mume-tokenizer-32k](https://huggingface.co/MuseMesh/mume-tokenizer-32k)).
157
+ - Left-padded batches give the same logits as single sequences (max |difference| 3.1e-05).
158
+
159
+ ## Quick start
160
+
161
+ ```python
162
+ from transformers import AutoModelForCausalLM, AutoTokenizer
163
+
164
+ repo = "MuseMesh/mume-math-125m"
165
+ tok = AutoTokenizer.from_pretrained(repo, revision="v0.1.0", trust_remote_code=True)
166
+ model = AutoModelForCausalLM.from_pretrained(repo, revision="v0.1.0", trust_remote_code=True)
167
+
168
+ inputs = tok("Let $f(x) = x^2 + 1$. Then", return_tensors="pt")
169
+ out = model.generate(**inputs, max_new_tokens=60, do_sample=True, temperature=0.8, top_k=100)
170
+ print(tok.decode(out[0], skip_special_tokens=True))
171
+ ```
172
+
173
+ Needs `transformers` (tested with 5.18.0), `torch` and `sentencepiece`. `trust_remote_code=True` runs two small files from this repository, `modeling_mume.py` (the network; the Sansar model code with the classes renamed) and `tokenization_mume.py` (SentencePiece, so the ids are exactly the training ids); read them before you run them. Without `trust_remote_code` the tokenizer falls back to `tokenizer.json`, which agrees on short texts but splits a few near-tie words differently in long documents. The weights are stored in bfloat16; pass `dtype=torch.float32` for fp32, usually the faster choice on a CPU. The tokenizer adds no BOS/EOS: training documents were separated by `</s>` only.
174
+
175
+ What this checkpoint wrote for that prompt (CPU, `torch.manual_seed(0)`, 60 new tokens):
176
+
177
+ ```text
178
+ Let $f(x) = x^2 + 1$. Then $|f(x)| = |x|^2$. If $f(x) = x^2 + 1$, then $|f'(x)| = |x|^2 = |x|^2$. Thus $|f(x)| \leq |x^2 +
179
+ ```
180
+
181
+ and with greedy decoding:
182
+
183
+ ```text
184
+ Let $f(x) = x^2 + 1$. Then $f(x) = x^2 + 1$ and $f(x) = x^2 + 1$ for all $x \in \mathbb{R}$.
185
+
186
+ Now, let $f(x) = x^2 + 1$ and $f(
187
+ ```
188
+
189
+ To score text instead of generating it, call the model with `labels=input_ids`; `loss` is the mean negative log-likelihood per token in nats.
190
+
191
+ ## Training data
192
+
193
+ OpenWebMath shards 4-15 of 114 (12 parquet files): 662,940 web pages with mathematical content, 816M words; 1,824 pages whose URL also occurs in shard 113 (the held-out shard) were skipped. Shards 0-3 were the tokenizer's math sample and are not in the training data.
194
+
195
+ Preparation (`scripts/train/prep_data.py`): Unicode NFC; documents longer than 20,000 characters cut into parts at whitespace (774,551 records); tokenized with the shared 32k tokenizer; one `</s>` after every record. A 0.5% validation stream by hash of each record's text (3,769 records); the rest is training: 770,782 records, 1,555,523,031 tokens, 5.12 GB (3.29 bytes per token).
196
+
197
+ Every training document is listed (source file, row, id; no text) in [MuseMesh/mume-eval-suites](https://huggingface.co/datasets/MuseMesh/mume-eval-suites), config `training_manifests`, split `math_pretrain`, with the parts that went to validation, so the slice can be rebuilt from the public source.
198
+
199
+ ## Training
200
+
201
+ | | |
202
+ |---|---|
203
+ | Optimizer, block matrices | Muon (84,934,656 params): momentum 0.95 (Nesterov), 5 Newton-Schulz steps in bf16, peak lr 0.02, update scaled by sqrt(max(1, rows/cols)), no weight decay |
204
+ | Optimizer, everything else | AdamW: embedding + head with weight decay 0.1, LayerNorm gains without; peak lr 0.001, betas (0.9, 0.95), eps 1e-8 |
205
+ | Learning-rate schedule | linear warm-up over 500 steps, then cosine decay to 0.1 x peak at step 27,106 |
206
+ | Batch | 12 sequences x 4 accumulation steps x 1,024 tokens = 49,152 tokens per step |
207
+ | Steps | 27,106 |
208
+ | Tokens seen | 1,332,314,112 (0.86 passes over 1,555.5M training tokens) |
209
+ | Gradient clipping | global norm 1.0 |
210
+ | Precision | bf16 autocast, fp32 master weights, torch.compile |
211
+ | Seed | 1337 |
212
+ | Data sampling | 1,024-token windows at uniformly random offsets of the token stream (documents separated by `</s>`) |
213
+ | Hardware | 1x NVIDIA RTX 3060 12 GB, power-capped at 150 W |
214
+ | Wall time | 889 min (14.8 h), 25.1k tokens/s; one power cut, resumed from a checkpoint |
215
+ | Compute cost | own hardware, no cloud cost |
216
+ | Final validation | 1.0307 bits per byte on the run's own validation stream (0.5% of documents, non-overlapping windows) |
217
+
218
+ ## Limitations
219
+
220
+ - **Base model.** It continues text. It has not been instruction-tuned or aligned: it does not follow instructions, answer questions or chat, and it will not refuse anything.
221
+ - **It makes things up.** Fluent text with invented facts, names, numbers, citations and proofs. Do not use it as a source of facts or of correct mathematics.
222
+ - **Small and short.** 134M parameters and a 1,024-token context. This implementation has no key/value cache, so long generations are slow (each new token re-reads the context).
223
+ - **Web math.** OpenWebMath is forum posts, lecture notes, blogs and Q&A pages with LaTeX; the model writes in that register, can switch into English prose, and has little arithmetic ability.
224
+ - **Contamination.** Some evaluation text occurs in the training data (measured above); prefer the `_clean` sets.
225
+ - **Tokenizer.** 32k pieces shared with Sanskrit (in SLP1 transliteration) and math; FineWeb text takes 13% more tokens than with GPT-2's tokenizer (1.52 vs 1.35 per word).
226
+
227
+ ## Versions
228
+
229
+ Each version is a git tag on this repository; `main` is version v0.1.0. Pin one with `revision=`. A version is one training run, named by its run id in the training log.
230
+
231
+ | version | where | date | training run | key numbers |
232
+ |---|---|---|---|---|
233
+ | v0.1.0 | tag `v0.1.0`, `main` | 2026-09-29 | `math0_shared32k_d125m_ctx1024` (MATH0) | owm_val_clean 1.0659, GSM8K 0.91% |
234
+ | v0.1.0-sft | branch `sft`, tag `v0.1.0-sft` | 2026-10-01 | `math0_sft` (MATH0-SFT) | GSM8K 2.43% |
235
+
236
+ The fine-tuned model lives on its own branch, `sft`, so `main` stays the base model that the bits-per-byte numbers describe; the tag `v0.1.0-sft` pins it. A later fine-tune of this base will move the `sft` branch and get its own tag.
237
+
238
+ ## Files
239
+
240
+ | file | what |
241
+ |---|---|
242
+ | `model.safetensors` | the weights, bfloat16 (no optimizer state) |
243
+ | `config.json`, `generation_config.json` | architecture and default generation settings |
244
+ | `configuration_mume.py`, `modeling_mume.py` | the network for transformers (`auto_map`, trust_remote_code) |
245
+ | `tokenizer.model`, `tokenizer.json`, `tokenization_mume.py`, `tokenizer_config.json`, `special_tokens_map.json` | the tokenizer ([MuseMesh/mume-tokenizer-32k](https://huggingface.co/MuseMesh/mume-tokenizer-32k) v0.1.0) |
246
+ | `eval/bpb_clean_ctx1024.json`, `eval/bpb_ctx1024.json`, `eval/bpb_ctx512.json`, `eval/contamination_overlap.json`, `eval/english_model_bpb_clean_ctx1024.json`, `eval/english_model_bpb_ctx1024.json`, `eval/english_model_gsm8k_exact_3shot.json`, `eval/gsm8k_exact_3shot.json`, `eval/gsm8k_exact_3shot_released_weights.json`, `eval/heldout_meta.json`, `eval/smoke_test.json`, `eval/verification.json` | the evaluation outputs quoted above, the release checks and the sample generations |
247
+ | `training/data_meta.json`, `training/slice_summary.json`, `training/summary.json` | every training argument, the validation points and the data preparation record |
248
+ | `LICENSE`, `LICENSE-CODE`, `CHANGELOG.md` | licences and version history |
249
+
250
+ ## Attribution
251
+
252
+ | data | Hugging Face | reference | licence |
253
+ |---|---|---|---|
254
+ | OpenWebMath | [open-web-math/open-web-math](https://huggingface.co/datasets/open-web-math/open-web-math) | Paster et al. 2023, *OpenWebMath*, [arXiv:2310.06786](https://arxiv.org/abs/2310.06786) | ODC-By 1.0; use is also subject to the Common Crawl Terms of Use |
255
+ | GSM8K | [openai/gsm8k](https://huggingface.co/datasets/openai/gsm8k) | Cobbe et al. 2021, *Training Verifiers to Solve Math Word Problems*, [arXiv:2110.14168](https://arxiv.org/abs/2110.14168) | MIT |
256
+ | MATH | [EleutherAI/hendrycks_math](https://huggingface.co/datasets/EleutherAI/hendrycks_math) | Hendrycks et al. 2021, *Measuring Mathematical Problem Solving With the MATH Dataset*, [arXiv:2103.03874](https://arxiv.org/abs/2103.03874) | MIT |
257
+
258
+ ## Licence
259
+
260
+ This release is for research and non-commercial use.
261
+
262
+ - Weights (`model.safetensors`), `tokenizer.model` and `tokenizer.json`: **CC BY-NC 4.0** (`LICENSE`). Non-commercial use (research, teaching, non-profit work) with attribution to "Muse Mesh Private Limited".
263
+ - Code (`configuration_mume.py`, `modeling_mume.py`, `tokenization_mume.py`): **Apache-2.0** (`LICENSE-CODE`).
264
+ - Commercial use: contact kushal@muse-mesh.com.
265
+
266
+ Why non-commercial: The weights saw only permissively licensed text: OpenWebMath (ODC-By 1.0). The tokenizer is the issue: the shared 32k tokenizer was trained on a 1.2 GB sample of which 400 MB is Sanskrit from the Sansar corpus, and part of that Sanskrit is licensed for non-commercial use only (GRETIL, CC BY-NC-SA 4.0; Muktabodha, CC BY-NC 4.0) or carries no licence statement. The tokenizer, and the weights that only work with it, are therefore released under CC BY-NC 4.0, the same terms as the Sansar Sanskrit tokenizer. An Apache-2.0 line is planned as separate repositories: a new tokenizer trained without those sources, and the models retrained on it.
267
+
268
+ ## Citation
269
+
270
+ ```bibtex
271
+ @misc{mume_math_125m_2026,
272
+ title = {Mume Math 125M},
273
+ author = {Muse Mesh},
274
+ year = {2026},
275
+ note = {v0.1.0},
276
+ url = {https://huggingface.co/MuseMesh/mume-math-125m}
277
+ }
278
+ ```
279
+
280
+ Contact: kushal@muse-mesh.com
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MumeForCausalLM"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_mume.MumeConfig",
7
+ "AutoModelForCausalLM": "modeling_mume.MumeForCausalLM"
8
+ },
9
+ "bias": false,
10
+ "block_size": 1024,
11
+ "bos_token_id": 1,
12
+ "dtype": "bfloat16",
13
+ "eos_token_id": 2,
14
+ "initializer_range": 0.02,
15
+ "layer_norm_eps": 1e-05,
16
+ "logit_cap": 0.0,
17
+ "mlp_ratio": 4,
18
+ "model_type": "mume_gpt",
19
+ "n_embd": 768,
20
+ "n_head": 12,
21
+ "n_layer": 12,
22
+ "pad_token_id": 2,
23
+ "qk_norm": true,
24
+ "relu_sq": true,
25
+ "rope": true,
26
+ "rope_theta": 10000.0,
27
+ "tie_word_embeddings": false,
28
+ "torch_dtype": "bfloat16",
29
+ "transformers_version": "5.18.0",
30
+ "untied_head": true,
31
+ "use_cache": false,
32
+ "value_embed": false,
33
+ "value_embed_layers": "",
34
+ "vocab_size": 32000
35
+ }
configuration_mume.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Configuration of the Muse Mesh English and Math language models (the Sansar model code, renamed).
2
+
3
+ Code licence: Apache-2.0 (LICENSE-CODE). The model weights are licensed separately (LICENSE).
4
+ """
5
+ from transformers import PretrainedConfig
6
+
7
+
8
+ class MumeConfig(PretrainedConfig):
9
+ """A compact pre-LayerNorm GPT. The flags select the two architectures the runs used:
10
+
11
+ - ``rope=False, qk_norm=False, untied_head=False, relu_sq=False``: learned position table, GELU (tanh) MLP, output
12
+ head tied to the token embedding (mume-english-125m v0.1.0, EN0).
13
+ - ``rope=True, qk_norm=True, untied_head=True, relu_sq=True``: rotary positions, RMS-normalised queries and keys,
14
+ a separate output head, squared-ReLU MLP (EN1-full, MATH0 and MATH0-SFT).
15
+
16
+ ``value_embed`` and ``logit_cap`` are supported for completeness; no released model uses them.
17
+ """
18
+
19
+ model_type = "mume_gpt"
20
+ attribute_map = {
21
+ "hidden_size": "n_embd",
22
+ "num_hidden_layers": "n_layer",
23
+ "num_attention_heads": "n_head",
24
+ "max_position_embeddings": "block_size",
25
+ }
26
+
27
+ def __init__(
28
+ self,
29
+ vocab_size: int = 8000,
30
+ block_size: int = 512,
31
+ n_layer: int = 6,
32
+ n_head: int = 8,
33
+ n_embd: int = 512,
34
+ mlp_ratio: int = 4,
35
+ bias: bool = False,
36
+ rope: bool = False,
37
+ rope_theta: float = 10000.0,
38
+ qk_norm: bool = False,
39
+ untied_head: bool = False,
40
+ relu_sq: bool = False,
41
+ value_embed: bool = False,
42
+ value_embed_layers: str = "",
43
+ logit_cap: float = 0.0,
44
+ layer_norm_eps: float = 1e-5,
45
+ initializer_range: float = 0.02,
46
+ bos_token_id: int = 1,
47
+ eos_token_id: int = 2,
48
+ pad_token_id: int = 2,
49
+ tie_word_embeddings=None,
50
+ use_cache: bool = False,
51
+ **kwargs,
52
+ ):
53
+ self.vocab_size = vocab_size
54
+ self.block_size = block_size
55
+ self.n_layer = n_layer
56
+ self.n_head = n_head
57
+ self.n_embd = n_embd
58
+ self.mlp_ratio = mlp_ratio
59
+ self.bias = bias
60
+ self.rope = rope
61
+ self.rope_theta = rope_theta
62
+ self.qk_norm = qk_norm
63
+ self.untied_head = untied_head
64
+ self.relu_sq = relu_sq
65
+ self.value_embed = value_embed
66
+ self.value_embed_layers = value_embed_layers
67
+ self.logit_cap = logit_cap
68
+ self.layer_norm_eps = layer_norm_eps
69
+ self.initializer_range = initializer_range
70
+ self.use_cache = use_cache
71
+ if tie_word_embeddings is None:
72
+ tie_word_embeddings = not untied_head
73
+ super().__init__(
74
+ bos_token_id=bos_token_id,
75
+ eos_token_id=eos_token_id,
76
+ pad_token_id=pad_token_id,
77
+ tie_word_embeddings=tie_word_embeddings,
78
+ **kwargs,
79
+ )
eval/bpb_clean_ctx1024.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "arm": "clean",
3
+ "ckpt": "/home/kushal/sansar/data/experts/math/train/runs/math0_shared32k_d125m_ctx1024/ckpt.pt",
4
+ "tokenizer": "/home/kushal/sansar/data/experts/shared/tokenizers/spm_shared_unigram_32000_v1.model",
5
+ "vocab_size": 32000,
6
+ "transliterate": "none",
7
+ "strip_refs": false,
8
+ "clean": "none",
9
+ "text_field": "text",
10
+ "denominator": "bytes_utf8",
11
+ "block": 1024,
12
+ "stride": 512,
13
+ "step": 27106,
14
+ "param_counts": {
15
+ "total": 134105856,
16
+ "embedding": 24576000,
17
+ "token_embedding": 24576000,
18
+ "position_embedding": 0,
19
+ "value_embedding": 0,
20
+ "head": 24576000,
21
+ "non_embedding": 84953856
22
+ },
23
+ "method": "records joined with EOS into one stream per set; sliding window, only the last `stride` predictions of each window after the first are scored; nats / UTF-8 bytes of the frozen text / ln 2",
24
+ "per_set": {
25
+ "owm_val_clean": {
26
+ "records": 1126,
27
+ "tokens": 1437715,
28
+ "tokens_scored": 1437714,
29
+ "bytes_utf8": 4780645,
30
+ "nll_nats": 3532240.215,
31
+ "bpb": 1.06595,
32
+ "nll_per_token": 2.45684,
33
+ "bytes_per_token": 3.3252
34
+ },
35
+ "math_test_clean": {
36
+ "records": 3754,
37
+ "tokens": 1018572,
38
+ "tokens_scored": 1018571,
39
+ "bytes_utf8": 2418527,
40
+ "nll_nats": 1442145.99,
41
+ "bpb": 0.86027,
42
+ "nll_per_token": 1.41585,
43
+ "bytes_per_token": 2.3744
44
+ }
45
+ },
46
+ "pooled": {
47
+ "tokens": 2456287,
48
+ "bytes_utf8": 7199172,
49
+ "nll_nats": 4974386.206,
50
+ "bpb": 0.99685
51
+ },
52
+ "seconds": 111.3
53
+ }
eval/bpb_ctx1024.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "arm": "shared32k_d125m_ctx1024",
3
+ "ckpt": "/home/kushal/sansar/data/experts/math/train/runs/math0_shared32k_d125m_ctx1024/ckpt.pt",
4
+ "tokenizer": "/home/kushal/sansar/data/experts/shared/tokenizers/spm_shared_unigram_32000_v1.model",
5
+ "vocab_size": 32000,
6
+ "transliterate": "none",
7
+ "strip_refs": false,
8
+ "clean": "none",
9
+ "text_field": "text",
10
+ "denominator": "bytes_utf8",
11
+ "block": 1024,
12
+ "stride": 512,
13
+ "step": 27106,
14
+ "param_counts": {
15
+ "total": 134105856,
16
+ "embedding": 24576000,
17
+ "token_embedding": 24576000,
18
+ "position_embedding": 0,
19
+ "value_embedding": 0,
20
+ "head": 24576000,
21
+ "non_embedding": 84953856
22
+ },
23
+ "method": "records joined with EOS into one stream per set; sliding window, only the last `stride` predictions of each window after the first are scored; nats / UTF-8 bytes of the frozen text / ln 2",
24
+ "per_set": {
25
+ "owm_val": {
26
+ "records": 2704,
27
+ "tokens": 6127232,
28
+ "tokens_scored": 6127231,
29
+ "bytes_utf8": 20001168,
30
+ "nll_nats": 13760918.543,
31
+ "bpb": 0.99258,
32
+ "nll_per_token": 2.24586,
33
+ "bytes_per_token": 3.2643
34
+ },
35
+ "gsm8k_test": {
36
+ "records": 1319,
37
+ "tokens": 225351,
38
+ "tokens_scored": 225350,
39
+ "bytes_utf8": 652230,
40
+ "nll_nats": 483810.729,
41
+ "bpb": 1.07016,
42
+ "nll_per_token": 2.14693,
43
+ "bytes_per_token": 2.8943
44
+ },
45
+ "math_test": {
46
+ "records": 5000,
47
+ "tokens": 1536141,
48
+ "tokens_scored": 1536140,
49
+ "bytes_utf8": 3565468,
50
+ "nll_nats": 2091408.281,
51
+ "bpb": 0.84625,
52
+ "nll_per_token": 1.36147,
53
+ "bytes_per_token": 2.3211
54
+ }
55
+ },
56
+ "pooled": {
57
+ "tokens": 7888724,
58
+ "bytes_utf8": 24218866,
59
+ "nll_nats": 16336137.553,
60
+ "bpb": 0.97313
61
+ },
62
+ "seconds": 359.0
63
+ }
eval/bpb_ctx512.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "arm": "shared32k_d125m_ctx1024",
3
+ "ckpt": "/home/kushal/sansar/data/experts/math/train/runs/math0_shared32k_d125m_ctx1024/ckpt.pt",
4
+ "tokenizer": "/home/kushal/sansar/data/experts/shared/tokenizers/spm_shared_unigram_32000_v1.model",
5
+ "vocab_size": 32000,
6
+ "transliterate": "none",
7
+ "strip_refs": false,
8
+ "clean": "none",
9
+ "text_field": "text",
10
+ "denominator": "bytes_utf8",
11
+ "block": 512,
12
+ "stride": 256,
13
+ "step": 27106,
14
+ "param_counts": {
15
+ "total": 134105856,
16
+ "embedding": 24576000,
17
+ "token_embedding": 24576000,
18
+ "position_embedding": 0,
19
+ "value_embedding": 0,
20
+ "head": 24576000,
21
+ "non_embedding": 84953856
22
+ },
23
+ "method": "records joined with EOS into one stream per set; sliding window, only the last `stride` predictions of each window after the first are scored; nats / UTF-8 bytes of the frozen text / ln 2",
24
+ "per_set": {
25
+ "owm_val": {
26
+ "records": 2704,
27
+ "tokens": 6127232,
28
+ "tokens_scored": 6127231,
29
+ "bytes_utf8": 20001168,
30
+ "nll_nats": 14138481.944,
31
+ "bpb": 1.01982,
32
+ "nll_per_token": 2.30748,
33
+ "bytes_per_token": 3.2643
34
+ },
35
+ "gsm8k_test": {
36
+ "records": 1319,
37
+ "tokens": 225351,
38
+ "tokens_scored": 225350,
39
+ "bytes_utf8": 652230,
40
+ "nll_nats": 485360.235,
41
+ "bpb": 1.07359,
42
+ "nll_per_token": 2.15381,
43
+ "bytes_per_token": 2.8943
44
+ },
45
+ "math_test": {
46
+ "records": 5000,
47
+ "tokens": 1536141,
48
+ "tokens_scored": 1536140,
49
+ "bytes_utf8": 3565468,
50
+ "nll_nats": 2137850.962,
51
+ "bpb": 0.86504,
52
+ "nll_per_token": 1.3917,
53
+ "bytes_per_token": 2.3211
54
+ }
55
+ },
56
+ "pooled": {
57
+ "tokens": 7888724,
58
+ "bytes_utf8": 24218866,
59
+ "nll_nats": 16761693.141,
60
+ "bpb": 0.99848
61
+ },
62
+ "seconds": 360.0
63
+ }
eval/contamination_overlap.json ADDED
The diff for this file is too large to render. See raw diff
 
eval/english_model_bpb_clean_ctx1024.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "arm": "clean",
3
+ "ckpt": "/home/kushal/sansar/data/experts/english/train/runs/en1_full_d125m_ctx1024/ckpt.pt",
4
+ "tokenizer": "/home/kushal/sansar/data/experts/shared/tokenizers/spm_shared_unigram_32000_v1.model",
5
+ "vocab_size": 32000,
6
+ "transliterate": "none",
7
+ "strip_refs": false,
8
+ "clean": "none",
9
+ "text_field": "text",
10
+ "denominator": "bytes_utf8",
11
+ "block": 1024,
12
+ "stride": 512,
13
+ "step": 27106,
14
+ "param_counts": {
15
+ "total": 134105856,
16
+ "embedding": 24576000,
17
+ "token_embedding": 24576000,
18
+ "position_embedding": 0,
19
+ "value_embedding": 0,
20
+ "head": 24576000,
21
+ "non_embedding": 84953856
22
+ },
23
+ "method": "records joined with EOS into one stream per set; sliding window, only the last `stride` predictions of each window after the first are scored; nats / UTF-8 bytes of the frozen text / ln 2",
24
+ "per_set": {
25
+ "owm_val_clean": {
26
+ "records": 1126,
27
+ "tokens": 1437715,
28
+ "tokens_scored": 1437714,
29
+ "bytes_utf8": 4780645,
30
+ "nll_nats": 5203267.294,
31
+ "bpb": 1.57023,
32
+ "nll_per_token": 3.61913,
33
+ "bytes_per_token": 3.3252
34
+ },
35
+ "math_test_clean": {
36
+ "records": 3754,
37
+ "tokens": 1018572,
38
+ "tokens_scored": 1018571,
39
+ "bytes_utf8": 2418527,
40
+ "nll_nats": 3858500.226,
41
+ "bpb": 2.30167,
42
+ "nll_per_token": 3.78815,
43
+ "bytes_per_token": 2.3744
44
+ }
45
+ },
46
+ "pooled": {
47
+ "tokens": 2456287,
48
+ "bytes_utf8": 7199172,
49
+ "nll_nats": 9061767.52,
50
+ "bpb": 1.81595
51
+ },
52
+ "seconds": 111.6
53
+ }
eval/english_model_bpb_ctx1024.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "arm": "en1_full_on_math",
3
+ "ckpt": "/home/kushal/sansar/data/experts/english/train/runs/en1_full_d125m_ctx1024/ckpt.pt",
4
+ "tokenizer": "/home/kushal/sansar/data/experts/shared/tokenizers/spm_shared_unigram_32000_v1.model",
5
+ "vocab_size": 32000,
6
+ "transliterate": "none",
7
+ "strip_refs": false,
8
+ "clean": "none",
9
+ "text_field": "text",
10
+ "denominator": "bytes_utf8",
11
+ "block": 1024,
12
+ "stride": 512,
13
+ "step": 27106,
14
+ "param_counts": {
15
+ "total": 134105856,
16
+ "embedding": 24576000,
17
+ "token_embedding": 24576000,
18
+ "position_embedding": 0,
19
+ "value_embedding": 0,
20
+ "head": 24576000,
21
+ "non_embedding": 84953856
22
+ },
23
+ "method": "records joined with EOS into one stream per set; sliding window, only the last `stride` predictions of each window after the first are scored; nats / UTF-8 bytes of the frozen text / ln 2",
24
+ "per_set": {
25
+ "owm_val": {
26
+ "records": 2704,
27
+ "tokens": 6127232,
28
+ "tokens_scored": 6127231,
29
+ "bytes_utf8": 20001168,
30
+ "nll_nats": 21404534.319,
31
+ "bpb": 1.54392,
32
+ "nll_per_token": 3.49335,
33
+ "bytes_per_token": 3.2643
34
+ },
35
+ "gsm8k_test": {
36
+ "records": 1319,
37
+ "tokens": 225351,
38
+ "tokens_scored": 225350,
39
+ "bytes_utf8": 652230,
40
+ "nll_nats": 545514.931,
41
+ "bpb": 1.20665,
42
+ "nll_per_token": 2.42075,
43
+ "bytes_per_token": 2.8943
44
+ },
45
+ "math_test": {
46
+ "records": 5000,
47
+ "tokens": 1536141,
48
+ "tokens_scored": 1536140,
49
+ "bytes_utf8": 3565468,
50
+ "nll_nats": 5836495.146,
51
+ "bpb": 2.36162,
52
+ "nll_per_token": 3.79946,
53
+ "bytes_per_token": 2.3211
54
+ }
55
+ },
56
+ "pooled": {
57
+ "tokens": 7888724,
58
+ "bytes_utf8": 24218866,
59
+ "nll_nats": 27786544.396,
60
+ "bpb": 1.65522
61
+ },
62
+ "seconds": 358.7
63
+ }
eval/english_model_gsm8k_exact_3shot.json ADDED
The diff for this file is too large to render. See raw diff
 
eval/gsm8k_exact_3shot.json ADDED
The diff for this file is too large to render. See raw diff
 
eval/gsm8k_exact_3shot_released_weights.json ADDED
The diff for this file is too large to render. See raw diff
 
eval/heldout_meta.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "created": "2026-09-28 11:14",
3
+ "sets": {
4
+ "owm_val": {
5
+ "records": 2704,
6
+ "bytes_utf8": 20001168,
7
+ "source": "open-web-math/open-web-math train-00113-of-00114",
8
+ "note": "first 2704 documents in file order up to 20,000,000 bytes"
9
+ },
10
+ "gsm8k_test": {
11
+ "records": 1319,
12
+ "bytes_utf8": 652230,
13
+ "source": "openai/gsm8k main test",
14
+ "note": "question + blank line + answer; <<calculator>> annotations removed"
15
+ },
16
+ "math_test": {
17
+ "records": 5000,
18
+ "bytes_utf8": 3565468,
19
+ "source": "EleutherAI/hendrycks_math test, 7 subjects",
20
+ "note": "problem + blank line + solution"
21
+ }
22
+ }
23
+ }
eval/smoke_test.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repo": "mume-math-125m",
3
+ "version": "v0.1.0",
4
+ "transformers": "5.18.0",
5
+ "torch": "2.14.0+cu130",
6
+ "dtype_loaded": "torch.bfloat16",
7
+ "tokenizer_trust_remote_code": "MumeTokenizer",
8
+ "tokenizer_default": "TokenizersBackend",
9
+ "fast_ids_equal_on_prompt": true,
10
+ "load_seconds": 0.2,
11
+ "prompt": "Let $f(x) = x^2 + 1$. Then",
12
+ "prompt_tokens": 15,
13
+ "prompt_pieces": [
14
+ "▁Let",
15
+ "▁$",
16
+ "f",
17
+ "(",
18
+ "x",
19
+ ")",
20
+ "▁=",
21
+ "▁x",
22
+ "^",
23
+ "2",
24
+ "▁+",
25
+ "▁",
26
+ "1",
27
+ "$.",
28
+ "▁Then"
29
+ ],
30
+ "sampled_seed0": {
31
+ "new_tokens": 60,
32
+ "seconds": 5.1,
33
+ "text": "Let $f(x) = x^2 + 1$. Then $|f(x)| = |x|^2$. If $f(x) = x^2 + 1$, then $|f'(x)| = |x|^2 = |x|^2$. Thus $|f(x)| \\leq |x^2 + ",
34
+ "do_sample": true,
35
+ "temperature": 0.8,
36
+ "top_k": 100
37
+ },
38
+ "greedy": {
39
+ "new_tokens": 60,
40
+ "seconds": 4.9,
41
+ "text": "Let $f(x) = x^2 + 1$. Then $f(x) = x^2 + 1$ and $f(x) = x^2 + 1$ for all $x \\in \\mathbb{R}$.\n\nNow, let $f(x) = x^2 + 1$ and $f(",
42
+ "do_sample": false
43
+ }
44
+ }
eval/verification.json ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repo": "mume-math-125m",
3
+ "version": "v0.1.0",
4
+ "run": "math0_shared32k_d125m_ctx1024",
5
+ "torch": "2.14.0+cu130",
6
+ "transformers": "5.18.0",
7
+ "hf_load_seconds": 0.3,
8
+ "hf_param_counts": {
9
+ "total": 134105856,
10
+ "embedding": 24576000,
11
+ "head": 24576000,
12
+ "non_embedding": 84953856
13
+ },
14
+ "tokenizer_class": "MumeTokenizer",
15
+ "orig_param_counts": {
16
+ "total": 134105856,
17
+ "embedding": 24576000,
18
+ "token_embedding": 24576000,
19
+ "position_embedding": 0,
20
+ "value_embedding": 0,
21
+ "head": 24576000,
22
+ "non_embedding": 84953856
23
+ },
24
+ "hf_head_equals_wte": false,
25
+ "logits": [
26
+ {
27
+ "input": "owm_val",
28
+ "tokens": 619,
29
+ "max_abs_diff_vs_same_bf16_weights": 0.0,
30
+ "mean_abs_diff_vs_same_bf16_weights": 0.0,
31
+ "max_abs_diff_vs_fp32_master": 0.18924713134765625,
32
+ "mean_abs_diff_vs_fp32_master": 0.02142287604510784,
33
+ "argmax_agree_vs_same_bf16_weights": 1.0,
34
+ "argmax_agree_vs_fp32_master": 0.9983844757080078,
35
+ "logit_abs_max": 30.520248413085938
36
+ },
37
+ {
38
+ "input": "owm_val_clean",
39
+ "tokens": 619,
40
+ "max_abs_diff_vs_same_bf16_weights": 0.0,
41
+ "mean_abs_diff_vs_same_bf16_weights": 0.0,
42
+ "max_abs_diff_vs_fp32_master": 0.18924713134765625,
43
+ "mean_abs_diff_vs_fp32_master": 0.02142287604510784,
44
+ "argmax_agree_vs_same_bf16_weights": 1.0,
45
+ "argmax_agree_vs_fp32_master": 0.9983844757080078,
46
+ "logit_abs_max": 30.520248413085938
47
+ },
48
+ {
49
+ "input": "gsm8k_test",
50
+ "tokens": 121,
51
+ "max_abs_diff_vs_same_bf16_weights": 0.0,
52
+ "mean_abs_diff_vs_same_bf16_weights": 0.0,
53
+ "max_abs_diff_vs_fp32_master": 0.17910480499267578,
54
+ "mean_abs_diff_vs_fp32_master": 0.02021566778421402,
55
+ "argmax_agree_vs_same_bf16_weights": 1.0,
56
+ "argmax_agree_vs_fp32_master": 0.9834710955619812,
57
+ "logit_abs_max": 22.752124786376953
58
+ },
59
+ {
60
+ "input": "math_test",
61
+ "tokens": 104,
62
+ "max_abs_diff_vs_same_bf16_weights": 0.0,
63
+ "mean_abs_diff_vs_same_bf16_weights": 0.0,
64
+ "max_abs_diff_vs_fp32_master": 0.1441974639892578,
65
+ "mean_abs_diff_vs_fp32_master": 0.021314028650522232,
66
+ "argmax_agree_vs_same_bf16_weights": 1.0,
67
+ "argmax_agree_vs_fp32_master": 1.0,
68
+ "logit_abs_max": 25.434036254882812
69
+ },
70
+ {
71
+ "input": "math_test_clean",
72
+ "tokens": 104,
73
+ "max_abs_diff_vs_same_bf16_weights": 0.0,
74
+ "mean_abs_diff_vs_same_bf16_weights": 0.0,
75
+ "max_abs_diff_vs_fp32_master": 0.1441974639892578,
76
+ "mean_abs_diff_vs_fp32_master": 0.021314028650522232,
77
+ "argmax_agree_vs_same_bf16_weights": 1.0,
78
+ "argmax_agree_vs_fp32_master": 1.0,
79
+ "logit_abs_max": 25.434036254882812
80
+ },
81
+ {
82
+ "input": "random_1024",
83
+ "tokens": 1024,
84
+ "max_abs_diff_vs_same_bf16_weights": 0.0,
85
+ "mean_abs_diff_vs_same_bf16_weights": 0.0,
86
+ "max_abs_diff_vs_fp32_master": 0.2052001953125,
87
+ "mean_abs_diff_vs_fp32_master": 0.024474455043673515,
88
+ "argmax_agree_vs_same_bf16_weights": 1.0,
89
+ "argmax_agree_vs_fp32_master": 0.994140625,
90
+ "logit_abs_max": 17.417985916137695
91
+ }
92
+ ],
93
+ "logits_max_abs_diff_impl": 0.0,
94
+ "logits_max_abs_diff_bf16_storage": 0.2052001953125,
95
+ "left_padding_max_abs_diff": 3.147125244140625e-05,
96
+ "tokenizer_ids_identical": "100/100",
97
+ "tokenizer_roundtrip_exact": "100/100",
98
+ "bpb_sample": {
99
+ "records_per_set": 20,
100
+ "max_chars_per_record": 20000,
101
+ "block": 1024,
102
+ "stride": 512,
103
+ "per_set": {
104
+ "owm_val": {
105
+ "records": 20,
106
+ "tokens": 19797,
107
+ "utf8_bytes": 67807,
108
+ "original_fp32_master": 1.04333,
109
+ "hf_bf16_weights_fp32_compute": 1.04337,
110
+ "rel_diff": 3.7595580306251906e-05
111
+ },
112
+ "owm_val_clean": {
113
+ "records": 20,
114
+ "tokens": 21497,
115
+ "utf8_bytes": 80082,
116
+ "original_fp32_master": 1.13213,
117
+ "hf_bf16_weights_fp32_compute": 1.13217,
118
+ "rel_diff": 3.843563384466128e-05
119
+ },
120
+ "gsm8k_test": {
121
+ "records": 20,
122
+ "tokens": 3636,
123
+ "utf8_bytes": 10910,
124
+ "original_fp32_master": 1.04602,
125
+ "hf_bf16_weights_fp32_compute": 1.04612,
126
+ "rel_diff": 9.461596812371703e-05
127
+ },
128
+ "math_test": {
129
+ "records": 20,
130
+ "tokens": 4062,
131
+ "utf8_bytes": 10074,
132
+ "original_fp32_master": 0.8763,
133
+ "hf_bf16_weights_fp32_compute": 0.87655,
134
+ "rel_diff": 0.00027754500238853655
135
+ },
136
+ "math_test_clean": {
137
+ "records": 20,
138
+ "tokens": 3983,
139
+ "utf8_bytes": 9958,
140
+ "original_fp32_master": 0.89883,
141
+ "hf_bf16_weights_fp32_compute": 0.89907,
142
+ "rel_diff": 0.0002619447947951707
143
+ }
144
+ },
145
+ "pooled_original_fp32_master": 1.0658,
146
+ "pooled_hf_bf16_weights_fp32_compute": 1.06587,
147
+ "pooled_rel_diff": 6.305839549519214e-05,
148
+ "seconds": 107.1
149
+ },
150
+ "full_set": {
151
+ "set": "gsm8k_test",
152
+ "records": 1319,
153
+ "tokens": 225351,
154
+ "utf8_bytes": 652230,
155
+ "frozen_bytes": 652230,
156
+ "hf_bpb": 1.07,
157
+ "frozen_bpb_gpu_bf16_autocast": 1.07016,
158
+ "rel_diff": -0.00014918026252958935,
159
+ "note": "",
160
+ "seconds": 217.3
161
+ }
162
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 1,
3
+ "eos_token_id": 2,
4
+ "pad_token_id": 2,
5
+ "do_sample": true,
6
+ "temperature": 0.8,
7
+ "top_k": 100,
8
+ "max_new_tokens": 128,
9
+ "use_cache": false
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e88758438a3853052749670271f203ea234f2ccd758304bf469390165b01c24
3
+ size 268219680
modeling_mume.py ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Muse Mesh English and Math language models as a transformers PreTrainedModel (load with trust_remote_code=True).
2
+
3
+ The same network code as the Sansar models (MuseMesh/sansar-*), renamed. The module tree and parameter names are those
4
+ of the training code (scripts/train/model.py in the Sansar repository), so the released weights are the trained
5
+ tensors with no renaming. The forward pass reproduces the training
6
+ model's logits (verified to fp32 rounding before release; see the model card).
7
+
8
+ Generation does not use a key/value cache: every step re-reads the last ``block_size`` tokens (1,024 for the English
9
+ and Math models, which were trained on 1,024-token windows), so text longer than that is read through a sliding window.
10
+
11
+ Code licence: Apache-2.0 (LICENSE-CODE). The model weights are licensed separately (LICENSE).
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import math
16
+
17
+ import torch
18
+ import torch.nn as nn
19
+ from torch.nn import functional as F
20
+
21
+ import transformers
22
+ from transformers import PreTrainedModel
23
+ from transformers.modeling_outputs import CausalLMOutputWithPast
24
+
25
+ try:
26
+ from transformers import GenerationMixin
27
+ except ImportError: # older transformers
28
+ from transformers.generation import GenerationMixin
29
+
30
+ try: # transformers >= 5: init functions that skip tensors already loaded from the checkpoint
31
+ from transformers import initialization as _init
32
+ except ImportError:
33
+ _init = nn.init
34
+
35
+ from .configuration_mume import MumeConfig
36
+
37
+ _TRANSFORMERS_V5 = int(transformers.__version__.split(".")[0]) >= 5
38
+
39
+
40
+ def rotary_cos_sin(positions: torch.Tensor, head_dim: int, base: float):
41
+ """cos, sin for each position, shape positions.shape + (head_dim,): the first half of the head dim pairs with the
42
+ second half (the layout of the training code)."""
43
+ inv = 1.0 / (base ** (torch.arange(0, head_dim, 2, device=positions.device, dtype=torch.float32) / head_dim))
44
+ ang = positions.to(torch.float32)[..., None] * inv
45
+ ang = torch.cat([ang, ang], dim=-1)
46
+ return ang.cos(), ang.sin()
47
+
48
+
49
+ def apply_rotary(x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor) -> torch.Tensor:
50
+ """x: (B, H, T, hs); cos/sin: (T, hs) or (B, 1, T, hs). Rotation in float32, result in x's dtype."""
51
+ hs = x.shape[-1]
52
+ xf = x.float()
53
+ x1, x2 = xf[..., : hs // 2], xf[..., hs // 2:]
54
+ rotated = torch.cat([-x2, x1], dim=-1)
55
+ return (xf * cos + rotated * sin).to(x.dtype)
56
+
57
+
58
+ def value_embed_layers(cfg: MumeConfig) -> tuple:
59
+ if not cfg.value_embed:
60
+ return ()
61
+ if cfg.value_embed_layers.strip():
62
+ return tuple(sorted({int(x) for x in cfg.value_embed_layers.split(",") if x.strip()}))
63
+ k = min(3, cfg.n_layer // 2)
64
+ return tuple(range(k)) + tuple(range(cfg.n_layer - k, cfg.n_layer))
65
+
66
+
67
+ class LayerNorm(nn.Module):
68
+ """LayerNorm with an optional bias (the released models have none)."""
69
+
70
+ def __init__(self, ndim: int, bias: bool, eps: float = 1e-5):
71
+ super().__init__()
72
+ self.weight = nn.Parameter(torch.ones(ndim))
73
+ self.bias = nn.Parameter(torch.zeros(ndim)) if bias else None
74
+ self.eps = eps
75
+
76
+ def forward(self, x):
77
+ return F.layer_norm(x, self.weight.shape, self.weight, self.bias, self.eps)
78
+
79
+
80
+ class CausalSelfAttention(nn.Module):
81
+ def __init__(self, cfg: MumeConfig, value_embed: bool = False):
82
+ super().__init__()
83
+ assert cfg.n_embd % cfg.n_head == 0
84
+ self.n_head = cfg.n_head
85
+ self.n_embd = cfg.n_embd
86
+ self.rope = cfg.rope
87
+ self.qk_norm = cfg.qk_norm
88
+ self.c_attn = nn.Linear(cfg.n_embd, 3 * cfg.n_embd, bias=cfg.bias)
89
+ self.c_proj = nn.Linear(cfg.n_embd, cfg.n_embd, bias=cfg.bias)
90
+ self.value_embed = value_embed
91
+ if value_embed:
92
+ self.v_scale = nn.Parameter(torch.tensor(0.5))
93
+ self.ve_scale = nn.Parameter(torch.tensor(0.5))
94
+
95
+ def forward(self, x, cos=None, sin=None, ve=None, attn_mask=None):
96
+ B, T, C = x.shape
97
+ hs = C // self.n_head
98
+ q, k, v = self.c_attn(x).split(self.n_embd, dim=2)
99
+ q = q.view(B, T, self.n_head, hs).transpose(1, 2)
100
+ k = k.view(B, T, self.n_head, hs).transpose(1, 2)
101
+ v = v.view(B, T, self.n_head, hs).transpose(1, 2)
102
+ if self.value_embed:
103
+ v = self.v_scale * v + self.ve_scale * ve.view(B, T, self.n_head, hs).transpose(1, 2).to(v.dtype)
104
+ if self.qk_norm:
105
+ q = F.rms_norm(q, (hs,)).to(v.dtype)
106
+ k = F.rms_norm(k, (hs,)).to(v.dtype)
107
+ if self.rope:
108
+ q = apply_rotary(q, cos, sin)
109
+ k = apply_rotary(k, cos, sin)
110
+ if attn_mask is None:
111
+ y = F.scaled_dot_product_attention(q, k, v, attn_mask=None, is_causal=True)
112
+ else:
113
+ y = F.scaled_dot_product_attention(q, k, v, attn_mask=attn_mask, is_causal=False)
114
+ y = y.transpose(1, 2).contiguous().view(B, T, C)
115
+ return self.c_proj(y)
116
+
117
+
118
+ class MLP(nn.Module):
119
+ def __init__(self, cfg: MumeConfig):
120
+ super().__init__()
121
+ hidden = cfg.mlp_ratio * cfg.n_embd
122
+ self.c_fc = nn.Linear(cfg.n_embd, hidden, bias=cfg.bias)
123
+ self.c_proj = nn.Linear(hidden, cfg.n_embd, bias=cfg.bias)
124
+ self.relu_sq = cfg.relu_sq
125
+
126
+ def forward(self, x):
127
+ h = self.c_fc(x)
128
+ h = F.relu(h).square() if self.relu_sq else F.gelu(h, approximate="tanh")
129
+ return self.c_proj(h)
130
+
131
+
132
+ class Block(nn.Module):
133
+ def __init__(self, cfg: MumeConfig, value_embed: bool = False):
134
+ super().__init__()
135
+ self.ln_1 = LayerNorm(cfg.n_embd, cfg.bias, cfg.layer_norm_eps)
136
+ self.attn = CausalSelfAttention(cfg, value_embed=value_embed)
137
+ self.ln_2 = LayerNorm(cfg.n_embd, cfg.bias, cfg.layer_norm_eps)
138
+ self.mlp = MLP(cfg)
139
+
140
+ def forward(self, x, cos=None, sin=None, ve=None, attn_mask=None):
141
+ x = x + self.attn(self.ln_1(x), cos, sin, ve, attn_mask)
142
+ x = x + self.mlp(self.ln_2(x))
143
+ return x
144
+
145
+
146
+ class MumePreTrainedModel(PreTrainedModel):
147
+ config_class = MumeConfig
148
+ base_model_prefix = "mume" # no such attribute: weights load by their full names, never re-prefixed
149
+ _no_split_modules = ["Block"]
150
+ supports_gradient_checkpointing = False
151
+
152
+ def _init_weights(self, module):
153
+ """Training-code initialisation; only used for tensors missing from a checkpoint (or a fresh model)."""
154
+ std = self.config.initializer_range
155
+ if isinstance(module, nn.Linear):
156
+ _init.normal_(module.weight, mean=0.0, std=std)
157
+ if module.bias is not None:
158
+ _init.zeros_(module.bias)
159
+ elif isinstance(module, nn.Embedding):
160
+ _init.normal_(module.weight, mean=0.0, std=std)
161
+ elif isinstance(module, LayerNorm):
162
+ _init.ones_(module.weight)
163
+ if module.bias is not None:
164
+ _init.zeros_(module.bias)
165
+
166
+
167
+ class MumeForCausalLM(MumePreTrainedModel, GenerationMixin):
168
+ if _TRANSFORMERS_V5:
169
+ _tied_weights_keys = {"lm_head.weight": "transformer.wte.weight"}
170
+ else:
171
+ _tied_weights_keys = ["lm_head.weight"]
172
+
173
+ def __init__(self, config: MumeConfig):
174
+ super().__init__(config)
175
+ parts = dict(wte=nn.Embedding(config.vocab_size, config.n_embd))
176
+ if not config.rope:
177
+ parts["wpe"] = nn.Embedding(config.block_size, config.n_embd)
178
+ self.ve_layers = value_embed_layers(config)
179
+ if config.value_embed:
180
+ parts["vte"] = nn.Embedding(config.vocab_size, config.n_embd)
181
+ parts.update(
182
+ h=nn.ModuleList([Block(config, value_embed=i in self.ve_layers) for i in range(config.n_layer)]),
183
+ ln_f=LayerNorm(config.n_embd, config.bias, config.layer_norm_eps),
184
+ )
185
+ self.transformer = nn.ModuleDict(parts)
186
+ self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False)
187
+ self.post_init()
188
+
189
+ # ------------------------------------------------------------------ embeddings (for tying and resizing)
190
+ def get_input_embeddings(self):
191
+ return self.transformer.wte
192
+
193
+ def set_input_embeddings(self, value):
194
+ self.transformer.wte = value
195
+
196
+ def get_output_embeddings(self):
197
+ return self.lm_head
198
+
199
+ def set_output_embeddings(self, new_embeddings):
200
+ self.lm_head = new_embeddings
201
+
202
+ # ------------------------------------------------------------------ forward
203
+ def _cap(self, logits):
204
+ c = self.config.logit_cap
205
+ if c and c > 0:
206
+ return c * torch.tanh(logits.float() / c)
207
+ return logits
208
+
209
+ def forward(
210
+ self,
211
+ input_ids: torch.LongTensor = None,
212
+ attention_mask: torch.Tensor | None = None,
213
+ position_ids: torch.LongTensor | None = None,
214
+ labels: torch.LongTensor | None = None,
215
+ return_dict: bool | None = None,
216
+ **kwargs,
217
+ ):
218
+ """input_ids (B, T) with T <= block_size. attention_mask (B, T) of 1/0 for padded batches (left padding for
219
+ generation); without padding the model runs exactly the training forward pass. labels: as in other causal LMs
220
+ (the same ids as input_ids; shifted inside; -100 is ignored)."""
221
+ cfg = self.config
222
+ B, T = input_ids.shape
223
+ if T > cfg.block_size:
224
+ raise ValueError(f"sequence length {T} > block_size {cfg.block_size}; crop the input")
225
+ dev = input_ids.device
226
+
227
+ mask = None
228
+ if attention_mask is not None and not bool(attention_mask.bool().all()):
229
+ am = attention_mask.bool()
230
+ if position_ids is None:
231
+ position_ids = (attention_mask.long().cumsum(-1) - 1).clamp(min=0)
232
+ causal = torch.ones(T, T, dtype=torch.bool, device=dev).tril()
233
+ mask = causal[None] & am[:, None, :]
234
+ mask = mask | torch.eye(T, dtype=torch.bool, device=dev)[None] # padded queries attend to themselves
235
+ mask = mask[:, None]
236
+ positions = position_ids if position_ids is not None else torch.arange(T, device=dev)
237
+
238
+ x = self.transformer.wte(input_ids)
239
+ if not cfg.rope:
240
+ x = x + self.transformer.wpe(positions)
241
+ cos = sin = None
242
+ if cfg.rope:
243
+ cos, sin = rotary_cos_sin(positions, cfg.n_embd // cfg.n_head, cfg.rope_theta)
244
+ if cos.dim() == 3: # (B, T, hs) -> (B, 1, T, hs)
245
+ cos, sin = cos[:, None], sin[:, None]
246
+ ve = self.transformer.vte(input_ids) if cfg.value_embed else None
247
+ for i, block in enumerate(self.transformer.h):
248
+ x = block(x, cos, sin, ve if i in self.ve_layers else None, mask)
249
+ x = self.transformer.ln_f(x)
250
+ logits = self._cap(self.lm_head(x))
251
+
252
+ loss = None
253
+ if labels is not None:
254
+ shift_logits = logits[:, :-1, :].float()
255
+ shift_labels = labels[:, 1:].to(dev)
256
+ loss = F.cross_entropy(shift_logits.reshape(-1, shift_logits.size(-1)), shift_labels.reshape(-1),
257
+ ignore_index=-100)
258
+ return CausalLMOutputWithPast(loss=loss, logits=logits)
259
+
260
+ # ------------------------------------------------------------------ generation (no KV cache)
261
+ @classmethod
262
+ def _supports_default_dynamic_cache(cls) -> bool:
263
+ return False
264
+
265
+ def prepare_inputs_for_generation(self, input_ids, attention_mask=None, **kwargs):
266
+ bs = self.config.block_size
267
+ if input_ids.shape[1] > bs:
268
+ input_ids = input_ids[:, -bs:]
269
+ if attention_mask is not None:
270
+ attention_mask = attention_mask[:, -bs:]
271
+ return {"input_ids": input_ids, "attention_mask": attention_mask}
272
+
273
+ def num_parameters_by_kind(self) -> dict:
274
+ """Parameter counts as the model cards report them (a tied head is counted once, in the embedding)."""
275
+ tok = self.transformer.wte.weight.numel()
276
+ pos = self.transformer.wpe.weight.numel() if "wpe" in self.transformer else 0
277
+ val = self.transformer.vte.weight.numel() if "vte" in self.transformer else 0
278
+ head = self.lm_head.weight.numel() if self.config.untied_head else 0
279
+ total = sum(p.numel() for p in self.parameters())
280
+ return {"total": total, "embedding": tok + pos + val, "head": head,
281
+ "non_embedding": total - tok - pos - val - head}
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "unk_token": "<unk>",
3
+ "bos_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "pad_token": "</s>"
6
+ }
tokenization_mume.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The Muse Mesh shared 32k tokenizer for transformers: SentencePiece itself, so the ids are exactly the ones the models
2
+ were trained and evaluated with (load with trust_remote_code=True).
3
+
4
+ tokenizer.model is a SentencePiece unigram model (identity normaliser, byte fallback, digits split). The repository
5
+ also carries tokenizer.json, a `tokenizers` fast version of the same vocabulary that AutoTokenizer uses when
6
+ trust_remote_code is not set. The two agree on short texts; on long documents SentencePiece settles a few near-tie
7
+ segmentations differently (it adds piece scores along the whole document in float32, the fast tokenizer scores word
8
+ by word): 24 of 14,983 FineWeb and 34 of 2,704 OpenWebMath validation documents differ, by a token or two. This class
9
+ removes that gap.
10
+
11
+ No BOS/EOS is added to encoded text: the models were trained on documents separated by </s> (id 2), with no BOS.
12
+ A literal "</s>" inside text is read as characters, as SentencePiece reads it.
13
+
14
+ Code licence: Apache-2.0 (LICENSE-CODE). tokenizer.model / tokenizer.json: see LICENSE.
15
+ """
16
+ from __future__ import annotations
17
+
18
+ import os
19
+ import shutil
20
+
21
+ import sentencepiece as spm
22
+ from transformers import PreTrainedTokenizer
23
+
24
+ VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
25
+
26
+
27
+ class MumeTokenizer(PreTrainedTokenizer):
28
+ vocab_files_names = VOCAB_FILES_NAMES
29
+ model_input_names = ["input_ids", "attention_mask"]
30
+
31
+ def __init__(self, vocab_file, unk_token="<unk>", bos_token="<s>", eos_token="</s>", pad_token="</s>",
32
+ clean_up_tokenization_spaces=False, split_special_tokens=True, **kwargs):
33
+ self.vocab_file = vocab_file
34
+ self.sp = spm.SentencePieceProcessor(model_file=vocab_file)
35
+ kwargs.setdefault("padding_side", "left") # left padding for batched generation
36
+ super().__init__(unk_token=unk_token, bos_token=bos_token, eos_token=eos_token, pad_token=pad_token,
37
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
38
+ split_special_tokens=split_special_tokens, **kwargs)
39
+
40
+ # ------------------------------------------------------------------ vocabulary
41
+ @property
42
+ def vocab_size(self) -> int:
43
+ return self.sp.get_piece_size()
44
+
45
+ def get_vocab(self):
46
+ vocab = {self.sp.id_to_piece(i): i for i in range(self.sp.get_piece_size())}
47
+ vocab.update(self.added_tokens_encoder)
48
+ return vocab
49
+
50
+ def _tokenize(self, text, **kwargs):
51
+ return self.sp.encode(text, out_type=str)
52
+
53
+ def _convert_token_to_id(self, token):
54
+ return self.sp.piece_to_id(token)
55
+
56
+ def _convert_id_to_token(self, index):
57
+ return self.sp.id_to_piece(int(index))
58
+
59
+ def convert_tokens_to_string(self, tokens):
60
+ """Pieces -> text. Control pieces (<s>, </s>, <unk>) are kept as written; byte pieces are decoded."""
61
+ specials = set(self.all_special_tokens)
62
+ out, buf = [], []
63
+ for t in tokens:
64
+ if t in specials:
65
+ if buf:
66
+ out.append(self.sp.decode_pieces(buf))
67
+ buf = []
68
+ out.append(t)
69
+ else:
70
+ buf.append(t)
71
+ if buf:
72
+ out.append(self.sp.decode_pieces(buf))
73
+ return "".join(out)
74
+
75
+ # ------------------------------------------------------------------ special tokens: none added
76
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
77
+ return list(token_ids_0) + (list(token_ids_1) if token_ids_1 is not None else [])
78
+
79
+ def get_special_tokens_mask(self, token_ids_0, token_ids_1=None, already_has_special_tokens=False):
80
+ if already_has_special_tokens:
81
+ return super().get_special_tokens_mask(token_ids_0, token_ids_1, already_has_special_tokens=True)
82
+ return [0] * (len(token_ids_0) + (len(token_ids_1) if token_ids_1 is not None else 0))
83
+
84
+ def num_special_tokens_to_add(self, pair: bool = False) -> int:
85
+ return 0
86
+
87
+ def save_vocabulary(self, save_directory, filename_prefix=None):
88
+ if not os.path.isdir(save_directory):
89
+ os.makedirs(save_directory, exist_ok=True)
90
+ out = os.path.join(save_directory, (filename_prefix + "-" if filename_prefix else "") + "tokenizer.model")
91
+ if os.path.abspath(self.vocab_file) != os.path.abspath(out):
92
+ shutil.copyfile(self.vocab_file, out)
93
+ return (out,)
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8fce91a9fbcce711999376b291a36456b15beb62ee9d821c8cf175a67d2b409
3
+ size 517970
tokenizer_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "auto_map": {
4
+ "AutoTokenizer": [
5
+ "tokenization_mume.MumeTokenizer",
6
+ null
7
+ ]
8
+ },
9
+ "unk_token": "<unk>",
10
+ "bos_token": "<s>",
11
+ "eos_token": "</s>",
12
+ "pad_token": "</s>",
13
+ "add_bos_token": false,
14
+ "add_eos_token": false,
15
+ "split_special_tokens": true,
16
+ "model_max_length": 1024,
17
+ "padding_side": "left",
18
+ "clean_up_tokenization_spaces": false
19
+ }
training/data_meta.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "created": "2026-09-28T11:52:23",
3
+ "vocab_size": 32000,
4
+ "eos_id": 2,
5
+ "val_split": {
6
+ "method": "blake2b(cluster id), else blake2b(phase3 dedup key)",
7
+ "permille": 5,
8
+ "cluster_file": "/home/kushal/sansar",
9
+ "cluster_memberships_loaded": 0,
10
+ "clustered_records": 0,
11
+ "unclustered_records": 774551,
12
+ "train_clustered_records": 0,
13
+ "val_clustered_records": 0
14
+ },
15
+ "records_read": 774551,
16
+ "records_kept": 774551,
17
+ "records_skipped": {
18
+ "not_training_candidate": 0,
19
+ "script": 0,
20
+ "licence": 0,
21
+ "empty": 0,
22
+ "bad_json": 0,
23
+ "excluded_heldout": 0,
24
+ "records_dropped_heldout_masked": 0,
25
+ "known_heldout_overlap": 0,
26
+ "all_rule_lines": 0
27
+ },
28
+ "train": {
29
+ "records": 770782,
30
+ "tokens": 1555523031,
31
+ "bytes_utf8": 5120530083,
32
+ "utf8_bytes": 5120530083,
33
+ "bpb_denominator": "bytes_utf8",
34
+ "bytes_per_token": 3.2918,
35
+ "tokens_per_byte": 0.303782
36
+ },
37
+ "val": {
38
+ "records": 3769,
39
+ "tokens": 7889546,
40
+ "bytes_utf8": 25980528,
41
+ "utf8_bytes": 25980528,
42
+ "bpb_denominator": "bytes_utf8",
43
+ "bytes_per_token": 3.293,
44
+ "tokens_per_byte": 0.303672
45
+ },
46
+ "input": "data/experts/math/slices/train_slice_all.jsonl.gz",
47
+ "record_split": "documents longer than 20,000 characters were cut into parts at whitespace (prep_data.py --max_record_chars)"
48
+ }
training/slice_summary.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "files": [
3
+ "train-00004-of-00114-3158c787ea8296d3.parquet",
4
+ "train-00005-of-00114-c525c7efee442287.parquet",
5
+ "train-00006-of-00114-c82ec070af45d226.parquet",
6
+ "train-00007-of-00114-36c74b525c9694d4.parquet",
7
+ "train-00008-of-00114-bf41cf8843148a70.parquet",
8
+ "train-00009-of-00114-691ac94b115fea46.parquet",
9
+ "train-00010-of-00114-5805e25b4884966e.parquet",
10
+ "train-00011-of-00114-da8ee2fcf07be148.parquet",
11
+ "train-00012-of-00114-7252b11ca4b39acd.parquet",
12
+ "train-00013-of-00114-a189dcaf5ac68c7e.parquet",
13
+ "train-00014-of-00114-23a118ee3aaea5c3.parquet",
14
+ "train-00015-of-00114-e65817847eac684c.parquet"
15
+ ],
16
+ "records": 662940,
17
+ "words": 816023053,
18
+ "skipped_heldout_url": 1824,
19
+ "seconds": 351
20
+ }
training/summary.json ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "run": "math0_shared32k_d125m_ctx1024",
3
+ "preset": "d125m",
4
+ "model_config": {
5
+ "vocab_size": 32000,
6
+ "block_size": 1024,
7
+ "n_layer": 12,
8
+ "n_head": 12,
9
+ "n_embd": 768,
10
+ "dropout": 0.0,
11
+ "bias": false,
12
+ "mlp_ratio": 4,
13
+ "rope": true,
14
+ "qk_norm": true,
15
+ "untied_head": true,
16
+ "relu_sq": true,
17
+ "value_embed": false,
18
+ "value_embed_layers": ""
19
+ },
20
+ "param_counts": {
21
+ "total": 134105856,
22
+ "embedding": 24576000,
23
+ "token_embedding": 24576000,
24
+ "position_embedding": 0,
25
+ "value_embedding": 0,
26
+ "head": 24576000,
27
+ "non_embedding": 84953856
28
+ },
29
+ "tokenizer": "data/experts/shared/tokenizers/spm_shared_unigram_32000_v1.model",
30
+ "steps": 27106,
31
+ "tokens_seen": 1332314112,
32
+ "tokens_per_step": 49152,
33
+ "batch_size": 12,
34
+ "grad_accum": 4,
35
+ "block_size": 1024,
36
+ "compiled": true,
37
+ "dtype": "bf16",
38
+ "best_val_loss": 2.35255,
39
+ "best_bpb": 1.03066,
40
+ "mean_tok_s": 24948.8,
41
+ "median_tok_s": 25088.9,
42
+ "peak_gpu_mem_alloc_gb": 9.102,
43
+ "wall_seconds": 53361.8,
44
+ "evals": [
45
+ {
46
+ "step": 10000,
47
+ "val_loss": 2.5602,
48
+ "bpb": 1.1217,
49
+ "tokens_seen": 491520000,
50
+ "t": 19685.4
51
+ },
52
+ {
53
+ "step": 12000,
54
+ "val_loss": 2.5196,
55
+ "bpb": 1.1038,
56
+ "tokens_seen": 589824000,
57
+ "t": 23639.6
58
+ },
59
+ {
60
+ "step": 14000,
61
+ "val_loss": 2.4853,
62
+ "bpb": 1.0888,
63
+ "tokens_seen": 688128000,
64
+ "t": 27574.4
65
+ },
66
+ {
67
+ "step": 16000,
68
+ "val_loss": 2.4527,
69
+ "bpb": 1.0745,
70
+ "tokens_seen": 786432000,
71
+ "t": 31509.3
72
+ },
73
+ {
74
+ "step": 18000,
75
+ "val_loss": 2.4244,
76
+ "bpb": 1.0621,
77
+ "tokens_seen": 884736000,
78
+ "t": 35442.3
79
+ },
80
+ {
81
+ "step": 20000,
82
+ "val_loss": 2.3989,
83
+ "bpb": 1.051,
84
+ "tokens_seen": 983040000,
85
+ "t": 39378.0
86
+ },
87
+ {
88
+ "step": 22000,
89
+ "val_loss": 2.3804,
90
+ "bpb": 1.0429,
91
+ "tokens_seen": 1081344000,
92
+ "t": 43312.8
93
+ },
94
+ {
95
+ "step": 24000,
96
+ "val_loss": 2.3654,
97
+ "bpb": 1.0363,
98
+ "tokens_seen": 1179648000,
99
+ "t": 47247.5
100
+ },
101
+ {
102
+ "step": 26000,
103
+ "val_loss": 2.3561,
104
+ "bpb": 1.0322,
105
+ "tokens_seen": 1277952000,
106
+ "t": 51183.3
107
+ },
108
+ {
109
+ "step": 27106,
110
+ "val_loss": 2.3525,
111
+ "bpb": 1.0307,
112
+ "tokens_seen": 1332314112,
113
+ "t": 53361.8
114
+ }
115
+ ],
116
+ "args": {
117
+ "data_dir": "data/experts/math/train/math0_shared32k",
118
+ "runs_dir": "data/experts/math/train/runs",
119
+ "run": "math0_shared32k_d125m_ctx1024",
120
+ "preset": "d125m",
121
+ "n_layer": 0,
122
+ "n_head": 0,
123
+ "n_embd": 0,
124
+ "block_size": 1024,
125
+ "batch_size": 12,
126
+ "grad_accum": 4,
127
+ "lr": 0.001,
128
+ "min_lr_frac": 0.1,
129
+ "warmup_steps": 500,
130
+ "max_steps": 27106,
131
+ "weight_decay": 0.1,
132
+ "optim": "muon",
133
+ "muon_lr": 0.02,
134
+ "muon_momentum": 0.95,
135
+ "rope": true,
136
+ "qk_norm": true,
137
+ "untied_head": true,
138
+ "relu_sq": true,
139
+ "value_embed": false,
140
+ "value_embed_layers": "",
141
+ "schedule": "cosine",
142
+ "warmdown_frac": 0.4,
143
+ "beta1": 0.9,
144
+ "beta2": 0.95,
145
+ "grad_clip": 1.0,
146
+ "dropout": 0.0,
147
+ "log_interval": 50,
148
+ "eval_interval": 2000,
149
+ "eval_batches": 40,
150
+ "eval_batch_size": 0,
151
+ "ckpt_minutes": 10.0,
152
+ "time_budget_min": 1300.0,
153
+ "compile": 1,
154
+ "dtype": "bf16",
155
+ "resume": true,
156
+ "seed": 1337,
157
+ "sample_tokens": 120,
158
+ "sample_temperature": 0.8,
159
+ "sample_top_k": 100,
160
+ "prompt": "Let $f(x) = x^2 + 1$. Then",
161
+ "probe_steps": 0,
162
+ "device": "cuda"
163
+ },
164
+ "data_dir": "data/experts/math/train/math0_shared32k"
165
+ }