notforu777 commited on
Commit
272005d
·
verified ·
1 Parent(s): 8178d96

kolibri-1-moe: German pool, Kolibri-1 vocab sweep, recipe and build; eval/neutral-de, eval/longctx, eval/agentic-kolibri

Browse files

For Aleph Alpha's Kolibri-1 (78B MoE, trained on 23.9% German).

- pool/german/ (tools/pool_german.py): Wikipedia DE, OpenAssistant oasst2 DE, ultrachat_de, germanrag,
templated German tool-calling dialogues, long German articles for calib_longctx. Licences in every record.
- pool/vocab_sweep/synthetic/kolibri-1-moe.jsonl: 127,148 of 127,166 sweepable ids.
- recipes/kolibri-1-moe.yaml and builds/kolibri-1-moe/: 5,598,775 tokens, 4,773 documents, German 21.4%,
reasoning_effort rendered through the model's template (tools/build.py + tools/auto_fmt.py); calib_longctx
771,843 tokens in 29 documents. The qwen3.8-flash-next-moe recipe rebuilds byte-identical with these tools.
- eval/neutral-de (348k tokens), eval/longctx (349k, eight chunks at 32k or needles to 128k),
eval/agentic-kolibri (354k: eval/agentic's generator, scripted and grounded, in Kolibri-1's template;
tools/build_eval_auto.py, repository commits in grounding.json).
- builds/kolibri-1-moe/crosscheck.json: no 13-gram shared with any eval apart from the template's own scaffolding.
- pool/_quarantine/eval-residue.jsonl: one German Wikipedia article that overlapped an eval.
- tools: auto_fmt passes reasoning_effort and keeps the text parts of list content; poollib knows the german
categories; build.py passes reasoning_effort when the recipe asks for it.

README.md CHANGED
@@ -66,6 +66,7 @@ kept as it was. It is history, not an alternative to `tools/`.
66
  | `nemotron-3.5-lightning` | `recipes/nemotron-3.5-lightning.yaml` | see manifest | hybrid Mamba2, expert rows do not divide by 256 |
67
  | `qwen3.8-27b` | `recipes/qwen3.8-27b.yaml` | 4,967,044 | 3,004 documents, 50.87% synthetic |
68
  | `dsv4-flash-0731` | `recipes/dsv4-flash-0731.yaml` | 1,868,626 | predates this format, recipe is a reconstruction |
 
69
 
70
  Every build carries a `manifest.json` with the recipe hash, the tokenizer hash,
71
  the corpus hash, requested against actual shares, per-category token counts,
@@ -100,6 +101,11 @@ token window never reaches.
100
  | `eval/neutral/eval_neutral.txt` | 353,771 | 86 | 176,128 | 19.43% | **1.37%** |
101
  | `eval/code/eval_code_full.txt` | 350,887 | 85 | 174,080 | 15.31% | 31.63% |
102
  | `eval/agentic/eval_agentic.txt` | 350,438 | 85 | 174,080 | 5.50% | 44.55% |
 
 
 
 
 
103
 
104
  `llama-perplexity` scores the second half of each context window, so a corpus
105
  has to be about twice the size of the measurement wanted out of it.
@@ -115,6 +121,21 @@ prose: measured, it is a source-code corpus. `eval_code_ext.txt` extends it from
115
  seven repositories that appear nowhere else, and `eval_code_full.txt` is the two
116
  concatenated. Measure against the full one.
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  **agentic.** Conversations in a model's own markup, across four reasoning
119
  strengths, grounded in four repositories reserved for this purpose.
120
 
@@ -309,6 +330,8 @@ python tools/build_eval.py --build builds/<name> ...
309
  | `purge_overlap.py` | pool, eval | `pool/_quarantine/eval-residue.jsonl` |
310
  | `build.py` | a recipe, pool | `builds/<name>/` |
311
  | `build_eval.py` | pool | `eval/` |
 
 
312
  | `coverage.py` | a corpus, a GGUF | vocabulary coverage report |
313
  | `crosscheck.py` | builds, eval | `eval/crosscheck.json` |
314
  | `converge.py` | imatrix checkpoints | per-tensor cosine curve |
 
66
  | `nemotron-3.5-lightning` | `recipes/nemotron-3.5-lightning.yaml` | see manifest | hybrid Mamba2, expert rows do not divide by 256 |
67
  | `qwen3.8-27b` | `recipes/qwen3.8-27b.yaml` | 4,967,044 | 3,004 documents, 50.87% synthetic |
68
  | `dsv4-flash-0731` | `recipes/dsv4-flash-0731.yaml` | 1,868,626 | predates this format, recipe is a reconstruction |
69
+ | `kolibri-1-moe` | `recipes/kolibri-1-moe.yaml` | 5,598,775 | 4,773 documents, German 21.4% (`pool/german/`), `reasoning_effort` rendered; `calib_longctx` 771,843 tokens in 29 documents |
70
 
71
  Every build carries a `manifest.json` with the recipe hash, the tokenizer hash,
72
  the corpus hash, requested against actual shares, per-category token counts,
 
101
  | `eval/neutral/eval_neutral.txt` | 353,771 | 86 | 176,128 | 19.43% | **1.37%** |
102
  | `eval/code/eval_code_full.txt` | 350,887 | 85 | 174,080 | 15.31% | 31.63% |
103
  | `eval/agentic/eval_agentic.txt` | 350,438 | 85 | 174,080 | 5.50% | 44.55% |
104
+ | `eval/neutral-de/eval_neutral-de.txt` ¹ | 348,005 | 84 | 172,032 | 23.18% | 7.78% |
105
+ | `eval/longctx/eval_longctx.txt` ¹ | 349,426 | 85 | 174,080 | 20.69% | 3.50% |
106
+ | `eval/agentic-kolibri/eval_agentic-kolibri.txt` ¹ | 353,717 | 86 | 176,128 | 6.58% | 36.33% |
107
+
108
+ ¹ Counted in Kolibri-1's tokenizer (128,000 ids).
109
 
110
  `llama-perplexity` scores the second half of each context window, so a corpus
111
  has to be about twice the size of the measurement wanted out of it.
 
121
  seven repositories that appear nowhere else, and `eval_code_full.txt` is the two
122
  concatenated. Measure against the full one.
123
 
124
+ **neutral-de.** German Wikipedia prose from offsets `tools/pool_german.py`
125
+ never reads for the pool. For a model trained on a quarter German.
126
+
127
+ **longctx.** Long articles (12k+ tokens), German and English: eight chunks at
128
+ `-c 32768`, or needles for 64k and 128k.
129
+
130
+ **agentic-kolibri.** `eval/agentic`'s generator (120 scripted conversations and
131
+ up to 900 grounded in the four held-out repositories) rendered through
132
+ Kolibri-1's own template by `tools/build_eval_auto.py`: its special tokens, its
133
+ Hermes tool calls, `reasoning_effort` per conversation. `grounding.json` holds
134
+ the repository commits. 188 conversations: 98 grounded, 90 scripted. Disjoint
135
+ from `kolibri-1-moe` (`builds/kolibri-1-moe/crosscheck.json`) apart from 94
136
+ 13-grams of the template's own scaffolding and one where two conversations
137
+ join; `llama-perplexity` must read it with `--parse-special`.
138
+
139
  **agentic.** Conversations in a model's own markup, across four reasoning
140
  strengths, grounded in four repositories reserved for this purpose.
141
 
 
330
  | `purge_overlap.py` | pool, eval | `pool/_quarantine/eval-residue.jsonl` |
331
  | `build.py` | a recipe, pool | `builds/<name>/` |
332
  | `build_eval.py` | pool | `eval/` |
333
+ | `build_eval_auto.py` | a tokenizer, a build, clones | `eval/agentic-<name>/` in the model's template |
334
+ | `pool_german.py` | Hugging Face datasets | `pool/german/`, `eval/neutral-de`, `eval/longctx` |
335
  | `coverage.py` | a corpus, a GGUF | vocabulary coverage report |
336
  | `crosscheck.py` | builds, eval | `eval/crosscheck.json` |
337
  | `converge.py` | imatrix checkpoints | per-tensor cosine curve |
