worthant commited on
Commit
60e42e6
·
1 Parent(s): c1007d5

docs: refactor markdown documentation files

Browse files
Files changed (2) hide show
  1. METHOD.md +78 -69
  2. README.md +77 -78
METHOD.md CHANGED
@@ -1,105 +1,114 @@
1
- # Calibration methodology what we measured
2
 
3
- Findings from building `nemotron-3.5-lightning`. They are about calibration in general,
4
- not about one model, and every number here is reproducible with the tools in this repo.
 
5
 
6
  ## A recipe is per-model, and the chat markup is the reason
7
 
8
- The pool is model-agnostic: `pool/**/**.jsonl` holds dialogues as structured records, not
9
- as text. Rendering into a model's chat template happens at build time, so one pool serves
10
- every target.
11
-
12
- This matters more than it sounds. Reusing a build made for another model puts that model's
13
- special tokens in the corpus. For `muse-glimmer-30b` those are `<|start|>`, `<|message|>`,
14
- `<|eot|>`; for `nemotron-3.5-lightning` they are `<|im_start|>`, `<|im_end|>`, `<think>`,
15
- `<tool_call>`. **The two sets do not overlap at all.** Run `llama-imatrix --parse-special`
16
- with the wrong build and the markup is tokenized as literal punctuation, while the tokens
17
- the model will really see appear zero times for these recipes that is the agentic plus
 
18
  reasoning slices, about 40% of the corpus, calibrating nothing.
19
 
20
  It also shows up in convergence. Same tool, same model, same chunk budget:
21
 
22
- | corpus | step 1504 → 2000 | tensors still moving |
23
- |---|---:|---:|
24
- | rendered in another model's markup | mean cos 0.9928 | 22 |
25
- | rendered in the target's own markup | mean cos 0.9985 | 10 |
26
 
27
- Correct markup converges about twice as cleanly, because the wrong tokens were injecting
28
- noise into the estimate.
29
 
30
- Add a model with a recipe plus a renderer module; `chat.format` selects it. The vocabulary
31
- sweep is per-tokenizer and auto-selected by recipe name, so adding a model never requires
32
- editing recipes that already exist.
33
 
34
  ## Content matters ~100× more than volume
35
 
36
  Cosine similarity between imatrix files, per tensor:
37
 
38
- | comparison | mean cos |
39
- |---|---:|
40
- | same corpus, 823 vs 3000 chunks (3.6× the data) | 0.9819 |
41
- | different corpora, both at 823 chunks | 0.8553 |
42
 
43
- Tripling the data moves the importance vector by 0.018. Changing what is *in* the corpus
44
- moves it by 0.145. Beyond the saturation point, more of the same text is close to free of
45
- effect; a different mix is not.
46
 
47
- The two corpora also do not converge toward each other as data grows (0.855 → 0.860 from
48
- 823 to 3000 chunks), so the difference is systematic, not sampling noise.
 
49
 
50
  ## When to stop: a criterion, not a feeling
51
 
52
- The imatrix estimates a mean, and means converge. The question "have I collected enough"
53
- has a definite answer.
54
 
55
- **Necessary, cheap, no model needed.** Build at N and 2N chunks, take the per-tensor cosine
56
- between them. Done when no tensor is still moving. `tools/converge.py` does this against
57
- `--save-frequency` checkpoints, so one run produces the whole curve for free.
 
58
 
59
- For `nemotron-3.5-lightning` that point is ~8,500 chunks (4.3M tokens): past it, zero of
60
- 186 tensors change measurably, min cosine 0.9963.
61
 
62
- **Sufficient, expensive, final.** Quantize the same recipe twice, with the imatrix at N and
63
- at 2N, and measure KL divergence of both against the unquantized model on held-out text.
64
- Done when the difference between them is below the reported KLD error — at that point more
65
- data provably cannot change the product.
 
66
 
