webxos commited on
Commit
c8fc8e3
·
verified ·
1 Parent(s): 08be8d8

Upload 14 files

Browse files
Files changed (14) hide show
  1. LICENSE +15 -0
  2. README.md +114 -54
  3. config.json +46 -0
  4. knowledge_graph.json +0 -0
  5. model.json +743 -0
  6. requirements.txt +4 -0
  7. run.sh +10 -0
  8. test.py +120 -0
  9. test.sh +45 -0
  10. test_readme.md +56 -0
  11. to_parquet.py +50 -0
  12. tokenizer_config.json +10 -0
  13. training_logs.json +122 -0
  14. vocab.json +29 -0
LICENSE ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
README.md CHANGED
@@ -1,59 +1,119 @@
1
  ---
2
- license: mit
3
  language:
4
- - en
5
- pipeline_tag: text-generation
6
- library_name: transformers.js
7
  tags:
8
- - text-generation-inference
9
- - distillation
10
- - grpo
11
- - vae
12
- - pytorch
13
- - agent
14
- - education
15
- - SLM
16
- - small
17
- - tiny
18
- - smol
19
- - distilled
20
- - micro
21
- - study
22
- - testing
23
- - blackbox
24
- - offline
25
- - localdb
26
  ---
27
 
28
- <div style="
29
- background: #00FF00;
30
- border-left: 4px solid #00FF00;
31
- padding: 1.5rem;
32
- margin: 2rem 0;
33
- font-family: 'Fira Code', 'Courier New', monospace;
34
- color: #00FF00;
35
- border-radius: 0 8px 8px 0;
36
- ">
37
- <pre style="
38
- font-size: 8px;
39
- line-height: 1.2;
40
- margin: 0;
41
- overflow-x: auto;
42
- color: #00FF00;
43
- ">
44
- ::: ::: ::::::::::: :::::::: ::::::::: :::::::: :::::::::
45
- :+:+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
46
- +:+ +:+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ |:| +:+
47
- +#+ +:+ +#+ +#+ +#+ +#++:++#: +#+ +:+ |#| +:+
48
- +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ |#| +#+
49
- ### ### ### ### ### ### ### ### ### ### ###
50
- ### ### ########### ######## ### ### ######## #########
51
- </div>
52
-
53
- # MICROD ALPHA VERSION UNDER TESTING AND DEVELOPMENT:
54
- This model was made with the 'Micro Distillery'
55
-
56
-
57
-
58
- ## Model Description
59
- UNDER DEVELOPMENT: MAJOR UPDATE UI FIX
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
2
  language:
3
+ - en
4
+ license: apache-2.0
 
5
  tags:
6
+ - micro-distillery
7
+ - bigram
8
+ - grpo
9
+ - vae
10
+ - distilled
11
+ - smollm2
12
+ - qwen2.5
13
+ - olmo
14
+ - tinyllama
15
+ library_name: micro-distillery
 
 
 
 
 
 
 
 
16
  ---
17
 
18
+ # Micro Distillery — Bigram Distilled Model
19
+
20
+ This model was trained from scratch using a combination of:
21
+
22
+ - **GRPO** (Group Relative Policy Optimization) for character-level trajectory training
23
+ - **VAE filtering** to keep only high-quality trajectories
24
+ - **4x quantum harmonic oscillator** superposition for deterministic seeding
25
+
26
+ It is a compact character-level bigram model - no transformer weights,
27
+ just transition probabilities. Runs on any machine with Python 3.8+.
28
+
29
+ ## Reference Architectures
30
+
31
+ The bundle metadata references these modern (2025-2026) open models as
32
+ inspiration sources. The actual model is a distilled bigram - not a
33
+ transformer checkpoint - and does not load via `AutoModelForCausalLM`.
34
+
35
+ - [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M) (HuggingFaceTB)
36
+ - [Qwen2.5-0.5B](https://huggingface.co/Qwen/Qwen2.5-0.5B) (Qwen)
37
+ - [OLMo-2-1B](https://huggingface.co/allenai/OLMo-2-0425-1B) (AllenAI)
38
+ - [TinyLlama-1.1B](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) (TinyLlama)
39
+
40
+ ## Model Details
41
+
42
+ - **Format**: micro-distill-bigram-v1
43
+ - **Version**: 3.1.1
44
+ - **Reference arch**: tiny-bigram
45
+ - **Vocab size**: 27 tokens
46
+ - **Transition states**: 27
47
+ - **Harmonic seed**: 1251963776
48
+ - **Created**: 2026-10-23T14:02:10.625Z
49
+
50
+ ## Quick Start
51
+
52
+ ```bash
53
+ # 1. Extract the bundle
54
+ unzip micro-distillery-*.zip
55
+ cd micro-distillery-*
56
+
57
+ # 2. Run the test harness
58
+ chmod +x test.sh run.sh
59
+ ./test.sh
60
+
61
+ # 3. Or chat directly
62
+ python3 test.py
63
+ ```
64
+
65
+ ## Files in the Bundle
66
+
67
+ | File | Description |
68
+ |------|-------------|
69
+ | `model.json` | The trained bigram model (all weights) |
70
+ | `config.json` | HuggingFace-style metadata config |
71
+ | `vocab.json` | Character vocabulary |
72
+ | `tokenizer_config.json` | Tokenizer metadata |
73
+ | `knowledge_graph.json` | 2D graph used to seed the model |
74
+ | `training_logs.json` | Metrics + quantum measurements |
75
+ | `test.py` | Interactive chat wrapper |
76
+ | `test.sh` | Test harness |
77
+ | `test_readme.md` | Testing instructions |
78
+ | `run.sh` | Minimal launcher |
79
+ | `to_parquet.py` | Convert to parquet |
80
+ | `diagrams/pipeline.svg` | Training pipeline diagram |
81
+ | `diagrams/architecture.svg` | Model architecture diagram |
82
+
83
+ ## Training Pipeline
84
+
85
+ 1. **Fetch** - pulls corpora and model cards from HuggingFace + GitHub (2026 open sources)
86
+ 2. **Knowledge graph** - builds a character-transition graph, laid out in 2D
87
+ 3. **Seed** - initializes bigram transition counts from the corpus
88
+ 4. **GRPO** - samples trajectories, scores with a name heuristic, boosts high-advantage transitions
89
+ 5. **VAE filter** - retains only high-probability trajectories
90
+ 6. **Quantum seed** - 4 harmonic oscillators (w = 1, phi, 2, pi) collapse to a deterministic seed
91
+ 7. **Export** - produces a HuggingFace-ready .zip bundle
92
+
93
+ ## Uploading to Hugging Face
94
+
95
+ The bundle is structured so you can upload it directly to a HF repo:
96
+
97
+ ```bash
98
+ pip install huggingface_hub
99
+ huggingface-cli login
100
+ huggingface-cli upload your-username/micro-distillery-bigram . --repo-type model
101
+ ```
102
+
103
+ The `model.json` file is not a transformer checkpoint - use `test.py` to run it.
104
+ `config.json` is provided for HF metadata and Datasets viewer compatibility.
105
+
106
+ ## Data Sources
107
+
108
+ This bundle was produced by fetching from these free, open endpoints:
109
+
110
+ - `raw.githubusercontent.com/karpathy/makemore/master/names.txt` (training corpus)
111
+ - `huggingface.co/api/models?search=smollm2` (model reference list)
112
+ - `huggingface.co/api/models?search=qwen2.5-0.5b` (model reference list)
113
+ - `huggingface.co/HuggingFaceTB/SmolLM2-135M/raw/main/README.md` (model card)
114
+ - `huggingface.co/allenai/OLMo-2-0425-1B/raw/main/README.md` (model card)
115
+ - `api.github.com/repos/karpathy/makemore` (repo metadata)
116
+
117
+ ## License
118
+
119
+ Apache 2.0
config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MicroDistilleryBigramForCausalLM"
4
+ ],
5
+ "model_type": "custom",
6
+ "custom_model_type": "micro-distillery-bigram",
7
+ "vocab_size": 256,
8
+ "max_position_embeddings": 1024,
9
+ "hidden_size": 512,
10
+ "num_hidden_layers": 0,
11
+ "num_attention_heads": 0,
12
+ "intermediate_size": 0,
13
+ "activation_function": "gelu_new",
14
+ "layer_norm_epsilon": 0.00001,
15
+ "use_cache": true,
16
+ "bos_token_id": 0,
17
+ "eos_token_id": 1,
18
+ "transformers_version": "4.44.0",
19
+ "library_name": "micro-distillery",
20
+ "micro_distillery": {
21
+ "format": "bigram-distilled",
22
+ "dialect": "character-level",
23
+ "reference_arch": "tiny-bigram",
24
+ "distill_from": [
25
+ "smollm2-135m",
26
+ "qwen2.5-0.5b",
27
+ "olmo2-1b",
28
+ "tinyllama-1.1b"
29
+ ],
30
+ "harmonic_seed": 1251963776,
31
+ "harmonic_frequencies": [
32
+ 1,
33
+ 1.618033988749895,
34
+ 2,
35
+ 3.141592653589793
36
+ ],
37
+ "grpo_config": {
38
+ "group_size": 8,
39
+ "kl_penalty": 0.1
40
+ },
41
+ "vae_config": {
42
+ "latent_dim": 32,
43
+ "filter_threshold": 0.7
44
+ }
45
+ }
46
+ }
knowledge_graph.json ADDED
The diff for this file is too large to render. See raw diff
 
