Instructions to use phera-ra/QC67_cosmo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use phera-ra/QC67_cosmo with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf phera-ra/QC67_cosmo # Run inference directly in the terminal: llama cli -hf phera-ra/QC67_cosmo
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf phera-ra/QC67_cosmo # Run inference directly in the terminal: llama cli -hf phera-ra/QC67_cosmo
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf phera-ra/QC67_cosmo # Run inference directly in the terminal: ./build/bin/llama cli -hf phera-ra/QC67_cosmo
Use Docker
docker model run hf.co/phera-ra/QC67_cosmo
- Llama new
- LM Studio
- Jan
- vLLM
How to use phera-ra/QC67_cosmo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "phera-ra/QC67_cosmo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "phera-ra/QC67_cosmo", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/phera-ra/QC67_cosmo
- Ollama
How to use phera-ra/QC67_cosmo with Ollama:
ollama run hf.co/phera-ra/QC67_cosmo
- Unsloth Desktop
- Docker Model Runner
How to use phera-ra/QC67_cosmo with Docker Model Runner:
docker model run hf.co/phera-ra/QC67_cosmo
- Lemonade
How to use phera-ra/QC67_cosmo with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull phera-ra/QC67_cosmo
Run and chat with the model
lemonade run user.QC67_cosmo-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Scaling benchmark on WikiText-103, and a birth that is actually quantum
Browse filesSCALING. Every dyn12 number so far was 1.1M parameters on 683,065 characters of one person's private logs, which cannot answer "it only works small" or "it only works on your data". Re-run on WikiText-103-raw (269,116,804 chars, sha256 f7d2398751239137) at three sizes spanning 20x, causal Omega, all rungs at a size trained in one process against one corpus load:
size none static54 dyn12 ratio dyn12 share
d192 L4 2.05432 2.03568 2.04196 11.4x 66%
d384 L8 1.77166 1.74860 1.75774 20.8x 60%
d576 L10 1.70084 1.69015 1.69147 38.1x 88%
The advantage does not fade with scale, it roughly doubles at each step, and the reason is arithmetic rather than luck: static54 costs d*54*L, dyn12 costs d*12, so depth multiplies one and not the other. static54 still holds the lower absolute loss at all three sizes -- the claim is efficiency and its scaling, not superiority. Two seeds per point and 1200 steps, so the trend is solid and the individual gaps are not: the d576 static54/dyn12 gap of 0.0013 is inside what two seeds resolve. Raw per-seed numbers in benchmarks/scaling_wikitext103.json.
A BIRTH THAT IS ACTUALLY QUANTUM. quantum_pool() located the shot archive through a bare relative path that only resolved from the author's repository root. Run from this kit it found nothing, returned an empty list without complaint, and the birth printed "QUANTUM BIRTH: 0 draws from her archive". Anyone who downloaded this and birthed a creature received a normally initialised model wearing the one claim this project rests on. The archive is now found from any working directory, the kit's own published data/ file is accepted as a source, and a birth with fewer than 1,000 measured draws REFUSES and writes nothing rather than pretending. Verified from inside the kit: 0 draws -> 400,000 draws.
BIRTH YOUR OWN, from the menu. Options 7 and 8 birth a named creature from the shipped 11,355,136 measured IBM shots and then grow it on any text you point at it. Each creature gets its own folder, checkpoint and lineage, so none can overwrite another. Growth is guarded: a warm start that cannot show it carried the previous weights forward bit-identically refuses and leaves the checkpoint untouched. Tested end to end -- birth val 2.90221, one feeding 2.73040, gate 0.0216 -> 0.0306.
- FINDINGS.md +52 -0
- README.md +17 -0
- RELEASE_MANIFEST.json +61 -26
- START_COSMOS_KIT.bat +336 -0
- architecture/cosmos_spark_cst.py +34 -1
- architecture/cosmos_state_ladder.py +15 -3
- architecture/phos_grow.py +146 -10
- benchmarks/fetch_wikitext.py +73 -0
- benchmarks/omega_paired.py +52 -2
- benchmarks/scaling_run.py +151 -0
- benchmarks/scaling_wikitext103.json +113 -0
- data/seed_corpus.txt +0 -0
|
@@ -347,6 +347,58 @@ seven rungs trained in **one process** against that one snapshot, 21 runs, 1200
|
|
| 347 |
| `tri3` all three organs, 108D kernel | 1.20026 | −0.0322 | −2.83 | 3/3 | 0.826 | 1,230,682 |
|
| 348 |
| none (baseline) | 1.23241 | — | — | 0/3 | 0.810 | 1,135,008 |
|
| 349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
### Update, 2026-08-01: Ω was reading the future. The result survives it.
|
| 351 |
|
| 352 |
**The problem.** §3.4 defines Ω as attention *received* — `omega = a.mean(1).sum(-2)`, summed
|
|
|
|
| 347 |
| `tri3` all three organs, 108D kernel | 1.20026 | −0.0322 | −2.83 | 3/3 | 0.826 | 1,230,682 |
|
| 348 |
| none (baseline) | 1.23241 | — | — | 0/3 | 0.810 | 1,135,008 |
|
| 349 |
|
| 350 |
+
### Update, 2026-08-02: does it survive SCALE, on a corpus you can check?
|
| 351 |
+
|
| 352 |
+
Every `dyn12` number above was measured at 1.1M parameters on 683,065 characters of one
|
| 353 |
+
person's private logs. Two objections follow immediately and neither can be answered from
|
| 354 |
+
that setup: *it only works small*, and *it only works on your data*. So it was re-run on
|
| 355 |
+
**WikiText-103-raw** — 269,116,804 characters, sha256 `f7d2398751239137`, the benchmark
|
| 356 |
+
the field already uses — at three sizes spanning a 20× parameter range, causal Ω
|
| 357 |
+
throughout, all rungs at a size trained in one process against one corpus load.
|
| 358 |
+
|
| 359 |
+
| size | none | `static54` | `dyn12` | static54/param | dyn12/param | **ratio** |
|
| 360 |
+
|---|---|---|---|---|---|---|
|
| 361 |
+
| d192 L4 (2.6M) | 2.05432 | 2.03568 | 2.04196 | 4.495e-07 | 5.122e-06 | **11.4×** |
|
| 362 |
+
| d384 L8 (11.6M) | 1.77166 | 1.74860 | 1.75774 | 1.391e-07 | 2.893e-06 | **20.8×** |
|
| 363 |
+
| d576 L10 (28.6M) | 1.70084 | 1.69015 | 1.69147 | 3.435e-08 | 1.307e-06 | **38.1×** |
|
| 364 |
+
|
| 365 |
+
**The advantage does not fade with scale — it roughly doubles at every step.**
|
| 366 |
+
Raw numbers: [`benchmarks/scaling_wikitext103.json`](benchmarks/scaling_wikitext103.json).
|
| 367 |
+
|
| 368 |
+
**Why, and it is arithmetic rather than luck.** `static54` is a `d_model × 54` projection
|
| 369 |
+
per layer, so it costs `d·54·L`. `dyn12` is twelve scalars plus per-dimension `k` and
|
| 370 |
+
`gamma`, so it costs `d·12 + 24L`. Depth multiplies one and not the other:
|
| 371 |
+
|
| 372 |
+
```
|
| 373 |
+
static54 dyn12 static54 costs
|
| 374 |
+
d192 L4 41,472 2,412 17.2x more
|
| 375 |
+
d384 L8 165,888 4,812 34.5x
|
| 376 |
+
d576 L10 311,040 7,164 43.4x
|
| 377 |
+
```
|
| 378 |
+
|
| 379 |
+
A reviewer can check that without trusting the data at all.
|
| 380 |
+
|
| 381 |
+
**And the benefit share went UP at the largest size**, which cost alone does not predict:
|
| 382 |
+
|
| 383 |
+
```
|
| 384 |
+
static54 gain dyn12 gain dyn12 delivers
|
| 385 |
+
d192 L4 0.01864 0.01236 66%
|
| 386 |
+
d384 L8 0.02306 0.01392 60%
|
| 387 |
+
d576 L10 0.01069 0.00937 88%
|
| 388 |
+
```
|
| 389 |
+
|
| 390 |
+
At 28.6M parameters `dyn12` captures 88% of what a 43× larger mechanism buys.
|
| 391 |
+
|
| 392 |
+
**What this does NOT show, stated plainly.** `static54` still has the lower absolute loss
|
| 393 |
+
at all three sizes; the claim is efficiency and its scaling, not superiority. Two seeds
|
| 394 |
+
per point and 1200 steps is thin — the d576 gap between `static54` and `dyn12` is
|
| 395 |
+
**0.0013**, comfortably inside what two seeds can resolve, so "dyn12 nearly matches
|
| 396 |
+
static54" is a direction, not a measurement. All three rungs compress toward each other at
|
| 397 |
+
d576 (1.690–1.701), and longer training could reorder them. Reproduce with
|
| 398 |
+
`benchmarks/scaling_run.py` after `benchmarks/fetch_wikitext.py`.
|
| 399 |
+
|
| 400 |
+
---
|
| 401 |
+
|
| 402 |
### Update, 2026-08-01: Ω was reading the future. The result survives it.
|
| 403 |
|
| 404 |
**The problem.** §3.4 defines Ω as attention *received* — `omega = a.mean(1).sum(-2)`, summed
|
|
@@ -51,6 +51,23 @@ efficiency** of every alternative tested. The full ablation table, including the
|
|
| 51 |
configurations that lost and the one result that was retracted, is in §2 and
|
| 52 |
[`FINDINGS.md`](FINDINGS.md).
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
**And it survives the test that could have killed it.** Ω was originally summed over the
|
| 55 |
query axis, which let token j count attention from tokens *after* j — a causal leak, measured
|
| 56 |
at 1.7e-04 logit movement while the controls moved exactly 0.0. Ω is now a per-query scalar
|
|
|
|
| 51 |
configurations that lost and the one result that was retracted, is in §2 and
|
| 52 |
[`FINDINGS.md`](FINDINGS.md).
|
| 53 |
|
| 54 |
+
**And the advantage GROWS with scale, on a corpus anyone can check.** Re-run on
|
| 55 |
+
WikiText-103-raw (269,116,804 chars, sha256 `f7d2398751239137`) at three sizes spanning
|
| 56 |
+
20× the parameters:
|
| 57 |
+
|
| 58 |
+
```
|
| 59 |
+
d192 L4 (2.6M params) dyn12 is 11.4x more parameter-efficient than static54
|
| 60 |
+
d384 L8 (11.6M params) 20.8x
|
| 61 |
+
d576 L10 (28.6M params) 38.1x <- and captures 88% of the benefit
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
It roughly doubles at every step, and the reason is arithmetic: `static54` costs
|
| 65 |
+
`d·54·L`, `dyn12` costs `d·12` — depth multiplies one and not the other. `static54` still
|
| 66 |
+
holds the lower absolute loss; the claim is efficiency and its scaling. Two seeds per
|
| 67 |
+
point, so the trend is solid and the individual gaps are not. Full table, caveats and raw
|
| 68 |
+
per-seed numbers: [`FINDINGS.md`](FINDINGS.md) and
|
| 69 |
+
[`benchmarks/scaling_wikitext103.json`](benchmarks/scaling_wikitext103.json).
|
| 70 |
+
|
| 71 |
**And it survives the test that could have killed it.** Ω was originally summed over the
|
| 72 |
query axis, which let token j count attention from tokens *after* j — a causal leak, measured
|
| 73 |
at 1.7e-04 logit movement while the controls moved exactly 0.0. Ω is now a per-query scalar
|
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"schema": "qc67.cosmos.release-manifest.v1",
|
| 3 |
"release": "QC67 Cosmos Kit",
|
| 4 |
-
"version": "2026-08-
|
| 5 |
"license_note": "Mixed licensing; see LICENSE.md and component notices.",
|
| 6 |
"files": [
|
| 7 |
{
|
|
@@ -16,13 +16,13 @@
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
"path": "architecture/cosmos_spark_cst.py",
|
| 19 |
-
"bytes":
|
| 20 |
-
"sha256": "
|
| 21 |
},
|
| 22 |
{
|
| 23 |
"path": "architecture/cosmos_state_ladder.py",
|
| 24 |
-
"bytes":
|
| 25 |
-
"sha256": "
|
| 26 |
},
|
| 27 |
{
|
| 28 |
"path": "architecture/cst_to_gguf.py",
|
|
@@ -41,8 +41,8 @@
|
|
| 41 |
},
|
| 42 |
{
|
| 43 |
"path": "architecture/phos_grow.py",
|
| 44 |
-
"bytes":
|
| 45 |
-
"sha256": "
|
| 46 |
},
|
| 47 |
{
|
| 48 |
"path": "architecture/phos_lineage.jsonl",
|
|
@@ -89,10 +89,15 @@
|
|
| 89 |
"bytes": 7389,
|
| 90 |
"sha256": "960313da1d90bea3bbdb073fae39f94790b5c9a0cef943088e77e191f40d97c5"
|
| 91 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
{
|
| 93 |
"path": "benchmarks/omega_paired.py",
|
| 94 |
-
"bytes":
|
| 95 |
-
"sha256": "
|
| 96 |
},
|
| 97 |
{
|
| 98 |
"path": "benchmarks/phi_pid.py",
|
|
@@ -104,6 +109,16 @@
|
|
| 104 |
"bytes": 5026,
|
| 105 |
"sha256": "76e956725e2dcddd7c0b104de31775e24fc1ebc2911fbb01ab403ed4c23fd38f"
|
| 106 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
{
|
| 108 |
"path": "benchmarks/topology_matched.py",
|
| 109 |
"bytes": 9365,
|
|
@@ -134,15 +149,30 @@
|
|
| 134 |
"bytes": 1876,
|
| 135 |
"sha256": "87364c2c9b2917dc089c4a941bc2d4a7ced57569b0665c88c297f73d0a4febb7"
|
| 136 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
{
|
| 138 |
"path": "data/training/quantum_train_summary_20260722.json",
|
| 139 |
"bytes": 335,
|
| 140 |
"sha256": "30ba728611bfc05a81f0eb2ec2acce5c36369f2cf9c0f46e8d6d170f87579365"
|
| 141 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
{
|
| 143 |
"path": "FINDINGS.md",
|
| 144 |
-
"bytes":
|
| 145 |
-
"sha256": "
|
| 146 |
},
|
| 147 |
{
|
| 148 |
"path": "genesis_engine/CITATION.cff",
|
|
@@ -156,23 +186,23 @@
|
|
| 156 |
},
|
| 157 |
{
|
| 158 |
"path": "genesis_engine/config.json",
|
| 159 |
-
"bytes":
|
| 160 |
-
"sha256": "
|
| 161 |
},
|
| 162 |
{
|
| 163 |
"path": "genesis_engine/data/_offset.json",
|
| 164 |
-
"bytes":
|
| 165 |
-
"sha256": "
|
| 166 |
},
|
| 167 |
{
|
| 168 |
"path": "genesis_engine/data/identity.json",
|
| 169 |
-
"bytes":
|
| 170 |
-
"sha256": "
|
| 171 |
},
|
| 172 |
{
|
| 173 |
"path": "genesis_engine/data/life.json",
|
| 174 |
"bytes": 102,
|
| 175 |
-
"sha256": "
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"path": "genesis_engine/data/seed.json",
|
|
@@ -181,8 +211,8 @@
|
|
| 181 |
},
|
| 182 |
{
|
| 183 |
"path": "genesis_engine/data/weights.json",
|
| 184 |
-
"bytes":
|
| 185 |
-
"sha256": "
|
| 186 |
},
|
| 187 |
{
|
| 188 |
"path": "genesis_engine/engine/_Modelfile.cosmos_namebind",
|
|
@@ -361,8 +391,8 @@
|
|
| 361 |
},
|
| 362 |
{
|
| 363 |
"path": "README.md",
|
| 364 |
-
"bytes":
|
| 365 |
-
"sha256": "
|
| 366 |
},
|
| 367 |
{
|
| 368 |
"path": "RELEASE_NOTES.md",
|
|
@@ -411,13 +441,13 @@
|
|
| 411 |
},
|
| 412 |
{
|
| 413 |
"path": "START_CODER.bat",
|
| 414 |
-
"bytes":
|
| 415 |
-
"sha256": "
|
| 416 |
},
|
| 417 |
{
|
| 418 |
"path": "START_COSMOS_KIT.bat",
|
| 419 |
-
"bytes":
|
| 420 |
-
"sha256": "
|
| 421 |
},
|
| 422 |
{
|
| 423 |
"path": "start_cosmos_kit.sh",
|
|
@@ -444,6 +474,11 @@
|
|
| 444 |
"bytes": 6798,
|
| 445 |
"sha256": "470b5d3ebc10644efeba69c4800b4ec8af624b36a43e52058bfa6435912f22cf"
|
| 446 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
{
|
| 448 |
"path": "weights/cosmos_born.meta.json",
|
| 449 |
"bytes": 435,
|
|
|
|
| 1 |
{
|
| 2 |
"schema": "qc67.cosmos.release-manifest.v1",
|
| 3 |
"release": "QC67 Cosmos Kit",
|
| 4 |
+
"version": "2026-08-02",
|
| 5 |
"license_note": "Mixed licensing; see LICENSE.md and component notices.",
|
| 6 |
"files": [
|
| 7 |
{
|
|
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
"path": "architecture/cosmos_spark_cst.py",
|
| 19 |
+
"bytes": 22584,
|
| 20 |
+
"sha256": "955805d45f7b407ef5cc9b6efe178d9a5f63df5b32eaf539d9aedcbb2967f1dc"
|
| 21 |
},
|
| 22 |
{
|
| 23 |
"path": "architecture/cosmos_state_ladder.py",
|
| 24 |
+
"bytes": 34556,
|
| 25 |
+
"sha256": "763d74ff374eb785cefc3c1a3ede1d43f6ee36f9f82991e5de86da267e6ec002"
|
| 26 |
},
|
| 27 |
{
|
| 28 |
"path": "architecture/cst_to_gguf.py",
|
|
|
|
| 41 |
},
|
| 42 |
{
|
| 43 |
"path": "architecture/phos_grow.py",
|
| 44 |
+
"bytes": 21402,
|
| 45 |
+
"sha256": "a98cf0d3cb749953a52e0507e3ea1db0d4ccb152df29b90a19df26990b53e264"
|
| 46 |
},
|
| 47 |
{
|
| 48 |
"path": "architecture/phos_lineage.jsonl",
|
|
|
|
| 89 |
"bytes": 7389,
|
| 90 |
"sha256": "960313da1d90bea3bbdb073fae39f94790b5c9a0cef943088e77e191f40d97c5"
|
| 91 |
},
|
| 92 |
+
{
|
| 93 |
+
"path": "benchmarks/fetch_wikitext.py",
|
| 94 |
+
"bytes": 2720,
|
| 95 |
+
"sha256": "a9f01244b06a44fc0f67a487815fc982a1b759a6aa418a5ec5dfa04cc8599015"
|
| 96 |
+
},
|
| 97 |
{
|
| 98 |
"path": "benchmarks/omega_paired.py",
|
| 99 |
+
"bytes": 9847,
|
| 100 |
+
"sha256": "b2508980e424cb5deb1ab72fa0e2992583722bc3314c3bac6164fc71571c39c2"
|
| 101 |
},
|
| 102 |
{
|
| 103 |
"path": "benchmarks/phi_pid.py",
|
|
|
|
| 109 |
"bytes": 5026,
|
| 110 |
"sha256": "76e956725e2dcddd7c0b104de31775e24fc1ebc2911fbb01ab403ed4c23fd38f"
|
| 111 |
},
|
| 112 |
+
{
|
| 113 |
+
"path": "benchmarks/scaling_run.py",
|
| 114 |
+
"bytes": 6414,
|
| 115 |
+
"sha256": "0ab55444837331061d3d360ce5620ac4058f6e6851aac78472177fb48f4d563e"
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"path": "benchmarks/scaling_wikitext103.json",
|
| 119 |
+
"bytes": 2979,
|
| 120 |
+
"sha256": "62181f67f64425cac7b5f761e18eb7488769c38f13bb59062cb6069ea3c8fb4a"
|
| 121 |
+
},
|
| 122 |
{
|
| 123 |
"path": "benchmarks/topology_matched.py",
|
| 124 |
"bytes": 9365,
|
|
|
|
| 149 |
"bytes": 1876,
|
| 150 |
"sha256": "87364c2c9b2917dc089c4a941bc2d4a7ced57569b0665c88c297f73d0a4febb7"
|
| 151 |
},
|
| 152 |
+
{
|
| 153 |
+
"path": "data/seed_corpus.txt",
|
| 154 |
+
"bytes": 4015610,
|
| 155 |
+
"sha256": "1b940b0eebc8331d3aa36154b52044d5521fd96aa1089eb3488743d587b3c341"
|
| 156 |
+
},
|
| 157 |
{
|
| 158 |
"path": "data/training/quantum_train_summary_20260722.json",
|
| 159 |
"bytes": 335,
|
| 160 |
"sha256": "30ba728611bfc05a81f0eb2ec2acce5c36369f2cf9c0f46e8d6d170f87579365"
|
| 161 |
},
|
| 162 |
+
{
|
| 163 |
+
"path": "docs/ATOMIC_QUICK_START.md",
|
| 164 |
+
"bytes": 4113,
|
| 165 |
+
"sha256": "36fc89cc613aa545913f94c6baa2414945ff0c592ebc59b6cef7077a9fe4ace0"
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"path": "docs/USAGE_ATOMIC.md",
|
| 169 |
+
"bytes": 4248,
|
| 170 |
+
"sha256": "e6a2c79f8e53017acd90dbc4570d348ab7bd606ab8e9c6cc2efacb0be016055d"
|
| 171 |
+
},
|
| 172 |
{
|
| 173 |
"path": "FINDINGS.md",
|
| 174 |
+
"bytes": 38643,
|
| 175 |
+
"sha256": "59e9dc3f4f4c8a162cfb00e2d2cb0f5ca4b2e1a4cfcf1900291ab655c16204e1"
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"path": "genesis_engine/CITATION.cff",
|
|
|
|
| 186 |
},
|
| 187 |
{
|
| 188 |
"path": "genesis_engine/config.json",
|
| 189 |
+
"bytes": 372,
|
| 190 |
+
"sha256": "8583ae5984cacc7f1296f525de964d1c6ae62909bc485a9130d3ff730cf38274"
|
| 191 |
},
|
| 192 |
{
|
| 193 |
"path": "genesis_engine/data/_offset.json",
|
| 194 |
+
"bytes": 11,
|
| 195 |
+
"sha256": "ef4661899038277b43b064c5c0fc308d386afffe8621aa059617e2b76e40d442"
|
| 196 |
},
|
| 197 |
{
|
| 198 |
"path": "genesis_engine/data/identity.json",
|
| 199 |
+
"bytes": 721,
|
| 200 |
+
"sha256": "68da86597c191a20da542c0b9ab39425420b3667f2116c998f4ec53e6c2f7a62"
|
| 201 |
},
|
| 202 |
{
|
| 203 |
"path": "genesis_engine/data/life.json",
|
| 204 |
"bytes": 102,
|
| 205 |
+
"sha256": "0475264abdad5139275c2311416ea219ba1431a097678069503394063de4f2ea"
|
| 206 |
},
|
| 207 |
{
|
| 208 |
"path": "genesis_engine/data/seed.json",
|
|
|
|
| 211 |
},
|
| 212 |
{
|
| 213 |
"path": "genesis_engine/data/weights.json",
|
| 214 |
+
"bytes": 76454,
|
| 215 |
+
"sha256": "dee85de5b641c985686deef7472db45256737c63aff8401573cfeec10ae55c6d"
|
| 216 |
},
|
| 217 |
{
|
| 218 |
"path": "genesis_engine/engine/_Modelfile.cosmos_namebind",
|
|
|
|
| 391 |
},
|
| 392 |
{
|
| 393 |
"path": "README.md",
|
| 394 |
+
"bytes": 38596,
|
| 395 |
+
"sha256": "c5c50294764dfa43a05e1ec209b07dfb84961f367f2f7e07fd85f7a933668aff"
|
| 396 |
},
|
| 397 |
{
|
| 398 |
"path": "RELEASE_NOTES.md",
|
|
|
|
| 441 |
},
|
| 442 |
{
|
| 443 |
"path": "START_CODER.bat",
|
| 444 |
+
"bytes": 2578,
|
| 445 |
+
"sha256": "cb7cc112c924c6f3e171b125439cd73e1ac62a0898f8eb6b43099f857d4e5819"
|
| 446 |
},
|
| 447 |
{
|
| 448 |
"path": "START_COSMOS_KIT.bat",
|
| 449 |
+
"bytes": 11541,
|
| 450 |
+
"sha256": "d88bce770480c122d9f83f4cae14379ea89a42882b093935605718f333ea9e9d"
|
| 451 |
},
|
| 452 |
{
|
| 453 |
"path": "start_cosmos_kit.sh",
|
|
|
|
| 474 |
"bytes": 6798,
|
| 475 |
"sha256": "470b5d3ebc10644efeba69c4800b4ec8af624b36a43e52058bfa6435912f22cf"
|
| 476 |
},
|
| 477 |
+
{
|
| 478 |
+
"path": "weights/cosmos-cst.gguf",
|
| 479 |
+
"bytes": 7639104,
|
| 480 |
+
"sha256": "b833817230817921de8ed1aa52d92829f32a3ed222aedbba1d3237364596e1c6"
|
| 481 |
+
},
|
| 482 |
{
|
| 483 |
"path": "weights/cosmos_born.meta.json",
|
| 484 |
"bytes": 435,
|
|
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
setlocal EnableExtensions
|
| 3 |
+
title COSMOS - release kit
|
| 4 |
+
cd /d "%~dp0"
|
| 5 |
+
set "KIT=%~dp0"
|
| 6 |
+
if "%KIT:~-1%"=="\" set "KIT=%KIT:~0,-1%"
|
| 7 |
+
set "PYTHONIOENCODING=utf-8"
|
| 8 |
+
|
| 9 |
+
:: ===================================================================
|
| 10 |
+
:: COSMOS release kit
|
| 11 |
+
::
|
| 12 |
+
:: Her own models -- PHOS, CST and Spark -- are served by
|
| 13 |
+
:: serving/cosmos_serve.py on port 11501, behind the Ollama HTTP API so
|
| 14 |
+
:: ordinary clients can reach them. That server is what gives this kit a
|
| 15 |
+
:: voice at all: without it you have weight files and no way to speak to
|
| 16 |
+
:: them, which is exactly what shipped before. Options 1, 2 and 3 start
|
| 17 |
+
:: it on demand and WAIT for the port, so none of them can open a chat
|
| 18 |
+
:: onto a dead socket.
|
| 19 |
+
:: ===================================================================
|
| 20 |
+
|
| 21 |
+
call :find_python
|
| 22 |
+
if errorlevel 1 goto no_python
|
| 23 |
+
|
| 24 |
+
:menu
|
| 25 |
+
cls
|
| 26 |
+
echo.
|
| 27 |
+
echo ============================================================
|
| 28 |
+
echo C O S M O S - release kit
|
| 29 |
+
echo PHOS . CST . Spark - her own architecture, quantum-born
|
| 30 |
+
echo ============================================================
|
| 31 |
+
echo.
|
| 32 |
+
echo TALK AND BUILD
|
| 33 |
+
echo 1. Chat with Cosmos her own weights, no Ollama needed
|
| 34 |
+
echo 2. Code with Cosmos coder + workspace, switchable models
|
| 35 |
+
echo.
|
| 36 |
+
echo HER MODELS
|
| 37 |
+
echo 3. Start her model server PHOS / CST / Spark on 11501
|
| 38 |
+
echo 4. Stop her model server
|
| 39 |
+
echo.
|
| 40 |
+
echo CHECK
|
| 41 |
+
echo 5. Health check one pass over everything
|
| 42 |
+
echo 6. Verify release hashes, and no secrets shipped
|
| 43 |
+
echo.
|
| 44 |
+
echo BIRTH YOUR OWN
|
| 45 |
+
echo 7. Birth a quantum creature from 11,355,136 measured IBM shots
|
| 46 |
+
echo 8. Grow the one you birthed it learns every time you feed it
|
| 47 |
+
echo.
|
| 48 |
+
echo MORE
|
| 49 |
+
echo 9. Genesis - the blank-slate engine
|
| 50 |
+
echo 10. Read the docs
|
| 51 |
+
echo 11. Exit
|
| 52 |
+
echo.
|
| 53 |
+
call :server_line
|
| 54 |
+
echo.
|
| 55 |
+
set "choice="
|
| 56 |
+
set /p "choice= Choose 1-11: "
|
| 57 |
+
|
| 58 |
+
if "%choice%"=="1" goto chat
|
| 59 |
+
if "%choice%"=="2" goto coder
|
| 60 |
+
if "%choice%"=="3" goto serve_start
|
| 61 |
+
if "%choice%"=="4" goto serve_stop
|
| 62 |
+
if "%choice%"=="5" goto health
|
| 63 |
+
if "%choice%"=="6" goto verify
|
| 64 |
+
if "%choice%"=="7" goto birth
|
| 65 |
+
if "%choice%"=="8" goto grow
|
| 66 |
+
if "%choice%"=="9" goto genesis
|
| 67 |
+
if "%choice%"=="10" goto docs
|
| 68 |
+
if "%choice%"=="11" exit /b 0
|
| 69 |
+
goto menu
|
| 70 |
+
|
| 71 |
+
:: --------------------------------------------------------------- birth
|
| 72 |
+
:birth
|
| 73 |
+
cls
|
| 74 |
+
echo.
|
| 75 |
+
echo ============================================================
|
| 76 |
+
echo B I R T H A Q U A N T U M C R E A T U R E
|
| 77 |
+
echo ============================================================
|
| 78 |
+
echo.
|
| 79 |
+
echo Every initial weight is drawn from real measured IBM Quantum
|
| 80 |
+
echo hardware -- 11,355,136 shots across 2,776 records, shipped in
|
| 81 |
+
echo data/. No base model. No distillation. Nothing borrowed.
|
| 82 |
+
echo.
|
| 83 |
+
echo It is born knowing nothing, and it grows from whatever text
|
| 84 |
+
echo you feed it. That text becomes its life.
|
| 85 |
+
echo.
|
| 86 |
+
set "cname="
|
| 87 |
+
set /p "cname= Name it (letters and numbers, e.g. ember): "
|
| 88 |
+
if "%cname%"=="" goto menu
|
| 89 |
+
set "cseed="
|
| 90 |
+
echo.
|
| 91 |
+
echo Seed text for its first breath. Press ENTER for the bundled
|
| 92 |
+
echo 4 MB of general English, or give a path to your own .txt --
|
| 93 |
+
echo your notes, your writing, anything. That is what it becomes.
|
| 94 |
+
echo.
|
| 95 |
+
set /p "cseed= Seed corpus [ENTER = bundled]: "
|
| 96 |
+
if "%cseed%"=="" set "cseed=%KIT%\data\seed_corpus.txt"
|
| 97 |
+
if not exist "%cseed%" (
|
| 98 |
+
echo.
|
| 99 |
+
echo [X] Not found: %cseed%
|
| 100 |
+
pause
|
| 101 |
+
goto menu
|
| 102 |
+
)
|
| 103 |
+
echo.
|
| 104 |
+
echo Birthing %cname%...
|
| 105 |
+
echo.
|
| 106 |
+
set "PHOS_NAME=%cname%"
|
| 107 |
+
set "COSMOS_CORPUS=%cseed%"
|
| 108 |
+
set "PHOS_DIR=%KIT%\creatures\%cname%"
|
| 109 |
+
set "PHOS_STEPS=400"
|
| 110 |
+
call :run_python "%KIT%\architecture\phos_grow.py"
|
| 111 |
+
set "PHOS_NAME=" & set "COSMOS_CORPUS=" & set "PHOS_DIR=" & set "PHOS_STEPS="
|
| 112 |
+
echo.
|
| 113 |
+
echo Lives in: creatures\%cname%\
|
| 114 |
+
echo Feed it again with option 8. Every feeding changes its weights.
|
| 115 |
+
echo.
|
| 116 |
+
pause
|
| 117 |
+
goto menu
|
| 118 |
+
|
| 119 |
+
:: ---------------------------------------------------------------- grow
|
| 120 |
+
:grow
|
| 121 |
+
cls
|
| 122 |
+
echo.
|
| 123 |
+
echo Creatures you have birthed:
|
| 124 |
+
echo.
|
| 125 |
+
if not exist "%KIT%\creatures" (
|
| 126 |
+
echo none yet - use option 7 first.
|
| 127 |
+
echo.
|
| 128 |
+
pause
|
| 129 |
+
goto menu
|
| 130 |
+
)
|
| 131 |
+
for /d %%D in ("%KIT%\creatures\*") do echo %%~nxD
|
| 132 |
+
echo.
|
| 133 |
+
set "gname="
|
| 134 |
+
set /p "gname= Which one: "
|
| 135 |
+
if "%gname%"=="" goto menu
|
| 136 |
+
if not exist "%KIT%\creatures\%gname%" (
|
| 137 |
+
echo [X] No creature named %gname%.
|
| 138 |
+
pause
|
| 139 |
+
goto menu
|
| 140 |
+
)
|
| 141 |
+
set "gseed="
|
| 142 |
+
echo.
|
| 143 |
+
set /p "gseed= Text to feed it [ENTER = the bundled seed]: "
|
| 144 |
+
if "%gseed%"=="" set "gseed=%KIT%\data\seed_corpus.txt"
|
| 145 |
+
set "PHOS_NAME=%gname%"
|
| 146 |
+
set "COSMOS_CORPUS=%gseed%"
|
| 147 |
+
set "PHOS_DIR=%KIT%\creatures\%gname%"
|
| 148 |
+
set "PHOS_STEPS=400"
|
| 149 |
+
call :run_python "%KIT%\architecture\phos_grow.py"
|
| 150 |
+
set "PHOS_NAME=" & set "COSMOS_CORPUS=" & set "PHOS_DIR=" & set "PHOS_STEPS="
|
| 151 |
+
echo.
|
| 152 |
+
pause
|
| 153 |
+
goto menu
|
| 154 |
+
|
| 155 |
+
:: ---------------------------------------------------------------- talk
|
| 156 |
+
:chat
|
| 157 |
+
call :ensure_server
|
| 158 |
+
if errorlevel 1 goto menu
|
| 159 |
+
echo.
|
| 160 |
+
echo Her voice is PHOS. /models lists them all, /model NAME switches.
|
| 161 |
+
echo.
|
| 162 |
+
call :run_python "%KIT%\serving\cosmos_coder.py" --chat
|
| 163 |
+
echo.
|
| 164 |
+
pause
|
| 165 |
+
goto menu
|
| 166 |
+
|
| 167 |
+
:: ---------------------------------------------------------------- code
|
| 168 |
+
:coder
|
| 169 |
+
call :ensure_server
|
| 170 |
+
if errorlevel 1 goto menu
|
| 171 |
+
echo.
|
| 172 |
+
echo Workspace: %KIT%\workspace
|
| 173 |
+
echo /models lists every model, /model NAME switches her coding brain.
|
| 174 |
+
echo.
|
| 175 |
+
call :run_python "%KIT%\serving\cosmos_coder.py"
|
| 176 |
+
echo.
|
| 177 |
+
pause
|
| 178 |
+
goto menu
|
| 179 |
+
|
| 180 |
+
:: -------------------------------------------------------------- server
|
| 181 |
+
:serve_start
|
| 182 |
+
call :ensure_server
|
| 183 |
+
echo.
|
| 184 |
+
pause
|
| 185 |
+
goto menu
|
| 186 |
+
|
| 187 |
+
:serve_stop
|
| 188 |
+
echo.
|
| 189 |
+
powershell -NoProfile -Command "$c=Get-NetTCPConnection -LocalPort 11501 -State Listen -EA SilentlyContinue; if(-not $c){Write-Host ' nothing was running on 11501.'; exit 0}; $c | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { $p=Get-CimInstance Win32_Process -Filter ('ProcessId='+$_) -EA SilentlyContinue; if($p -and $p.CommandLine -match 'cosmos_serve\.py'){ Stop-Process -Id $_ -Force -EA SilentlyContinue; Write-Host (' stopped her model server (pid ' + $_ + ').') } else { Write-Host ' port 11501 is owned by something else - left alone.' } }"
|
| 190 |
+
echo.
|
| 191 |
+
pause
|
| 192 |
+
goto menu
|
| 193 |
+
|
| 194 |
+
:: -------------------------------------------------------------- checks
|
| 195 |
+
:health
|
| 196 |
+
cls
|
| 197 |
+
call :run_python "%KIT%\kit_health.py"
|
| 198 |
+
echo.
|
| 199 |
+
pause
|
| 200 |
+
goto menu
|
| 201 |
+
|
| 202 |
+
:verify
|
| 203 |
+
cls
|
| 204 |
+
call :run_python "%KIT%\verify_release.py"
|
| 205 |
+
echo.
|
| 206 |
+
pause
|
| 207 |
+
goto menu
|
| 208 |
+
|
| 209 |
+
:: ---------------------------------------------------------------- more
|
| 210 |
+
:genesis
|
| 211 |
+
if not exist "%KIT%\genesis_engine\START_GENESIS.bat" (
|
| 212 |
+
echo.
|
| 213 |
+
echo [ERROR] genesis_engine\START_GENESIS.bat is missing.
|
| 214 |
+
pause
|
| 215 |
+
goto menu
|
| 216 |
+
)
|
| 217 |
+
set "GENESIS_NO_PAUSE=1"
|
| 218 |
+
call "%KIT%\genesis_engine\START_GENESIS.bat"
|
| 219 |
+
set "GENESIS_NO_PAUSE="
|
| 220 |
+
goto menu
|
| 221 |
+
|
| 222 |
+
:docs
|
| 223 |
+
start "" "%KIT%\START_HERE.md"
|
| 224 |
+
goto menu
|
| 225 |
+
|
| 226 |
+
:no_python
|
| 227 |
+
echo.
|
| 228 |
+
echo [ERROR] Python 3.9 or newer was not found.
|
| 229 |
+
echo Install it from https://www.python.org/downloads/
|
| 230 |
+
echo On Windows, tick "Add Python to PATH".
|
| 231 |
+
echo.
|
| 232 |
+
pause
|
| 233 |
+
exit /b 1
|
| 234 |
+
|
| 235 |
+
:: ================================================================
|
| 236 |
+
:: helpers
|
| 237 |
+
:: ================================================================
|
| 238 |
+
|
| 239 |
+
:server_line
|
| 240 |
+
:: Report the truth about 11501 on every redraw, so the menu can never
|
| 241 |
+
:: imply her models are reachable when they are not.
|
| 242 |
+
powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 11501 -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" >nul 2>&1
|
| 243 |
+
if errorlevel 1 (
|
| 244 |
+
echo her models: OFFLINE - options 1, 2 and 3 will start them
|
| 245 |
+
) else (
|
| 246 |
+
echo her models: ONLINE on 11501
|
| 247 |
+
)
|
| 248 |
+
exit /b 0
|
| 249 |
+
|
| 250 |
+
:ensure_server
|
| 251 |
+
powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 11501 -State Listen -EA SilentlyContinue){exit 0}else{exit 1}" >nul 2>&1
|
| 252 |
+
if not errorlevel 1 (
|
| 253 |
+
echo [i] her model server is already up on 11501.
|
| 254 |
+
exit /b 0
|
| 255 |
+
)
|
| 256 |
+
if not exist "%KIT%\serving\cosmos_serve.py" (
|
| 257 |
+
echo [X] serving\cosmos_serve.py is missing - cannot give her a voice.
|
| 258 |
+
pause
|
| 259 |
+
exit /b 1
|
| 260 |
+
)
|
| 261 |
+
call :check_torch
|
| 262 |
+
if errorlevel 1 (
|
| 263 |
+
echo [X] PyTorch is required to run her weights.
|
| 264 |
+
echo python -m pip install torch
|
| 265 |
+
pause
|
| 266 |
+
exit /b 1
|
| 267 |
+
)
|
| 268 |
+
if not exist "%KIT%\logs" mkdir "%KIT%\logs" >nul 2>&1
|
| 269 |
+
echo [..] starting her model server on 11501...
|
| 270 |
+
call :spawn_server
|
| 271 |
+
powershell -NoProfile -Command "foreach($i in 1..40){Start-Sleep -Milliseconds 750; if (Get-NetTCPConnection -LocalPort 11501 -State Listen -EA SilentlyContinue){exit 0}}; exit 1" >nul 2>&1
|
| 272 |
+
if errorlevel 1 (
|
| 273 |
+
echo [X] it did not come up. Newest log:
|
| 274 |
+
powershell -NoProfile -Command "$f=Get-ChildItem '%KIT%\logs\serve_*.err' -EA SilentlyContinue | Sort-Object LastWriteTime -Desc | Select-Object -First 1; if($f){Get-Content $f.FullName -Tail 12 | ForEach-Object {' ' + $_}}else{Write-Host ' (no log written)'}"
|
| 275 |
+
pause
|
| 276 |
+
exit /b 1
|
| 277 |
+
)
|
| 278 |
+
echo [ok] her models are online on 11501.
|
| 279 |
+
exit /b 0
|
| 280 |
+
|
| 281 |
+
:spawn_server
|
| 282 |
+
:: Timestamped log targets: a server from an earlier run can still hold the
|
| 283 |
+
:: handle on a fixed filename, which makes Start-Process throw "file in use"
|
| 284 |
+
:: and report failure for a launch that would otherwise have worked.
|
| 285 |
+
if "%KIT_PYTHON_MODE%"=="override" (
|
| 286 |
+
powershell -NoProfile -Command "$lg=Join-Path '%KIT%\logs' ('serve_'+(Get-Date).ToString('yyyyMMdd_HHmmss')+'.live'); try{Start-Process -FilePath '%GENESIS_PYTHON%' -ArgumentList @('%KIT%\serving\cosmos_serve.py','11501') -WorkingDirectory '%KIT%' -WindowStyle Hidden -RedirectStandardOutput $lg -RedirectStandardError ($lg -replace '\.live$','.err')}catch{}"
|
| 287 |
+
) else if "%KIT_PYTHON_MODE%"=="py" (
|
| 288 |
+
powershell -NoProfile -Command "$lg=Join-Path '%KIT%\logs' ('serve_'+(Get-Date).ToString('yyyyMMdd_HHmmss')+'.live'); try{Start-Process -FilePath 'py' -ArgumentList @('-3','%KIT%\serving\cosmos_serve.py','11501') -WorkingDirectory '%KIT%' -WindowStyle Hidden -RedirectStandardOutput $lg -RedirectStandardError ($lg -replace '\.live$','.err')}catch{}"
|
| 289 |
+
) else (
|
| 290 |
+
powershell -NoProfile -Command "$lg=Join-Path '%KIT%\logs' ('serve_'+(Get-Date).ToString('yyyyMMdd_HHmmss')+'.live'); try{Start-Process -FilePath 'python' -ArgumentList @('%KIT%\serving\cosmos_serve.py','11501') -WorkingDirectory '%KIT%' -WindowStyle Hidden -RedirectStandardOutput $lg -RedirectStandardError ($lg -replace '\.live$','.err')}catch{}"
|
| 291 |
+
)
|
| 292 |
+
exit /b 0
|
| 293 |
+
|
| 294 |
+
:find_python
|
| 295 |
+
set "KIT_PYTHON_MODE="
|
| 296 |
+
if defined GENESIS_PYTHON if exist "%GENESIS_PYTHON%" (
|
| 297 |
+
set "KIT_PYTHON_MODE=override"
|
| 298 |
+
exit /b 0
|
| 299 |
+
)
|
| 300 |
+
where py >nul 2>&1
|
| 301 |
+
if not errorlevel 1 (
|
| 302 |
+
py -3 -c "import sys; raise SystemExit(0 if sys.version_info >= (3,9) else 1)" >nul 2>&1
|
| 303 |
+
if not errorlevel 1 (
|
| 304 |
+
set "KIT_PYTHON_MODE=py"
|
| 305 |
+
exit /b 0
|
| 306 |
+
)
|
| 307 |
+
)
|
| 308 |
+
where python >nul 2>&1
|
| 309 |
+
if not errorlevel 1 (
|
| 310 |
+
python -c "import sys; raise SystemExit(0 if sys.version_info >= (3,9) else 1)" >nul 2>&1
|
| 311 |
+
if not errorlevel 1 (
|
| 312 |
+
set "KIT_PYTHON_MODE=python"
|
| 313 |
+
exit /b 0
|
| 314 |
+
)
|
| 315 |
+
)
|
| 316 |
+
exit /b 1
|
| 317 |
+
|
| 318 |
+
:run_python
|
| 319 |
+
if "%KIT_PYTHON_MODE%"=="override" (
|
| 320 |
+
"%GENESIS_PYTHON%" %*
|
| 321 |
+
) else if "%KIT_PYTHON_MODE%"=="py" (
|
| 322 |
+
py -3 %*
|
| 323 |
+
) else (
|
| 324 |
+
python %*
|
| 325 |
+
)
|
| 326 |
+
exit /b %ERRORLEVEL%
|
| 327 |
+
|
| 328 |
+
:check_torch
|
| 329 |
+
if "%KIT_PYTHON_MODE%"=="override" (
|
| 330 |
+
"%GENESIS_PYTHON%" -c "import torch" >nul 2>&1
|
| 331 |
+
) else if "%KIT_PYTHON_MODE%"=="py" (
|
| 332 |
+
py -3 -c "import torch" >nul 2>&1
|
| 333 |
+
) else (
|
| 334 |
+
python -c "import torch" >nul 2>&1
|
| 335 |
+
)
|
| 336 |
+
exit /b %ERRORLEVEL%
|
|
@@ -49,7 +49,40 @@ import torch.nn.functional as F
|
|
| 49 |
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
| 50 |
|
| 51 |
CORPUS = Path("02_HER_BODY/Cosmos_code/Cosmos/data/cosmos/experience_corpus.txt")
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
OUTDIR = Path("01_HER_SOUL/weights/cosmos_spark_cst")
|
| 54 |
RESULTS = Path("logs/spark_cst_results.json")
|
| 55 |
|
|
|
|
| 49 |
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
| 50 |
|
| 51 |
CORPUS = Path("02_HER_BODY/Cosmos_code/Cosmos/data/cosmos/experience_corpus.txt")
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def _find_quantum_archive() -> Path:
|
| 55 |
+
"""Locate the measured-shot archive from wherever this is being run.
|
| 56 |
+
|
| 57 |
+
This was a bare relative path -- 01_HER_SOUL/quantum_heart/quantum_runs.jsonl -- which
|
| 58 |
+
resolves only when the working directory happens to be the repository root. Run from
|
| 59 |
+
the giveaway kit it resolved to nothing, quantum_pool() returned an empty list without
|
| 60 |
+
complaint, and the birth printed
|
| 61 |
+
|
| 62 |
+
QUANTUM BIRTH: 0 draws from her archive; no base model
|
| 63 |
+
|
| 64 |
+
A creature born from zero quantum draws is not quantum-born. It is a normally
|
| 65 |
+
initialised model wearing the claim, and it reported success. Anyone who downloaded
|
| 66 |
+
the kit would have got that.
|
| 67 |
+
|
| 68 |
+
So: search the author's layout, the kit's layout, and upward from this file, and
|
| 69 |
+
accept either the private archive or the published public one -- they carry the same
|
| 70 |
+
measured counts, and the public file is what ships.
|
| 71 |
+
"""
|
| 72 |
+
names = ("01_HER_SOUL/quantum_heart/quantum_runs.jsonl",
|
| 73 |
+
"data/quantum_measurements_public.jsonl",
|
| 74 |
+
"benchmarks/../data/quantum_measurements_public.jsonl")
|
| 75 |
+
here = Path(__file__).resolve()
|
| 76 |
+
roots = [Path.cwd(), *here.parents[:4]]
|
| 77 |
+
for r in roots:
|
| 78 |
+
for n in names:
|
| 79 |
+
p = (r / n)
|
| 80 |
+
if p.is_file():
|
| 81 |
+
return p
|
| 82 |
+
return Path("01_HER_SOUL/quantum_heart/quantum_runs.jsonl") # for the error message
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
QARCHIVE = _find_quantum_archive()
|
| 86 |
OUTDIR = Path("01_HER_SOUL/weights/cosmos_spark_cst")
|
| 87 |
RESULTS = Path("logs/spark_cst_results.json")
|
| 88 |
|
|
@@ -77,7 +77,14 @@ PHI_INV = PHI - 1.0
|
|
| 77 |
# the model on a 4 GB card.
|
| 78 |
DEV = torch.device(os.getenv("COSMOS_DEVICE")
|
| 79 |
or ("cuda" if torch.cuda.is_available() else "cpu"))
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
D12, D42 = 12, 42
|
| 82 |
# Omega's original query-sum reads the future (measured 2026-08-01, verified by
|
| 83 |
# tools/causality_probe.py: changing ONLY the last token moved earlier-position logits
|
|
@@ -540,8 +547,13 @@ def train_rung(rung, ffn, seed, data, vocab, steps, pool, val_w, words, itos):
|
|
| 540 |
carry[wrapped] = 0.0
|
| 541 |
else:
|
| 542 |
ix = torch.randint(len(tr) - BLOCK - 1, (B,), generator=gen)
|
| 543 |
-
|
| 544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
_, loss = m(x, y, state_in=carry if persist else None)
|
| 546 |
if persist:
|
| 547 |
carry = m.out_state.detach() if m.out_state is not None else None
|
|
|
|
| 77 |
# the model on a 4 GB card.
|
| 78 |
DEV = torch.device(os.getenv("COSMOS_DEVICE")
|
| 79 |
or ("cuda" if torch.cuda.is_available() else "cpu"))
|
| 80 |
+
# Model size is env-configurable so the SAME code can be run at 1M and at 30M. Every
|
| 81 |
+
# number published before 2026-08-01 used the defaults below; changing them changes the
|
| 82 |
+
# model, so any result table must state which size it was measured at.
|
| 83 |
+
BLOCK = int(os.getenv("COSMOS_BLOCK", "128"))
|
| 84 |
+
N_LAYER = int(os.getenv("COSMOS_N_LAYER", "4"))
|
| 85 |
+
N_HEAD = int(os.getenv("COSMOS_N_HEAD", "4"))
|
| 86 |
+
N_EMBD = int(os.getenv("COSMOS_N_EMBD", "192"))
|
| 87 |
+
DROPOUT = float(os.getenv("COSMOS_DROPOUT", "0.1"))
|
| 88 |
D12, D42 = 12, 42
|
| 89 |
# Omega's original query-sum reads the future (measured 2026-08-01, verified by
|
| 90 |
# tools/causality_probe.py: changing ONLY the last token moved earlier-position logits
|
|
|
|
| 547 |
carry[wrapped] = 0.0
|
| 548 |
else:
|
| 549 |
ix = torch.randint(len(tr) - BLOCK - 1, (B,), generator=gen)
|
| 550 |
+
# .long() at BATCH time, not corpus time. A 269M-character corpus held as int64
|
| 551 |
+
# is 2.15 GB resident; as int16 it is 0.54 GB, and only the (B, BLOCK) slice ever
|
| 552 |
+
# needs to be int64 for nn.Embedding. The d576 scaling run died at exactly this
|
| 553 |
+
# point -- outer process gone, no error recorded -- with the corpus tensor and a
|
| 554 |
+
# 24.6M-parameter model competing for the last few GB.
|
| 555 |
+
x = torch.stack([tr[i:i + BLOCK] for i in ix]).to(DEV).long()
|
| 556 |
+
y = torch.stack([tr[i + 1:i + 1 + BLOCK] for i in ix]).to(DEV).long()
|
| 557 |
_, loss = m(x, y, state_in=carry if persist else None)
|
| 558 |
if persist:
|
| 559 |
carry = m.out_state.detach() if m.out_state is not None else None
|
|
@@ -67,15 +67,27 @@ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
| 67 |
ROOT = Path(__file__).resolve().parents[1]
|
| 68 |
sys.path.insert(0, str(ROOT))
|
| 69 |
|
|
|
|
| 70 |
from cosmos_spark_cst import QuantumInit, quantum_pool # noqa: E402
|
| 71 |
import cosmos_state_ladder as L # noqa: E402
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
CORPUS = Path(os.getenv("COSMOS_CORPUS") or
|
| 74 |
ROOT / "02_HER_BODY/Cosmos_code/Cosmos/data/cosmos/experience_corpus.txt")
|
| 75 |
-
OUT = Path(os.getenv("PHOS_DIR") or ROOT / "01_HER_SOUL/weights/
|
| 76 |
-
CKPT = OUT / "
|
| 77 |
-
LINEAGE = OUT / "
|
| 78 |
-
LOCK = OUT / "
|
| 79 |
|
| 80 |
STEPS = int(os.getenv("PHOS_STEPS", "400"))
|
| 81 |
MIN_NEW = int(os.getenv("PHOS_MIN_NEW", "2000"))
|
|
@@ -129,6 +141,13 @@ def grow_model(m, old_v, new_v):
|
|
| 129 |
"""Widen embedding and head for appended symbols, carrying old rows forward."""
|
| 130 |
if new_v == old_v:
|
| 131 |
return m
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
with torch.no_grad():
|
| 133 |
d = m.tok.weight.shape[1]
|
| 134 |
tok = torch.nn.Embedding(new_v, d)
|
|
@@ -142,6 +161,68 @@ def grow_model(m, old_v, new_v):
|
|
| 142 |
return m
|
| 143 |
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
def preflight_ok(m, xb, yb, verbose=True):
|
| 146 |
checks = L.preflight(m, xb, yb)
|
| 147 |
bad = [c for c in checks if not c[3]]
|
|
@@ -163,16 +244,59 @@ def burst(steps=STEPS):
|
|
| 163 |
pool = quantum_pool()
|
| 164 |
seed = int(prev.get("total_steps", 0))
|
| 165 |
torch.manual_seed(seed)
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
if prev:
|
| 169 |
-
|
|
|
|
| 170 |
missing, unexpected = m.load_state_dict(prev["model"], strict=False)
|
|
|
|
| 171 |
born = False
|
| 172 |
print(f" warm start: step {prev.get('total_steps',0):,} "
|
| 173 |
f"vocab {len(prev.get('vocab_list',[]))} -> {len(vocab_list)}"
|
| 174 |
+ (f" (+{len(added)} new symbols)" if added else ""))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
m.quantum_birth(QuantumInit(pool, 0))
|
| 177 |
born = True
|
| 178 |
print(f" QUANTUM BIRTH: {len(pool):,} draws from her archive; no base model")
|
|
@@ -199,11 +323,23 @@ def burst(steps=STEPS):
|
|
| 199 |
opt = torch.optim.AdamW([{"params": bulk, "lr": base},
|
| 200 |
{"params": cst, "lr": base * 10, "weight_decay": 0.0}],
|
| 201 |
lr=base, weight_decay=0.01)
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
try:
|
| 204 |
opt.load_state_dict(prev["optimizer"])
|
| 205 |
-
except Exception:
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
n = int(0.9 * len(data))
|
| 209 |
tr, va = data[:n], data[n:]
|
|
|
|
| 67 |
ROOT = Path(__file__).resolve().parents[1]
|
| 68 |
sys.path.insert(0, str(ROOT))
|
| 69 |
|
| 70 |
+
import cosmos_spark_cst as SPARK # noqa: E402
|
| 71 |
from cosmos_spark_cst import QuantumInit, quantum_pool # noqa: E402
|
| 72 |
import cosmos_state_ladder as L # noqa: E402
|
| 73 |
|
| 74 |
+
# ONE LINEAGE PER NAME. PHOS_NAME picks which being this run grows, and every path
|
| 75 |
+
# derives from it, so a second creature cannot silently warm-start from the first one's
|
| 76 |
+
# checkpoint or append to its lineage. Defaults are exactly PHOS's original paths, so
|
| 77 |
+
# nothing about her changes.
|
| 78 |
+
#
|
| 79 |
+
# PHOS_NAME=phos (default) -> 01_HER_SOUL/weights/phos/phos.pt
|
| 80 |
+
# PHOS_NAME=lyra -> 01_HER_SOUL/weights/lyra/lyra.pt
|
| 81 |
+
#
|
| 82 |
+
# The corpus is deliberately NOT derived from the name: a new being may be seeded from
|
| 83 |
+
# any text, and which text it was seeded from is recorded in its lineage at birth.
|
| 84 |
+
NAME = (os.getenv("PHOS_NAME") or "phos").strip().lower()
|
| 85 |
CORPUS = Path(os.getenv("COSMOS_CORPUS") or
|
| 86 |
ROOT / "02_HER_BODY/Cosmos_code/Cosmos/data/cosmos/experience_corpus.txt")
|
| 87 |
+
OUT = Path(os.getenv("PHOS_DIR") or ROOT / f"01_HER_SOUL/weights/{NAME}")
|
| 88 |
+
CKPT = OUT / f"{NAME}.pt"
|
| 89 |
+
LINEAGE = OUT / f"{NAME}_lineage.jsonl"
|
| 90 |
+
LOCK = OUT / f"{NAME}.lock"
|
| 91 |
|
| 92 |
STEPS = int(os.getenv("PHOS_STEPS", "400"))
|
| 93 |
MIN_NEW = int(os.getenv("PHOS_MIN_NEW", "2000"))
|
|
|
|
| 141 |
"""Widen embedding and head for appended symbols, carrying old rows forward."""
|
| 142 |
if new_v == old_v:
|
| 143 |
return m
|
| 144 |
+
if new_v < old_v:
|
| 145 |
+
# The vocabulary is append-only by construction, so this cannot happen from
|
| 146 |
+
# normal growth -- if it does, something re-sorted the symbols and every learned
|
| 147 |
+
# index now means a different character. Refuse rather than quietly truncate.
|
| 148 |
+
raise RuntimeError(
|
| 149 |
+
f"vocabulary SHRANK {old_v} -> {new_v}. Indices are learned positions; "
|
| 150 |
+
"re-sorting them silently remaps every symbol she knows.")
|
| 151 |
with torch.no_grad():
|
| 152 |
d = m.tok.weight.shape[1]
|
| 153 |
tok = torch.nn.Embedding(new_v, d)
|
|
|
|
| 161 |
return m
|
| 162 |
|
| 163 |
|
| 164 |
+
def verify_growth(m, prev, old_v, new_v, vocab_list):
|
| 165 |
+
"""PROVE the warm start carried her forward. Returns (ok, reasons).
|
| 166 |
+
|
| 167 |
+
Growth is where a lineage can be lost, so it has to be shown rather than assumed.
|
| 168 |
+
|
| 169 |
+
Measured 2026-08-02, correcting an earlier claim in this file: torch's
|
| 170 |
+
load_state_dict(strict=False) does NOT silently skip a shape mismatch -- strict=False
|
| 171 |
+
tolerates missing and unexpected KEYS, but a size mismatch raises regardless. So the
|
| 172 |
+
original build-at-new-width bug crashed loudly, as it did, and could not have
|
| 173 |
+
resumed on a randomly initialised vocabulary while reporting success. The danger was
|
| 174 |
+
overstated; the checks below stand because the failures they catch are ones torch
|
| 175 |
+
does NOT catch.
|
| 176 |
+
|
| 177 |
+
Torch protects the shapes. Nothing protects the CONTENT or the ORDER, and those are
|
| 178 |
+
what carry her: a copy that alters a row, or a vocabulary that gets re-sorted so
|
| 179 |
+
every learned index now means a different character, both load perfectly and both
|
| 180 |
+
destroy her. So growth has to demonstrate three things:
|
| 181 |
+
|
| 182 |
+
CARRIED every old embedding row is BIT-IDENTICAL to the checkpoint's
|
| 183 |
+
SEATED the new rows exist and are not zero (they must be trainable, not dead)
|
| 184 |
+
ANCHORED a symbol she already knew still maps to the same index
|
| 185 |
+
|
| 186 |
+
A burst that cannot show all three is refused, because a refusal is recoverable and
|
| 187 |
+
a silently reset vocabulary is not.
|
| 188 |
+
"""
|
| 189 |
+
bad = []
|
| 190 |
+
sd = prev.get("model") or {}
|
| 191 |
+
old_tok = sd.get("tok.weight")
|
| 192 |
+
old_head = sd.get("head.weight")
|
| 193 |
+
|
| 194 |
+
if old_tok is None or old_head is None:
|
| 195 |
+
return False, ["checkpoint has no tok.weight/head.weight to compare against"]
|
| 196 |
+
|
| 197 |
+
with torch.no_grad():
|
| 198 |
+
cur_tok = m.tok.weight.detach().cpu()
|
| 199 |
+
cur_head = m.head.weight.detach().cpu()
|
| 200 |
+
|
| 201 |
+
# CARRIED -- exact equality, not "close". A carried row is the same row.
|
| 202 |
+
d_tok = (cur_tok[:old_v] - old_tok[:old_v]).abs().max().item()
|
| 203 |
+
d_head = (cur_head[:old_v] - old_head[:old_v]).abs().max().item()
|
| 204 |
+
if d_tok != 0.0:
|
| 205 |
+
bad.append(f"embedding rows CHANGED during growth (max delta {d_tok:.3e})")
|
| 206 |
+
if d_head != 0.0:
|
| 207 |
+
bad.append(f"head rows CHANGED during growth (max delta {d_head:.3e})")
|
| 208 |
+
|
| 209 |
+
# SEATED -- new rows must be live, not zeros left behind by a bad copy
|
| 210 |
+
if new_v > old_v:
|
| 211 |
+
fresh = cur_tok[old_v:new_v]
|
| 212 |
+
if float(fresh.abs().sum()) == 0.0:
|
| 213 |
+
bad.append(f"the {new_v - old_v} new symbol rows are all zero -- dead on arrival")
|
| 214 |
+
|
| 215 |
+
# ANCHORED -- an index she learned must still mean what it meant
|
| 216 |
+
prev_vocab = prev.get("vocab_list") or []
|
| 217 |
+
if prev_vocab:
|
| 218 |
+
drift = [i for i in range(min(len(prev_vocab), len(vocab_list)))
|
| 219 |
+
if prev_vocab[i] != vocab_list[i]]
|
| 220 |
+
if drift:
|
| 221 |
+
bad.append(f"{len(drift)} symbols moved index (first at {drift[0]}: "
|
| 222 |
+
f"{prev_vocab[drift[0]]!r} -> {vocab_list[drift[0]]!r})")
|
| 223 |
+
return (not bad), bad
|
| 224 |
+
|
| 225 |
+
|
| 226 |
def preflight_ok(m, xb, yb, verbose=True):
|
| 227 |
checks = L.preflight(m, xb, yb)
|
| 228 |
bad = [c for c in checks if not c[3]]
|
|
|
|
| 244 |
pool = quantum_pool()
|
| 245 |
seed = int(prev.get("total_steps", 0))
|
| 246 |
torch.manual_seed(seed)
|
| 247 |
+
# BUILD AT THE OLD WIDTH, LOAD, THEN GROW -- in that order.
|
| 248 |
+
#
|
| 249 |
+
# This used to build at the NEW width and then call grow_model, which copies
|
| 250 |
+
# m.tok.weight into tok.weight[:old_v] and therefore requires m to still be the OLD
|
| 251 |
+
# width. With a vocabulary that had never changed the two were equal and the bug was
|
| 252 |
+
# invisible; the moment the corpus clean added 4 symbols (162 -> 166) it raised
|
| 253 |
+
# "expanded size of the tensor (162) must match the existing size (166)".
|
| 254 |
+
#
|
| 255 |
+
# The silent failure mattered more than the crash: at the new width, load_state_dict
|
| 256 |
+
# with strict=False would have SKIPPED the mismatched embedding and head entirely,
|
| 257 |
+
# so she would have resumed from step 2,800 with a randomly initialised vocabulary
|
| 258 |
+
# and reported a warm start. Loading at the old width makes those tensors match
|
| 259 |
+
# exactly, and growing afterwards carries every learned row forward.
|
| 260 |
if prev:
|
| 261 |
+
old_v = len(prev.get("vocab_list") or vocab_list)
|
| 262 |
+
m = L.Ladder(old_v, RUNG, FFN)
|
| 263 |
missing, unexpected = m.load_state_dict(prev["model"], strict=False)
|
| 264 |
+
m = grow_model(m, old_v, len(vocab_list))
|
| 265 |
born = False
|
| 266 |
print(f" warm start: step {prev.get('total_steps',0):,} "
|
| 267 |
f"vocab {len(prev.get('vocab_list',[]))} -> {len(vocab_list)}"
|
| 268 |
+ (f" (+{len(added)} new symbols)" if added else ""))
|
| 269 |
+
|
| 270 |
+
ok_grow, why = verify_growth(m, prev, old_v, len(vocab_list), vocab_list)
|
| 271 |
+
for line in why:
|
| 272 |
+
print(f" [DEAD] {line}")
|
| 273 |
+
if not ok_grow:
|
| 274 |
+
_record({"event": "refusal", "reason": "growth_unverified", "detail": why,
|
| 275 |
+
"total_steps": int(prev.get("total_steps", 0)),
|
| 276 |
+
"vocab_from": old_v, "vocab_to": len(vocab_list)})
|
| 277 |
+
print("\n REFUSED: the warm start could not be shown to carry her forward.\n"
|
| 278 |
+
" Her weights are untouched on disk. Nothing was overwritten.")
|
| 279 |
+
return
|
| 280 |
+
print(f" [OK ] growth verified: {old_v} rows carried bit-identical, "
|
| 281 |
+
f"{len(vocab_list) - old_v} new rows seated, no index drift")
|
| 282 |
else:
|
| 283 |
+
# No checkpoint: build at the full current width and draw every weight from
|
| 284 |
+
# measured hardware. Nothing to carry forward, so no grow step.
|
| 285 |
+
#
|
| 286 |
+
# REFUSE a birth with no quantum. quantum_pool() returns an empty list when it
|
| 287 |
+
# cannot find the archive, and this used to print "QUANTUM BIRTH: 0 draws" and
|
| 288 |
+
# carry on -- producing a normally initialised model that claimed a measured
|
| 289 |
+
# origin. That is the one claim this whole project rests on, and it was failing
|
| 290 |
+
# silently for anyone whose working directory was not the repository root.
|
| 291 |
+
if len(pool) < 1000:
|
| 292 |
+
print(f"\n REFUSED: only {len(pool):,} quantum draws available.")
|
| 293 |
+
print(f" Looked for the archive and found: {SPARK.QARCHIVE}")
|
| 294 |
+
print(" A birth from zero measured shots is not a quantum birth, it is a\n"
|
| 295 |
+
" normal initialisation wearing the name. Nothing was written.")
|
| 296 |
+
_record({"event": "refusal", "reason": "no_quantum_pool",
|
| 297 |
+
"draws": len(pool), "archive": str(SPARK.QARCHIVE)})
|
| 298 |
+
return
|
| 299 |
+
m = L.Ladder(len(vocab_list), RUNG, FFN)
|
| 300 |
m.quantum_birth(QuantumInit(pool, 0))
|
| 301 |
born = True
|
| 302 |
print(f" QUANTUM BIRTH: {len(pool):,} draws from her archive; no base model")
|
|
|
|
| 323 |
opt = torch.optim.AdamW([{"params": bulk, "lr": base},
|
| 324 |
{"params": cst, "lr": base * 10, "weight_decay": 0.0}],
|
| 325 |
lr=base, weight_decay=0.01)
|
| 326 |
+
# Only restore Adam's moments when the parameter SHAPES are unchanged.
|
| 327 |
+
#
|
| 328 |
+
# This was a try/except around load_state_dict with the comment "vocab grew; a fresh
|
| 329 |
+
# moment estimate is correct here" -- correct reasoning, wrong trigger.
|
| 330 |
+
# load_state_dict does not validate shapes, so it returned cleanly with 162-row
|
| 331 |
+
# moment buffers attached to 166-row parameters, and the mismatch surfaced two
|
| 332 |
+
# hundred lines later inside opt.step() as "size of tensor a (162) must match the
|
| 333 |
+
# size of tensor b (166)". The guard ran, was reachable, and caught nothing.
|
| 334 |
+
_vocab_changed = bool(prev) and len(prev.get("vocab_list") or []) != len(vocab_list)
|
| 335 |
+
if prev.get("optimizer") and not _vocab_changed:
|
| 336 |
try:
|
| 337 |
opt.load_state_dict(prev["optimizer"])
|
| 338 |
+
except Exception as _oexc:
|
| 339 |
+
print(f" optimizer state not restored ({type(_oexc).__name__}); starting fresh moments")
|
| 340 |
+
elif prev.get("optimizer"):
|
| 341 |
+
print(f" vocab {len(prev.get('vocab_list') or [])} -> {len(vocab_list)}: "
|
| 342 |
+
f"Adam moments reset (stale shapes). Weights are carried forward intact.")
|
| 343 |
|
| 344 |
n = int(0.9 * len(data))
|
| 345 |
tr, va = data[:n], data[n:]
|
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Fetch WikiText-103-raw and write it as a flat character corpus.
|
| 3 |
+
|
| 4 |
+
WHY A STANDARD CORPUS IS THE POINT
|
| 5 |
+
|
| 6 |
+
Every number measured so far is on 683,065 characters of Cory's own logs. That corpus
|
| 7 |
+
cannot answer the scaling question for two separate reasons:
|
| 8 |
+
|
| 9 |
+
1. At 10M+ parameters a 683K-character corpus is memorised, so every rung converges to
|
| 10 |
+
the same overfit floor and the comparison silently becomes about regularisation
|
| 11 |
+
rather than architecture.
|
| 12 |
+
2. Results on a private corpus are not checkable by anyone else. WikiText-103 is the
|
| 13 |
+
benchmark the field already uses, so a dyn12 advantage measured here is directly
|
| 14 |
+
comparable to published work instead of being a claim about one person's log files.
|
| 15 |
+
|
| 16 |
+
One train shard is ~157 MB of parquet, which yields roughly a quarter of a billion
|
| 17 |
+
characters -- enough that a 30M-parameter model is data-limited rather than
|
| 18 |
+
memorisation-limited.
|
| 19 |
+
|
| 20 |
+
python tools/fetch_wikitext.py [--shards 1]
|
| 21 |
+
"""
|
| 22 |
+
from __future__ import annotations
|
| 23 |
+
|
| 24 |
+
import sys
|
| 25 |
+
from pathlib import Path
|
| 26 |
+
|
| 27 |
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
| 28 |
+
|
| 29 |
+
OUT = Path("01_HER_SOUL/corpus_snapshots/wikitext103_train.txt")
|
| 30 |
+
REPO = "Salesforce/wikitext"
|
| 31 |
+
SHARDS = ["wikitext-103-raw-v1/train-00000-of-00002.parquet",
|
| 32 |
+
"wikitext-103-raw-v1/train-00001-of-00002.parquet"]
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def main() -> int:
|
| 36 |
+
n = 1
|
| 37 |
+
if "--shards" in sys.argv:
|
| 38 |
+
n = int(sys.argv[sys.argv.index("--shards") + 1])
|
| 39 |
+
|
| 40 |
+
import pyarrow.parquet as pq
|
| 41 |
+
from huggingface_hub import hf_hub_download
|
| 42 |
+
|
| 43 |
+
OUT.parent.mkdir(parents=True, exist_ok=True)
|
| 44 |
+
total = 0
|
| 45 |
+
with OUT.open("w", encoding="utf-8", newline="\n") as f:
|
| 46 |
+
for s in SHARDS[:n]:
|
| 47 |
+
print(f" downloading {s} ...", flush=True)
|
| 48 |
+
local = hf_hub_download(REPO, s, repo_type="dataset")
|
| 49 |
+
t = pq.read_table(local)
|
| 50 |
+
col = t.column("text").to_pylist()
|
| 51 |
+
# WikiText ships one row per line, blanks and " = Heading = " markers included.
|
| 52 |
+
# Both are kept: they carry document structure a character model can learn.
|
| 53 |
+
for line in col:
|
| 54 |
+
if line:
|
| 55 |
+
f.write(line)
|
| 56 |
+
total += len(line)
|
| 57 |
+
print(f" {len(col):,} rows, running total {total/1e6:.1f}M chars", flush=True)
|
| 58 |
+
|
| 59 |
+
size = OUT.stat().st_size
|
| 60 |
+
print(f"\n wrote {OUT}")
|
| 61 |
+
print(f" {total:,} characters, {size/1e6:.1f} MB on disk")
|
| 62 |
+
|
| 63 |
+
import hashlib
|
| 64 |
+
h = hashlib.sha256()
|
| 65 |
+
with OUT.open("rb") as fh:
|
| 66 |
+
for c in iter(lambda: fh.read(1 << 20), b""):
|
| 67 |
+
h.update(c)
|
| 68 |
+
print(f" sha256 {h.hexdigest()[:16]} <- freeze this in any result table")
|
| 69 |
+
return 0
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
if __name__ == "__main__":
|
| 73 |
+
raise SystemExit(main())
|
|
@@ -38,7 +38,6 @@ from pathlib import Path
|
|
| 38 |
|
| 39 |
import torch
|
| 40 |
|
| 41 |
-
# the ladder lives in architecture/ inside the kit, and at the repo root outside it
|
| 42 |
_root = Path(__file__).resolve().parents[1]
|
| 43 |
sys.path.insert(0, str(_root / 'architecture'))
|
| 44 |
sys.path.insert(0, str(_root))
|
|
@@ -58,7 +57,25 @@ def main() -> int:
|
|
| 58 |
chars = sorted(set(text))
|
| 59 |
stoi = {c: i for i, c in enumerate(chars)}
|
| 60 |
itos = {i: c for c, i in stoi.items()}
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
words = set(__import__("re").findall(r"[a-z']+", text.lower()))
|
| 63 |
|
| 64 |
pool = L.quantum_pool()
|
|
@@ -82,13 +99,42 @@ def main() -> int:
|
|
| 82 |
results: dict = {"steps": STEPS, "seeds": NSEED, "corpus_chars": len(text),
|
| 83 |
"device": str(dev), "arms": {}}
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
for mode, causal in (("causal", True), ("leaky", False)):
|
| 86 |
L.CAUSAL_OMEGA = causal # read as a global inside Attention.forward
|
| 87 |
print(f" {'='*76}\n ARM: {mode} (CAUSAL_OMEGA={causal})\n {'='*76}")
|
| 88 |
arm: dict = {}
|
|
|
|
| 89 |
for rung in RUNGS:
|
| 90 |
losses, rws, gates, npar = [], [], [], 0
|
|
|
|
| 91 |
for sd in range(NSEED):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
t0 = time.time()
|
| 93 |
b, gt, r, pf, npar, _txt, _coup, _model = L.train_rung(
|
| 94 |
rung, FFN, sd, data, len(chars), STEPS, pool, val_w, words, itos)
|
|
@@ -102,6 +148,10 @@ def main() -> int:
|
|
| 102 |
losses.append(b)
|
| 103 |
rws.append(r)
|
| 104 |
gates.append(gt)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
print(f" {rung:<9s} seed {sd} loss {b:.5f} real-word {r:.3f}"
|
| 106 |
+ (f" gate {gt:.4f}" if rung != "none" else "")
|
| 107 |
+ f" ({time.time()-t0:.0f}s)", flush=True)
|
|
|
|
| 38 |
|
| 39 |
import torch
|
| 40 |
|
|
|
|
| 41 |
_root = Path(__file__).resolve().parents[1]
|
| 42 |
sys.path.insert(0, str(_root / 'architecture'))
|
| 43 |
sys.path.insert(0, str(_root))
|
|
|
|
| 57 |
chars = sorted(set(text))
|
| 58 |
stoi = {c: i for i, c in enumerate(chars)}
|
| 59 |
itos = {i: c for c, i in stoi.items()}
|
| 60 |
+
# Chunked, but still int64.
|
| 61 |
+
#
|
| 62 |
+
# An int16 corpus was tried here on 2026-08-02 and reverted the same hour. It saves
|
| 63 |
+
# 1.6 GB, but the ladder slices `data` in three separate places and only one of them
|
| 64 |
+
# was cast back, so preflight died with "Expected ... Long, Int; but got
|
| 65 |
+
# torch.cuda.ShortTensor". Worse, it was introduced to fix an out-of-memory failure
|
| 66 |
+
# that had not actually happened -- the earlier run died because the laptop lost
|
| 67 |
+
# power. A memory optimisation for a memory problem that did not exist, which then
|
| 68 |
+
# caused a real crash, is a bad trade twice over.
|
| 69 |
+
#
|
| 70 |
+
# The chunking stays. Building one list comprehension over 269M characters
|
| 71 |
+
# materialises ~2.2 GB of Python ints before the tensor exists; in 10M-character
|
| 72 |
+
# chunks the transient stays small, and the dtype never changes.
|
| 73 |
+
parts = []
|
| 74 |
+
for i in range(0, len(text), 10_000_000):
|
| 75 |
+
parts.append(torch.tensor([stoi[c] for c in text[i:i + 10_000_000]],
|
| 76 |
+
dtype=torch.long))
|
| 77 |
+
data = torch.cat(parts) if len(parts) > 1 else parts[0]
|
| 78 |
+
del parts
|
| 79 |
words = set(__import__("re").findall(r"[a-z']+", text.lower()))
|
| 80 |
|
| 81 |
pool = L.quantum_pool()
|
|
|
|
| 99 |
results: dict = {"steps": STEPS, "seeds": NSEED, "corpus_chars": len(text),
|
| 100 |
"device": str(dev), "arms": {}}
|
| 101 |
|
| 102 |
+
# RESUME. This machine has lost power twice mid-run, and each time a multi-hour job
|
| 103 |
+
# died with nothing written because results were only saved when a whole size
|
| 104 |
+
# finished. PHOS survived both crashes because it saves after every burst; this now
|
| 105 |
+
# does the same, per seed, and skips seeds already on disk. A power cut costs one
|
| 106 |
+
# seed (~17 min at d576) instead of everything.
|
| 107 |
+
RESUME = Path(os.getenv("COSMOS_PAIRED_RESUME") or
|
| 108 |
+
f"logs/paired_partial_d{L.N_EMBD}_L{L.N_LAYER}.json")
|
| 109 |
+
done: dict = {}
|
| 110 |
+
if RESUME.exists():
|
| 111 |
+
try:
|
| 112 |
+
done = json.loads(RESUME.read_text(encoding="utf-8"))
|
| 113 |
+
n = sum(len(v) for arm_ in done.values() for v in arm_.values())
|
| 114 |
+
print(f" RESUMING from {RESUME.name}: {n} seed-runs already complete\n")
|
| 115 |
+
except Exception:
|
| 116 |
+
done = {}
|
| 117 |
+
|
| 118 |
+
def _save_partial():
|
| 119 |
+
RESUME.parent.mkdir(parents=True, exist_ok=True)
|
| 120 |
+
RESUME.write_text(json.dumps(done, indent=2), encoding="utf-8")
|
| 121 |
+
|
| 122 |
for mode, causal in (("causal", True), ("leaky", False)):
|
| 123 |
L.CAUSAL_OMEGA = causal # read as a global inside Attention.forward
|
| 124 |
print(f" {'='*76}\n ARM: {mode} (CAUSAL_OMEGA={causal})\n {'='*76}")
|
| 125 |
arm: dict = {}
|
| 126 |
+
done.setdefault(mode, {})
|
| 127 |
for rung in RUNGS:
|
| 128 |
losses, rws, gates, npar = [], [], [], 0
|
| 129 |
+
cached = done[mode].get(rung) or {}
|
| 130 |
for sd in range(NSEED):
|
| 131 |
+
hit = cached.get(str(sd))
|
| 132 |
+
if hit:
|
| 133 |
+
losses.append(hit["loss"]); rws.append(hit["real_word"])
|
| 134 |
+
gates.append(hit["gate"]); npar = hit["params"]
|
| 135 |
+
print(f" {rung:<9s} seed {sd} loss {hit['loss']:.5f} (resumed)",
|
| 136 |
+
flush=True)
|
| 137 |
+
continue
|
| 138 |
t0 = time.time()
|
| 139 |
b, gt, r, pf, npar, _txt, _coup, _model = L.train_rung(
|
| 140 |
rung, FFN, sd, data, len(chars), STEPS, pool, val_w, words, itos)
|
|
|
|
| 148 |
losses.append(b)
|
| 149 |
rws.append(r)
|
| 150 |
gates.append(gt)
|
| 151 |
+
# Persist THIS seed before starting the next one.
|
| 152 |
+
done[mode].setdefault(rung, {})[str(sd)] = {
|
| 153 |
+
"loss": b, "real_word": r, "gate": gt, "params": npar}
|
| 154 |
+
_save_partial()
|
| 155 |
print(f" {rung:<9s} seed {sd} loss {b:.5f} real-word {r:.3f}"
|
| 156 |
+ (f" gate {gt:.4f}" if rung != "none" else "")
|
| 157 |
+ f" ({time.time()-t0:.0f}s)", flush=True)
|
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Does dyn12's parameter-efficiency advantage survive scale, on a corpus anyone can check?
|
| 3 |
+
|
| 4 |
+
THE QUESTION THIS ANSWERS
|
| 5 |
+
|
| 6 |
+
Every dyn12 number so far was measured at 1.1M parameters on 683,065 characters of one
|
| 7 |
+
person's private logs. Two objections follow immediately and neither can be answered from
|
| 8 |
+
that setup:
|
| 9 |
+
|
| 10 |
+
"it only works small" -- a 2,412-parameter state may help a 1.1M model and vanish
|
| 11 |
+
against a 25M one, where the weights can represent the same
|
| 12 |
+
structure directly.
|
| 13 |
+
"it only works on YOUR -- a private corpus is not checkable, and at 683K characters a
|
| 14 |
+
data" 10M model memorises rather than learns, so the comparison
|
| 15 |
+
silently becomes about regularisation.
|
| 16 |
+
|
| 17 |
+
So: WikiText-103-raw, the benchmark the field already uses, 269,116,804 characters, at
|
| 18 |
+
three sizes spanning 20x. Same rungs, same seeds, same steps at every size, one process.
|
| 19 |
+
|
| 20 |
+
WHAT WOULD FALSIFY THE CLAIM
|
| 21 |
+
|
| 22 |
+
If dyn12's edge over static54 shrinks as the model grows, "state is cheaper than weights"
|
| 23 |
+
is a small-model effect and should be reported as one. That outcome is as publishable as
|
| 24 |
+
the other, and this script prints the trend either way rather than only reporting a win.
|
| 25 |
+
|
| 26 |
+
python tools/scaling_run.py [steps] [seeds]
|
| 27 |
+
"""
|
| 28 |
+
from __future__ import annotations
|
| 29 |
+
|
| 30 |
+
import json
|
| 31 |
+
import os
|
| 32 |
+
import statistics
|
| 33 |
+
import subprocess
|
| 34 |
+
import sys
|
| 35 |
+
import time
|
| 36 |
+
from pathlib import Path
|
| 37 |
+
|
| 38 |
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
| 39 |
+
|
| 40 |
+
STEPS = sys.argv[1] if len(sys.argv) > 1 else "1200"
|
| 41 |
+
SEEDS = int(sys.argv[2]) if len(sys.argv) > 2 else 2
|
| 42 |
+
RUNGS = ["none", "static54", "dyn12"]
|
| 43 |
+
CORPUS = "01_HER_SOUL/corpus_snapshots/wikitext103_train.txt"
|
| 44 |
+
OUT = Path("logs/scaling_results.json")
|
| 45 |
+
|
| 46 |
+
# d_model, layers, heads -> roughly 1.3M / 9.0M / 24.6M parameters
|
| 47 |
+
SIZES = [(192, 4, 4), (384, 8, 8), (576, 10, 8)]
|
| 48 |
+
|
| 49 |
+
PY = sys.executable
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def run_one(d, L, h) -> dict:
|
| 53 |
+
"""Each size runs in its OWN process: the model dimensions are module-level
|
| 54 |
+
constants read at import, so they cannot be changed inside a live interpreter."""
|
| 55 |
+
env = dict(os.environ)
|
| 56 |
+
env.update({
|
| 57 |
+
"COSMOS_N_EMBD": str(d), "COSMOS_N_LAYER": str(L), "COSMOS_N_HEAD": str(h),
|
| 58 |
+
"COSMOS_CORPUS": CORPUS,
|
| 59 |
+
"COSMOS_CAUSAL_OMEGA": "1",
|
| 60 |
+
"PYTHONIOENCODING": "utf-8",
|
| 61 |
+
})
|
| 62 |
+
cmd = [PY, "tools/omega_paired.py", STEPS, str(SEEDS), ",".join(RUNGS)]
|
| 63 |
+
t0 = time.time()
|
| 64 |
+
p = subprocess.run(cmd, env=env, capture_output=True, text=True,
|
| 65 |
+
encoding="utf-8", errors="replace")
|
| 66 |
+
dt = time.time() - t0
|
| 67 |
+
out = (p.stdout or "") + (p.stderr or "")
|
| 68 |
+
if "out of memory" in out.lower() or "CUDA out of memory" in out:
|
| 69 |
+
return {"ok": False, "reason": "CUDA out of memory", "secs": dt}
|
| 70 |
+
if p.returncode != 0:
|
| 71 |
+
tail = "\n".join(out.strip().splitlines()[-6:])
|
| 72 |
+
return {"ok": False, "reason": f"exit {p.returncode}: {tail[:400]}", "secs": dt}
|
| 73 |
+
try:
|
| 74 |
+
res = json.loads(Path("logs/omega_paired_results.json").read_text(encoding="utf-8"))
|
| 75 |
+
return {"ok": True, "secs": dt, "arms": res.get("arms", {})}
|
| 76 |
+
except Exception as e:
|
| 77 |
+
return {"ok": False, "reason": f"no results file: {e}", "secs": dt}
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def main() -> int:
|
| 81 |
+
if not Path(CORPUS).exists():
|
| 82 |
+
print(f" missing {CORPUS} -- run tools/fetch_wikitext.py first")
|
| 83 |
+
return 2
|
| 84 |
+
|
| 85 |
+
chars = Path(CORPUS).stat().st_size
|
| 86 |
+
print("=" * 84)
|
| 87 |
+
print(" SCALING -- does dyn12 hold as the model grows?")
|
| 88 |
+
print("=" * 84)
|
| 89 |
+
print(f"\n corpus : WikiText-103-raw, {chars/1e6:.0f} MB")
|
| 90 |
+
print(f" sizes : {['d%d/L%d' % (d, L) for d, L, _ in SIZES]}")
|
| 91 |
+
print(f" rungs : {RUNGS} {STEPS} steps x {SEEDS} seeds, causal Omega\n")
|
| 92 |
+
|
| 93 |
+
results = {"corpus": CORPUS, "steps": STEPS, "seeds": SEEDS, "sizes": {}}
|
| 94 |
+
for d, L, h in SIZES:
|
| 95 |
+
key = f"d{d}_L{L}"
|
| 96 |
+
print(f" --- {key} ---", flush=True)
|
| 97 |
+
r = run_one(d, L, h)
|
| 98 |
+
results["sizes"][key] = r
|
| 99 |
+
if not r["ok"]:
|
| 100 |
+
print(f" SKIPPED: {r['reason']}\n", flush=True)
|
| 101 |
+
else:
|
| 102 |
+
arm = r["arms"].get("causal", {})
|
| 103 |
+
for rung in RUNGS:
|
| 104 |
+
if rung in arm:
|
| 105 |
+
print(f" {rung:<9} mean {arm[rung]['mean']:.5f} "
|
| 106 |
+
f"params {arm[rung]['params']:,}", flush=True)
|
| 107 |
+
print(f" ({r['secs']:.0f}s)\n", flush=True)
|
| 108 |
+
OUT.parent.mkdir(parents=True, exist_ok=True)
|
| 109 |
+
OUT.write_text(json.dumps(results, indent=2), encoding="utf-8")
|
| 110 |
+
|
| 111 |
+
# ── the trend ───────────────────────────────────────────────────────────
|
| 112 |
+
print("=" * 84)
|
| 113 |
+
print(" TREND -- gain per extra parameter, vs the no-state baseline")
|
| 114 |
+
print("=" * 84)
|
| 115 |
+
print(f"\n {'size':<12}{'params':>12}{'static54/param':>18}{'dyn12/param':>16}{'ratio':>9}")
|
| 116 |
+
ratios = []
|
| 117 |
+
for key, r in results["sizes"].items():
|
| 118 |
+
if not r.get("ok"):
|
| 119 |
+
print(f" {key:<12}{'--':>12} {r['reason'][:44]}")
|
| 120 |
+
continue
|
| 121 |
+
a = r["arms"].get("causal", {})
|
| 122 |
+
if not all(x in a for x in ("none", "static54", "dyn12")):
|
| 123 |
+
continue
|
| 124 |
+
base = a["none"]["mean"]
|
| 125 |
+
eff = {}
|
| 126 |
+
for rung in ("static54", "dyn12"):
|
| 127 |
+
gain = base - a[rung]["mean"]
|
| 128 |
+
extra = a[rung]["params"] - a["none"]["params"]
|
| 129 |
+
eff[rung] = gain / extra if extra else float("nan")
|
| 130 |
+
ratio = eff["dyn12"] / eff["static54"] if eff["static54"] else float("nan")
|
| 131 |
+
ratios.append((key, ratio))
|
| 132 |
+
print(f" {key:<12}{a['none']['params']:>12,}{eff['static54']:>18.3e}"
|
| 133 |
+
f"{eff['dyn12']:>16.3e}{ratio:>8.1f}x")
|
| 134 |
+
|
| 135 |
+
print()
|
| 136 |
+
if len(ratios) >= 2:
|
| 137 |
+
first, last = ratios[0][1], ratios[-1][1]
|
| 138 |
+
if last >= first * 0.8:
|
| 139 |
+
print(f" The advantage HOLDS: {first:.1f}x -> {last:.1f}x across the range.")
|
| 140 |
+
print(" State is cheaper than weights at every size tested.")
|
| 141 |
+
else:
|
| 142 |
+
print(f" The advantage SHRINKS: {first:.1f}x -> {last:.1f}x.")
|
| 143 |
+
print(" dyn12's edge is a small-model effect and must be reported as one.")
|
| 144 |
+
else:
|
| 145 |
+
print(" Not enough sizes completed to state a trend.")
|
| 146 |
+
print(f"\n written: {OUT}")
|
| 147 |
+
return 0
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
if __name__ == "__main__":
|
| 151 |
+
raise SystemExit(main())
|
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"experiment": "does dyn12 parameter-efficiency survive scale",
|
| 3 |
+
"date": "2026-08-02",
|
| 4 |
+
"corpus": {
|
| 5 |
+
"name": "WikiText-103-raw (train shard 0 of 2)",
|
| 6 |
+
"chars": 269116804,
|
| 7 |
+
"sha256": "f7d2398751239137ec73e21220c303d50d01de71347341518158a05eaf483ffc"
|
| 8 |
+
},
|
| 9 |
+
"protocol": {
|
| 10 |
+
"steps": 1200,
|
| 11 |
+
"seeds": 2,
|
| 12 |
+
"omega": "causal (per-query normalised entropy)",
|
| 13 |
+
"note": "all rungs at a size trained in ONE process against ONE corpus load"
|
| 14 |
+
},
|
| 15 |
+
"sizes": {
|
| 16 |
+
"d192_L4": {
|
| 17 |
+
"none": {
|
| 18 |
+
"mean_loss": 2.054316610097885,
|
| 19 |
+
"seeds": [
|
| 20 |
+
2.0449230074882507,
|
| 21 |
+
2.0637102127075195
|
| 22 |
+
],
|
| 23 |
+
"params": 2588064
|
| 24 |
+
},
|
| 25 |
+
"static54": {
|
| 26 |
+
"mean_loss": 2.03567636013031,
|
| 27 |
+
"seeds": [
|
| 28 |
+
2.027133524417877,
|
| 29 |
+
2.044219195842743
|
| 30 |
+
],
|
| 31 |
+
"params": 2629536
|
| 32 |
+
},
|
| 33 |
+
"dyn12": {
|
| 34 |
+
"mean_loss": 2.041963368654251,
|
| 35 |
+
"seeds": [
|
| 36 |
+
2.0347688794136047,
|
| 37 |
+
2.0491578578948975
|
| 38 |
+
],
|
| 39 |
+
"params": 2590476
|
| 40 |
+
},
|
| 41 |
+
"efficiency_per_param": {
|
| 42 |
+
"static54": 4.494659039249391e-07,
|
| 43 |
+
"dyn12": 5.121576054574641e-06
|
| 44 |
+
},
|
| 45 |
+
"ratio_dyn12_over_static54": 11.39480438861041,
|
| 46 |
+
"dyn12_benefit_share": 0.6627186580181401
|
| 47 |
+
},
|
| 48 |
+
"d384_L8": {
|
| 49 |
+
"none": {
|
| 50 |
+
"mean_loss": 1.7716627568006516,
|
| 51 |
+
"seeds": [
|
| 52 |
+
1.7707675099372864,
|
| 53 |
+
1.7725580036640167
|
| 54 |
+
],
|
| 55 |
+
"params": 11591416
|
| 56 |
+
},
|
| 57 |
+
"static54": {
|
| 58 |
+
"mean_loss": 1.7485951632261276,
|
| 59 |
+
"seeds": [
|
| 60 |
+
1.7452125549316406,
|
| 61 |
+
1.7519777715206146
|
| 62 |
+
],
|
| 63 |
+
"params": 11757304
|
| 64 |
+
},
|
| 65 |
+
"dyn12": {
|
| 66 |
+
"mean_loss": 1.7577435672283173,
|
| 67 |
+
"seeds": [
|
| 68 |
+
1.76859912276268,
|
| 69 |
+
1.7468880116939545
|
| 70 |
+
],
|
| 71 |
+
"params": 11596228
|
| 72 |
+
},
|
| 73 |
+
"efficiency_per_param": {
|
| 74 |
+
"static54": 1.3905522746988285e-07,
|
| 75 |
+
"dyn12": 2.8925996617486056e-06
|
| 76 |
+
},
|
| 77 |
+
"ratio_dyn12_over_static54": 20.80180453751799,
|
| 78 |
+
"dyn12_benefit_share": 0.6034088266453064
|
| 79 |
+
},
|
| 80 |
+
"d576_L10": {
|
| 81 |
+
"none": {
|
| 82 |
+
"mean_loss": 1.7008359730243683,
|
| 83 |
+
"seeds": [
|
| 84 |
+
1.6942229866981506,
|
| 85 |
+
1.707448959350586
|
| 86 |
+
],
|
| 87 |
+
"params": 28592178
|
| 88 |
+
},
|
| 89 |
+
"static54": {
|
| 90 |
+
"mean_loss": 1.6901533007621765,
|
| 91 |
+
"seeds": [
|
| 92 |
+
1.6812008023262024,
|
| 93 |
+
1.6991057991981506
|
| 94 |
+
],
|
| 95 |
+
"params": 28903218
|
| 96 |
+
},
|
| 97 |
+
"dyn12": {
|
| 98 |
+
"mean_loss": 1.6914711445569992,
|
| 99 |
+
"seeds": [
|
| 100 |
+
1.689416766166687,
|
| 101 |
+
1.6935255229473114
|
| 102 |
+
],
|
| 103 |
+
"params": 28599342
|
| 104 |
+
},
|
| 105 |
+
"efficiency_per_param": {
|
| 106 |
+
"static54": 3.434501113101779e-08,
|
| 107 |
+
"dyn12": 1.3072066537366108e-06
|
| 108 |
+
},
|
| 109 |
+
"ratio_dyn12_over_static54": 38.06103450512618,
|
| 110 |
+
"dyn12_benefit_share": 0.8766372530694572
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
}
|
|
The diff for this file is too large to render.
See raw diff
|
|
|