67
- Note what this criterion does *not* answer: whether the corpus has the right content. That
68
- question is only well-posed once you fix the evaluation set, because "importance" is defined
69
- relative to the text the model will actually see. A corpus tuned for agentic work should win
70
- on agentic held-out and may lose on generic prose that is the intended outcome, not a bug.
71
- This is why `eval/` carries three independent sets rather than one.
 
72
 
73
  ## `% Active` is not a quality metric
74
 
75
- `llama-imatrix --show-statistics` reports a `% Active` column. It is the fraction of columns
76
- whose mean squared activation exceeds a hard threshold of `1e-5`
77
- (`tools/imatrix/imatrix.cpp`, `compute_statistics`). It measures activation magnitude, not
78
- calibration coverage.
79
 
80
- Early layers score low on it because their activations are genuinely small — layer 1's
81
- `ffn_down_shexp` has Σ(Act²) = 0.13. No corpus raises that; it is a property of the model.
82
- Chasing the number optimizes for nothing.
83
 
84
  Two checks that do mean something:
85
 
86
- - **Dead experts** — the `.counts` array in the imatrix says how many times each expert was
87
- routed to. `counts[i] == 0` is a genuine hole. Measured here: 0 dead of 5,888
88
- (46 expert tensors × 128) at every corpus size tested, including 823 chunks. For this
89
- model, expert coverage is not what a larger corpus buys.
90
  - **Per-tensor cosine between imatrix files** — the convergence criterion above.
91
 
92
- The per-layer Σ(Act²) curve is a model property, not a corpus property: two corpora with
93
- cosine 0.855 between their imatrices produce per-layer curves within 8% of each other
94
- (median 2.6%). Useful as a sanity check for a broken build, useless as a quality claim.
 
95
 
96
  ## Practical notes
97
 
98
- - `llama-imatrix` defaults to `parse_special = false`. Without `--parse-special` all chat
99
- markup is literal text.
100
- - `-b 8192` instead of the default 512: 1h22m instead of 2h12m for 9.3k chunks on 2×RTX 5090.
101
- It plateaus there; `-b 16384` saves another minute.
102
- - MTP / NextN blocks are never executed in a normal forward pass, so they collect no imatrix
103
- data at any corpus size. Pin them explicitly at quantize time.
104
- - `max_doc_fraction` is not optional. Uncapped, one amalgamated header took 59.8% of a slice
105
- the imatrix then describes that file rather than that category.
 
 
 
1
+ # Calibration methodology - what we measured
2
 
3
+ Findings from building `nemotron-3.5-lightning`. They are about calibration in
4
+ general, not about one model, and every number here is reproducible with the
5
+ tools in this repo.
6
 
7
  ## A recipe is per-model, and the chat markup is the reason
8
 
9
+ The pool is model-agnostic: `pool/**/**.jsonl` holds dialogues as structured
10
+ records, not as text. Rendering into a model's chat template happens at build
11
+ time, so one pool serves every target.
12
+
13
+ This matters more than it sounds. Reusing a build made for another model puts
14
+ that model's special tokens in the corpus. For `muse-glimmer-30b` those are
15
+ `<|start|>`, `<|message|>`, `<|eot|>`; for `nemotron-3.5-lightning` they are
16
+ `<|im_start|>`, `<|im_end|>`, `<think>`, `<tool_call>`. **The two sets do not
17
+ overlap at all.** Run `llama-imatrix --parse-special` with the wrong build and
18
+ the markup is tokenized as literal punctuation, while the tokens the model will
19
+ really see appear zero times — for these recipes that is the agentic plus
20
  reasoning slices, about 40% of the corpus, calibrating nothing.
21
 
22
  It also shows up in convergence. Same tool, same model, same chunk budget:
23
 
24
+ | corpus | step 1504 → 2000 | tensors still moving |
25
+ | ----------------------------------- | ---------------: | -------------------: |
26
+ | rendered in another model's markup | mean cos 0.9928 | 22 |
27
+ | rendered in the target's own markup | mean cos 0.9985 | 10 |
28
 
29
+ Correct markup converges about twice as cleanly, because the wrong tokens were
30
+ injecting noise into the estimate.
31
 