model.json ADDED
@@ -0,0 +1,743 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "micro-distill-bigram-v1",
3
+ "version": "3.1.1",
4
+ "arch": "tiny-bigram",
5
+ "created": "2026-10-23T14:02:10.625Z",
6
+ "bos_token": "<|endoftext|>",
7
+ "eos_token": "<|endoftext|>",
8
+ "vocab": [
9
+ "e",
10
+ "m",
11
+ "a",
12
+ "<|endoftext|>",
13
+ "o",
14
+ "l",
15
+ "i",
16
+ "v",
17
+ "s",
18
+ "b",
19
+ "p",
20
+ "h",
21
+ "c",
22
+ "r",
23
+ "t",
24
+ "y",
25
+ "n",
26
+ "g",
27
+ "z",
28
+ "f",
29
+ "d",
30
+ "u",
31
+ "k",
32
+ "w",
33
+ "q",
34
+ "x",
35
+ "j"
36
+ ],
37
+ "transitions": {
38
+ "<|endoftext|>": {
39
+ "e": 0.02632925453799971,
40
+ "o": 0.0055529585839044155,
41
+ "a": 0.11138837036057227,
42
+ "i": 0.007983519455344637,
43
+ "s": 0.07144111253849553,
44
+ "c": 0.02960376873881103,
45
+ "m": 0.07239315373685744,
46
+ "h": 0.01400079581594919,
47
+ "v": 0.005478716091718827,
48
+ "l": 0.03085103781853533,
49
+ "g": 0.009421277677131207,
50
+ "p": 0.0071976899824217275,
51
+ "r": 0.030937817022350572,
52
+ "z": 0.015179045455648193,
53
+ "n": 0.016386437148535823,
54
+ "b": 0.024423926783632,
55
+ "k": 0.24593286467148892,
56
+ "w": 0.00446403150807165,
57
+ "q": 0.0011926482438765309,
58
+ "j": 0.19095148992066813,
59
+ "d": 0.03682044625399203,
60
+ "x": 0.0018051199278446592,
61
+ "t": 0.02315596816816066,
62
+ "f": 0.0066636407815420014,
63
+ "y": 0.009433750482725847,
64
+ "u": 0.001011158293721407
65
+ },
66
+ "e": {
67
+ "m": 0.031935808204561794,
68
+ "l": 0.21245097346593414,
69
+ "<|endoftext|>": 0.13953926566356842,
70
+ "r": 0.09323388494850188,
71
+ "v": 0.017899450582351324,
72
+ "t": 0.02733238639247131,
73
+ "n": 0.18302794825587526,
74
+ "y": 0.050928133629114976,
75
+ "a": 0.027033283616821422,
76
+ "s": 0.04627188312600912,
77
+ "d": 0.01458369428592689,
78
+ "h": 0.005325123871670196,
79
+ "x": 0.004624449678029383,
80
+ "p": 0.002907797903609386,
81
+ "e": 0.05670244867056299,
82
+ "i": 0.039584193086533354,
83
+ "c": 0.00536015758135224,
84
+ "b": 0.004239078871526933,
85
+ "o": 0.009863070053639502,
86
+ "g": 0.004585682404378634,
87
+ "j": 0.001926854032512244,
88
+ "k": 0.0064344511989443305,
89
+ "w": 0.0017516854841020384,
90
+ "z": 0.006574489229040662,
91
+ "f": 0.002976007859352247,
92
+ "u": 0.0024173259680608144,
93
+ "q": 0.000490471935548571
94
+ },
95
+ "m": {
96
+ "m": 0.014593156867118595,
97
+ "a": 0.6213252589356665,
98
+ "i": 0.12774728918880585,
99
+ "e": 0.07677280161679566,
100
+ "n": 0.001684631296847133,
101
+ "o": 0.04394172759774475,
102
+ "b": 0.00943393526234396,
103
+ "y": 0.02492862964011599,
104
+ "c": 0.004295809806960194,
105
+ "<|endoftext|>": 0.043463487458656094,
106
+ "r": 0.00864562069506167,
107
+ "p": 0.003200799464009558,
108
+ "u": 0.01170818751308759,
109
+ "d": 0.002021557556216561,
110
+ "s": 0.0029481047694824834,
111
+ "h": 0.00042115782421178326,
112
+ "l": 0.00042115782421178326,
113
+ "t": 0.00033692625936942647,
114
+ "z": 0.0009265472132659241,
115
+ "f": 0.00008423156484235662,
116
+ "j": 0.0005896209538964975,
117
+ "k": 0.00008820286707779163,
118
+ "w": 0.00016846312968471323,
119
+ "v": 0.0002526946945270701
120
+ },
121
+ "a": {
122
+ "<|endoftext|>": 0.007001710976588857,
123
+ "v": 0.0009445230276038111,
124
+ "b": 0.0006661395917300331,
125
+ "r": 0.007876707928699728,
126
+ "m": 0.002554525124260189,
127
+ "i": 0.0026218170060924744,
128
+ "d": 0.0013111684007819204,
129
+ "c": 0.0005352363715604257,
130
+ "y": 0.00287674929208445,
131
+ "n": 0.9582086273878258,
132
+ "h": 0.00443616199941351,
133
+ "u": 0.0004205082673848085,
134
+ "t": 0.0008174131228679635,
135
+ "l": 0.004852510589245695,
136
+ "z": 0.0004586964269301434,
137
+ "o": 0.00006643189631402075,
138
+ "a": 0.0006248845524653838,
139
+ "e": 0.000749693104110385,
140
+ "g": 0.00018182319667244212,
141
+ "s": 0.0012891325716957495,
142
+ "w": 0.00016977040169138629,
143
+ "k": 0.0006441598301716339,
144
+ "p": 0.00008646691266269368,
145
+ "x": 0.00019191436712939333,
146
+ "q": 0.00006625141888856939,
147
+ "j": 0.00020043984118049539,
148
+ "f": 0.00014653639394791634
149
+ },
150
+ "o": {
151
+ "l": 0.04655784213222656,
152
+ "p": 0.006827348763611927,
153
+ "t": 0.00873402800232495,
154
+ "f": 0.0024434721890821665,
155
+ "r": 0.09070321469787364,
156
+ "n": 0.5779780509093801,
157
+ "e": 0.009486421439966045,
158
+ "o": 0.008264685345424967,
159
+ "k": 0.004886944378164333,
160
+ "v": 0.01342898342765805,
161
+ "w": 0.008192818516334318,
162
+ "m": 0.020163813614499242,
163
+ "s": 0.04183539391502521,
164
+ "d": 0.013654697527223853,
165
+ "i": 0.00495881120725498,
166
+ "a": 0.010708157534507136,
167
+ "c": 0.008192818516334318,
168
+ "u": 0.01976337799992925,
169
+ "g": 0.003162140479988684,
170
+ "y": 0.007402283396337145,
171
+ "h": 0.012666915228957635,
172
+ "x": 0.003234007309079334,
173
+ "<|endoftext|>": 0.061446138872507404,
174
+ "b": 0.010061356072691258,
175
+ "z": 0.0038808087708952074,
176
+ "j": 0.0011498692654504298,
177
+ "q": 0.0002156004872719556
178
+ },
179
+ "l": {
180
+ "i": 0.1982820422099798,
181
+ "l": 0.07592898398255979,
182
+ "a": 0.2272249083942482,
183
+ "o": 0.04442973075887423,
184
+ "y": 0.09966683646902887,
185
+ "<|endoftext|>": 0.06503569359438059,
186
+ "e": 0.23727395936428541,
187
+ "u": 0.018312725872180476,
188
+ "s": 0.004652477319537118,
189
+ "t": 0.0038110718468548706,
190
+ "d": 0.007152148993458551,
191
+ "b": 0.0025737108576162765,
192
+ "v": 0.0035635996490071494,
193
+ "m": 0.003140572899048235,
194
+ "c": 0.00128579915602016,
195
+ "k": 0.0011878665496690513,
196
+ "n": 0.0006929221539736136,
197
+ "h": 0.0010073302268253377,
198
+ "g": 0.0003027507532623459,
199
+ "p": 0.0007424165935431571,
200
+ "r": 0.0008908999122517874,
201
+ "w": 0.0008122804210438736,
202
+ "z": 0.0004949443956954382,
203
+ "j": 0.0002969666374172628,
204
+ "f": 0.0010888776705299656,
205
+ "q": 0.0001484833187086314
206
+ },
207
+ "i": {
208
+ "v": 0.010643372842180572,
209
+ "a": 0.1722381748996308,
210
+ "s": 0.07278788053787447,
211
+ "g": 0.017441139442827425,
212
+ "l": 0.07164003157408359,
213
+ "z": 0.01095990437652051,
214
+ "c": 0.024027223772230172,
215
+ "e": 0.1122226123064717,
216
+ "o": 0.027230769661124442,
217
+ "r": 0.043286322833405964,
218
+ "n": 0.18198638786219876,
219
+ "<|endoftext|>": 0.09848087362151449,
220
+ "y": 0.03572992322190827,
221
+ "t": 0.02994384393955899,
222
+ "p": 0.0020970214150021187,
223
+ "m": 0.017810406677028275,
224
+ "d": 0.018468392481505252,
225
+ "f": 0.003996210621041772,
226
+ "x": 0.003773601803955036,
227
+ "k": 0.02403908632047845,
228
+ "b": 0.0043523085971742086,
229
+ "u": 0.004403239912291267,
230
+ "q": 0.002057454973209625,
231
+ "j": 0.003007049576229451,
232
+ "h": 0.0038157869692299375,
233
+ "i": 0.0032444482269844113,
234
+ "w": 0.00031653153433994246
235
+ },
236
+ "v": {
237
+ "i": 0.38959019118754895,
238
+ "a": 0.23031801458198817,
239
+ "e": 0.21948685999855871,
240
+ "y": 0.045017653259335356,
241
+ "o": 0.05462521432403607,
242
+ "<|endoftext|>": 0.03013854980376912,
243
+ "k": 0.0010274505614921287,
244
+ "r": 0.01643920898387406,
245
+ "n": 0.002739868163979013,
246
+ "v": 0.0023973846434816332,
247
+ "l": 0.0047947692869632665,
248
+ "u": 0.0023973846434816332,
249
+ "b": 0.0003424835204973766,
250
+ "d": 0.0003424835204973766,
251
+ "h": 0.0003424835204973766
252
+ },
253
+ "s": {
254
+ "a": 0.19912878165603182,
255
+ "o": 0.061301521843309205,
256
+ "c": 0.006190057214742588,
257
+ "t": 0.09837876033985199,
258
+ "k": 0.008075330660494581,
259
+ "l": 0.03266303743192299,
260
+ "i": 0.08465733560126257,
261
+ "<|endoftext|>": 0.11512270173314848,
262
+ "e": 0.10037943274701436,
263
+ "h": 0.17437316766516275,
264
+ "m": 0.009189381633581215,
265
+ "y": 0.021614048293947072,
266
+ "s": 0.048120774772634885,
267
+ "u": 0.019632545333647375,
268
+ "p": 0.005022461752258826,
269
+ "r": 0.005416380321063441,
270
+ "w": 0.0023635114128276826,
271
+ "n": 0.0023635114128276826,
272
+ "d": 0.0008863167798103808,
273
+ "b": 0.0020680724862242226,
274
+ "v": 0.0013787149908161488,
275
+ "z": 0.0009847964220115342,
276
+ "j": 0.00019695928440230685,
277
+ "f": 0.00019695928440230685,
278
+ "q": 0.00009847964220115342,
279
+ "g": 0.00019695928440230685
280
+ },
281
+ "b": {
282
+ "e": 0.25210670145039304,
283
+ "i": 0.0672399544727755,
284
+ "r": 0.39119821291085244,
285
+ "y": 0.026692544101860755,
286
+ "a": 0.09946555477309198,
287
+ "l": 0.031915738758967194,
288
+ "b": 0.011774738571269459,
289
+ "o": 0.03253546184166562,
290
+ "<|endoftext|>": 0.03532421571380834,
291
+ "u": 0.013943769360713827,
292
+ "h": 0.01270432319531704,
293
+ "t": 0.0006197230826983926,
294
+ "s": 0.0024788923307935704,
295
+ "c": 0.0003098615413491963,
296
+ "n": 0.0012394461653967852,
297
+ "d": 0.02014100018769773,
298
+ "j": 0.0003098615413491963
299
+ },
300
+ "p": {
301
+ "h": 0.19379346184321214,
302
+ "e": 0.19596703098784815,
303
+ "a": 0.2140506749808666,
304
+ "i": 0.05794804496292127,
305
+ "r": 0.14344516048198544,
306
+ "o": 0.05604810906249763,
307
+ "p": 0.03805091495821508,
308
+ "y": 0.011399615402541885,
309
+ "t": 0.016149455153601014,
310
+ "b": 0.0018999359004236484,
311
+ "l": 0.015199487203389187,
312
+ "<|endoftext|>": 0.031348942356990206,
313
+ "s": 0.015199487203389187,
314
+ "u": 0.0037998718008472967,
315
+ "j": 0.0009499679502118242,
316
+ "f": 0.0009499679502118242,
317
+ "n": 0.0009499679502118242,
318
+ "c": 0.0009499679502118242,
319
+ "k": 0.0009499679502118242,
320
+ "m": 0.0009499679502118242
321
+ },
322
+ "h": {
323
+ "i": 0.07910027435219431,
324
+ "a": 0.4404474898502001,
325
+ "<|endoftext|>": 0.23644354772459888,
326
+ "l": 0.018701071250229687,
327
+ "e": 0.08206351232990523,
328
+ "o": 0.03427343763206647,
329
+ "n": 0.013968020174937769,
330
+ "r": 0.021529575611350504,
331
+ "t": 0.006968655827499589,
332
+ "y": 0.020905967482498795,
333
+ "u": 0.01629291362485821,
334
+ "m": 0.011736669447795655,
335
+ "z": 0.0019630016415491834,
336
+ "k": 0.0028463523802463135,
337
+ "v": 0.0038278532010209035,
338
+ "d": 0.0023556019698590175,
339
+ "s": 0.0030426525444012292,
340
+ "w": 0.0009815008207745917,
341
+ "b": 0.0007852006566196716,
342
+ "j": 0.0008833507386971307,
343
+ "g": 0.0001963001641549179,
344
+ "p": 0.00009815008207745895,
345
+ "f": 0.0001963001641549179,
346
+ "c": 0.0001963001641549179,
347
+ "h": 0.00009815008207745895,
348
+ "q": 0.00009815008207745895
349
+ },
350
+ "c": {
351
+ "h": 0.1985942649233418,
352
+ "a": 0.2750281516645673,
353
+ "t": 0.00869014000643676,
354
+ "e": 0.13680763267276158,
355
+ "l": 0.028801606878476115,
356
+ "y": 0.0264107138889173,
357
+ "o": 0.09970279121223982,
358
+ "k": 0.08684508204106975,
359
+ "i": 0.06959849666069513,
360
+ "c": 0.010428168007724116,
361
+ "<|endoftext|>": 0.024084102303553317,
362
+ "q": 0.002731186859165839,
363
+ "r": 0.018870018299691257,
364
+ "s": 0.0012414485723481101,
365
+ "j": 0.0007448691434088659,
366
+ "u": 0.00869014000643676,
367
+ "z": 0.0009931588578784866,
368
+ "d": 0.00024828971446962166,
369
+ "p": 0.00024828971446962166,
370
+ "g": 0.0004965794289392433,
371
+ "x": 0.0007448691434088659
372
+ },
373
+ "r": {
374
+ "l": 0.020914608418745328,
375
+ "p": 0.0006478939382929761,
376
+ "<|endoftext|>": 0.06372499664495922,
377
+ "y": 0.037949054358008806,
378
+ "i": 0.4304776153918007,
379
+ "a": 0.1503429979118953,
380
+ "e": 0.14713775840497326,
381
+ "o": 0.04501847708253126,
382
+ "u": 0.01166209088927357,
383
+ "g": 0.0035171385221618723,
384
+ "s": 0.009033806905157364,
385
+ "k": 0.0041650324604548495,
386
+ "d": 0.008654011890056173,
387
+ "m": 0.007497058428818724,
388
+ "n": 0.007119971233411747,
389
+ "r": 0.020331911951491234,
390
+ "t": 0.011192648262743363,
391
+ "c": 0.004581535706500326,
392
+ "h": 0.005599654752389291,
393
+ "b": 0.0019875265494692235,
394
+ "j": 0.001156953461237458,
395
+ "w": 0.0009718409074394641,
396
+ "v": 0.0039552308672639504,
397
+ "z": 0.001064397184338462,
398
+ "f": 0.0004165032460454844,
399
+ "q": 0.0007404502151919726,
400
+ "x": 0.00013883441534849492
401
+ },
402
+ "t": {
403
+ "t": 0.05789743131229027,
404
+ "e": 0.1724017749805774,
405
+ "h": 0.1247264843699963,
406
+ "<|endoftext|>": 0.07125118304370909,
407
+ "o": 0.11266499761360438,
408
+ "a": 0.1777192446428519,
409
+ "y": 0.05684087004227434,
410
+ "u": 0.01279333785379203,
411
+ "i": 0.10427906569898242,
412
+ "r": 0.05724187101509228,
413
+ "l": 0.01976740896036652,
414
+ "z": 0.015489387618197627,
415
+ "n": 0.0032453955009556995,
416
+ "s": 0.005163129206065882,
417
+ "c": 0.002507805614374856,
418
+ "g": 0.00029503595463233604,
419
+ "w": 0.0016226977504778498,
420
+ "x": 0.00029503595463233604,
421
+ "m": 0.0005900719092646721,
422
+ "j": 0.0004425539319485042,
423
+ "v": 0.0023226630939651377,
424
+ "f": 0.00029503595463233604,
425
+ "b": 0.00014751797731616802
426
+ },
427
+ "y": {
428
+ "n": 0.2185598719864901,
429
+ "<|endoftext|>": 0.16537466405376425,
430
+ "l": 0.09699025392582455,
431
+ "a": 0.2866246676480417,
432
+ "d": 0.025105175773772925,
433
+ "t": 0.008569489318182114,
434
+ "s": 0.03442726855568459,
435
+ "e": 0.02753981502018649,
436
+ "z": 0.0064271169886365755,
437
+ "r": 0.025499343613605157,
438
+ "c": 0.00947587761145136,
439
+ "p": 0.0012942575133915509,
440
+ "v": 0.0087342871896856,
441
+ "j": 0.0018951755222902714,
442
+ "o": 0.02282229095404815,
443
+ "u": 0.012048842198086373,
444
+ "k": 0.007376548561974343,
445
+ "m": 0.012889819666281629,
446
+ "b": 0.0022247712652972763,
447
+ "x": 0.0023071702010490284,
448
+ "g": 0.0024719680725525293,
449
+ "i": 0.0158205956643362,
450
+ "y": 0.0018951755222902714,
451
+ "f": 0.0009887872290210125,
452
+ "q": 0.0004943936145105063,
453
+ "h": 0.0018127765865385214,
454
+ "w": 0.000329595743007004
455
+ },
456
+ "n": {
457
+ "<|endoftext|>": 0.16422522245532942,
458
+ "a": 0.41627962769012833,
459
+ "e": 0.05613383964915609,
460
+ "o": 0.014252180694003767,
461
+ "n": 0.11892558523529079,
462
+ "t": 0.015642743435773026,
463
+ "s": 0.007054985773367971,
464
+ "i": 0.13867609130205072,
465
+ "z": 0.003651514882455496,
466
+ "d": 0.024110365492134852,
467
+ "l": 0.004735164627944589,
468
+ "y": 0.01416075914432966,
469
+ "g": 0.007479400174010978,
470
+ "c": 0.005172256747447169,
471
+ "r": 0.0010684474032285228,
472
+ "k": 0.0014084079406194174,
473
+ "v": 0.0013355592540356543,
474
+ "h": 0.0006313552837259445,
475
+ "u": 0.0024453150859718937,
476
+ "j": 0.0011056382062645893,
477
+ "m": 0.00046137501503049804,
478
+ "w": 0.0002671118508071307,
479
+ "f": 0.0002671118508071307,
480
+ "b": 0.0001942631642233677,
481
+ "x": 0.00014569737316752566,
482
+ "q": 0.000048565791055841925,
483
+ "p": 0.00012141447763960482
484
+ },
485
+ "g": {
486
+ "a": 0.181221838530906,
487
+ "r": 0.10408046524714042,
488
+ "e": 0.17074722415533705,
489
+ "i": 0.10151926821383782,
490
+ "h": 0.18641568277839354,
491
+ "g": 0.012362665554576813,
492
+ "n": 0.013351678798942945,
493
+ "o": 0.041044049641194964,
494
+ "t": 0.015329705287675244,
495
+ "w": 0.012857172176759878,
496
+ "l": 0.016241494789672226,
497
+ "u": 0.044418991440776226,
498
+ "y": 0.015354624369298398,
499
+ "d": 0.009395625821478367,
500
+ "<|endoftext|>": 0.05340671519577178,
501
+ "s": 0.014835198665492166,
502
+ "b": 0.0014835198665492158,
503
+ "j": 0.0014835198665492158,
504
+ "m": 0.0029670397330984317,
505
+ "f": 0.0004945066221830724,
506
+ "z": 0.0004945066221830724,
507
+ "v": 0.0004945066221830724
508
+ },
509
+ "z": {
510
+ "a": 0.38763405459326883,
511
+ "o": 0.04206266134613296,
512
+ "e": 0.14928850084627274,
513
+ "i": 0.15537747734451107,
514
+ "u": 0.027914311620615515,
515
+ "l": 0.04844101819160039,
516
+ "m": 0.013383574064678674,
517
+ "h": 0.01644267670803379,
518
+ "r": 0.012236410573420488,
519
+ "<|endoftext|>": 0.06118205286710247,
520
+ "b": 0.001529551321677561,
521
+ "y": 0.056211011071650434,
522
+ "z": 0.017207452368872576,
523
+ "n": 0.001529551321677561,
524
+ "t": 0.001529551321677561,
525
+ "k": 0.0007647756608387805,
526
+ "j": 0.0007647756608387805,
527
+ "s": 0.001529551321677561,
528
+ "c": 0.0007647756608387805,
529
+ "v": 0.0007647756608387805,
530
+ "g": 0.00038238783041939024,
531
+ "p": 0.0007647756608387805,
532
+ "w": 0.001147163491258171,
533
+ "d": 0.0007647756608387805,
534
+ "x": 0.00038238783041939024
535
+ },
536
+ "f": {
537
+ "i": 0.17269361518206552,
538
+ "a": 0.28314999270852925,
539
+ "r": 0.12474670835499219,
540
+ "e": 0.1354569216230245,
541
+ "f": 0.04749074417506806,
542
+ "l": 0.0211742834870872,
543
+ "s": 0.006352285046126162,
544
+ "n": 0.004234856697417438,
545
+ "t": 0.020094660729704915,
546
+ "<|endoftext|>": 0.0846971339483488,
547
+ "u": 0.010976807401869857,
548
+ "y": 0.014821998440961038,
549
+ "o": 0.0635228504612616,
550
+ "k": 0.002117428348708719,
551
+ "z": 0.002117428348708719,
552
+ "w": 0.004234856697417438,
553
+ "h": 0.0010587141743543596,
554
+ "g": 0.0010587141743543596
555
+ },
556
+ "d": {
557
+ "i": 0.10720052332059903,
558
+ "d": 0.02196260437673727,
559
+ "r": 0.06811893663576916,
560
+ "y": 0.04486791044056427,
561
+ "e": 0.216640832931884,
562
+ "l": 0.008433549539362612,
563
+ "a": 0.3460119333355518,
564
+ "n": 0.004357333928670686,
565
+ "o": 0.056362319768898314,
566
+ "<|endoftext|>": 0.07252852603851848,
567
+ "g": 0.0035139789747344195,
568
+ "s": 0.004076215610691929,
569
+ "u": 0.012931442627022668,
570
+ "h": 0.019359654049025777,
571
+ "v": 0.0023895057028194035,
572
+ "z": 0.00014055915898937696,
573
+ "j": 0.0012650324309043922,
574
+ "w": 0.003232860656755667,
575
+ "m": 0.004216774769681306,
576
+ "t": 0.0005622366359575078,
577
+ "f": 0.0007027957949468842,
578
+ "c": 0.0004216774769681307,
579
+ "k": 0.0004216774769681307,
580
+ "b": 0.00014055915898937696,
581
+ "q": 0.00014055915898937696
582
+ },
583
+ "u": {
584
+ "n": 0.08492314794111876,
585
+ "b": 0.03484451893422853,
586
+ "r": 0.1443793187966973,
587
+ "d": 0.04199835679997148,
588
+ "c": 0.03180757904703717,
589
+ "t": 0.025322538658806293,
590
+ "m": 0.04755696284702645,
591
+ "i": 0.037366185094092244,
592
+ "l": 0.09490273771563056,
593
+ "e": 0.0521891345529057,
594
+ "s": 0.14637662590578282,
595
+ "a": 0.054794328302449444,
596
+ "p": 0.004940983152937814,
597
+ "g": 0.016048337276269736,
598
+ "z": 0.015263780498184283,
599
+ "x": 0.01049958919999287,
600
+ "v": 0.01204013272191116,
601
+ "<|endoftext|>": 0.047865774294085124,
602
+ "o": 0.003201774246502677,
603
+ "h": 0.018677333975928502,
604
+ "w": 0.02806152008553187,
605
+ "j": 0.004323360258820591,
606
+ "k": 0.02871946457645105,
607
+ "q": 0.003088114470586136,
608
+ "y": 0.004014548811761979,
609
+ "f": 0.005867417494113658,
610
+ "u": 0.0009264343411758405
611
+ },
612
+ "k": {
613
+ "l": 0.015196220931516909,
614
+ "y": 0.04207934802160087,
615
+ "e": 0.10025251044870982,
616
+ "i": 0.06359361992026763,
617
+ "a": 0.6365008471702182,
618
+ "h": 0.03379741030290867,
619
+ "o": 0.03600170807158109,
620
+ "r": 0.011122851850442084,
621
+ "s": 0.0092537190375477,
622
+ "<|endoftext|>": 0.03535894748031379,
623
+ "t": 0.0016559286698769574,
624
+ "k": 0.001995258846806241,
625
+ "u": 0.005110994967537751,
626
+ "n": 0.0026258104269600933,
627
+ "w": 0.0033118573397539148,
628
+ "m": 0.0008766681193466236,
629
+ "c": 0.00019481513763258335,
630
+ "j": 0.00019481513763258335,
631
+ "z": 0.00019481513763258335,
632
+ "f": 0.00009740756881629167,
633
+ "b": 0.00019481513763258335,
634
+ "d": 0.00019481513763258335,
635
+ "v": 0.00019481513763258335
636
+ },
637
+ "w": {
638
+ "i": 0.16807019409361693,
639
+ "<|endoftext|>": 0.05341742044613456,
640
+ "a": 0.2932721122532879,
641
+ "y": 0.07646022926603577,
642
+ "e": 0.16914063122539208,
643
+ "r": 0.02304280881990118,
644
+ "h": 0.024922330530089982,
645
+ "s": 0.020948008018091973,
646
+ "n": 0.06074922325246677,
647
+ "u": 0.026185010022614984,
648
+ "o": 0.037706414432565574,
649
+ "t": 0.008379203207236795,
650
+ "l": 0.013616205211759791,
651
+ "d": 0.008379203207236795,
652
+ "b": 0.0010474004009045994,
653
+ "w": 0.002094800801809199,
654
+ "m": 0.002094800801809199,
655
+ "f": 0.002094800801809199,
656
+ "k": 0.006284402405427598,
657
+ "z": 0.0010474004009045994,
658
+ "g": 0.0010474004009045994
659
+ },
660
+ "q": {
661
+ "u": 0.7657184893274326,
662
+ "r": 0.0035497198586752605,
663
+ "<|endoftext|>": 0.0993921560429073,
664
+ "s": 0.007099439717350521,
665
+ "a": 0.046146358162778386,
666
+ "i": 0.046146358162778386,
667
+ "l": 0.0035497198586752605,
668
+ "w": 0.010649159576025777,
669
+ "e": 0.0035497198586752605,
670
+ "m": 0.007099439717350521,
671
+ "o": 0.007099439717350521
672
+ },
673
+ "x": {
674
+ "a": 0.1459919528593453,
675
+ "i": 0.1549283634228476,
676
+ "<|endoftext|>": 0.23245320649449158,
677
+ "l": 0.055278506422470564,
678
+ "e": 0.051026313620742066,
679
+ "o": 0.058113301623622896,
680
+ "y": 0.04252192801728504,
681
+ "t": 0.09921783204033176,
682
+ "w": 0.004252192801728504,
683
+ "u": 0.00708698800288084,
684
+ "c": 0.005669590402304673,
685
+ "x": 0.0538611088218944,
686
+ "z": 0.0269305544109472,
687
+ "s": 0.045659389852193595,
688
+ "n": 0.0014173976005761682,
689
+ "f": 0.004252192801728504,
690
+ "h": 0.0014173976005761682,
691
+ "d": 0.00708698800288084,
692
+ "b": 0.0014173976005761682,
693
+ "m": 0.0014173976005761682
694
+ },
695
+ "j": {
696
+ "o": 0.09561819362979579,
697
+ "u": 0.032431451394297574,
698
+ "a": 0.7347231959793296,
699
+ "e": 0.0877853418546096,
700
+ "i": 0.020581019686630037,
701
+ "h": 0.007141121145558524,
702
+ "r": 0.0016825101366730144,
703
+ "<|endoftext|>": 0.010859838154889454,
704
+ "l": 0.001376599202732467,
705
+ "m": 0.0007647773348513709,
706
+ "w": 0.0009177328018216453,
707
+ "s": 0.0010706882687919186,
708
+ "n": 0.0003059109339405484,
709
+ "y": 0.0015295546697027419,
710
+ "v": 0.0007647773348513709,
711
+ "k": 0.0003059109339405484,
712
+ "j": 0.0003059109339405484,
713
+ "d": 0.0006118218678810968,
714
+ "c": 0.0006118218678810968,
715
+ "t": 0.0003059109339405484,
716
+ "p": 0.0001529554669702742,
717
+ "b": 0.0001529554669702742
718
+ }
719
+ },
720
+ "harmonic_seed": 1251963776,
721
+ "harmonic_frequencies": [
722
+ 1,
723
+ 1.618033988749895,
724
+ 2,
725
+ 3.141592653589793
726
+ ],
727
+ "config": {
728
+ "grpo": {
729
+ "group_size": 8,
730
+ "kl_penalty": 0.1
731
+ },
732
+ "vae": {
733
+ "latent_dim": 32,
734
+ "filter_threshold": 0.7
735
+ },
736
+ "policy_arch": "tiny-bigram"
737
+ },
738
+ "metrics": {
739
+ "training_steps": 60,
740
+ "final_loss": 0.010978239385384714,
741
+ "average_reward": 0.6262606837606838
742
+ }
743
+ }
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Core test.py requires only Python 3.8+ standard library.
2
+ # Optional:
3
+ pandas>=2.0
4
+ pyarrow>=14.0
run.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # run.sh - Minimal launcher for test.py.
3
+ set -euo pipefail
4
+ cd "$(dirname "$0")"
5
+ PY="${PYTHON:-python3}"
6
+ if ! command -v "$PY" >/dev/null 2>&1; then
7
+ echo "Error: python3 not found." >&2
8
+ exit 1
9
+ fi
10
+ exec "$PY" test.py "$@"
test.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ test.py - Micro Distillery model chat wrapper.
4
+
5
+ Loads model.json (a GRPO+VAE-distilled bigram model) and provides
6
+ a simple REPL chat interface.
7
+
8
+ Usage:
9
+ python3 test.py # interactive chat
10
+ python3 test.py hello # one-shot from prompt
11
+ python3 test.py --temperature 1.2 # one-shot with custom temperature
12
+ python3 test.py # (interactive also supports --temperature)
13
+ """
14
+ import json
15
+ import os
16
+ import random
17
+ import sys
18
+
19
+ MODEL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "model.json")
20
+
21
+
22
+ def load_model(path=MODEL_PATH):
23
+ with open(path, "r", encoding="utf-8") as f:
24
+ return json.load(f)
25
+
26
+
27
+ def sample_next(transitions, token, rng, temperature=1.0):
28
+ bucket = transitions.get(token)
29
+ if not bucket:
30
+ return None
31
+ tokens = list(bucket.keys())
32
+ inv_t = 1.0 / max(temperature, 1e-3)
33
+ weights = [max(bucket[t], 1e-12) ** inv_t for t in tokens]
34
+ total = sum(weights)
35
+ if total <= 0:
36
+ return None
37
+ r = rng.random() * total
38
+ acc = 0.0
39
+ for t, w in zip(tokens, weights):
40
+ acc += w
41
+ if r <= acc:
42
+ return t
43
+ return tokens[-1]
44
+
45
+
46
+ def generate(model, prompt, max_tokens=32, temperature=0.9):
47
+ transitions = model.get("transitions", {})
48
+ bos = model.get("bos_token", "<|endoftext|>")
49
+ eos = model.get("eos_token", "<|endoftext|>")
50
+ seed = int(model.get("harmonic_seed", 1337)) & 0xFFFFFFFF
51
+ rng = random.Random(seed)
52
+
53
+ if prompt and prompt.strip():
54
+ current = prompt.strip()[-1]
55
+ prefix = prompt.strip()
56
+ else:
57
+ current = bos
58
+ prefix = ""
59
+
60
+ generated = ""
61
+ for _ in range(max_tokens):
62
+ nxt = sample_next(transitions, current, rng, temperature=temperature)
63
+ if nxt is None or nxt == eos:
64
+ break
65
+ generated += nxt
66
+ current = nxt
67
+ return prefix + generated
68
+
69
+
70
+ def main(temperature=0.9):
71
+ print("=== Micro Distillery Model Chat ===")
72
+ if not os.path.exists(MODEL_PATH):
73
+ print("Error: " + MODEL_PATH + " not found.", file=sys.stderr)
74
+ sys.exit(1)
75
+ model = load_model()
76
+ print("Format: " + str(model.get("format")))
77
+ print("Vocab size: " + str(len(model.get("vocab", []))))
78
+ print("Transitions: " + str(len(model.get("transitions", {}))))
79
+ print("Seed: " + str(model.get("harmonic_seed")))
80
+ print("Temperature: " + str(temperature))
81
+ print("Type /quit to exit.\n")
82
+ while True:
83
+ try:
84
+ prompt = input("You: ").strip()
85
+ except (EOFError, KeyboardInterrupt):
86
+ print("\nBye!")
87
+ break
88
+ if not prompt:
89
+ continue
90
+ if prompt.lower() in ("/quit", "/exit", "quit", "exit"):
91
+ break
92
+ out = generate(model, prompt, temperature=temperature)
93
+ print("Bot: " + out)
94
+
95
+
96
+ if __name__ == "__main__":
97
+ args = sys.argv[1:]
98
+ temperature = 0.9
99
+ prompts = []
100
+ i = 0
101
+ while i < len(args):
102
+ if args[i] == "--temperature" and i + 1 < len(args):
103
+ try:
104
+ temperature = float(args[i + 1])
105
+ except ValueError:
106
+ print("Warning: invalid --temperature value, using 0.9", file=sys.stderr)
107
+ i += 2
108
+ elif args[i] in ("--help", "-h"):
109
+ print("Usage: python3 test.py [prompt...] [--temperature T]")
110
+ sys.exit(0)
111
+ elif args[i].startswith("--"):
112
+ i += 1
113
+ else:
114
+ prompts.append(args[i])
115
+ i += 1
116
+ if prompts:
117
+ model = load_model()
118
+ print(generate(model, " ".join(prompts), temperature=temperature))
119
+ else:
120
+ main(temperature=temperature)
test.sh ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # test.sh - Test harness for the exported Micro Distillery model.
3
+ set -euo pipefail
4
+ cd "$(dirname "$0")"
5
+
6
+ PY="${PYTHON:-python3}"
7
+
8
+ echo "================================================"
9
+ echo " Micro Distillery - Model Test Harness"
10
+ echo "================================================"
11
+ echo ""
12
+
13
+ if ! command -v "$PY" >/dev/null 2>&1; then
14
+ echo "ERROR: $PY not found. Install Python 3.8+." >&2
15
+ echo " macOS: brew install python3" >&2
16
+ echo " Ubuntu: sudo apt install python3" >&2
17
+ echo " Windows: https://python.org/downloads/" >&2
18
+ exit 1
19
+ fi
20
+
21
+ echo "[1/3] Python: $($PY --version 2>&1)"
22
+
23
+ if [ ! -f model.json ]; then
24
+ echo "ERROR: model.json not found in $(pwd)" >&2
25
+ exit 1
26
+ fi
27
+ echo "[2/3] Found model.json"
28
+
29
+ $PY -c "
30
+ import json
31
+ m = json.load(open('model.json'))
32
+ assert 'transitions' in m, 'missing transitions'
33
+ assert 'vocab' in m, 'missing vocab'
34
+ print('OK: format=%s vocab=%d transitions=%d' % (m.get('format','?'), len(m['vocab']), len(m['transitions'])))
35
+ "
36
+ echo "[3/3] Model validation passed"
37
+ echo ""
38
+ echo "=== Sample Generations ==="
39
+ for prompt in alice bob zoe liam; do
40
+ echo -n " $prompt -> "
41
+ $PY test.py "$prompt" 2>/dev/null | tail -1 || echo "(failed)"
42
+ done
43
+ echo ""
44
+ echo "=== Interactive Chat (type /quit to exit) ==="
45
+ exec $PY test.py
test_readme.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Testing Your Exported Model
2
+
3
+ This bundle contains a fully runnable bigram language model. No GPU,
4
+ no external dependencies - Python 3.8+ standard library only.
5
+
6
+ ## Files
7
+
8
+ | File | Purpose |
9
+ |------|---------|
10
+ | `model.json` | The trained model (transitions + config + metrics) |
11
+ | `test.py` | Interactive chat wrapper |
12
+ | `test.sh` | Test harness (validates + generates samples) |
13
+ | `run.sh` | Minimal launcher for test.py |
14
+
15
+ ## Quick Start
16
+
17
+ ### macOS / Linux
18
+
19
+ ```bash
20
+ chmod +x test.sh run.sh
21
+ ./test.sh
22
+ ```
23
+
24
+ ### Windows (PowerShell)
25
+
26
+ ```powershell
27
+ python test.py
28
+ ```
29
+
30
+ ### One-shot generation
31
+
32
+ ```bash
33
+ python3 test.py alice
34
+ # => alicea
35
+ ```
36
+
37
+ ### Custom temperature
38
+
39
+ ```bash
40
+ python3 test.py --temperature 0.5
41
+ python3 test.py alice --temperature 1.2
42
+ ```
43
+
44
+ ## Manual Test
45
+
46
+ ```bash
47
+ python3 -c "import json; m=json.load(open('model.json')); print(len(m['vocab']), 'tokens,', len(m['transitions']), 'states')"
48
+ ```
49
+
50
+ Expected output: `<N> tokens, <M> states`.
51
+
52
+ ## Troubleshooting
53
+
54
+ - **`python3 not found`** - install Python 3.8+ from https://python.org
55
+ - **`model.json not found`** - make sure you are inside the extracted directory
56
+ - **`Permission denied`** - run `chmod +x test.sh run.sh` first
to_parquet.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Convert model.json to model.parquet.
3
+
4
+ Requires: pandas, pyarrow
5
+ pip install pandas pyarrow
6
+ """
7
+ import json
8
+ import os
9
+ import sys
10
+
11
+ MODEL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "model.json")
12
+ OUT_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "model.parquet")
13
+
14
+
15
+ def main():
16
+ try:
17
+ import pandas as pd
18
+ except ImportError:
19
+ print("Error: pandas required. Install: pip install pandas pyarrow", file=sys.stderr)
20
+ sys.exit(1)
21
+
22
+ with open(MODEL_PATH, "r", encoding="utf-8") as f:
23
+ model = json.load(f)
24
+
25
+ rows = []
26
+ for state, bucket in model.get("transitions", {}).items():
27
+ for nxt, prob in bucket.items():
28
+ rows.append({
29
+ "state": state,
30
+ "next_token": nxt,
31
+ "probability": float(prob),
32
+ "harmonic_seed": int(model.get("harmonic_seed", 0)),
33
+ "format": model.get("format", "unknown"),
34
+ "version": model.get("version", "0.0"),
35
+ })
36
+
37
+ if not rows:
38
+ print("Warning: no transitions. Writing metadata-only parquet.")
39
+ rows = [{"state": "", "next_token": "", "probability": 0.0,
40
+ "harmonic_seed": int(model.get("harmonic_seed", 0)),
41
+ "format": model.get("format", "unknown"),
42
+ "version": model.get("version", "0.0")}]
43
+
44
+ df = pd.DataFrame(rows)
45
+ df.to_parquet(OUT_PATH, index=False)
46
+ print("Wrote " + str(len(df)) + " rows to " + OUT_PATH)
47
+
48
+
49
+ if __name__ == "__main__":
50
+ main()
tokenizer_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "bos_token": "<|endoftext|>",
4
+ "eos_token": "<|endoftext|>",
5
+ "unk_token": "<|endoftext|>",
6
+ "pad_token": "<|endoftext|>",
7
+ "add_prefix_space": false,
8
+ "model_max_length": 1024,
9
+ "name_or_path": "micro-distillery"
10
+ }
training_logs.json ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "created": "2026-10-23T14:02:10.625Z",
3
+ "metrics": {
4
+ "trainingSteps": 60,
5
+ "finalLoss": 0.010978239385384714,
6
+ "averageReward": 0.6262606837606838,
7
+ "cacheHits": 1,
8
+ "cacheMisses": 251,
9
+ "filteredCount": 0,
10
+ "totalSamples": 0,
11
+ "vaeLoss": 0
12
+ },
13
+ "quantum_measurements": [
14
+ {
15
+ "oscillator": 0,
16
+ "energy": 0.5,
17
+ "x": 0.615234375,
18
+ "t": 0.1,
19
+ "probabilities": [
20
+ 0.25,
21
+ 0.25,
22
+ 0.25,
23
+ 0.25
24
+ ]
25
+ },
26
+ {
27
+ "oscillator": 3,
28
+ "energy": 10.995574287564276,
29
+ "x": -1.1074424442685453,
30
+ "t": 0.2,
31
+ "probabilities": [
32
+ 0.25,
33
+ 0.25,
34
+ 0.25,
35
+ 0.25
36
+ ]
37
+ },
38
+ {
39
+ "oscillator": 3,
40
+ "energy": 10.995574287564276,
41
+ "x": 0.23140588387700944,
42
+ "t": 0.30000000000000004,
43
+ "probabilities": [
44
+ 0.24999999999999997,
45
+ 0.25,
46
+ 0.24999999999999997,
47
+ 0.25
48
+ ]
49
+ },
50
+ {
51
+ "oscillator": 1,
52
+ "energy": 2.4270509831248424,
53
+ "x": -0.7830804739380586,
54
+ "t": 0.4,
55
+ "probabilities": [
56
+ 0.25,
57
+ 0.25,
58
+ 0.25,
59
+ 0.24999999999999997
60
+ ]
61
+ },
62
+ {
63
+ "oscillator": 3,
64
+ "energy": 10.995574287564276,
65
+ "x": -0.2644638672880113,
66
+ "t": 0.5,
67
+ "probabilities": [
68
+ 0.24999999999999997,
69
+ 0.25,
70
+ 0.25,
71
+ 0.25
72
+ ]
73
+ },
74
+ {
75
+ "oscillator": 3,
76
+ "energy": 10.995574287564276,
77
+ "x": 1.7355441290775708,
78
+ "t": 0.6,
79
+ "probabilities": [
80
+ 0.25,
81
+ 0.25,
82
+ 0.25,
83
+ 0.25
84
+ ]
85
+ },
86
+ {
87
+ "oscillator": 0,
88
+ "energy": 0.5,
89
+ "x": 1.171875,
90
+ "t": 0.7,
91
+ "probabilities": [
92
+ 0.25,
93
+ 0.25,
94
+ 0.25,
95
+ 0.25
96
+ ]
97
+ },
98
+ {
99
+ "oscillator": 3,
100
+ "energy": 10.995574287564276,
101
+ "x": -0.34710882581551417,
102
+ "t": 0.7999999999999999,
103
+ "probabilities": [
104
+ 0.25,
105
+ 0.25,
106
+ 0.25,
107
+ 0.25
108
+ ]
109
+ }
110
+ ],
111
+ "config": {
112
+ "grpo": {
113
+ "group_size": 8,
114
+ "kl_penalty": 0.1
115
+ },
116
+ "vae": {
117
+ "latent_dim": 32,
118
+ "filter_threshold": 0.7
119
+ },
120
+ "policy_arch": "tiny-bigram"
121
+ }
122
+ }
vocab.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "e": 0,
3
+ "m": 1,
4
+ "a": 2,
5
+ "<|endoftext|>": 3,
6
+ "o": 4,
7
+ "l": 5,
8
+ "i": 6,
9
+ "v": 7,
10
+ "s": 8,
11
+ "b": 9,
12
+ "p": 10,
13
+ "h": 11,
14
+ "c": 12,
15
+ "r": 13,
16
+ "t": 14,
17
+ "y": 15,
18
+ "n": 16,
19
+ "g": 17,
20
+ "z": 18,
21
+ "f": 19,
22
+ "d": 20,
23
+ "u": 21,
24
+ "k": 22,
25
+ "w": 23,
26
+ "q": 24,
27
+ "x": 25,
28
+ "j": 26
29
+ }