builds/kolibri-1-moe/calib_longctx.manifest.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73e53380f3881252ca8579bb34d2b8039e3f93c3e0166168ad091f4efc02a7f6
3
+ size 7320
builds/kolibri-1-moe/calib_longctx.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c529ae516f2d859ef43bfbb1f75da571e0ab470c8a9a3de196c245a6be08f78c
3
+ size 2923094
builds/kolibri-1-moe/calib_train.manifest.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a0b71d80718fa8dcc1df91c7e6bef1a2e9b8c752358ebc3f04baa88e7911b9e
3
+ size 1651353
builds/kolibri-1-moe/calib_train.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44233be3d07a3a41cc5a4aebac201792731222142d29225bdd57c0d79f10f68f
3
+ size 20796861
builds/kolibri-1-moe/crosscheck.json ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "builds/kolibri-1-moe/calib_train.txt ^ builds/kolibri-1-moe/calib_longctx.txt": {
3
+ "shared": 20250,
4
+ "excluding_chat_template": 20250
5
+ },
6
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/agentic-kolibri/eval_agentic-kolibri.txt": {
7
+ "shared": 95,
8
+ "excluding_chat_template": 95
9
+ },
10
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/agentic/eval_agentic.txt": {
11
+ "shared": 1,
12
+ "excluding_chat_template": 1
13
+ },
14
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/code/eval_code.txt": {
15
+ "shared": 0,
16
+ "excluding_chat_template": 0
17
+ },
18
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/code/eval_code_ext.txt": {
19
+ "shared": 0,
20
+ "excluding_chat_template": 0
21
+ },
22
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/code/eval_code_full.txt": {
23
+ "shared": 0,
24
+ "excluding_chat_template": 0
25
+ },
26
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/longctx/eval_longctx.txt": {
27
+ "shared": 0,
28
+ "excluding_chat_template": 0
29
+ },
30
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/neutral-de/eval_neutral-de.txt": {
31
+ "shared": 0,
32
+ "excluding_chat_template": 0
33
+ },
34
+ "builds/kolibri-1-moe/calib_train.txt ^ eval/neutral/eval_neutral.txt": {
35
+ "shared": 0,
36
+ "excluding_chat_template": 0
37
+ },
38
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/agentic-kolibri/eval_agentic-kolibri.txt": {
39
+ "shared": 0,
40
+ "excluding_chat_template": 0
41
+ },
42
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/agentic/eval_agentic.txt": {
43
+ "shared": 0,
44
+ "excluding_chat_template": 0
45
+ },
46
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/code/eval_code.txt": {
47
+ "shared": 0,
48
+ "excluding_chat_template": 0
49
+ },
50
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/code/eval_code_ext.txt": {
51
+ "shared": 0,
52
+ "excluding_chat_template": 0
53
+ },
54
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/code/eval_code_full.txt": {
55
+ "shared": 0,
56
+ "excluding_chat_template": 0
57
+ },
58
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/longctx/eval_longctx.txt": {
59
+ "shared": 0,
60
+ "excluding_chat_template": 0
61
+ },
62
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/neutral-de/eval_neutral-de.txt": {
63
+ "shared": 0,
64
+ "excluding_chat_template": 0
65
+ },
66
+ "builds/kolibri-1-moe/calib_longctx.txt ^ eval/neutral/eval_neutral.txt": {
67
+ "shared": 0,
68
+ "excluding_chat_template": 0
69
+ },
70
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/agentic/eval_agentic.txt": {
71
+ "shared": 7536,
72
+ "excluding_chat_template": 7536
73
+ },
74
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/code/eval_code.txt": {
75
+ "shared": 0,
76
+ "excluding_chat_template": 0
77
+ },
78
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/code/eval_code_ext.txt": {
79
+ "shared": 0,
80
+ "excluding_chat_template": 0
81
+ },
82
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/code/eval_code_full.txt": {
83
+ "shared": 0,
84
+ "excluding_chat_template": 0
85
+ },
86
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/longctx/eval_longctx.txt": {
87
+ "shared": 0,
88
+ "excluding_chat_template": 0
89
+ },
90
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/neutral-de/eval_neutral-de.txt": {
91
+ "shared": 0,
92
+ "excluding_chat_template": 0
93
+ },
94
+ "eval/agentic-kolibri/eval_agentic-kolibri.txt ^ eval/neutral/eval_neutral.txt": {
95
+ "shared": 0,
96
+ "excluding_chat_template": 0
97
+ },
98
+ "eval/agentic/eval_agentic.txt ^ eval/code/eval_code.txt": {
99
+ "shared": 0,
100
+ "excluding_chat_template": 0
101
+ },
102
+ "eval/agentic/eval_agentic.txt ^ eval/code/eval_code_ext.txt": {
103
+ "shared": 0,
104
+ "excluding_chat_template": 0
105
+ },
106
+ "eval/agentic/eval_agentic.txt ^ eval/code/eval_code_full.txt": {
107
+ "shared": 0,
108
+ "excluding_chat_template": 0
109
+ },
110
+ "eval/agentic/eval_agentic.txt ^ eval/longctx/eval_longctx.txt": {
111
+ "shared": 0,
112
+ "excluding_chat_template": 0
113
+ },
114
+ "eval/agentic/eval_agentic.txt ^ eval/neutral-de/eval_neutral-de.txt": {
115
+ "shared": 0,
116
+ "excluding_chat_template": 0
117
+ },
118
+ "eval/agentic/eval_agentic.txt ^ eval/neutral/eval_neutral.txt": {
119
+ "shared": 0,
120
+ "excluding_chat_template": 0
121
+ },
122
+ "eval/code/eval_code.txt ^ eval/code/eval_code_ext.txt": {
123
+ "shared": 0,
124
+ "excluding_chat_template": 0
125
+ },
126
+ "eval/code/eval_code.txt ^ eval/code/eval_code_full.txt": {
127
+ "shared": 87918,
128
+ "excluding_chat_template": 87918
129
+ },
130
+ "eval/code/eval_code.txt ^ eval/longctx/eval_longctx.txt": {
131
+ "shared": 0,
132
+ "excluding_chat_template": 0
133
+ },
134
+ "eval/code/eval_code.txt ^ eval/neutral-de/eval_neutral-de.txt": {
135
+ "shared": 0,
136
+ "excluding_chat_template": 0
137
+ },
138
+ "eval/code/eval_code.txt ^ eval/neutral/eval_neutral.txt": {
139
+ "shared": 0,
140
+ "excluding_chat_template": 0
141
+ },
142
+ "eval/code/eval_code_ext.txt ^ eval/code/eval_code_full.txt": {
143
+ "shared": 75283,
144
+ "excluding_chat_template": 75283
145
+ },
146
+ "eval/code/eval_code_ext.txt ^ eval/longctx/eval_longctx.txt": {
147
+ "shared": 0,
148
+ "excluding_chat_template": 0
149
+ },
150
+ "eval/code/eval_code_ext.txt ^ eval/neutral-de/eval_neutral-de.txt": {
151
+ "shared": 0,
152
+ "excluding_chat_template": 0
153
+ },
154
+ "eval/code/eval_code_ext.txt ^ eval/neutral/eval_neutral.txt": {
155
+ "shared": 0,
156
+ "excluding_chat_template": 0
157
+ },
158
+ "eval/code/eval_code_full.txt ^ eval/longctx/eval_longctx.txt": {
159
+ "shared": 0,
160
+ "excluding_chat_template": 0
161
+ },
162
+ "eval/code/eval_code_full.txt ^ eval/neutral-de/eval_neutral-de.txt": {
163
+ "shared": 0,
164
+ "excluding_chat_template": 0
165
+ },
166
+ "eval/code/eval_code_full.txt ^ eval/neutral/eval_neutral.txt": {
167
+ "shared": 0,
168
+ "excluding_chat_template": 0
169
+ },
170
+ "eval/longctx/eval_longctx.txt ^ eval/neutral-de/eval_neutral-de.txt": {
171
+ "shared": 0,
172
+ "excluding_chat_template": 0
173
+ },
174
+ "eval/longctx/eval_longctx.txt ^ eval/neutral/eval_neutral.txt": {
175
+ "shared": 0,
176
+ "excluding_chat_template": 0
177
+ },
178
+ "eval/neutral-de/eval_neutral-de.txt ^ eval/neutral/eval_neutral.txt": {
179
+ "shared": 0,
180
+ "excluding_chat_template": 0
181
+ }
182
+ }
builds/kolibri-1-moe/manifest.json ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "build": "kolibri-1-moe",
3
+ "built_at": null,
4
+ "build_tool_version": "build.py/1.0",
5
+ "recipe": {
6
+ "path": "recipes/kolibri-1-moe.yaml",
7
+ "sha256": "af25f49e7e83b225b457d45d51c3fecbe9ae4f6d94bfa27e631dbdc8d905b07c",
8
+ "seed": 20261006
9
+ },
10
+ "model": {
11
+ "repo": "Aleph-Alpha/Kolibri-1-BF16",
12
+ "tokenizer": "/src/tokenizer.json",
13
+ "gguf": "/gguf/Kolibri-1-BF16.gguf",
14
+ "vocab_size": 128000,
15
+ "layers": 50,
16
+ "sliding_window": 513,
17
+ "context_length": 262144,
18
+ "llama_cpp_commit": "980aef8c8dca"
19
+ },
20
+ "tokenizer": {
21
+ "path": "/src/tokenizer.json",
22
+ "sha256": "5d4798f2a8c9d598d6dc005614216989d4b6aeffaf9f6f5e136f0ec5fc4a4c13",
23
+ "rows": 128000,
24
+ "pre_tokenizer": "llama4",
25
+ "note": "built on a laptop from this same file (sha256 above, the tokenizer.json of Aleph-Alpha/Kolibri-1-BF16@8c8b3489); paths written as the box layout"
26
+ },
27
+ "llama_cpp": {
28
+ "commit": "980aef8c8dca",
29
+ "note": "llama-imatrix must be given --parse-special or the chat markup in calib_train.txt is tokenised as literal text (parse_special defaults to false in that tool)"
30
+ },
31
+ "calib_train": {
32
+ "path": "calib_train.txt",
33
+ "sha256": "44233be3d07a3a41cc5a4aebac201792731222142d29225bdd57c0d79f10f68f",
34
+ "bytes": 20796861,
35
+ "documents": 4773,
36
+ "tokens": 5598775,
37
+ "target_tokens": 6000000,
38
+ "document_separator": "\n\n",
39
+ "shares_requested_percent": {
40
+ "agentic": 18.0,
41
+ "code": 14.0,
42
+ "german": 20.0,
43
+ "graphics": 4.0,
44
+ "longctx": 9.0,
45
+ "multilingual": 10.0,
46
+ "reasoning": 10.0,
47
+ "structured": 5.0,
48
+ "vocab_sweep": 10.0
49
+ },
50
+ "shares_actual_percent": {
51
+ "agentic": 19.29,
52
+ "code": 15.11,
53
+ "german": 21.438,
54
+ "graphics": 4.34,
55
+ "longctx": 9.984,
56
+ "multilingual": 10.736,
57
+ "reasoning": 10.719,
58
+ "structured": 3.69,
59
+ "vocab_sweep": 4.693
60
+ },
61
+ "documents_by_category": {
62
+ "agentic": 398,
63
+ "code": 523,
64
+ "german": 2055,
65
+ "graphics": 162,
66
+ "longctx": 19,
67
+ "multilingual": 107,
68
+ "reasoning": 948,
69
+ "structured": 451,
70
+ "vocab_sweep": 110
71
+ },
72
+ "tokens_by_category": {
73
+ "agentic": 1080022,
74
+ "code": 845968,
75
+ "german": 1200240,
76
+ "graphics": 242994,
77
+ "longctx": 559002,
78
+ "multilingual": 601098,
79
+ "reasoning": 600105,
80
+ "structured": 206585,
81
+ "vocab_sweep": 262761
82
+ },
83
+ "synthetic_tokens": 2011557,
84
+ "synthetic_percent": 35.929,
85
+ "document_tokens": {
86
+ "p50": 543,
87
+ "p90": 2400,
88
+ "p95": 3816,
89
+ "p99": 11295,
90
+ "max": 51740,
91
+ "min": 53
92
+ }
93
+ },
94
+ "pool_sources": {
95
+ "pool/_quarantine/eval-residue.jsonl": {
96
+ "sha256": "10c4ea316927721fc6d3c21731378491702a52cc095dba6d11c133e18a6f6112",
97
+ "bytes": 1590349,
98
+ "documents": 62
99
+ },
100
+ "pool/_quarantine/removed.jsonl": {
101
+ "sha256": "28615d8080e4b3b95a29447402e8163786c42e23e6c5175a18783a591bde13d0",
102
+ "bytes": 8600246,
103
+ "documents": 1056
104
+ },
105
+ "pool/_quarantine/untokenizable.jsonl": {
106
+ "sha256": "8226d1b281ce13ceab909c06383d78176b3cc5c2d3f1a49094ef808e3f220335",
107
+ "bytes": 88848,
108
+ "documents": 2
109
+ },
110
+ "pool/agentic/synthetic/conversations.jsonl": {
111
+ "sha256": "40478e56fdee9bf965b0e56800e3d940e772db11e856f0170d92043d86861973",
112
+ "bytes": 5641610,
113
+ "documents": 531
114
+ },
115
+ "pool/agentic/synthetic/legacy-dsv4-rendered.jsonl": {
116
+ "sha256": "24e99d36930e6547e90058654b712ae50a1294a1cdc4da7b38ae688a97537dca",
117
+ "bytes": 948845,
118
+ "documents": 50
119
+ },
120
+ "pool/code/legacy-dsv4.jsonl": {
121
+ "sha256": "5122a4eb0af1a88bc5d0ed76ad6714fe82de91fb3ca8d92f555df5207361123f",
122
+ "bytes": 472956,
123
+ "documents": 120
124
+ },
125
+ "pool/code/repos.jsonl": {
126
+ "sha256": "4024f3432de7f57a9f48442ceae1e499110fc3acd173ab1c9de754d9cfd39c4b",
127
+ "bytes": 9176959,
128
+ "documents": 832
129
+ },
130
+ "pool/german/agentic_de.jsonl": {
131
+ "sha256": "f7afba5c9872c9e69f6fc9b0e4eb72dc1e80d8eaef1c92c736636b924eb00609",
132
+ "bytes": 1230904,
133
+ "documents": 735
134
+ },
135
+ "pool/german/germanrag.jsonl": {
136
+ "sha256": "23a5c7e8d2cea57ab8e01d5c8b953b81e6eb7811f12dae4b59b8396ceebf27ba",
137
+ "bytes": 1029498,
138
+ "documents": 265
139
+ },
140
+ "pool/german/longctx.jsonl": {
141
+ "sha256": "26d9b0f152105337fad88e098dcffa7dbcae8fe3eccd8c0a35850603b485ea60",
142
+ "bytes": 2488298,
143
+ "documents": 24
144
+ },
145
+ "pool/german/oasst2.jsonl": {
146
+ "sha256": "8ca93fad0812efdc21ed2ce06123627e97f41345eda8939419bd5af9b131ac01",
147
+ "bytes": 888635,
148
+ "documents": 410
149
+ },
150
+ "pool/german/ultrachat_de.jsonl": {
151
+ "sha256": "d42ccac07f7187c1f55f4de99335be4164f3b663d4319c2c29c31f234019d280",
152
+ "bytes": 1698445,
153
+ "documents": 488
154
+ },
155
+ "pool/german/wikipedia.jsonl": {
156
+ "sha256": "f0771f38f5f42aee0ff88741b7f6188b8b3bad3f0927181f1038716374285494",
157
+ "bytes": 2291623,
158
+ "documents": 443
159
+ },
160
+ "pool/graphics/legacy-dsv4.jsonl": {
161
+ "sha256": "09e62f79a8859e2c0f275bc38b93dde63f5751660eb3e9fc8636782cb47d3689",
162
+ "bytes": 2068241,
163
+ "documents": 335
164
+ },
165
+ "pool/graphics/repos.jsonl": {
166
+ "sha256": "862600d1842bd530e65884d8bc4bfcfa8892ddd1e430a927f30d35651539b7d1",
167
+ "bytes": 6231338,
168
+ "documents": 827
169
+ },
170
+ "pool/longctx/legacy-dsv4.jsonl": {
171
+ "sha256": "1f17bf4553c25558953fd746ce3bce278e932690e02d926395f8ecf21dacc100",
172
+ "bytes": 591648,
173
+ "documents": 10
174
+ },
175
+ "pool/longctx/module-bundles.jsonl": {
176
+ "sha256": "767b0cb154af75a8e5023e948f39fb3cbef424c99ba643779c5bd3e289945bb5",
177
+ "bytes": 9837165,
178
+ "documents": 83
179
+ },
180
+ "pool/multilingual/legacy-dsv4-wikipedia.jsonl": {
181
+ "sha256": "aa0344e84c60e1c423ac543d205bad77e3c0cc475799ddcb76d4e338cbdfb266",
182
+ "bytes": 420903,
183
+ "documents": 14
184
+ },
185
+ "pool/multilingual/wikipedia.jsonl": {
186
+ "sha256": "0cd11f4e6a768439f37aa354c422eb980d161e9ac2a8dde856a2f61a362480d0",
187
+ "bytes": 12207837,
188
+ "documents": 687
189
+ },
190
+ "pool/reasoning/synthetic/conversations.jsonl": {
191
+ "sha256": "9e890645baaad2045ac87ce9a9649082ccc37bec1c3d72b1da2a5b6c92af3e2f",
192
+ "bytes": 6724419,
193
+ "documents": 3015
194
+ },
195
+ "pool/reasoning/synthetic/legacy-dsv4-rendered.jsonl": {
196
+ "sha256": "e690d0acb22a427e0b17f57ee8f255a36c5550de23775a52c9117198b02e8f95",
197
+ "bytes": 440412,
198
+ "documents": 153
199
+ },
200
+ "pool/structured/legacy-dsv4.jsonl": {
201
+ "sha256": "e0a6537986934b5418b6d711c2712728979e1019eb6ca40885429fc068e8c6d4",
202
+ "bytes": 108168,
203
+ "documents": 19
204
+ },
205
+ "pool/structured/repos.jsonl": {
206
+ "sha256": "631c8fd66fa7fc1d60fe50e257385512c77e0c1d0e1a86f88a482c29e0b2f83c",
207
+ "bytes": 1226353,
208
+ "documents": 227
209
+ },
210
+ "pool/structured/synthetic/structured-in-chat.jsonl": {
211
+ "sha256": "435a1be5a7b8bd230105b85fbe708649fb2ddef5a65198bdd808bcff1b3d1b64",
212
+ "bytes": 395812,
213
+ "documents": 207
214
+ },
215
+ "pool/vocab_sweep/synthetic/kolibri-1-moe.jsonl": {
216
+ "sha256": "3d165633bb5201090c11a63671e4f993e054cc342881007eb03b29e03d89cf27",
217
+ "bytes": 1323571,
218
+ "documents": 110
219
+ },
220
+ "pool/vocab_sweep/synthetic/legacy-dsv4-rendered.jsonl": {
221
+ "sha256": "e30414d83fc63d1a5bb293a50d174eb65385efa237111f7ae001f923a9498424",
222
+ "bytes": 745316,
223
+ "documents": 65
224
+ },
225
+ "pool/vocab_sweep/synthetic/muse-glimmer-30b.jsonl": {
226
+ "sha256": "4eb612024896df3b979fa74b92cc27ddbce56af100a14611bcfccd4ea9ce92c5",
227
+ "bytes": 2068343,
228
+ "documents": 172
229
+ },
230
+ "pool/vocab_sweep/synthetic/nemotron-3.5-lightning.jsonl": {
231
+ "sha256": "cd73220ef1ac82132a4c2b217f77af7b2eaea2c06939394fe36650221cc22a1d",
232
+ "bytes": 1269096,
233
+ "documents": 113
234
+ },
235
+ "pool/vocab_sweep/synthetic/qwen3.8-flash-next-moe.jsonl": {
236
+ "sha256": "ee4657dd2394309d06d6e6a978e020d535e0f899c0b80ca2067672889a276913",
237
+ "bytes": 2508961,
238
+ "documents": 208
239
+ }
240
+ },
241
+ "calib_longctx": {
242
+ "path": "calib_longctx.txt",
243
+ "sha256": "c529ae516f2d859ef43bfbb1f75da571e0ab470c8a9a3de196c245a6be08f78c",
244
+ "documents": 29,
245
+ "tokens": 771843,
246
+ "document_tokens": {
247
+ "min": 16617,
248
+ "p50": 26654,
249
+ "max": 32579
250
+ },
251
+ "contiguous": true
252
+ }
253
+ }
eval/agentic-kolibri/eval_agentic-kolibri.manifest.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08ebcc07b977e97fa9f31c100f448a4e431fa7b17df7dcd45b774e6cd410d077
3
+ size 53391
eval/agentic-kolibri/eval_agentic-kolibri.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f259c00a0d09895044105f72417020c870f2b0dfc35edf08a727e3deccbfff86
3
+ size 1257909
eval/agentic-kolibri/grounding.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repositories": {
3
+ "rust-regex": "72d650cb0a880a01ab6dc2137c0888e8f89740f7",
4
+ "googletest": "988ea2c1798de7779f656df2281dd36d6039a17a",
5
+ "black": "939fa93a1327d2a5f2829e6c1d7e4bd25a17b0f7",
6
+ "tokio-bytes": "7930d93d583757e922014312d4aa3e58a415131f"
7
+ },
8
+ "seed": 20261006
9
+ }
eval/longctx/eval_longctx.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4aa8085083beed1213070df87cf576f2c16cce578d53fdb80e9f562b39f3fc2f
3
+ size 1249293
eval/neutral-de/eval_neutral-de.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1dd17de80324c503a2a9a956dbcf5e4ef17267be7cbdb2813e7d59d70fac747f
3
+ size 1576922
pool/_quarantine/eval-residue.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c39046c6f682564f6a1c11bff74f014130f3f21de5595be49d0b6348be86cb9e
3
- size 1583427
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10c4ea316927721fc6d3c21731378491702a52cc095dba6d11c133e18a6f6112
3
+ size 1590349
pool/german/agentic_de.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7afba5c9872c9e69f6fc9b0e4eb72dc1e80d8eaef1c92c736636b924eb00609
3
+ size 1230904
pool/german/germanrag.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23a5c7e8d2cea57ab8e01d5c8b953b81e6eb7811f12dae4b59b8396ceebf27ba
3
+ size 1029498
pool/german/longctx.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26d9b0f152105337fad88e098dcffa7dbcae8fe3eccd8c0a35850603b485ea60
3
+ size 2488298
pool/german/oasst2.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ca93fad0812efdc21ed2ce06123627e97f41345eda8939419bd5af9b131ac01
3
+ size 888635
pool/german/ultrachat_de.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d42ccac07f7187c1f55f4de99335be4164f3b663d4319c2c29c31f234019d280
3
+ size 1698445
pool/german/wikipedia.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0771f38f5f42aee0ff88741b7f6188b8b3bad3f0927181f1038716374285494
3
+ size 2291623
pool/vocab_sweep/synthetic/kolibri-1-moe.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d165633bb5201090c11a63671e4f993e054cc342881007eb03b29e03d89cf27
3
+ size 1323571
recipes/kolibri-1-moe.yaml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Calibration recipe for Aleph-Alpha/Kolibri-1 (kolibri1), a German/English MoE.
2
+ #
3
+ # Architecture facts that matter here:
4
+ # hidden_size = 2560, moe_intermediate_size = 512, q 6144 (all %256 = 0)
5
+ # 384 routed experts, 6 active, one shared expert in every block
6
+ # ~6M * 6 / 384 = ~94k tokens per expert on average
7
+ # blocks 0 and 2 route by the balancing bias more than by the token (weight_probe.py):
8
+ # block 0 never selects 337 of 384 experts for any vocabulary token, so their zero
9
+ # counts are expected, not holes (im_report.py --expected-dead)
10
+ # four sliding-window layers (513) to one full-attention NoPE layer
11
+ # own tokenizer, 128k vocabulary, cut for German
12
+ #
13
+ # Pre-training mix: 62.5% English, 23.9% German, 13.6% code. The MoE shares of the
14
+ # Qwen recipes give German 0.62% (19 Wikipedia articles of the multilingual pool), so
15
+ # this recipe adds the category `german` (tools/pool_german.py: Wikipedia DE, OASST2,
16
+ # UltraChat DE, GermanRAG, templated tool calls in German) at 20% and takes it from
17
+ # the other shares in proportion:
18
+ # agentic 18 tool markup (English coding sessions)
19
+ # code 14
20
+ # reasoning 10
21
+ # multilingual 10 the other 29 languages
22
+ # longctx 9
23
+ # vocab_sweep 10 regenerated against THIS tokenizer
24
+ # structured 5
25
+ # graphics 4
26
+ # german 20 prose 36%, chats 38%, RAG 16%, tool calls 10% of the category
27
+ #
28
+ # chat.reasoning_effort: Kolibri's template reads reasoning_effort (none, minimal, low,
29
+ # medium, high) and renders every document at "high" when it is absent; with this switch
30
+ # each document's reasoning_strength reaches the template.
31
+
32
+ name: kolibri-1-moe
33
+
34
+ model:
35
+ repo: Aleph-Alpha/Kolibri-1-BF16
36
+ tokenizer: /src/tokenizer.json
37
+ gguf: /gguf/Kolibri-1-BF16.gguf
38
+ vocab_size: 128000
39
+ layers: 50
40
+ sliding_window: 513
41
+ context_length: 262144
42
+ llama_cpp_commit: 980aef8c8dca
43
+
44
+ seed: 20261006
45
+
46
+ chat:
47
+ format: auto
48
+ add_bos_per_document: false
49
+ reasoning_effort: true
50
+
51
+ calib_train:
52
+ target_tokens: 6000000
53
+ max_doc_fraction:
54
+ default: 0.05
55
+ longctx: 0.12
56
+ shares:
57
+ agentic: 18
58
+ code: 14
59
+ reasoning: 10
60
+ multilingual: 10
61
+ longctx: 9
62
+ vocab_sweep: 10
63
+ structured: 5
64
+ graphics: 4
65
+ german: 20
66
+
67
+ calib_longctx:
68
+ target_tokens: 750000
69
+ doc_tokens_min: 16384
70
+ doc_tokens_max: 32768
71
+ sources: [longctx, german_longctx]
72
+
73
+ notes:
74
+ imatrix: >
75
+ llama-imatrix needs --parse-special (the chat markup) and --no-escape (llama.cpp
76
+ otherwise turns literal \n, \t, \\ in code and JSON into control characters).
77
+ evals: >
78
+ eval/neutral-de and eval/longctx come from Wikipedia offsets this pool never read
79
+ (tools/pool_german.py); purge_overlap.py --whole-pool runs against them before the build.
tools/auto_fmt.py CHANGED
@@ -123,6 +123,22 @@ def _clean(messages: Sequence[dict]) -> list[dict]:
123
  return out