32
+ Add a model with a recipe plus a renderer module; `chat.format` selects it. The
33
+ vocabulary sweep is per-tokenizer and auto-selected by recipe name, so adding a
34
+ model never requires editing recipes that already exist.
35
 
36
  ## Content matters ~100× more than volume
37
 
38
  Cosine similarity between imatrix files, per tensor:
39
 
40
+ | comparison | mean cos |
41
+ | ----------------------------------------------- | -------: |
42
+ | same corpus, 823 vs 3000 chunks (3.6× the data) | 0.9819 |
43
+ | different corpora, both at 823 chunks | 0.8553 |
44
 
45
+ Tripling the data moves the importance vector by 0.018. Changing what is _in_
46
+ the corpus moves it by 0.145. Beyond the saturation point, more of the same text
47
+ is close to free of effect; a different mix is not.
48
 
49
+ The two corpora also do not converge toward each other as data grows (0.855 →
50
+ 0.860 from 823 to 3000 chunks), so the difference is systematic, not sampling
51
+ noise.
52
 
53
  ## When to stop: a criterion, not a feeling
54
 
55
+ The imatrix estimates a mean, and means converge. The question "have I collected
56
+ enough" has a definite answer.
57
 
58
+ **Necessary, cheap, no model needed.** Build at N and 2N chunks, take the
59
+ per-tensor cosine between them. Done when no tensor is still moving.
60
+ `tools/converge.py` does this against `--save-frequency` checkpoints, so one run
61
+ produces the whole curve for free.
62
 
63
+ For `nemotron-3.5-lightning` that point is ~8,500 chunks (4.3M tokens): past it,
64
+ zero of 186 tensors change measurably, min cosine 0.9963.
65
 
66
+ **Sufficient, expensive, final.** Quantize the same recipe twice, with the
67
+ imatrix at N and at 2N, and measure KL divergence of both against the
68
+ unquantized model on held-out text. Done when the difference between them is
69
+ below the reported KLD error — at that point more data provably cannot change
70
+ the product.
71
 
72
+ Note what this criterion does _not_ answer: whether the corpus has the right
73
+ content. That question is only well-posed once you fix the evaluation set,
74
+ because "importance" is defined relative to the text the model will actually
75
+ see. A corpus tuned for agentic work should win on agentic held-out and may lose
76
+ on generic prose that is the intended outcome, not a bug. This is why `eval/`
77
+ carries three independent sets rather than one.
78
 
79
  ## `% Active` is not a quality metric
80
 
81
+ `llama-imatrix --show-statistics` reports a `% Active` column. It is the
82
+ fraction of columns whose mean squared activation exceeds a hard threshold of
83
+ `1e-5` (`tools/imatrix/imatrix.cpp`, `compute_statistics`). It measures
84
+ activation magnitude, not calibration coverage.
85
 
86
+ Early layers score low on it because their activations are genuinely small —
87
+ layer 1's `ffn_down_shexp` has Σ(Act²) = 0.13. No corpus raises that; it is a
88
+ property of the model. Chasing the number optimizes for nothing.
89
 
90
  Two checks that do mean something:
91
 
92
+ - **Dead experts** — the `.counts` array in the imatrix says how many times each
93
+ expert was routed to. `counts[i] == 0` is a genuine hole. Measured here: 0
94
+ dead of 5,888 (46 expert tensors × 128) at every corpus size tested, including
95
+ 823 chunks. For this model, expert coverage is not what a larger corpus buys.
96
  - **Per-tensor cosine between imatrix files** — the convergence criterion above.
97
 
98
+ The per-layer Σ(Act²) curve is a model property, not a corpus property: two
99
+ corpora with cosine 0.855 between their imatrices produce per-layer curves
100
+ within 8% of each other (median 2.6%). Useful as a sanity check for a broken
101
+ build, useless as a quality claim.
102
 
103
  ## Practical notes
104
 
105
+ - `llama-imatrix` defaults to `parse_special = false`. Without `--parse-special`
106
+ all chat markup is literal text.
107
+ - `-b 8192` instead of the default 512: 1h22m instead of 2h12m for 9.3k chunks
108
+ on 2×RTX 5090. It plateaus there; `-b 16384` saves another minute.
109
+ - MTP / NextN blocks are never executed in a normal forward pass, so they
110
+ collect no imatrix data at any corpus size. Pin them explicitly at quantize
111
+ time.
112
+ - `max_doc_fraction` is not optional. Uncapped, one amalgamated header took
113
+ 59.8% of a slice — the imatrix then describes that file rather than that
114
+ category.
README.md CHANGED
@@ -1,28 +1,28 @@
1
  ---
2
  license: other
3
  language:
4
- - en
5
- - zh
6
- - ru
7
- - ja
8
- - ar
9
- - multilingual
10
  tags:
11
- - imatrix
12
- - quantization
13
- - calibration
14
- - gguf
15
- - agentic
16
- - tool-use
17
  task_categories:
18
- - text-generation
19
  ---
20
 
21
  # calib-corpora — a pool of calibration material, and per-model builds from it
22
 
23
- This repository is **not a corpus**. It is a *pool* of raw units with provenance,
24
- plus recipes that turn the pool into a calibration set for one specific model,
25
- plus the measurement corpora that quant is scored against.
26
 
27
  That split exists because the previous layout could not survive a change of
28
  model. The old `calib_train.txt` had DeepSeek-V4's chat markup baked into its
@@ -47,19 +47,19 @@ pipeline/ the previous DeepSeek-era pipeline, kept as it was
47
  `builds/muse-glimmer-30b/` — recipe `recipes/muse-glimmer-30b.yaml`, seed
48
  `20260810`.
49
 
50
- | | requested | actual | tokens |
51
- |---|---:|---:|---:|
52
- | agentic | 25.0% | **25.50%** | 1,250,047 |
53
- | code | 18.0% | **18.66%** | 914,575 |
54
- | reasoning | 15.0% | **15.31%** | 750,307 |
55
- | longctx | 12.0% | **12.75%** | 624,756 |
56
- | multilingual | 12.0% | **12.27%** | 601,231 |
57
- | vocab_sweep | 10.0% | **8.50%** | 416,579 |
58
- | structured | 5.0% | **3.93%** | 192,839 |
59
- | graphics | 3.0% | **3.08%** | 151,161 |
60
 
61
  `calib_train.txt` — 3,363 documents, **4,901,495 tokens** by `tokenizer.json`
62
- (4,954,537 by `llama-tokenize`; see *Two tokenizers* below). 50.7% of the tokens
63
  are synthetic, all of it template-generated and marked in the manifest.
64
 
65
  `calib_longctx.txt` — 29 unbroken documents, **751,109 tokens**, each 17,745 to
@@ -67,20 +67,20 @@ are synthetic, all of it template-generated and marked in the manifest.
67
  layers are full-attention with RoPE disabled, and nothing shorter than the
68
  2,048-token sliding window exercises them.
69
 
70
- Document length in `calib_train.txt`: p50 = 562, p90 = 3,349, p95 = 4,958,
71
- p99 = 14,814, max = 49,527. 68 documents are ≥ 8k tokens and carry 25.6% of all
72
  tokens.
73
 
74
  ### Vocabulary coverage
75
 
76
  Denominator is 202,048 embedding rows.
77
 
78
- | | old corpus | this build |
79
- |---|---:|---:|
80
- | seen ≥ 1 | 96,099 (47.56%) | **196,430 (97.22%)** |
81
- | seen ≥ 10 | 14,454 (7.15%) | 24,831 (12.29%) |
82
- | seen ≥ 100 | 2,097 (1.04%) | 4,968 (2.46%) |
83
- | unseen | 105,949 (52.44%) | **5,618 (2.78%)** |
84
 
85
  The jump is the vocabulary sweep, regenerated for this tokenizer by
86
  `tools/vocab_sweep.py`: 200,185 of the 200,220 ids that have any standalone
@@ -106,25 +106,25 @@ model never emits. The flag is registered for the imatrix example only.
106
 