124
 
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  def render(messages: Sequence[dict],
127
  tools: Sequence[dict] | None = None,
128
  reasoning_strength: str | None = None,
@@ -130,20 +146,39 @@ def render(messages: Sequence[dict],
130
  current_date: Any = None, # unused, pinned via env instead
131
  namespace_descriptions: Any = None, # unused, Glimmer only
132
  add_generation_prompt: bool = False,
133
- add_bos: bool = False) -> str:
 
134
  tok = _tokenizer()
135
 
136
- # Templates that have no thinking channel simply never read this variable,
137
- # so passing it unconditionally is safe and keeps one code path.
138
- enable_thinking = str(reasoning_strength or DEFAULT_REASONING).lower() not in _NO_THINK
139
-
140
- text = tok.apply_chat_template(
141
- _clean(messages),
142
- tools=list(tools) if tools else None,
143
- enable_thinking=enable_thinking,
144
- add_generation_prompt=add_generation_prompt,
145
- tokenize=False,
146
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
  if add_bos and tok.bos_token and not text.startswith(tok.bos_token):
149
  text = tok.bos_token + text
 
123
  return out
124
 
125
 
126
+ # reasoning_strength of the pool -> the reasoning_effort values chat templates take
127
+ # (Kolibri-1: none, minimal, low, medium, high; xhigh and max read as high)
128
+ _EFFORT = {"none": "none", "off": "none", "no": "none", "disabled": "none", "low0": "none",
129
+ "minimal": "minimal", "low": "low", "medium": "medium", "high": "high", "xhigh": "high", "max": "high"}
130
+
131
+
132
+ def _flatten(messages):
133
+ out = []
134
+ for m in messages:
135
+ c = m.get("content")
136
+ if isinstance(c, list):
137
+ m = dict(m, content="".join(part.get("text", "") for part in c if isinstance(part, dict) and part.get("type") == "text"))
138
+ out.append(m)
139
+ return out
140
+
141
+
142
  def render(messages: Sequence[dict],
143
  tools: Sequence[dict] | None = None,
144
  reasoning_strength: str | None = None,
 
146
  current_date: Any = None, # unused, pinned via env instead
147
  namespace_descriptions: Any = None, # unused, Glimmer only
148
  add_generation_prompt: bool = False,
149
+ add_bos: bool = False,
150
+ reasoning_effort: bool = False) -> str:
151
  tok = _tokenizer()
152
 
153
+ # Templates that have no thinking channel simply never read these variables,
154
+ # so passing them unconditionally is safe and keeps one code path. Qwen reads
155
+ # enable_thinking, MiniMax-M3 reads thinking_mode and ignores the other.
156
+ strength = str(reasoning_strength or DEFAULT_REASONING).lower()
157
+ enable_thinking = strength not in _NO_THINK
158
+ kw = {}
159
+ # reasoning_effort is opt in (recipe chat.reasoning_effort: true): a template that reads it
160
+ # (Kolibri-1) otherwise renders every document at its default effort; builds made before it
161
+ # existed must rebuild byte for byte, and Qwen3.8's template refuses some values
162
+ if reasoning_effort:
163
+ kw["reasoning_effort"] = _EFFORT.get(strength, "high")
164
+
165
+ def apply(msgs):
166
+ return tok.apply_chat_template(
167
+ msgs,
168
+ tools=list(tools) if tools else None,
169
+ enable_thinking=enable_thinking,
170
+ thinking_mode="enabled" if enable_thinking else "disabled",
171
+ add_generation_prompt=add_generation_prompt,
172
+ tokenize=False,
173
+ **kw,
174
+ )
175
+
176
+ try:
177
+ text = apply(_clean(messages))
178
+ except TypeError:
179
+ # a text-only template (Kolibri-1) cannot take content given as a list of parts: keep the text
180
+ # parts, drop the rest. Templates that take lists never get here, so their renders do not change
181
+ text = apply(_flatten(_clean(messages)))
182
 
183
  if add_bos and tok.bos_token and not text.startswith(tok.bos_token):
184
  text = tok.bos_token + text
tools/build.py CHANGED
@@ -136,6 +136,9 @@ def make_renderer(recipe: dict):
136
  import importlib
137
  F = importlib.import_module(FORMATTERS[fmt_name])
138
 
 
 
 
139
  def render(rec: dict) -> str:
140
  prov = rec.get("provenance") or {}
141
  return F.render(
@@ -147,6 +150,7 @@ def make_renderer(recipe: dict):
147
  namespace_descriptions=prov.get("namespace_descriptions"),
148
  add_generation_prompt=False,
149
  add_bos=chat.get("add_bos_per_document", True),
 
150
  )
151
  return render
152
 
 
136
  import importlib
137
  F = importlib.import_module(FORMATTERS[fmt_name])
138
 
139
+ # chat.reasoning_effort: true (auto renderer only) passes each document's effort to the template
140
+ extra = {"reasoning_effort": True} if fmt_name == "auto" and chat.get("reasoning_effort") else {}
141
+
142
  def render(rec: dict) -> str:
143
  prov = rec.get("provenance") or {}
144
  return F.render(
 
150
  namespace_descriptions=prov.get("namespace_descriptions"),
151
  add_generation_prompt=False,
152
  add_bos=chat.get("add_bos_per_document", True),
153
+ **extra,
154
  )
155
  return render
156
 
tools/build_eval_auto.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """eval/agentic-<name>: the agentic measurement corpus in a model's own markup, through its chat template.
2
+
3
+ FOUNDRY_MODEL_DIR=/path/to/tokenizer python tools/build_eval_auto.py --name kolibri \\
4
+ --tokenizer /path/to/tokenizer.json --build builds/kolibri-1-moe --raw-eval /path/to/raw_eval
5
+
6
+ eval/agentic is rendered in Muse Glimmer markup, which is plain text to any
7
+ other tokenizer. This renders the same generator (tools/gen_agentic_eval.py:
8
+ its own tools, prompts and prose, nothing shared with the calibration agentic
9
+ slice; 120 scripted conversations and up to 900 grounded in the held-out
10
+ repositories, as build_eval.py draws them) with tools/auto_fmt.py, so the conversations carry the target's special
11
+ tokens, its tool-call format and its reasoning switch (reasoning_effort per
12
+ conversation).
13
+
14
+ Exclusion as in build_eval.py: a conversation enters only if it shares no
15
+ 13-gram with the calibration build (calib_train and calib_longctx) or with the
16
+ other eval corpora; the template's own scaffolding is subtracted first, since
17
+ it is in every conversation the model ever sees. llama-perplexity has to read
18
+ the result with --parse-special (node_base passes it when the build has it) or
19
+ the markup is scored as literal characters.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ import argparse
25
+ import glob
26
+ import json
27
+ import os
28
+ import sys
29
+ from collections import Counter
30
+
31
+ HERE = os.path.dirname(os.path.abspath(__file__))
32
+ sys.path.insert(0, HERE)
33
+ import auto_fmt as F # noqa: E402
34
+ import build_eval as BE # noqa: E402
35
+ import gen_agentic_eval as GAE # noqa: E402
36
+ import poollib as P # noqa: E402
37
+
38
+ # build_eval.py's grounding set: repositories that appear in no other file. The four scripted
39
+ # scenarios alone repeat themselves (92% duplicate lines, 0.4% of the vocabulary on Kolibri-1).
40
+ GROUNDING_REPOS = ("rust-regex", "googletest", "black", "tokio-bytes")
41
+
42
+
43
+ def grounding_pool(raw_eval):
44
+ """The held-out repository files, as build_eval.py reads them (its legacy `sources.walk_repo`)."""
45
+ import subprocess
46
+ sys.path.insert(0, os.path.join(P.REPO_ROOT, "builds", "dsv4-flash-0731", "pipeline"))
47
+ import sources as S
48
+ docs, commits = [], {}
49
+ for repo in GROUNDING_REPOS:
50
+ root = os.path.join(raw_eval, repo)
51
+ if not os.path.isdir(root):
52
+ raise SystemExit(f"missing grounding clone: {root} ({BE.EXTRA_EVAL_REPOS[repo][0]})")
53
+ commits[repo] = subprocess.run(["git", "-C", root, "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip()
54
+ url, lic = BE.EXTRA_EVAL_REPOS[repo]
55
+ for rel, lang, text in sorted(S.walk_repo(root, repo), key=lambda t: t[0]):
56
+ docs.append({"id": P.make_id(repo, rel, text), "source": repo, "path": rel, "license": lic, "lang": lang,
57
+ "origin": "repo_file", "text": text, "upstream": url})
58
+ return docs, commits
59
+
60
+
61
+ def main() -> int:
62
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
63
+ ap.add_argument("--name", required=True, help="eval/agentic-<name>")
64
+ ap.add_argument("--tokenizer", required=True)
65
+ ap.add_argument("--build", required=True, help="the calibration build this eval must not overlap")
66
+ ap.add_argument("--n", type=int, default=120, help="scripted candidate conversations")
67
+ ap.add_argument("--grounded", type=int, default=900, help="conversations grounded in held-out repository files")
68
+ ap.add_argument("--raw-eval", required=True, help="clones of the grounding repositories (tools/clone.sh)")
69
+ ap.add_argument("--seed", type=int, default=20261006)
70
+ ap.add_argument("--repo", default=P.REPO_ROOT)
71
+ a = ap.parse_args()
72
+
73
+ tok = P.TargetTokenizer(a.tokenizer)
74
+ pool, commits = grounding_pool(a.raw_eval)
75
+ convs = GAE.build(a.n, a.seed) + GAE.build_grounded(pool, min(len(pool), a.grounded), a.seed + 4)
76
+ print(f"{len(convs)} candidate conversations ({len(pool)} held-out files for grounding)")
77
+ render = lambda c: F.render(c["messages"], tools=c["tools"], reasoning_strength=c["reasoning_strength"], # noqa: E731
78
+ add_bos=False, reasoning_effort=True)
79
+ # the template's scaffolding, as build_eval subtracts it: an empty turn with every tool set used
80
+ scaffolds = {F.render([{"role": "user", "content": ""}], tools=c["tools"], reasoning_strength=lvl, reasoning_effort=True)
81
+ for c in convs for lvl in ("none", "low", "high")}
82
+ ignore = {int(x) for s in scaffolds for x in P.shingles(s, BE.NGRAM)}
83
+ excl = BE.Excluder(ignore)
84
+ for f in ("calib_train.txt", "calib_longctx.txt"):
85
+ p = os.path.join(a.build, f)
86
+ if os.path.exists(p):
87
+ excl.add_static(open(p, encoding="utf-8").read(), f)
88
+ # eval/agentic is this same generator in another model's markup: overlapping it is the point of a re-render
89
+ for p in sorted(glob.glob(os.path.join(a.repo, "eval", "*", "eval_*.txt"))):
90
+ if f"agentic-{a.name}" not in p and os.sep + os.path.join("eval", "agentic") + os.sep not in p:
91
+ excl.add_static(open(p, encoding="utf-8").read(), os.path.relpath(p, a.repo))
92
+ excl.freeze()
93
+
94
+ docs = []
95
+ for c in convs:
96
+ text = render(c)
97
+ docs.append({"id": P.make_id("eval-agentic", f"{c['scenario']}/{c['index']}", text),
98
+ "source": f"synthetic/eval-agentic:{c['scenario']}",
99
+ "path": f"eval_agentic/{c['scenario']}/{c['index']:04d}",
100
+ "license": "CC0-1.0 (generated; quoted file excerpts keep their upstream licence)",
101
+ "lang": "chat", "origin": "synth_agentic_eval", "text": text,
102
+ "grounded_in": c.get("grounded_in", ""), "reasoning_strength": c["reasoning_strength"]})
103
+ out_dir = os.path.join(a.repo, "eval", f"agentic-{a.name}")
104
+ taken, n = BE.take_until(docs, excl, tok, BE.TARGET_LO, BE.TARGET_HI, f"eval/agentic-{a.name}", allow_intra_repeat=True)
105
+ path = os.path.join(out_dir, f"eval_agentic-{a.name}.txt")
106
+ BE.write_corpus(path, taken, os.path.join(out_dir, f"eval_agentic-{a.name}.manifest.jsonl"))
107
+ with open(os.path.join(out_dir, "grounding.json"), "w") as f:
108
+ json.dump({"repositories": commits, "seed": a.seed}, f, indent=1)
109
+ print(f"{path}: {len(taken)} conversations, {n:,} tokens, {n // BE.CTX} chunks of {BE.CTX}; "
110
+ f"reasoning {dict(Counter(d['reasoning_strength'] for d, _, _ in taken))}")
111
+ return 0
112
+
113
+
114
+ if __name__ == "__main__":
115
+ sys.exit(main())
tools/pool_german.py ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """German for the pool and the held-out German evals, for a model trained on 24% German.
2
+
3
+ python tools/pool_german.py --seed 20261006 # pool/german/*.jsonl, eval/neutral-de, eval/longctx
4
+
5
+ Kolibri-1 (Aleph Alpha) was trained on 62.5% English, 23.9% German and 13.6%
6
+ code, with a tokenizer cut for German word structure. The multilingual pool
7
+ had 19 German documents of 687, 0.62% of the Flash-Next MoE build: the experts
8
+ German routes to would be calibrated on almost nothing. This collects, from
9
+ sources with a licence that allows it and nothing written by a language model
10
+ here:
11
+
12
+ german wikipedia Wikipedia DE articles (CC BY-SA 4.0), text
13
+ oasst2 OpenAssistant conversations in German (Apache-2.0), the
14
+ best-ranked reply at every turn, chat
15
+ ultrachat_de multi-turn chats (MIT), chat
16
+ germanrag question + retrieved passages -> answer (CC BY 4.0), chat
17
+ agentic_de tool-calling dialogues in German from templates: weather,
18
+ trains, calendar, invoices, file and web search, single and
19
+ parallel calls, a failed call read and corrected; chat
20
+ german_longctx long Wikipedia DE articles (16k+ tokens), for calib_longctx
21
+
22
+ and the held-out sets, drawn from offsets the pool never reads:
23
+
24
+ eval/neutral-de/eval_neutral-de.txt German Wikipedia prose, ~350k tokens
25
+ eval/longctx/eval_longctx.txt long articles (12k+ tokens), German and English, ~280k tokens:
26
+ eight chunks at -c 32768
27
+
28
+ Records go through poollib.Record (stable ids, field order). Selection is
29
+ seeded: the same seed reads the same rows. The datasets-server API serves the
30
+ rows, so nothing is cloned.
31
+ """
32
+
33
+ from __future__ import annotations
34
+
35
+ import argparse
36
+ import ast
37
+ import json
38
+ import os
39
+ import random
40
+ import sys
41
+ import time
42
+ import urllib.parse
43
+ import urllib.request
44
+
45
+ HERE = os.path.dirname(os.path.abspath(__file__))
46
+ sys.path.insert(0, HERE)
47
+ import poollib as P # noqa: E402
48
+
49
+ DS = "https://datasets-server.huggingface.co"
50
+ WIKI_DE = ("wikimedia/wikipedia", "20231101.de")
51
+ WIKI_EN = ("wikimedia/wikipedia", "20231101.en")
52
+ CHARS_PER_TOKEN = 4.4 # German prose on a German-cut tokenizer, measured on the 128k Kolibri vocabulary
53
+
54
+
55
+ def get(path, **q):
56
+ url = f"{DS}/{path}?" + urllib.parse.urlencode(q)
57
+ for i in range(6):
58
+ try:
59
+ with urllib.request.urlopen(url, timeout=120) as r:
60
+ return json.loads(r.read())
61
+ except Exception as e: # rate limits and the occasional 5xx: back off
62
+ if i == 5:
63
+ raise RuntimeError(f"{url}: {e}")
64
+ time.sleep(5 * (i + 1))
65
+
66
+
67
+ def rows(dataset, config, offset, length=100, split="train"):
68
+ return [r["row"] for r in get("rows", dataset=dataset, config=config, split=split, offset=offset, length=length)["rows"]]
69
+
70
+
71
+ def filtered(dataset, where, config="default", split="train", page=100):
72
+ out, off = [], 0
73
+ while True:
74
+ d = get("filter", dataset=dataset, config=config, split=split, where=where, offset=off, length=page)
75
+ got = [r["row"] for r in d["rows"]]
76
+ out += got
77
+ off += len(got)
78
+ if not got or off >= d.get("num_rows_total", 0):
79
+ return out
80
+
81
+
82
+ def maybe_list(v):
83
+ if isinstance(v, str):
84
+ try:
85
+ return json.loads(v)
86
+ except json.JSONDecodeError:
87
+ return ast.literal_eval(v)
88
+ return v
89
+
90
+
91
+ # ---------------------------------------------------------------- Wikipedia
92
+
93
+ def wiki_sample(config, offsets, seen):
94
+ for off in offsets:
95
+ for r in rows(*config, offset=off):
96
+ if r["id"] in seen:
97
+ continue
98
+ seen.add(r["id"])
99
+ yield r
100
+
101
+
102
+ def wiki_offsets(rng, n_total, n, avoid=()):
103
+ out = set()
104
+ while len(out) < n:
105
+ o = rng.randrange(0, n_total - 100) // 100 * 100
106
+ if all(abs(o - a) >= 100 for a in avoid):
107
+ out.add(o)
108
+ return sorted(out)
109
+
110
+
111
+ def wiki_text(r, cap=None):
112
+ """Title and text; with cap, cut at the last paragraph break before cap characters."""
113
+ text = r["text"].strip()
114
+ if cap and len(text) > cap:
115
+ cut = text.rfind("\n", 0, cap)
116
+ text = text[:cut if cut > cap // 2 else cap].rstrip()
117
+ return f"{r['title']}\n\n{text}"
118
+
119
+
120
+ def wiki_record(r, config, category, cap=None):
121
+ return P.Record(category=category, domain="multilingual" if category == "german" else "longctx",
122
+ source=f"{config[0]}:{config[1]}", license="CC-BY-SA-4.0",
123
+ license_url="https://creativecommons.org/licenses/by-sa/4.0/", path=f"wiki/de/{r['id']}",
124
+ lang="de", origin="wikipedia", text=wiki_text(r, cap),
125
+ provenance={"url": r["url"], "collector": "tools/pool_german.py"})
126
+
127
+
128
+ # ---------------------------------------------------------------- chats
129
+
130
+ OASST2_FILE = "2023-11-05_oasst2_ready.messages.jsonl.gz"
131
+
132
+
133
+ def oasst2_messages(cache):
134
+ """The German messages of the OASST2 release file (the datasets-server filter answers 500 on it)."""
135
+ import gzip
136
+ path = os.path.join(cache, OASST2_FILE)
137
+ if not os.path.exists(path):
138
+ os.makedirs(cache, exist_ok=True)
139
+ urllib.request.urlretrieve(f"https://huggingface.co/datasets/OpenAssistant/oasst2/resolve/main/{OASST2_FILE}", path)
140
+ with gzip.open(path, "rt", encoding="utf-8") as f:
141
+ for line in f:
142
+ m = json.loads(line)
143
+ if m.get("lang") == "de":
144
+ yield m
145
+
146
+
147
+ def oasst2_threads(cache):
148
+ msgs = [m for m in oasst2_messages(cache)
149
+ if str(m.get("deleted")) != "True" and str(m.get("review_result")) != "False"]
150
+ by_id = {m["message_id"]: m for m in msgs}
151
+ kids = {}
152
+ for m in msgs:
153
+ kids.setdefault(m["parent_id"], []).append(m)
154
+
155
+ def rank(m):
156
+ r = m.get("rank")
157
+ return int(r) if r not in (None, "None", "") else 99
158
+
159
+ for root in (m for m in msgs if m["parent_id"] in (None, "None") and m["role"] == "prompter"):
160
+ path, cur = [root], root
161
+ while kids.get(cur["message_id"]):
162
+ cur = sorted(kids[cur["message_id"]], key=rank)[0]
163
+ path.append(cur)
164
+ if len(path) < 2:
165
+ continue
166
+ if path[-1]["role"] == "prompter":
167
+ path = path[:-1]
168
+ yield root["message_tree_id"], [{"role": "user" if m["role"] == "prompter" else "assistant",
169
+ "content": m["text"]} for m in path if m["message_id"] in by_id]
170
+
171
+
172
+ def chat_record(source, lic, url, path, messages, origin, strength="none", tools=None):
173
+ return P.Record(category="german", domain="chat", source=source, license=lic, license_url=url, path=path,
174
+ lang="de", origin=origin, render="chat", messages=messages, tools=tools,
175
+ reasoning_strength=strength, provenance={"collector": "tools/pool_german.py"})
176
+
177
+
178
+ def ultrachat_records():
179
+ total = get("size", dataset="bjoernp/ultrachat_de")["size"]["dataset"]["num_rows"]
180
+ for off in range(0, total, 100):
181
+ for r in rows("bjoernp/ultrachat_de", "default", off):
182
+ conv = maybe_list(r["conversations"])
183
+ role = {"system": "system", "human": "user", "gpt": "assistant"}
184
+ msgs = [{"role": role[c["from"]], "content": c["value"]} for c in conv if c.get("from") in role]
185
+ if len(msgs) >= 2 and msgs[-1]["role"] == "assistant":
186
+ yield chat_record("bjoernp/ultrachat_de", "MIT", "https://opensource.org/licenses/MIT",
187
+ f"ultrachat_de/{r['prompt_id'][:16]}", msgs, "ultrachat_de")
188
+
189
+
190
+ def germanrag_records(rng):
191
+ total = get("size", dataset="DiscoResearch/germanrag")["size"]["dataset"]["num_rows"]
192
+ for off in range(0, total, 100):
193
+ for i, r in enumerate(rows("DiscoResearch/germanrag", "default", off)):
194
+ ctx = maybe_list(r["contexts"])
195
+ docs = "\n\n".join(f"Dokument {k + 1}:\n{c}" for k, c in enumerate(ctx))
196
+ msgs = [{"role": "system", "content": "Beantworte die Frage ausschließlich anhand der Dokumente. "
197
+ "Wenn sie die Antwort nicht enthalten, sag das."},
198
+ {"role": "user", "content": f"{docs}\n\nFrage: {r['question']}"},
199
+ {"role": "assistant", "content": r["answer"]}]
200
+ yield chat_record("DiscoResearch/germanrag", "CC-BY-4.0", "https://creativecommons.org/licenses/by/4.0/",
201
+ f"germanrag/{off + i}", msgs, "germanrag", strength=rng.choice(["none", "low", "medium"]))
202
+
203
+
204
+ # ---------------------------------------------------------------- agentic, from templates
205
+
206
+ CITIES = ["Berlin", "München", "Hamburg", "Köln", "Frankfurt am Main", "Stuttgart", "Leipzig", "Dresden", "Nürnberg",
207
+ "Hannover", "Bremen", "Düsseldorf", "Freiburg im Breisgau", "Heidelberg", "Wien", "Graz", "Zürich", "Basel"]
208
+ TOOLS = {
209
+ "wetter": {"type": "function", "function": {"name": "wetter_abfragen", "description": "Aktuelles Wetter und Vorhersage für einen Ort",
210
+ "parameters": {"type": "object", "properties": {"ort": {"type": "string"}, "tage": {"type": "integer", "description": "Vorhersage in Tagen, 0 = heute"},
211
+ "einheit": {"type": "string", "enum": ["celsius", "fahrenheit"]}}, "required": ["ort"]}}},
212
+ "bahn": {"type": "function", "function": {"name": "verbindung_suchen", "description": "Zugverbindungen zwischen zwei Bahnhöfen",
213
+ "parameters": {"type": "object", "properties": {"von": {"type": "string"}, "nach": {"type": "string"}, "datum": {"type": "string", "description": "JJJJ-MM-TT"},
214
+ "abfahrt_ab": {"type": "string", "description": "HH:MM"}, "nur_direkt": {"type": "boolean"}}, "required": ["von", "nach", "datum"]}}},
215
+ "termin": {"type": "function", "function": {"name": "termin_anlegen", "description": "Legt einen Termin im Kalender an",
216
+ "parameters": {"type": "object", "properties": {"titel": {"type": "string"}, "beginn": {"type": "string", "description": "ISO 8601"},
217
+ "dauer_minuten": {"type": "integer"}, "teilnehmer": {"type": "array", "items": {"type": "string"}},
218
+ "ort": {"type": "string"}}, "required": ["titel", "beginn"]}}},
219
+ "rechnung": {"type": "function", "function": {"name": "rechnung_berechnen", "description": "Summe, Mehrwertsteuer und Gesamtbetrag einer Rechnung",
220
+ "parameters": {"type": "object", "properties": {"positionen": {"type": "array", "items": {"type": "object", "properties": {
221
+ "bezeichnung": {"type": "string"}, "menge": {"type": "number"}, "einzelpreis": {"type": "number"}}}},
222
+ "mwst_satz": {"type": "number", "description": "z. B. 19 oder 7"}}, "required": ["positionen", "mwst_satz"]}}},
223
+ "dateien": {"type": "function", "function": {"name": "dateien_suchen", "description": "Sucht Dateien im Projektordner nach Name oder Inhalt",
224
+ "parameters": {"type": "object", "properties": {"muster": {"type": "string"}, "pfad": {"type": "string"}, "inhalt": {"type": "boolean"}}, "required": ["muster"]}}},
225
+ "suche": {"type": "function", "function": {"name": "websuche", "description": "Websuche, liefert Titel, Ausschnitt und Adresse",
226
+ "parameters": {"type": "object", "properties": {"anfrage": {"type": "string"}, "anzahl": {"type": "integer"}, "sprache": {"type": "string"}}, "required": ["anfrage"]}}},
227
+ }
228
+
229
+
230
+ def _call(i, name, args):
231
+ return {"id": f"call_{i:03d}", "type": "function", "function": {"name": name, "arguments": args}}
232
+
233
+
234
+ def agentic_de(rng, n):
235
+ for k in range(n):
236
+ kind = rng.choice(["wetter2", "bahn", "termin", "rechnung", "dateien_fehler", "suche"])
237
+ day = rng.randint(1, 28)
238
+ month = rng.randint(1, 12)
239
+ if kind == "wetter2":
240
+ a, b = rng.sample(CITIES, 2)
241
+ t = rng.choice([0, 1, 2])
242
+ calls = [_call(1, "wetter_abfragen", {"ort": a, "tage": t}), _call(2, "wetter_abfragen", {"ort": b, "tage": t})]
243
+ ta, tb = rng.randint(-3, 31), rng.randint(-3, 31)
244
+ res = [{"ort": a, "temperatur": ta, "lage": rng.choice(["sonnig", "bewölkt", "Regen", "Schauer"])},
245
+ {"ort": b, "temperatur": tb, "lage": rng.choice(["sonnig", "bewölkt", "Regen", "Nebel"])}]
246
+ ask = f"Wie wird das Wetter {['heute', 'morgen', 'übermorgen'][t]} in {a} und in {b}? Wo ist es wärmer?"
247
+ ans = f"In {a} werden {ta} °C erwartet ({res[0]['lage']}), in {b} {tb} °C ({res[1]['lage']}). " + \
248
+ (f"{a} ist wärmer." if ta > tb else f"{b} ist wärmer." if tb > ta else "Beide Orte sind gleich warm.")
249
+ tools = [TOOLS["wetter"]]
250
+ elif kind == "bahn":
251
+ a, b = rng.sample(CITIES[:14], 2)
252
+ hh = rng.randint(5, 21)
253
+ calls = [_call(1, "verbindung_suchen", {"von": a, "nach": b, "datum": f"2026-{month:02d}-{day:02d}",
254
+ "abfahrt_ab": f"{hh:02d}:00", "nur_direkt": rng.random() < 0.3})]
255
+ dur = rng.randint(60, 420)
256
+ res = [{"verbindungen": [{"abfahrt": f"{hh:02d}:{m:02d}", "dauer_minuten": dur + d, "umstiege": u}
257
+ for m, d, u in ((rng.randint(0, 59), 0, rng.randint(0, 2)), (rng.randint(0, 59), rng.randint(5, 40), 1))]}]
258
+ ask = f"Ich muss am {day}.{month}. von {a} nach {b}, frühestens um {hh} Uhr. Was gibt es?"
259
+ v = res[0]["verbindungen"][0]
260
+ ans = f"Die erste passende Verbindung fährt um {v['abfahrt']} und braucht {v['dauer_minuten'] // 60} Stunden " \
261
+ f"{v['dauer_minuten'] % 60} Minuten mit {v['umstiege']} Umstieg(en)."
262
+ tools = [TOOLS["bahn"], TOOLS["wetter"]]
263
+ elif kind == "termin":
264
+ who = rng.sample(["Anna", "Jonas", "Leonie", "Mehmet", "Sophie", "Lukas", "Fatima", "Paul"], rng.randint(1, 3))
265
+ hh = rng.randint(8, 17)
266
+ calls = [_call(1, "termin_anlegen", {"titel": rng.choice(["Projektbesprechung", "Quartalsplanung", "Arzttermin", "Kundengespräch"]),
267
+ "beginn": f"2026-{month:02d}-{day:02d}T{hh:02d}:30:00", "dauer_minuten": rng.choice([30, 45, 60, 90]),
268
+ "teilnehmer": who})]
269
+ res = [{"status": "angelegt", "id": f"evt-{rng.randint(1000, 9999)}"}]
270
+ ask = f"Trag mir bitte am {day}.{month}. um {hh}:30 einen Termin mit {', '.join(who)} ein, Titel {calls[0]['function']['arguments']['titel']}."
271
+ ans = f"Erledigt: Der Termin steht am {day}.{month}. um {hh}:30 im Kalender (ID {res[0]['id']})."
272
+ tools = [TOOLS["termin"]]
273
+ elif kind == "rechnung":
274
+ pos = [{"bezeichnung": rng.choice(["Beratung", "Lizenz", "Wartung", "Schulung", "Material"]),
275
+ "menge": rng.randint(1, 12), "einzelpreis": round(rng.uniform(20, 400), 2)} for _ in range(rng.randint(2, 4))]
276
+ satz = rng.choice([19, 7])
277
+ netto = round(sum(p["menge"] * p["einzelpreis"] for p in pos), 2)
278
+ calls = [_call(1, "rechnung_berechnen", {"positionen": pos, "mwst_satz": satz})]
279
+ res = [{"netto": netto, "mwst": round(netto * satz / 100, 2), "brutto": round(netto * (1 + satz / 100), 2)}]
280
+ ask = "Rechne mir bitte diese Rechnung aus: " + "; ".join(f"{p['menge']}× {p['bezeichnung']} zu {p['einzelpreis']:.2f} €" for p in pos) + f", {satz} % MwSt."
281
+ ans = f"Netto {netto:.2f} €, MwSt. {res[0]['mwst']:.2f} €, brutto {res[0]['brutto']:.2f} €."
282
+ tools = [TOOLS["rechnung"]]
283
+ elif kind == "dateien_fehler":
284
+ name = rng.choice(["konfiguration", "rechnung", "bericht", "export"])
285
+ calls = [_call(1, "dateien_suchen", {"muster": f"{name}*.yml", "pfad": "/projekt/einstellungen"})]
286
+ res = [{"fehler": "Pfad existiert nicht", "pfad": "/projekt/einstellungen"}]
287
+ calls2 = [_call(2, "dateien_suchen", {"muster": f"{name}*.yml", "pfad": "/projekt/config"})]
288
+ res2 = [{"treffer": [f"/projekt/config/{name}.yml", f"/projekt/config/{name}_alt.yml"]}]
289
+ ask = f"Wo liegt bei uns die {name}-Datei im YAML-Format?"
290
+ ans = f"Der Ordner /projekt/einstellungen existiert nicht; unter /projekt/config liegen {name}.yml und {name}_alt.yml."
291
+ tools = [TOOLS["dateien"]]
292
+ msgs = [{"role": "user", "content": ask},
293
+ {"role": "assistant", "content": "", "tool_calls": calls},
294
+ {"role": "tool", "tool_call_id": "call_001", "content": json.dumps(res[0], ensure_ascii=False)},
295
+ {"role": "assistant", "content": "", "tool_calls": calls2},
296
+ {"role": "tool", "tool_call_id": "call_002", "content": json.dumps(res2[0], ensure_ascii=False)},
297
+ {"role": "assistant", "content": ans}]
298
+ yield chat_record("synthetic/agentic_de", "CC0-1.0 (generated)", "", f"agentic_de/{kind}/{k}", msgs,
299
+ "synth_agentic_de", rng.choice(["none", "low", "medium"]), tools)
300
+ continue
301
+ else:
302
+ q = rng.choice(["Öffnungszeiten Pergamonmuseum", "Rentenerhöhung 2026", "Fahrradstraße Regeln", "Grundsteuerreform Frist"])
303
+ calls = [_call(1, "websuche", {"anfrage": q, "anzahl": 3, "sprache": "de"})]
304
+ res = [{"ergebnisse": [{"titel": f"{q} – Überblick", "ausschnitt": f"Aktuelle Informationen zu {q}.", "adresse": "https://example.org/a"}]}]
305
+ ask = f"Such mir bitte etwas zu: {q}."
306
+ ans = f"Ich habe einen Überblick gefunden: „{q} – Überblick“ (https://example.org/a)."
307
+ tools = [TOOLS["suche"]]
308
+ msgs = [{"role": "user", "content": ask}, {"role": "assistant", "content": "", "tool_calls": calls}]
309
+ msgs += [{"role": "tool", "tool_call_id": c["id"], "content": json.dumps(r, ensure_ascii=False)} for c, r in zip(calls, res)]
310
+ msgs.append({"role": "assistant", "content": ans})
311
+ yield chat_record("synthetic/agentic_de", "CC0-1.0 (generated)", "", f"agentic_de/{kind}/{k}", msgs,
312
+ "synth_agentic_de", rng.choice(["none", "low", "medium"]), tools)
313
+
314
+
315
+ # ---------------------------------------------------------------- main
316
+
317
+ def take(gen, chars):
318
+ out, got = [], 0
319
+ for rec in gen:
320
+ if got >= chars:
321
+ break
322
+ out.append(rec)
323
+ got += len(rec.text or json.dumps(rec.messages, ensure_ascii=False))
324
+ return out, got
325
+
326
+
327
+ def main() -> int:
328
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
329
+ ap.add_argument("--seed", type=int, default=20261006)
330
+ ap.add_argument("--tokens", type=int, default=1_250_000, help="German tokens for the pool (category german)")
331
+ ap.add_argument("--eval-tokens", type=int, default=350_000)
332
+ ap.add_argument("--repo", default=P.REPO_ROOT)
333
+ a = ap.parse_args()
334
+ rng = random.Random(a.seed)
335
+ out = os.path.join(a.repo, "pool", "german")
336
+ os.makedirs(out, exist_ok=True)
337
+ budget = {"wikipedia": 0.36, "ultrachat_de": 0.26, "germanrag": 0.16, "oasst2": 0.12, "agentic_de": 0.10}
338
+ chars = {k: int(v * a.tokens * CHARS_PER_TOKEN) for k, v in budget.items()}
339
+
340
+ n_de = get("size", dataset=WIKI_DE[0], config=WIKI_DE[1])["size"]["config"]["num_rows"]
341
+ pool_off = wiki_offsets(rng, n_de, 120)
342
+ eval_off = wiki_offsets(random.Random(a.seed + 1), n_de, 60, avoid=pool_off)
343
+ seen = set()
344
+
345
+ # pool: Wikipedia DE, long articles to german_longctx
346
+ wiki, longs, got = [], [], 0
347
+ for r in wiki_sample(WIKI_DE, pool_off, seen):
348
+ n = len(r["text"])
349
+ if n >= 16000 * CHARS_PER_TOKEN and len(longs) < 24:
350
+ longs.append(wiki_record(r, WIKI_DE, "german_longctx"))
351
+ elif n >= 800 and got < chars["wikipedia"]:
352
+ # many articles, each cut at ~6000 characters: expert coverage wants breadth, not depth
353
+ rec = wiki_record(r, WIKI_DE, "german", cap=6000)
354
+ wiki.append(rec)
355
+ got += len(rec.text)
356
+ print(f"wikipedia: {len(wiki)} articles, {got:,} chars; long: {len(longs)}")
357
+ P.write_jsonl(os.path.join(out, "wikipedia.jsonl"), wiki)
358
+ P.write_jsonl(os.path.join(a.repo, "pool", "german", "longctx.jsonl"), longs)
359
+
360
+ for name, gen in (("ultrachat_de", ultrachat_records()), ("germanrag", germanrag_records(rng)),
361
+ ("oasst2", (chat_record("OpenAssistant/oasst2", "Apache-2.0", "https://www.apache.org/licenses/LICENSE-2.0",
362
+ f"oasst2/{tid}", m, "oasst2") for tid, m in oasst2_threads(os.path.join(a.repo, ".cache")))),
363
+ ("agentic_de", agentic_de(rng, 2000))):
364
+ recs, got = take(gen, chars[name])
365
+ P.write_jsonl(os.path.join(out, f"{name}.jsonl"), recs)
366
+ print(f"{name}: {len(recs)} records, {got:,} chars")
367
+
368
+ # eval: German prose from offsets the pool never read
369
+ ev, got = [], 0
370
+ for r in wiki_sample(WIKI_DE, eval_off, seen):
371
+ if 3000 <= len(r["text"]) <= 60000:
372
+ ev.append(wiki_text(r))
373
+ got += len(r["text"])
374
+ if got >= a.eval_tokens * CHARS_PER_TOKEN:
375
+ break
376
+ d = os.path.join(a.repo, "eval", "neutral-de")
377
+ os.makedirs(d, exist_ok=True)
378
+ with open(os.path.join(d, "eval_neutral-de.txt"), "w", encoding="utf-8", newline="") as f:
379
+ f.write("\n\n".join(ev) + "\n")
380
+ print(f"eval/neutral-de: {len(ev)} articles, {got:,} chars")
381
+
382
+ # eval: long articles, German then English, ~140k tokens each, from their own offsets
383
+ lo = []
384
+ for config, off_seed, cpt in ((WIKI_DE, a.seed + 2, CHARS_PER_TOKEN), (WIKI_EN, a.seed + 3, 4.0)):
385
+ n_total = get("size", dataset=config[0], config=config[1])["size"]["config"]["num_rows"]
386
+ got = 0
387
+ for r in wiki_sample(config, wiki_offsets(random.Random(off_seed), n_total, 300), seen):
388
+ if len(r["text"]) >= 12000 * cpt:
389
+ lo.append(wiki_text(r))
390
+ got += len(r["text"]) / cpt
391
+ if got >= 140_000:
392
+ break
393
+ print(f"eval/longctx {config[1]}: {got:,.0f} tokens")
394
+ d = os.path.join(a.repo, "eval", "longctx")
395
+ os.makedirs(d, exist_ok=True)
396
+ with open(os.path.join(d, "eval_longctx.txt"), "w", encoding="utf-8", newline="") as f:
397
+ f.write("\n\n".join(lo) + "\n")
398
+ print(f"eval/longctx: {len(lo)} documents")
399
+ return 0
400
+
401
+
402
+ if __name__ == "__main__":
403
+ sys.exit(main())
tools/poollib.py CHANGED
@@ -55,6 +55,8 @@ CATEGORIES = (
55
  "vocab_sweep",
56
  "structured",
57
  "graphics",
 
 
58
  "unsorted",
59
  )
60
 
 
55
  "vocab_sweep",
56
  "structured",
57
  "graphics",
58
+ "german", # Kolibri-1: German of every kind (tools/pool_german.py)
59
+ "german_longctx", # long German articles, for calib_longctx sources
60
  "unsorted",
61
  )
62