107
  `eval/` never intersects a build. Verified pairwise with `tools/crosscheck.py`.
108
 
109
- | corpus | tokens | chunks @4096 | scored positions | vocab | dup lines |
110
- |---|---:|---:|---:|---:|---:|
111
- | `eval/neutral/eval_neutral.txt` | 353,771 | 86 | 176,128 | 19.43% | **1.37%** |
112
- | `eval/code/eval_code_full.txt` | 350,887 | 85 | 174,080 | 15.31% | 31.63% |
113
- | `eval/agentic/eval_agentic.txt` | 350,438 | 85 | 174,080 | 5.50% | 44.55% |
114
 
115
  `llama-perplexity` scores the second half of each context window, so a corpus
116
  must be about twice the size of the measurement you want out of it.
117
 
118
- * **neutral** — 30 languages, no code. Latin script is 46.5% of letters;
119
- Arabic 7.6%, Armenian 6.3%, Cyrillic 5.4%, Han 5.3%, Greek 4.3%, Hebrew 4.2%,
120
  Devanagari 3.7%, Myanmar 3.6%, then Bengali, Thai, Georgian, Tamil, Hangul,
121
  Hiragana, Katakana, Ethiopic.
122
- * **code** — `eval_code.txt` is the file previously called `eval_neutral.txt`,
123
  byte-identical so old measurements stay comparable. It was never neutral
124
  prose: measured, it is a source-code corpus. `eval_code_ext.txt` extends it
125
- from seven repositories that appear nowhere else;
126
- `eval_code_full.txt` is the two concatenated and is what to measure against.
127
- * **agentic** — conversations in the model's own markup, all four reasoning
128
  strengths (low 50 / medium 46 / high 48 / xhigh 48), grounded in four
129
  repositories reserved for this purpose.
130
 
@@ -145,18 +145,17 @@ Two things to know before using `eval/agentic`:
145
  7,415 units after filtering, in `pool/<category>/*.jsonl`. Every line carries
146
  `source`, `license`, `path`, `origin` and a `provenance` object.
147
 
148
- Dialogue is stored as `messages`, not as rendered text, and
149
- `tools/build.py` applies the target model's chat format at build time. Storing
150
- one model's special tokens in the pool is exactly what made the previous corpus
151
- single-use.
152
 
153
  `render` tells a build what a unit is:
154
 
155
- * `text` — used verbatim
156
- * `chat` — `messages` are rendered by `tools/glimmer_fmt.py`
157
- * `dsv4` — already rendered in DeepSeek markup. **Kept, never built from.**
158
- 203 such units are preserved for provenance; their conversations were
159
- regenerated structurally instead.
160
 
161
  `pool/_quarantine/` holds everything removed, with the reason on each record.
162
  Nothing is deleted.
@@ -165,8 +164,8 @@ Nothing is deleted.
165
 
166
  Repository files keep their upstream licence (MIT, Apache-2.0, BSD-3-Clause,
167
  BSL-1.0) and record the commit they were taken from. Wikipedia is CC-BY-SA-4.0.
168
- Generated units are CC0-1.0 and live under a `synthetic/` subdirectory, with
169
- the caveat that agentic traces quote real repository files verbatim inside tool
170
  results — those excerpts keep their own licence, which is recorded per unit.
171
 
172
  `patriciogonzalezvivo/thebookofshaders` is an obvious fit for the graphics slice
@@ -176,21 +175,21 @@ and is **all-rights-reserved**. It is not here and must not be added.
176
 
177
  All at 13-word shingles, `tools/dedupe.py`.
178
 
179
- | check | result |
180
- |---|---|
181
- | wikitext-103-raw-v1 (superset of wikitext-2) | 6 documents removed |
182
- | pool vs eval, any shared 13-gram | 3,672 documents |
183
- | pool vs eval, *distinctive* 13-gram | 143 removed, **0 remain** |
184
- | exact duplicates within the pool | 379 removed |
185
- | near duplicates at J ≥ 0.8 | 202 removed |
186
- | total quarantined | 1,056 of 8,471 (12.5%) |
187
 
188
  The two eval rows differ by a factor of twenty-five and the difference matters.
189
  A 13-gram shared by thousands of documents is an MIT header or an SPDX line, not
190
  leaked measurement data; treating those as contamination removed 43% of the pool
191
  on the first run and improved nothing. A gram counts as evidence only when it
192
- occurs in at most two pool documents. Both numbers are reported rather than
193
- just the flattering one.
194
 
195
  **No wikitext of any version is in any build.** Grepping for the string proves
196
  nothing — wikitext is a curated slice of English Wikipedia and this pool
@@ -203,14 +202,14 @@ benchmark text itself.
203
  (4,954,537 vs 4,901,495 tokens on `calib_train.txt`). The disagreement is not
204
  spread evenly — it is almost entirely non-Latin text:
205
 
206
- | slice | `tokenizer.json` | `llama-tokenize` | |
207
- |---|---:|---:|---:|
208
- | multilingual | 34,988 | 37,072 | **+5.96%** |
209
- | vocab_sweep | 28,389 | 28,826 | **+1.54%** |
210
- | longctx | 356,401 | 356,215 | −0.05% |
211
- | code | 16,425 | 16,420 | −0.03% |
212
- | agentic | 34,950 | 34,948 | −0.01% |
213
- | graphics, reasoning, structured | | | 0.00% |
214
 
215
  Both sides run the same `llama4` split regex, but llama.cpp implements the
216
  Unicode property classes in it with its own tables rather than a PCRE engine,
@@ -234,7 +233,7 @@ terminate called after throwing an instance of 'std::invalid_argument'
234
  what(): invalid codepoint
235
  ```
236
 
237
- The escape sequence is only *described*, not encoded; `F4 91 92 93` would decode
238
  to U+111493, past U+10FFFF, and `unicode_cpt_to_utf8` in `src/unicode.cpp`
239
  throws instead of substituting U+FFFD. UTF-8 conformance test suites are full of
240
  such literals. The previous `calib_train.txt` contains one
@@ -260,8 +259,8 @@ python tools/coverage.py --gguf GGUF --tokenizer TOKENIZER_JSON \
260
  python tools/crosscheck.py builds/*/calib_*.txt eval/*/*.txt
261
  ```
262
 
263
- Order matters: harvesting excludes the measurement split by `(source, path)`, and
264
- the generators draw from the pool, so agentic traces cannot quote a held-out
265
  file.
266
 
267
  `tools/test_glimmer_fmt.py` renders 13 conversations through both
 
1
  ---
2
  license: other
3
  language:
4
+ - en
5
+ - zh
6
+ - ru
7
+ - ja
8
+ - ar
9
+ - multilingual
10
  tags:
11
+ - imatrix
12
+ - quantization
13
+ - calibration
14
+ - gguf
15
+ - agentic
16
+ - tool-use
17
  task_categories:
18
+ - text-generation
19
  ---
20
 
21
  # calib-corpora — a pool of calibration material, and per-model builds from it
22
 
23
+ This repository is **not a corpus**. It is a _pool_ of raw units with
24
+ provenance, plus recipes that turn the pool into a calibration set for one
25
+ specific model, plus the measurement corpora that quant is scored against.
26
 
27
  That split exists because the previous layout could not survive a change of
28
  model. The old `calib_train.txt` had DeepSeek-V4's chat markup baked into its
 
47
  `builds/muse-glimmer-30b/` — recipe `recipes/muse-glimmer-30b.yaml`, seed
48
  `20260810`.
49
 
50
+ | | requested | actual | tokens |
51
+ | ------------ | --------: | ---------: | --------: |
52
+ | agentic | 25.0% | **25.50%** | 1,250,047 |
53
+ | code | 18.0% | **18.66%** | 914,575 |
54
+ | reasoning | 15.0% | **15.31%** | 750,307 |
55
+ | longctx | 12.0% | **12.75%** | 624,756 |
56
+ | multilingual | 12.0% | **12.27%** | 601,231 |
57
+ | vocab_sweep | 10.0% | **8.50%** | 416,579 |
58
+ | structured | 5.0% | **3.93%** | 192,839 |
59
+ | graphics | 3.0% | **3.08%** | 151,161 |
60
 
61
  `calib_train.txt` — 3,363 documents, **4,901,495 tokens** by `tokenizer.json`
62
+ (4,954,537 by `llama-tokenize`; see _Two tokenizers_ below). 50.7% of the tokens
63
  are synthetic, all of it template-generated and marked in the manifest.
64
 
65
  `calib_longctx.txt` — 29 unbroken documents, **751,109 tokens**, each 17,745 to
 
67
  layers are full-attention with RoPE disabled, and nothing shorter than the
68
  2,048-token sliding window exercises them.
69
 
70
+ Document length in `calib_train.txt`: p50 = 562, p90 = 3,349, p95 = 4,958, p99 =
71
+ 14,814, max = 49,527. 68 documents are ≥ 8k tokens and carry 25.6% of all
72
  tokens.
73
 
74
  ### Vocabulary coverage
75
 
76
  Denominator is 202,048 embedding rows.
77
 
78
+ | | old corpus | this build |
79
+ | ---------- | ---------------: | -------------------: |
80
+ | seen ≥ 1 | 96,099 (47.56%) | **196,430 (97.22%)** |
81
+ | seen ≥ 10 | 14,454 (7.15%) | 24,831 (12.29%) |
82
+ | seen ≥ 100 | 2,097 (1.04%) | 4,968 (2.46%) |
83
+ | unseen | 105,949 (52.44%) | **5,618 (2.78%)** |
84
 
85
  The jump is the vocabulary sweep, regenerated for this tokenizer by
86
  `tools/vocab_sweep.py`: 200,185 of the 200,220 ids that have any standalone
 
106
 
107
  `eval/` never intersects a build. Verified pairwise with `tools/crosscheck.py`.
108
 
109
+ | corpus | tokens | chunks @4096 | scored positions | vocab | dup lines |
110
+ | ------------------------------- | ------: | -----------: | ---------------: | -----: | --------: |
111
+ | `eval/neutral/eval_neutral.txt` | 353,771 | 86 | 176,128 | 19.43% | **1.37%** |
112
+ | `eval/code/eval_code_full.txt` | 350,887 | 85 | 174,080 | 15.31% | 31.63% |
113
+ | `eval/agentic/eval_agentic.txt` | 350,438 | 85 | 174,080 | 5.50% | 44.55% |
114
 
115
  `llama-perplexity` scores the second half of each context window, so a corpus
116
  must be about twice the size of the measurement you want out of it.
117
 
118
+ - **neutral** — 30 languages, no code. Latin script is 46.5% of letters; Arabic
119
+ 7.6%, Armenian 6.3%, Cyrillic 5.4%, Han 5.3%, Greek 4.3%, Hebrew 4.2%,
120
  Devanagari 3.7%, Myanmar 3.6%, then Bengali, Thai, Georgian, Tamil, Hangul,
121
  Hiragana, Katakana, Ethiopic.
122
+ - **code** — `eval_code.txt` is the file previously called `eval_neutral.txt`,
123
  byte-identical so old measurements stay comparable. It was never neutral
124
  prose: measured, it is a source-code corpus. `eval_code_ext.txt` extends it
125
+ from seven repositories that appear nowhere else; `eval_code_full.txt` is the
126
+ two concatenated and is what to measure against.
127
+ - **agentic** — conversations in the model's own markup, all four reasoning
128
  strengths (low 50 / medium 46 / high 48 / xhigh 48), grounded in four
129
  repositories reserved for this purpose.
130
 
 
145
  7,415 units after filtering, in `pool/<category>/*.jsonl`. Every line carries
146
  `source`, `license`, `path`, `origin` and a `provenance` object.
147
 
148
+ Dialogue is stored as `messages`, not as rendered text, and `tools/build.py`
149
+ applies the target model's chat format at build time. Storing one model's
150
+ special tokens in the pool is exactly what made the previous corpus single-use.
 
151
 
152
  `render` tells a build what a unit is:
153
 
154
+ - `text` — used verbatim
155
+ - `chat` — `messages` are rendered by `tools/glimmer_fmt.py`
156
+ - `dsv4` — already rendered in DeepSeek markup. **Kept, never built from.** 203
157
+ such units are preserved for provenance; their conversations were regenerated
158
+ structurally instead.
159
 
160
  `pool/_quarantine/` holds everything removed, with the reason on each record.
161
  Nothing is deleted.
 
164
 
165
  Repository files keep their upstream licence (MIT, Apache-2.0, BSD-3-Clause,
166
  BSL-1.0) and record the commit they were taken from. Wikipedia is CC-BY-SA-4.0.
167
+ Generated units are CC0-1.0 and live under a `synthetic/` subdirectory, with the
168
+ caveat that agentic traces quote real repository files verbatim inside tool
169
  results — those excerpts keep their own licence, which is recorded per unit.
170
 
171
  `patriciogonzalezvivo/thebookofshaders` is an obvious fit for the graphics slice
 
175
 
176
  All at 13-word shingles, `tools/dedupe.py`.
177
 
178
+ | check | result |
179
+ | -------------------------------------------- | ------------------------- |
180
+ | wikitext-103-raw-v1 (superset of wikitext-2) | 6 documents removed |
181
+ | pool vs eval, any shared 13-gram | 3,672 documents |
182
+ | pool vs eval, _distinctive_ 13-gram | 143 removed, **0 remain** |
183
+ | exact duplicates within the pool | 379 removed |
184
+ | near duplicates at J ≥ 0.8 | 202 removed |
185
+ | total quarantined | 1,056 of 8,471 (12.5%) |
186
 
187
  The two eval rows differ by a factor of twenty-five and the difference matters.
188
  A 13-gram shared by thousands of documents is an MIT header or an SPDX line, not
189
  leaked measurement data; treating those as contamination removed 43% of the pool
190
  on the first run and improved nothing. A gram counts as evidence only when it
191
+ occurs in at most two pool documents. Both numbers are reported rather than just
192
+ the flattering one.
193
 
194
  **No wikitext of any version is in any build.** Grepping for the string proves
195
  nothing — wikitext is a curated slice of English Wikipedia and this pool
 
202
  (4,954,537 vs 4,901,495 tokens on `calib_train.txt`). The disagreement is not
203
  spread evenly — it is almost entirely non-Latin text:
204
 
205
+ | slice | `tokenizer.json` | `llama-tokenize` | |
206
+ | ------------------------------- | ---------------: | ---------------: | ---------: |
207
+ | multilingual | 34,988 | 37,072 | **+5.96%** |
208
+ | vocab_sweep | 28,389 | 28,826 | **+1.54%** |
209
+ | longctx | 356,401 | 356,215 | −0.05% |
210
+ | code | 16,425 | 16,420 | −0.03% |
211
+ | agentic | 34,950 | 34,948 | −0.01% |
212
+ | graphics, reasoning, structured | | | 0.00% |
213
 
214
  Both sides run the same `llama4` split regex, but llama.cpp implements the
215
  Unicode property classes in it with its own tables rather than a PCRE engine,
 
233
  what(): invalid codepoint
234
  ```
235
 
236
+ The escape sequence is only _described_, not encoded; `F4 91 92 93` would decode
237
  to U+111493, past U+10FFFF, and `unicode_cpt_to_utf8` in `src/unicode.cpp`
238
  throws instead of substituting U+FFFD. UTF-8 conformance test suites are full of
239
  such literals. The previous `calib_train.txt` contains one
 
259
  python tools/crosscheck.py builds/*/calib_*.txt eval/*/*.txt
260
  ```
261
 
262
+ Order matters: harvesting excludes the measurement split by `(source, path)`,
263
+ and the generators draw from the pool, so agentic traces cannot quote a held-out
264
  file.
265
 
266
  `tools/test_glimmer_fmt.py` renders 13 conversations through both