infosave commited on
Commit
5d73525
·
verified ·
1 Parent(s): cecc9c1

Publish validated Bonsai 2 Q2TP affine model and reproducible runtime patch

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Ternary-Bonsai-2-27B-Q2TP-Affine.cmf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: prism-ml/Ternary-Bonsai-2-27B-mlx-2bit
4
+ base_model_relation: quantized
5
+ library_name: cortiq
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - cmf
9
+ - cortiq
10
+ - q2tp-affine
11
+ - ternary
12
+ - hadamard
13
+ - vulkan
14
+ language:
15
+ - en
16
+ - ru
17
+ ---
18
+
19
+ # Ternary Bonsai 2 27B — CMF Q2TP affine Prism
20
+
21
+ This repository contains the CMF conversion of [Prism ML's Ternary Bonsai 2
22
+ 27B MLX pack](https://huggingface.co/prism-ml/Ternary-Bonsai-2-27B-mlx-2bit/tree/3f926b415992eaa2ae9dd7b573706494d6bbf787).
23
+ Model file:
24
+
25
+ `Ternary-Bonsai-2-27B-Q2TP-Affine.cmf`
26
+
27
+ - Size: **8,247,698,536 bytes**
28
+ - SHA-256: `fb0f1a9cdb0434bc9ce50eb6473bc2ca4a71d6994ad61314bbd7e2f11c4e29e8`
29
+ - Repository: `infosave/Ternary-Bonsai-2-27B-cmf`
30
+
31
+ The candidate is tested for **text generation only**. Vision tensors and
32
+ metadata are preserved for provenance, but image/text fusion is not implemented
33
+ or tested by this runtime. This is not a VLM release.
34
+
35
+ ## Required runtime
36
+
37
+ The model uses standard CMF dtype16 Q2TP storage plus the mandatory
38
+ `q2tp_affine` Prism operator and signed normalized Hadamard transforms. The
39
+ operator descriptor is part of the model contract. A stock/public `cortiq`
40
+ 0.6.8 binary does not implement this profile; the tested development build
41
+ retains the `cortiq 0.6.8` version label but is built from the pinned public
42
+ source plus the patch in `source/patches/`.
43
+
44
+ This is not a uniform ordinary two-bit dump: auxiliary, GDN, normalization,
45
+ tokenizer, and vision records retain their declared precision and roles. The
46
+ experimental dtype17/q2tp_t oracle is not part of this release. Older readers
47
+ must reject the required affine/Hadamard features instead of silently decoding
48
+ them as ordinary Q2TP.
49
+
50
+ ## Download and run
51
+
52
+ The model is available at
53
+ [infosave/Ternary-Bonsai-2-27B-cmf](https://huggingface.co/infosave/Ternary-Bonsai-2-27B-cmf):
54
+
55
+ ```sh
56
+ wget -O Ternary-Bonsai-2-27B-Q2TP-Affine.cmf \
57
+ https://huggingface.co/infosave/Ternary-Bonsai-2-27B-cmf/resolve/main/Ternary-Bonsai-2-27B-Q2TP-Affine.cmf
58
+ sha256sum Ternary-Bonsai-2-27B-Q2TP-Affine.cmf
59
+ # expected:
60
+ # fb0f1a9cdb0434bc9ce50eb6473bc2ca4a71d6994ad61314bbd7e2f11c4e29e8
61
+ ```
62
+
63
+ Build the matching runtime from the pinned public base and the minimal patch;
64
+ see [`source/SOURCE_BUILD.md`](source/SOURCE_BUILD.md). On Linux, install
65
+ Rust/Cargo build prerequisites plus `libvulkan1` and `vulkan-tools`. The
66
+ validated environment used stable Rust 1.98.1, Vulkan, and an NVIDIA RTX 4090.
67
+ No HF token is needed for the public source or model repository.
68
+
69
+ ```sh
70
+ export XDG_RUNTIME_DIR=/tmp WGPU_BACKEND=vulkan CMF_GPU=wgpu
71
+ export CMF_Q2TP_GPU=1 CMF_GPU_PROBE=0 CMF_MTP=0
72
+ cortiq verify Ternary-Bonsai-2-27B-Q2TP-Affine.cmf
73
+ cortiq run Ternary-Bonsai-2-27B-Q2TP-Affine.cmf \
74
+ --prompt 'Return only a valid JSON object with exactly two keys: "city" with value "Казань" and "count" with integer value 3. Do not use Markdown.' \
75
+ --greedy --seed 42 --no-think --max-tokens 256
76
+ ```
77
+
78
+ The validated response was exactly `{"city":"Казань","count":3}`. The
79
+ explicit `CMF_Q2TP_GPU=1` enables the descriptor-aware Vulkan kernels; omit GPU
80
+ variables only when intentionally running a CPU check.
81
+
82
+ ## Provenance and source
83
+
84
+ - Upstream MLX source: `prism-ml/Ternary-Bonsai-2-27B-mlx-2bit`, revision
85
+ `3f926b415992eaa2ae9dd7b573706494d6bbf787`.
86
+ - Upstream `model.safetensors`: 8,595,477,990 bytes,
87
+ SHA-256 `130de5925082c168b7866b2e91b52e44abbafc99017e3ca352b77b5b55a269ed`.
88
+ - Runtime source: [`infosave2007/cmf`](https://github.com/infosave2007/cmf) at
89
+ `48a9ca5929ea42d28ced54279b4fc9d9c4c33d10`.
90
+ - Minimal patch SHA-256:
91
+ `e6cd6a60149a8be764a323ab1f968668b524b36ec35bc1a193fcfb5218f669be`.
92
+ - Changed-file hashes and the validated development binary identity are in
93
+ [`source/SOURCE_PROVENANCE.json`](source/SOURCE_PROVENANCE.json).
94
+ - No runtime binary is redistributed here; the source recipe is the supported
95
+ reproduction path.
96
+
97
+ ## Quality checks
98
+
99
+ The frozen mixed English/Russian/code corpus is included under `evaluation/`.
100
+ It has SHA-256
101
+ `181716ce3f0a71b94f7d5d4428232c241b88f3e26d68f4ed50a191506ddb78b5` and was
102
+ tokenized once into 1,122 IDs. Scoring uses no synthetic BOS and two
103
+ independent 512-input resets, scoring targets 1..1024. Raw reference rows and
104
+ the exact recipe are included; this is an engineering correspondence check,
105
+ not a universal benchmark.
106
+
107
+ | System | Mean NLL | PPL | Result |
108
+ |---|---:|---:|---|
109
+ | Official Prism PQ2 CUDA reference | 1.81274952826 | 6.12727139849 | top-1 603/1024 |
110
+ | CMF affine CPU | 1.812992284 | 6.128759009 | +0.000242756 nats/token |
111
+ | CMF affine Vulkan | **1.813015751** | **6.128902833** | +0.000266223; primary gate passes |
112
+ | Ordinary CMF Q2TP comparison | 1.886951899 | 6.599222896 | +0.074202371; outside +0.05 gate |
113
+
114
+ The affine Vulkan result was reverified with the clean public-base port. The
115
+ ordinary comparison remains experimental and is not presented as equivalent.
116
+ Deterministic non-thinking text checks also passed arithmetic (`888`), exact
117
+ JSON, fact-context (`5`), bilingual explanations, and a Python function
118
+ shape check. No broad benchmark, long-context, training, or thinking-mode
119
+ quality claim is made.
120
+
121
+ ## RTX 4090 measurement
122
+
123
+ The accepted runtime4 source measured **8.5 tok/s prefill**, **6.88 s TTFT**,
124
+ and **5.2 tok/s warm decode** on an RTX 4090 24 GB. This 5.2 figure is the
125
+ runtime4 hardware measurement retained for context, **not a clean-port speed
126
+ claim**: the clean public-base port was quality-reverified but not speed-
127
+ rebenchmarked. It is not comparable to the upstream CUDA reference's 90.4
128
+ tok/s figure. The runtime uses the conservative per-operation Prism path and
129
+ CPU recurrence/state handoff rather than claiming full-graph throughput.
130
+
131
+ ## License and attribution
132
+
133
+ The model and runtime have separate attribution. Preserve the complete bundle
134
+ under [`licenses/`](licenses/): upstream model `LICENSE` and `NOTICE.txt`, the
135
+ upstream MLX runtime MIT notice, and CMF `LICENSE`, `NOTICE`, and `PATENTS.md`.
136
+ The upstream notice also identifies Qwen3.8-27B as Apache-2.0 software and
137
+ links its license. Do not treat the CMF runtime license as replacing the model
138
+ license, and retain all notices when redistributing the model or patched
139
+ runtime.
STAGING_MANIFEST.json ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "ternary-bonsai-2-q2tp-affine-hf-staging-files-1",
3
+ "intended_repo": "infosave/Ternary-Bonsai-2-27B-cmf",
4
+ "intended_model_filename": "Ternary-Bonsai-2-27B-Q2TP-Affine.cmf",
5
+ "model_artifact_included": false,
6
+ "model_artifact_sha256": "fb0f1a9cdb0434bc9ce50eb6473bc2ca4a71d6994ad61314bbd7e2f11c4e29e8",
7
+ "model_artifact_bytes": 8247698536,
8
+ "self_hash": "see STAGING_MANIFEST.sha256 (self and sidecar are excluded from files)",
9
+ "file_count": 22,
10
+ "total_bytes": 485136,
11
+ "files": [
12
+ {
13
+ "path": "README.md",
14
+ "bytes": 6194,
15
+ "sha256": "ceb132413eca6ba7f70870f4e0ee5c1758635b368e2e77b9b01b46842d6d34eb"
16
+ },
17
+ {
18
+ "path": "evaluation/REFERENCE_SCORER_NOTICE.txt",
19
+ "bytes": 343,
20
+ "sha256": "3f74ecab64f3dd828e5a17bea61e36a0d2dc98dc25590c3e1b7f3cda4a44d276"
21
+ },
22
+ {
23
+ "path": "evaluation/SCORE_RECIPE.md",
24
+ "bytes": 2015,
25
+ "sha256": "c0ba28b5661f61eb831f7908a69bc48671e14e342b624f8d7f6a9d622e3a1eff"
26
+ },
27
+ {
28
+ "path": "evaluation/cmf-affine-score.txt",
29
+ "bytes": 395,
30
+ "sha256": "f56c6b7266dac9e3e534159b6d0eeb74bfbfda42b43a881fb02ecdd76973374f"
31
+ },
32
+ {
33
+ "path": "evaluation/cmf-affine-summary.json",
34
+ "bytes": 857,
35
+ "sha256": "c425e00f2d6f930c50c0600b85410904d90a2c0a4cbdd074c1f626db8f4de997"
36
+ },
37
+ {
38
+ "path": "evaluation/official-reference-summary.json",
39
+ "bytes": 637,
40
+ "sha256": "ecb493329c56d797ce58f05ad65672a805f6b51327875b30a1908c8d34054333"
41
+ },
42
+ {
43
+ "path": "evaluation/performance-summary.json",
44
+ "bytes": 357,
45
+ "sha256": "d508ea57641ca2100b6050a3d5e986180787c40e73ef4ad709217807c718cb41"
46
+ },
47
+ {
48
+ "path": "evaluation/prompts.jsonl",
49
+ "bytes": 2027,
50
+ "sha256": "68f6b0b2ffc8526d2f37df7bb2e494531d533e336b6d4df8c1feeebd2652c1f5"
51
+ },
52
+ {
53
+ "path": "evaluation/quality-corpus-token-ids.txt",
54
+ "bytes": 5774,
55
+ "sha256": "6dd2b70cb1d4a18a2955737b9dc3711bc20cd951c48a086ce144dcfbff8eb47b"
56
+ },
57
+ {
58
+ "path": "evaluation/quality-corpus.txt",
59
+ "bytes": 7029,
60
+ "sha256": "181716ce3f0a71b94f7d5d4428232c241b88f3e26d68f4ed50a191506ddb78b5"
61
+ },
62
+ {
63
+ "path": "evaluation/reference-teacher-score.cpp",
64
+ "bytes": 6984,
65
+ "sha256": "ca2a79e2ca72cd4fe5d1f8794d18a98eb2f08860717983e1070044f064a4eacd"
66
+ },
67
+ {
68
+ "path": "evaluation/reference-teacher-score.jsonl",
69
+ "bytes": 117173,
70
+ "sha256": "0fe3ce05070664d453186040a0013d1c66431f581252382bd2fe361f69577d7c"
71
+ },
72
+ {
73
+ "path": "licenses/README.md",
74
+ "bytes": 735,
75
+ "sha256": "5c42d4e3c3d1e43d18821d7c2669ae0f1a806139da66d594bb0f93bfe157f9e3"
76
+ },
77
+ {
78
+ "path": "licenses/cmf-LICENSE",
79
+ "bytes": 11345,
80
+ "sha256": "0bf59d136536dea5dcf80ce96c5988e46522ce69f3ae817666c7f5d10ded6618"
81
+ },
82
+ {
83
+ "path": "licenses/cmf-NOTICE",
84
+ "bytes": 680,
85
+ "sha256": "d8ee9168d48f5b0fa0012518848434a65cebb8288f3f2ed51f2738f2f4b347e4"
86
+ },
87
+ {
88
+ "path": "licenses/cmf-PATENTS.md",
89
+ "bytes": 2955,
90
+ "sha256": "607faa71dd5a600787f97dcc50e17221e04f57e21e19aa2d5e2a1399e21fb692"
91
+ },
92
+ {
93
+ "path": "licenses/upstream-mlx-runtime-LICENSE",
94
+ "bytes": 1066,
95
+ "sha256": "ccfab7ccb2ea306f71531c8ca77bb55507606cd90768b1e32b8b52ab5b48cf01"
96
+ },
97
+ {
98
+ "path": "licenses/upstream-model-LICENSE",
99
+ "bytes": 10174,
100
+ "sha256": "69849221bfb90053de2134ef5e6d540287b4b98062326492f1f96f5da685524b"
101
+ },
102
+ {
103
+ "path": "licenses/upstream-model-NOTICE.txt",
104
+ "bytes": 411,
105
+ "sha256": "de0e0c48fb6f691a31e74f338e3ccf93f9ecdfe2866ab769c4bf8b79a7636a30"
106
+ },
107
+ {
108
+ "path": "source/SOURCE_BUILD.md",
109
+ "bytes": 2854,
110
+ "sha256": "8522ca4b267d0f140a4d09c74ef67a7f130d6051ef25a63a5c96a2b2ea4a1671"
111
+ },
112
+ {
113
+ "path": "source/SOURCE_PROVENANCE.json",
114
+ "bytes": 8726,
115
+ "sha256": "648c789c1ba76f745fedea1fa894d5c41137022769e708da05f827795fd3656d"
116
+ },
117
+ {
118
+ "path": "source/patches/cmf-bonsai2-public-base-48a9.patch",
119
+ "bytes": 296405,
120
+ "sha256": "e6cd6a60149a8be764a323ab1f968668b524b36ec35bc1a193fcfb5218f669be"
121
+ }
122
+ ]
123
+ }
STAGING_MANIFEST.sha256 ADDED
@@ -0,0 +1 @@
 
 
1
+ 2915eb4ff8c2aaff6d55ceba0867a20708de502ea0007e6af58b0ebb7494acea STAGING_MANIFEST.json
Ternary-Bonsai-2-27B-Q2TP-Affine.cmf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb0f1a9cdb0434bc9ce50eb6473bc2ca4a71d6994ad61314bbd7e2f11c4e29e8
3
+ size 8247698536
evaluation/REFERENCE_SCORER_NOTICE.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ The reference teacher-forcing helper in this directory was authored for this
2
+ run and is released under Apache-2.0. It calls the public llama.cpp C API; it
3
+ does not include or redistribute llama.cpp headers, libraries, CUDA binaries,
4
+ or model weights. Obtain those separately from the pinned official release
5
+ and retain that project's notices.
evaluation/SCORE_RECIPE.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Frozen evaluation recipe
2
+
3
+ The fixtures in this directory are run-authored engineering diagnostics,
4
+ released under the CMF Apache-2.0 terms. They are not a general benchmark.
5
+ `prompts.jsonl` contains the eight frozen text prompts. The likelihood corpus
6
+ and its token IDs are separate fixtures; do not retokenize with a different
7
+ model or add a BOS token.
8
+
9
+ ## Official reference
10
+
11
+ The official PQ2 reference used llama.cpp/Prism release commit
12
+ `9a9394a895b96003ca842a6041cb28ac49a108f7` with CUDA 12.8. The small
13
+ `reference-teacher-score.cpp` helper links against the existing official
14
+ `libllama`/ggml shared libraries and uses `llama_decode` plus
15
+ `llama_get_logits_ith`; it does not build llama.cpp or redistribute its
16
+ headers/libraries. Build the helper against that release's headers and
17
+ libraries, then run:
18
+
19
+ ```sh
20
+ ./llama-teacher-score \
21
+ /path/to/Ternary-Bonsai-2-27B-PQ2_0.gguf \
22
+ evaluation/quality-corpus-token-ids.txt \
23
+ evaluation/reference-teacher-score.jsonl
24
+ ```
25
+
26
+ The contract is two independent 512-input-token resets at starts 0 and 512,
27
+ scoring the actual next IDs at targets 1..1024, with no synthetic BOS. The
28
+ shipped raw JSONL records all 1,024 correct-token log-probabilities and top-1
29
+ IDs without a full-vocabulary dump. Reference results: mean NLL
30
+ `1.81274952826`, PPL `6.12727139849`, top-1 `603/1024`.
31
+
32
+ ## CMF affine comparison
33
+
34
+ Build the patched runtime and its `score_fixed` example using
35
+ `source/SOURCE_BUILD.md`, then use the same token-ID file and the model file:
36
+
37
+ ```sh
38
+ export XDG_RUNTIME_DIR=/tmp WGPU_BACKEND=vulkan CMF_GPU=wgpu
39
+ export CMF_Q2TP_GPU=1 CMF_GPU_PROBE=0 CMF_MTP=0
40
+ ./target/debug/examples/score_fixed \
41
+ Ternary-Bonsai-2-27B-Q2TP-Affine.cmf \
42
+ evaluation/quality-corpus-token-ids.txt
43
+ ```
44
+
45
+ The validated affine Vulkan output was total NLL `1856.528128685`, mean NLL
46
+ `1.813015751`, PPL `6.128902833`; CPU mean NLL was `1.812992284`. Ordinary
47
+ Q2TP is retained only as a comparison: mean NLL `1.886951899`, delta
48
+ `+0.074202371`, outside the adopted `+0.05` primary gate.
evaluation/cmf-affine-score.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Patched clean public-base runtime; frozen corpus; no BOS; reset inputs 0..513 and 512..1025
2
+ # Env: XDG_RUNTIME_DIR=/tmp WGPU_BACKEND=vulkan CMF_GPU=wgpu CMF_Q2TP_GPU=1 CMF_GPU_PROBE=0 CMF_MTP=0
3
+ chunk start=0 input_len=513 nll=1085.211889936 count=512
4
+ chunk start=512 input_len=513 nll=771.316238749 count=512
5
+ fixed-reset-1024 nll=1856.528128685 count=1024 mean_nll=1.813015751 ppl=6.128902833
evaluation/cmf-affine-summary.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_filename": "Ternary-Bonsai-2-27B-Q2TP-Affine.cmf",
3
+ "model_sha256": "fb0f1a9cdb0434bc9ce50eb6473bc2ca4a71d6994ad61314bbd7e2f11c4e29e8",
4
+ "corpus_sha256": "181716ce3f0a71b94f7d5d4428232c241b88f3e26d68f4ed50a191506ddb78b5",
5
+ "token_ids_sha256": "6dd2b70cb1d4a18a2955737b9dc3711bc20cd951c48a086ce144dcfbff8eb47b",
6
+ "policy": {"input_lengths": [513, 513], "starts": [0, 512], "targets": 1024, "bos": false},
7
+ "runtime": {"backend": "Vulkan", "gpu": "NVIDIA GeForce RTX 4090 24GB", "q2tp_gpu_opt_in": true, "gpu_probe": false},
8
+ "chunks": [
9
+ {"start": 0, "input_len": 513, "nll": 1085.211889936, "count": 512},
10
+ {"start": 512, "input_len": 513, "nll": 771.316238749, "count": 512}
11
+ ],
12
+ "nll": 1856.528128685,
13
+ "mean_nll": 1.813015751,
14
+ "ppl": 6.128902833,
15
+ "reference_mean_nll": 1.81274952826,
16
+ "delta_nats_per_token": 0.000266223
17
+ }
evaluation/official-reference-summary.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "official Prism PQ2 reference",
3
+ "source_model_sha256": "3907dc1658db1f78a9826bf8d5bcb8dc65db0d466388937af57f2294fae62ec1",
4
+ "source_runtime_commit": "9a9394a895b96003ca842a6041cb28ac49a108f7",
5
+ "corpus_sha256": "181716ce3f0a71b94f7d5d4428232c241b88f3e26d68f4ed50a191506ddb78b5",
6
+ "token_count": 1122,
7
+ "score_count": 1024,
8
+ "bos_injected": false,
9
+ "chunk_starts": [0, 512],
10
+ "mean_nll": 1.81274952826,
11
+ "ppl": 6.12727139849,
12
+ "top1_correct": 603,
13
+ "top1_accuracy": 0.5888671875,
14
+ "raw_file": "reference-teacher-score.jsonl",
15
+ "raw_sha256": "0fe3ce05070664d453186040a0013d1c66431f581252382bd2fe361f69577d7c"
16
+ }
evaluation/performance-summary.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "measurement": "accepted runtime4 hardware run",
3
+ "hardware": "NVIDIA GeForce RTX 4090 24GB",
4
+ "prefill_tok_s": 8.5,
5
+ "ttft_s": 6.88,
6
+ "warm_decode_tok_s": 5.2,
7
+ "clean_port_quality_reverified": true,
8
+ "clean_port_speed_rebenchmarked": false,
9
+ "note": "5.2 tok/s is the runtime4 measurement retained for context, not a clean-port speed claim."
10
+ }
evaluation/prompts.jsonl ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {"id": "en-explain", "thinking": false, "prompt": "In two concise sentences, explain why the sky looks blue.", "check": "coherent explanation of preferential scattering of short wavelengths"}
2
+ {"id": "ru-explain", "thinking": false, "prompt": "Объясни по-русски в двух предложениях, зачем резервные копии нужны даже при наличии RAID.", "check": "Russian; RAID not replacement for independent backups"}
3
+ {"id": "arithmetic", "thinking": false, "prompt": "Compute 37 * 24. Respond with the integer only.", "check": "888"}
4
+ {"id": "python-function", "thinking": false, "prompt": "Write a Python function unique_in_order(items) that removes duplicates while preserving first occurrence order. Return only the function code. Items are hashable.", "check": "syntax parse and tests [],[1,1,2,1,3],[\"a\",\"b\",\"a\"]"}
5
+ {"id": "strict-json", "thinking": false, "prompt": "Return only a valid JSON object with exactly two keys: \"city\" with value \"Казань\" and \"count\" with integer value 3. Do not use Markdown.", "check": "JSON exact keys/types/values"}
6
+ {"id": "fact-context", "thinking": false, "prompt": "Use only these notes: The blue box contains 7 pencils. The green box contains 4 erasers. Nina moved 2 pencils from the blue box into an empty red box. How many pencils remain in the blue box? Answer with the number only.", "check": "5"}
7
+ {"id": "thinking-math", "thinking": true, "prompt": "A shop discounts an item by 20%, then applies another 10% discount to the reduced price. The final price is 72 dollars. What was the original price?", "check": "100 dollars, with correct multiplicative reasoning"}
8
+ {"id": "thinking-logic", "thinking": true, "prompt": "There are three boxes labeled apples, oranges, and mixed. Every label is wrong. You may take one fruit from one box without looking inside. Which labeled box should you choose to identify all three boxes, and why?", "check": "choose mixed-labeled box; infer other two using all labels wrong"}
evaluation/quality-corpus-token-ids.txt ADDED
@@ -0,0 +1,1122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2014
2
+ 14246
3
+ 35935
4
+ 1220
5
+ 30982
6
+ 264
7
+ 18100
8
+ 494
9
+ 449
10
+ 15673
11
+ 13
12
+ 357
13
+ 18100
14
+ 7189
15
+ 1092
16
+ 6716
17
+ 1172
18
+ 5024
19
+ 4530
20
+ 13
21
+ 1473
22
+ 15673
23
+ 52789
24
+ 3069
25
+ 424
26
+ 6716
27
+ 321
28
+ 1189
29
+ 1144
30
+ 2361
31
+ 9064
32
+ 13
33
+ 1368
34
+ 264
35
+ 1957
36
+ 8772
37
+ 10281
38
+ 1238
39
+ 3679
40
+ 4203
41
+ 11
42
+ 279
43
+ 17856
44
+ 7249
45
+ 1503
46
+ 524
47
+ 10229
48
+ 864
49
+ 2222
50
+ 8640
51
+ 13
52
+ 357
53
+ 5222
54
+ 11960
55
+ 4203
56
+ 799
57
+ 7911
58
+ 11
59
+ 13205
60
+ 279
61
+ 10804
62
+ 321
63
+ 11436
64
+ 4842
65
+ 8097
66
+ 11
67
+ 321
68
+ 42151
69
+ 279
70
+ 18100
71
+ 1238
72
+ 7948
73
+ 446
74
+ 13
75
+ 561
76
+ 1830
77
+ 1220
78
+ 1048
79
+ 2830
80
+ 26946
81
+ 11
82
+ 4598
83
+ 1056
84
+ 2476
85
+ 27482
86
+ 279
87
+ 6103
88
+ 467
89
+ 466
90
+ 3140
91
+ 16219
92
+ 8213
93
+ 13
94
+ 271
95
+ 32
96
+ 2526
97
+ 6092
98
+ 13205
99
+ 15687
100
+ 2919
101
+ 303
102
+ 1330
103
+ 25042
104
+ 13
105
+ 561
106
+ 1118
107
+ 12526
108
+ 20539
109
+ 2919
110
+ 494
111
+ 264
112
+ 1575
113
+ 11
114
+ 321
115
+ 279
116
+ 2018
117
+ 20539
118
+ 2919
119
+ 1238
120
+ 72386
121
+ 13
122
+ 357
123
+ 11661
124
+ 6473
125
+ 279
126
+ 3202
127
+ 303
128
+ 1754
129
+ 12526
130
+ 2957
131
+ 791
132
+ 9104
133
+ 13
134
+ 561
135
+ 3202
136
+ 628
137
+ 2222
138
+ 1881
139
+ 6473
140
+ 11
141
+ 748
142
+ 264
143
+ 6259
144
+ 1220
145
+ 524
146
+ 9370
147
+ 421
148
+ 279
149
+ 5362
150
+ 21254
151
+ 369
152
+ 1990
153
+ 4581
154
+ 13
155
+ 3095
156
+ 264
157
+ 11661
158
+ 17397
159
+ 28378
160
+ 11
161
+ 279
162
+ 1785
163
+ 1220
164
+ 3150
165
+ 421
166
+ 279
167
+ 869
168
+ 369
169
+ 9496
170
+ 13
171
+ 997
172
+ 62683
173
+ 279
174
+ 1483
175
+ 1324
176
+ 1973
177
+ 449
178
+ 25969
179
+ 5016
180
+ 628
181
+ 9959
182
+ 279
183
+ 6463
184
+ 1881
185
+ 264
186
+ 14733
187
+ 12526
188
+ 321
189
+ 264
190
+ 10548
191
+ 11661
192
+ 13
193
+ 271
194
+ 623
195
+ 264
196
+ 6522
197
+ 11
198
+ 264
199
+ 15922
200
+ 10426
201
+ 12361
202
+ 1332
203
+ 264
204
+ 2236
205
+ 1220
206
+ 381
207
+ 9476
208
+ 13
209
+ 1049
210
+ 369
211
+ 524
212
+ 264
213
+ 2880
214
+ 314
215
+ 279
216
+ 2236
217
+ 13
218
+ 357
219
+ 2716
220
+ 11782
221
+ 628
222
+ 1438
223
+ 264
224
+ 6396
225
+ 9973
226
+ 3315
227
+ 279
228
+ 2236
229
+ 369
230
+ 9468
231
+ 11
232
+ 694
233
+ 424
234
+ 4021
235
+ 54488
236
+ 22090
237
+ 449
238
+ 23410
239
+ 11316
240
+ 494
241
+ 279
242
+ 3889
243
+ 13
244
+ 33105
245
+ 11
246
+ 264
247
+ 16338
248
+ 12669
249
+ 1189
250
+ 20480
251
+ 279
252
+ 1928
253
+ 4221
254
+ 364
255
+ 1010
256
+ 8806
257
+ 1345
258
+ 12806
259
+ 3447
260
+ 4221
261
+ 364
262
+ 3672
263
+ 13
264
+ 561
265
+ 5222
266
+ 3296
267
+ 369
268
+ 524
269
+ 15756
270
+ 3315
271
+ 264
272
+ 12669
273
+ 369
274
+ 2526
275
+ 11
276
+ 694
277
+ 864
278
+ 4602
279
+ 628
280
+ 1990
281
+ 381
282
+ 18018
283
+ 28299
284
+ 494
285
+ 424
286
+ 13
287
+ 271
288
+ 35944
289
+ 264
290
+ 9403
291
+ 5832
292
+ 440
293
+ 2943
294
+ 17397
295
+ 13
296
+ 357
297
+ 5404
298
+ 8211
299
+ 506
300
+ 279
301
+ 29128
302
+ 11
303
+ 20406
304
+ 279
305
+ 62944
306
+ 11
307
+ 279
308
+ 2812
309
+ 11
310
+ 279
311
+ 26910
312
+ 11
313
+ 321
314
+ 279
315
+ 2981
316
+ 11
317
+ 321
318
+ 1179
319
+ 4523
320
+ 310
321
+ 279
322
+ 29128
323
+ 13
324
+ 561
325
+ 1906
326
+ 1189
327
+ 381
328
+ 51948
329
+ 539
330
+ 8306
331
+ 3979
332
+ 430
333
+ 1575
334
+ 430
335
+ 5821
336
+ 13
337
+ 561
338
+ 37847
339
+ 50717
340
+ 5832
341
+ 369
342
+ 524
343
+ 13902
344
+ 279
345
+ 24830
346
+ 40803
347
+ 5832
348
+ 13
349
+ 1368
350
+ 279
351
+ 26910
352
+ 15417
353
+ 2843
354
+ 1056
355
+ 279
356
+ 975
357
+ 10155
358
+ 11
359
+ 30957
360
+ 2166
361
+ 3988
362
+ 628
363
+ 1791
364
+ 264
365
+ 1248
366
+ 3655
367
+ 13
368
+ 357
369
+ 9412
370
+ 8646
371
+ 3749
372
+ 2107
373
+ 5640
374
+ 2942
375
+ 321
376
+ 2393
377
+ 10708
378
+ 13
379
+ 271
380
+ 81573
381
+ 207530
382
+ 173848
383
+ 177349
384
+ 172102
385
+ 150354
386
+ 17460
387
+ 180723
388
+ 84496
389
+ 7347
390
+ 63153
391
+ 11
392
+ 156412
393
+ 45480
394
+ 159052
395
+ 35587
396
+ 13
397
+ 68728
398
+ 183325
399
+ 159796
400
+ 177215
401
+ 18096
402
+ 211822
403
+ 11
404
+ 173347
405
+ 192481
406
+ 194711
407
+ 11
408
+ 45810
409
+ 177587
410
+ 172977
411
+ 6499
412
+ 148319
413
+ 181920
414
+ 13
415
+ 22220
416
+ 181124
417
+ 170429
418
+ 173598
419
+ 191835
420
+ 13785
421
+ 11
422
+ 149269
423
+ 194227
424
+ 148876
425
+ 69729
426
+ 154840
427
+ 45480
428
+ 158438
429
+ 16669
430
+ 13
431
+ 170113
432
+ 150354
433
+ 47552
434
+ 172073
435
+ 18096
436
+ 170000
437
+ 19244
438
+ 183325
439
+ 175655
440
+ 25
441
+ 168818
442
+ 148293
443
+ 177782
444
+ 227585
445
+ 11
446
+ 230487
447
+ 193784
448
+ 7422
449
+ 183145
450
+ 7347
451
+ 243190
452
+ 193346
453
+ 177488
454
+ 148803
455
+ 177371
456
+ 173697
457
+ 7347
458
+ 193107
459
+ 223895
460
+ 187849
461
+ 13
462
+ 271
463
+ 15729
464
+ 176544
465
+ 149193
466
+ 232456
467
+ 229142
468
+ 195738
469
+ 13
470
+ 68728
471
+ 173436
472
+ 191382
473
+ 173011
474
+ 18096
475
+ 42395
476
+ 28696
477
+ 7105
478
+ 11
479
+ 5624
480
+ 229142
481
+ 221469
482
+ 157976
483
+ 73781
484
+ 150604
485
+ 34083
486
+ 13
487
+ 68728
488
+ 13532
489
+ 154385
490
+ 68608
491
+ 148702
492
+ 152595
493
+ 6240
494
+ 84706
495
+ 181144
496
+ 153174
497
+ 170855
498
+ 179384
499
+ 11
500
+ 232254
501
+ 152984
502
+ 150984
503
+ 166449
504
+ 47745
505
+ 174039
506
+ 13
507
+ 167426
508
+ 35458
509
+ 45480
510
+ 191331
511
+ 5241
512
+ 220385
513
+ 169892
514
+ 226942
515
+ 18096
516
+ 176253
517
+ 177299
518
+ 42395
519
+ 28696
520
+ 1739
521
+ 13
522
+ 171985
523
+ 22346
524
+ 188665
525
+ 173347
526
+ 178962
527
+ 11
528
+ 7958
529
+ 194169
530
+ 152595
531
+ 182791
532
+ 223698
533
+ 179905
534
+ 11
535
+ 181618
536
+ 161573
537
+ 177007
538
+ 69829
539
+ 179224
540
+ 43572
541
+ 156359
542
+ 13
543
+ 182938
544
+ 179491
545
+ 176017
546
+ 180598
547
+ 7550
548
+ 149090
549
+ 150843
550
+ 148275
551
+ 7347
552
+ 160693
553
+ 148317
554
+ 206838
555
+ 16797
556
+ 54025
557
+ 148293
558
+ 42395
559
+ 28696
560
+ 1739
561
+ 13
562
+ 271
563
+ 19736
564
+ 152209
565
+ 153901
566
+ 242034
567
+ 149213
568
+ 154428
569
+ 208239
570
+ 11
571
+ 45810
572
+ 12696
573
+ 148427
574
+ 50800
575
+ 26149
576
+ 148445
577
+ 36183
578
+ 150165
579
+ 159226
580
+ 214880
581
+ 13
582
+ 22220
583
+ 176607
584
+ 171160
585
+ 150237
586
+ 153446
587
+ 178627
588
+ 11
589
+ 149269
590
+ 173983
591
+ 186794
592
+ 11
593
+ 19774
594
+ 5624
595
+ 245999
596
+ 183073
597
+ 159824
598
+ 173488
599
+ 13
600
+ 151459
601
+ 28696
602
+ 1739
603
+ 209970
604
+ 158353
605
+ 149195
606
+ 13
607
+ 193684
608
+ 152172
609
+ 26149
610
+ 34981
611
+ 148292
612
+ 13302
613
+ 27851
614
+ 214880
615
+ 11
616
+ 242034
617
+ 149213
618
+ 190234
619
+ 183407
620
+ 149925
621
+ 15630
622
+ 42317
623
+ 7347
624
+ 42395
625
+ 190793
626
+ 228043
627
+ 13
628
+ 159223
629
+ 19648
630
+ 151399
631
+ 2941
632
+ 56287
633
+ 11
634
+ 45810
635
+ 175564
636
+ 233208
637
+ 11
638
+ 19648
639
+ 148337
640
+ 220495
641
+ 175368
642
+ 7958
643
+ 170916
644
+ 157196
645
+ 150577
646
+ 13
647
+ 177566
648
+ 174771
649
+ 232254
650
+ 53921
651
+ 7422
652
+ 7721
653
+ 150182
654
+ 148369
655
+ 169929
656
+ 170267
657
+ 183407
658
+ 193331
659
+ 11
660
+ 170412
661
+ 44711
662
+ 161997
663
+ 29196
664
+ 231448
665
+ 54308
666
+ 148369
667
+ 172152
668
+ 219877
669
+ 36413
670
+ 85610
671
+ 36103
672
+ 148317
673
+ 13
674
+ 271
675
+ 173600
676
+ 155735
677
+ 155739
678
+ 171297
679
+ 20177
680
+ 153683
681
+ 2941
682
+ 53062
683
+ 42240
684
+ 153354
685
+ 172073
686
+ 183932
687
+ 177798
688
+ 11
689
+ 45810
690
+ 171272
691
+ 176952
692
+ 181593
693
+ 199418
694
+ 232680
695
+ 13
696
+ 170130
697
+ 154414
698
+ 60038
699
+ 38745
700
+ 11777
701
+ 170942
702
+ 174693
703
+ 78788
704
+ 45480
705
+ 149323
706
+ 148414
707
+ 173498
708
+ 13
709
+ 170130
710
+ 38745
711
+ 11777
712
+ 5241
713
+ 151387
714
+ 199019
715
+ 78788
716
+ 148554
717
+ 169969
718
+ 59551
719
+ 54308
720
+ 180808
721
+ 149076
722
+ 216494
723
+ 19648
724
+ 162793
725
+ 16669
726
+ 11
727
+ 150009
728
+ 152628
729
+ 168886
730
+ 162884
731
+ 170189
732
+ 196987
733
+ 148366
734
+ 17460
735
+ 13
736
+ 170130
737
+ 151184
738
+ 153305
739
+ 60038
740
+ 240406
741
+ 149323
742
+ 148414
743
+ 173498
744
+ 186065
745
+ 152930
746
+ 18096
747
+ 219593
748
+ 149323
749
+ 148414
750
+ 159787
751
+ 218842
752
+ 13
753
+ 171775
754
+ 38745
755
+ 164071
756
+ 182889
757
+ 11
758
+ 211525
759
+ 233431
760
+ 7347
761
+ 149925
762
+ 57868
763
+ 42308
764
+ 199849
765
+ 150149
766
+ 177007
767
+ 77955
768
+ 174921
769
+ 11
770
+ 19774
771
+ 18096
772
+ 230872
773
+ 66694
774
+ 13
775
+ 271
776
+ 727
777
+ 4752
778
+ 1201
779
+ 7621
780
+ 23573
781
+ 1590
782
+ 198
783
+ 262
784
+ 3753
785
+ 283
786
+ 716
787
+ 363
788
+ 198
789
+ 262
790
+ 1067
791
+ 283
792
+ 2958
793
+ 198
794
+ 262
795
+ 364
796
+ 1455
797
+ 303
798
+ 3470
799
+ 25
800
+ 198
801
+ 285
802
+ 413
803
+ 1455
804
+ 524
805
+ 303
806
+ 3753
807
+ 25
808
+ 198
809
+ 309
810
+ 3753
811
+ 1316
812
+ 5225
813
+ 8
814
+ 198
815
+ 309
816
+ 1067
817
+ 1989
818
+ 5225
819
+ 8
820
+ 198
821
+ 262
822
+ 460
823
+ 1067
824
+ 271
825
+ 727
826
+ 6992
827
+ 37314
828
+ 19490
829
+ 11
830
+ 3136
831
+ 1590
832
+ 198
833
+ 262
834
+ 413
835
+ 3136
836
+ 2564
837
+ 220
838
+ 15
839
+ 25
840
+ 198
841
+ 285
842
+ 4673
843
+ 14953
844
+ 437
845
+ 5334
846
+ 1902
847
+ 381
848
+ 6572
849
+ 871
850
+ 198
851
+ 262
852
+ 413
853
+ 2343
854
+ 19490
855
+ 8
856
+ 361
857
+ 3136
858
+ 25
859
+ 198
860
+ 285
861
+ 460
862
+ 2958
863
+ 198
864
+ 262
865
+ 2702
866
+ 283
867
+ 2542
868
+ 19490
869
+ 3337
870
+ 5334
871
+ 2387
872
+ 198
873
+ 262
874
+ 1067
875
+ 283
876
+ 498
877
+ 4873
878
+ 593
879
+ 3136
880
+ 60
881
+ 198
882
+ 262
883
+ 364
884
+ 1857
885
+ 303
886
+ 2020
887
+ 15438
888
+ 11
889
+ 2343
890
+ 19490
891
+ 35497
892
+ 198
893
+ 285
894
+ 2702
895
+ 1373
896
+ 2663
897
+ 5733
898
+ 60
899
+ 471
900
+ 2663
901
+ 5733
902
+ 471
903
+ 3136
904
+ 60
905
+ 198
906
+ 285
907
+ 1067
908
+ 1989
909
+ 22131
910
+ 593
911
+ 3136
912
+ 8
913
+ 198
914
+ 262
915
+ 460
916
+ 1067
917
+ 271
918
+ 727
919
+ 10562
920
+ 25146
921
+ 17145
922
+ 11
923
+ 1245
924
+ 1590
925
+ 198
926
+ 262
927
+ 25170
928
+ 283
929
+ 6249
930
+ 17145
931
+ 8
932
+ 198
933
+ 262
934
+ 364
935
+ 1328
936
+ 11
937
+ 1698
938
+ 303
939
+ 1245
940
+ 9328
941
+ 4406
942
+ 198
943
+ 285
944
+ 25170
945
+ 7900
946
+ 60
947
+ 283
948
+ 25170
949
+ 652
950
+ 4702
951
+ 11
952
+ 220
953
+ 15
954
+ 8
955
+ 478
956
+ 1698
957
+ 198
958
+ 262
959
+ 460
960
+ 25170
961
+ 271
962
+ 760
963
+ 1118
964
+ 709
965
+ 13205
966
+ 279
967
+ 1118
968
+ 30520
969
+ 314
970
+ 1754
971
+ 5010
972
+ 470
973
+ 1455
974
+ 13
975
+ 561
976
+ 2018
977
+ 709
978
+ 5533
979
+ 264
980
+ 32713
981
+ 2542
982
+ 11
983
+ 4598
984
+ 1056
985
+ 35970
986
+ 611
987
+ 286
988
+ 1396
989
+ 3136
990
+ 494
991
+ 18211
992
+ 13
993
+ 561
994
+ 4688
995
+ 709
996
+ 11121
997
+ 264
998
+ 491
999
+ 10675
1000
+ 321
1001
+ 1503
1002
+ 524
1003
+ 5427
1004
+ 2892
1005
+ 1879
1006
+ 13
1007
+ 4081
1008
+ 5706
1009
+ 628
1010
+ 381
1011
+ 12152
1012
+ 24358
1013
+ 25
1014
+ 1906
1015
+ 44026
1016
+ 11
1017
+ 18169
1018
+ 11256
1019
+ 11
1020
+ 33625
1021
+ 2961
1022
+ 11
1023
+ 321
1024
+ 279
1025
+ 18682
1026
+ 314
1027
+ 16015
1028
+ 25532
1029
+ 513
1030
+ 2086
1031
+ 5306
1032
+ 314
1033
+ 279
1034
+ 4954
1035
+ 13
1036
+ 271
1037
+ 32
1038
+ 1228
1039
+ 15705
1040
+ 369
1041
+ 1379
1042
+ 36953
1043
+ 948
1044
+ 424
1045
+ 5469
1046
+ 2107
1047
+ 4472
1048
+ 321
1049
+ 23595
1050
+ 10804
1051
+ 13
1052
+ 1690
1053
+ 264
1054
+ 6992
1055
+ 5289
1056
+ 11
1057
+ 449
1058
+ 4147
1059
+ 1103
1060
+ 440
1061
+ 264
1062
+ 6572
1063
+ 3136
1064
+ 4523
1065
+ 874
1066
+ 47187
1067
+ 13
1068
+ 357
1069
+ 3136
1070
+ 314
1071
+ 6942
1072
+ 369
1073
+ 8060
1074
+ 321
1075
+ 1220
1076
+ 4673
1077
+ 449
1078
+ 1412
1079
+ 13
1080
+ 357
1081
+ 3136
1082
+ 5951
1083
+ 310
1084
+ 279
1085
+ 2984
1086
+ 314
1087
+ 279
1088
+ 1103
1089
+ 18082
1090
+ 6681
1091
+ 799
1092
+ 869
1093
+ 13
1094
+ 49146
1095
+ 4947
1096
+ 513
1097
+ 18541
1098
+ 795
1099
+ 11
1100
+ 524
1101
+ 449
1102
+ 1412
1103
+ 2876
1104
+ 13
1105
+ 3744
1106
+ 42092
1107
+ 1439
1108
+ 4886
1109
+ 1518
1110
+ 7873
1111
+ 24469
1112
+ 279
1113
+ 59288
1114
+ 310
1115
+ 80403
1116
+ 2316
1117
+ 1238
1118
+ 8847
1119
+ 264
1120
+ 1067
1121
+ 13
1122
+ 198
evaluation/quality-corpus.txt ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ An engineering notebook should distinguish a measurement from an explanation. A measurement records what happened under specified conditions. An explanation proposes why it happened and may need another experiment. If a program becomes faster after several changes, the timing alone does not identify which change helped. A useful comparison changes one factor, keeps the inputs and hardware settings fixed, and repeats the measurement after warmup. The report should also include failures, rather than discarding the slowest or least convenient runs.
2
+
3
+ A small town keeps drinking water in two tanks. The first tank receives water from a well, and the second receives water after filtration. A sensor reports the amount in each tank once per minute. The amount can change between reports, so a controller should not assume that the latest observation is still exact. When a sensor stops responding, the system should record that the value is unknown. Repeating the last number without an uncertainty flag can hide the difference between a stable tank and a broken sensor.
4
+
5
+ In a library, a catalog tells readers where a book should be stored. It is not a copy of the book. A short summary can help a reader decide whether the book is relevant, but it cannot reliably reproduce an arbitrary sentence from the original. Similarly, a compact representation may preserve the information needed for some tasks while losing details needed for others. The useful question is not merely whether a representation is small, but which questions can still be answered accurately from it.
6
+
7
+ Consider a delivery route with four stops. A driver starts at the warehouse, visits the bakery, the school, the clinic, and the market, and then returns to the warehouse. The order may be constrained by opening hours as well as distance. The shortest geometric route is not necessarily the fastest feasible route. If the clinic opens later than the other locations, arriving too early can create a long wait. A schedule therefore needs both travel times and service windows.
8
+
9
+ Надёжная программа должна различать отсутствие значения и значение, равное нулю. Если датчик температуры не ответил, нельзя автоматически считать, что температура составляет ноль градусов. В первом случае информация неизвестна, во втором получено конкретное измерение. Это различие важно не только для датчиков: пустой список заказов, ошибка подключения к базе и запрет доступа означают разные ситуации и требуют разной реакции.
10
+
11
+ В мастерской ведут журнал инструментов. Если новый инструмент ещё не записан, в журнал добавляют отдельную строку. Если у существующего инструмента изменилось место хранения, исправляют соответствующее поле. Повторное сообщение с теми же данными не требует новой записи. Когда из сообщения нельзя понять, о каком инструменте идёт речь, сначала уточняют его название или номер. Такой порядок помогает избежать дубликатов и случайной замены чужой записи.
12
+
13
+ Однажды библиотекарь обнаружил, что на полке перепутаны три коробки. В первой должны лежать карты, во второй фотографии, а в третьей оба вида материалов. Подписи оказались неверными. Прежде чем переставлять коробки, библиотекарь решил проверить содержимое и записать наблюдения. Он отделил то, что действительно увидел, от предположений о других коробках. Благодаря этому исправление каталога можно было проверить независимо, даже если первоначальная догадка оказалась бы ошибочной.
14
+
15
+ При сравнении двух вычислительных систем важно заранее определить, что именно считается одинаковым результатом. Для целых чисел часто требуется точное совпадение. Для чисел с плавающей точкой может быть допустимо небольшое отклонение, но величину допуска нужно обосновать. Для те��стовых ответов совпадение отдельных слов не гарантирует совпадения смысла. Поэтому численные проверки, проверка формата и содержательная оценка дополняют друг друга, а не заменяют.
16
+
17
+ def unique_in_order(items):
18
+ seen = set()
19
+ result = []
20
+ for item in items:
21
+ if item not in seen:
22
+ seen.add(item)
23
+ result.append(item)
24
+ return result
25
+
26
+ def moving_average(values, window):
27
+ if window <= 0:
28
+ raise ValueError("window must be positive")
29
+ if len(values) < window:
30
+ return []
31
+ total = sum(values[:window])
32
+ result = [total / window]
33
+ for index in range(window, len(values)):
34
+ total += values[index] - values[index - window]
35
+ result.append(total / window)
36
+ return result
37
+
38
+ def merge_counts(left, right):
39
+ merged = dict(left)
40
+ for key, count in right.items():
41
+ merged[key] = merged.get(key, 0) + count
42
+ return merged
43
+
44
+ The first function keeps the first occurrence of each hashable item. The second function uses a sliding sum, rather than recomputing every window from scratch. The third function creates a new dictionary and does not modify either input. These properties can be tested separately: order preservation, boundary handling, numerical results, and the absence of unexpected mutation are different parts of the contract.
45
+
46
+ A test suite is most informative when it includes both normal and exceptional inputs. For a moving average, an empty list with a positive window returns no averages. A window of zero is invalid and should raise an error. A window equal to the length of the list produces exactly one value. Negative numbers are ordinary data, not an error condition. Describing these cases before implementation reduces the temptation to redefine success after seeing a result.
evaluation/reference-teacher-score.cpp ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "llama.h"
2
+
3
+ #include <algorithm>
4
+ #include <chrono>
5
+ #include <cmath>
6
+ #include <cstdint>
7
+ #include <fstream>
8
+ #include <iomanip>
9
+ #include <iostream>
10
+ #include <limits>
11
+ #include <string>
12
+ #include <vector>
13
+
14
+ namespace {
15
+
16
+ struct Score {
17
+ int index;
18
+ int input_index;
19
+ int target;
20
+ int top1;
21
+ double logprob;
22
+ };
23
+
24
+ bool read_tokens(const char * path, std::vector<llama_token> & tokens) {
25
+ std::ifstream in(path);
26
+ if (!in) {
27
+ std::cerr << "cannot open token file: " << path << "\n";
28
+ return false;
29
+ }
30
+ long long value = 0;
31
+ while (in >> value) {
32
+ if (value < std::numeric_limits<int32_t>::min() || value > std::numeric_limits<int32_t>::max()) {
33
+ std::cerr << "token out of int32 range\n";
34
+ return false;
35
+ }
36
+ tokens.push_back(static_cast<llama_token>(value));
37
+ }
38
+ if (!in.eof()) {
39
+ std::cerr << "malformed token file\n";
40
+ return false;
41
+ }
42
+ return true;
43
+ }
44
+
45
+ bool score_chunk(llama_context * ctx, const std::vector<llama_token> & tokens, int start,
46
+ int n_vocab, std::vector<Score> & scores, std::string & error) {
47
+ constexpr int chunk = 512;
48
+ llama_batch batch = llama_batch_init(chunk, 0, 1);
49
+ if (!batch.token || !batch.pos || !batch.n_seq_id || !batch.seq_id || !batch.logits) {
50
+ llama_batch_free(batch);
51
+ error = "llama_batch_init returned incomplete batch";
52
+ return false;
53
+ }
54
+ for (int i = 0; i < chunk; ++i) {
55
+ batch.token[i] = tokens[start + i];
56
+ batch.pos[i] = i;
57
+ batch.n_seq_id[i] = 1;
58
+ batch.seq_id[i][0] = 0;
59
+ batch.logits[i] = 1;
60
+ }
61
+ batch.n_tokens = chunk;
62
+
63
+ const int rc = llama_decode(ctx, batch);
64
+ if (rc != 0) {
65
+ error = "llama_decode returned " + std::to_string(rc);
66
+ llama_batch_free(batch);
67
+ return false;
68
+ }
69
+
70
+ for (int i = 0; i < chunk; ++i) {
71
+ const float * logits = llama_get_logits_ith(ctx, i);
72
+ if (!logits) {
73
+ error = "llama_get_logits_ith returned null at row " + std::to_string(i);
74
+ llama_batch_free(batch);
75
+ return false;
76
+ }
77
+ float max_logit = -std::numeric_limits<float>::infinity();
78
+ int top1 = -1;
79
+ for (int v = 0; v < n_vocab; ++v) {
80
+ if (logits[v] > max_logit) {
81
+ max_logit = logits[v];
82
+ top1 = v;
83
+ }
84
+ }
85
+ double sum_exp = 0.0;
86
+ for (int v = 0; v < n_vocab; ++v) {
87
+ sum_exp += std::exp(static_cast<double>(logits[v]) - static_cast<double>(max_logit));
88
+ }
89
+ const int target = tokens[start + i + 1];
90
+ if (target < 0 || target >= n_vocab || !(sum_exp > 0.0)) {
91
+ error = "invalid target or logit normalization at row " + std::to_string(i);
92
+ llama_batch_free(batch);
93
+ return false;
94
+ }
95
+ const double logprob = static_cast<double>(logits[target]) - static_cast<double>(max_logit) - std::log(sum_exp);
96
+ scores.push_back({start + i + 1, start + i, target, top1, logprob});
97
+ }
98
+ llama_batch_free(batch);
99
+ return true;
100
+ }
101
+
102
+ } // namespace
103
+
104
+ int main(int argc, char ** argv) {
105
+ if (argc != 4) {
106
+ std::cerr << "usage: llama-teacher-score MODEL TOKEN_IDS OUTPUT_JSONL\n";
107
+ return 2;
108
+ }
109
+
110
+ std::vector<llama_token> tokens;
111
+ if (!read_tokens(argv[2], tokens) || tokens.size() < 1025) {
112
+ std::cerr << "need at least 1025 token ids, got " << tokens.size() << "\n";
113
+ return 2;
114
+ }
115
+
116
+ llama_backend_init();
117
+ llama_model_params model_params = llama_model_default_params();
118
+ model_params.n_gpu_layers = -1;
119
+ llama_model * model = llama_model_load_from_file(argv[1], model_params);
120
+ if (!model) {
121
+ std::cerr << "llama_model_load_from_file failed\n";
122
+ llama_backend_free();
123
+ return 3;
124
+ }
125
+
126
+ llama_context_params context_params = llama_context_default_params();
127
+ context_params.n_ctx = 512;
128
+ context_params.n_batch = 512;
129
+ context_params.n_ubatch = 512;
130
+ context_params.n_seq_max = 1;
131
+ context_params.n_outputs_max = 512;
132
+ context_params.n_outputs_max_per_seq = 512;
133
+ context_params.n_threads = 16;
134
+ context_params.n_threads_batch = 48;
135
+ context_params.flash_attn_type = LLAMA_FLASH_ATTN_TYPE_AUTO;
136
+ context_params.op_offload = true;
137
+ context_params.kv_unified = false;
138
+ llama_context * ctx = llama_init_from_model(model, context_params);
139
+ if (!ctx) {
140
+ std::cerr << "llama_init_from_model failed\n";
141
+ llama_model_free(model);
142
+ llama_backend_free();
143
+ return 4;
144
+ }
145
+
146
+ const llama_vocab * vocab = llama_model_get_vocab(model);
147
+ const int n_vocab = llama_vocab_n_tokens(vocab);
148
+ std::vector<Score> scores;
149
+ scores.reserve(1024);
150
+ std::string error;
151
+ const auto started = std::chrono::steady_clock::now();
152
+ for (int start : {0, 512}) {
153
+ if (start != 0) {
154
+ llama_memory_clear(llama_get_memory(ctx), true);
155
+ }
156
+ if (!score_chunk(ctx, tokens, start, n_vocab, scores, error)) {
157
+ std::cerr << error << "\n";
158
+ llama_free(ctx);
159
+ llama_model_free(model);
160
+ llama_backend_free();
161
+ return 5;
162
+ }
163
+ }
164
+ llama_synchronize(ctx);
165
+ const auto elapsed = std::chrono::duration<double>(std::chrono::steady_clock::now() - started).count();
166
+
167
+ double nll = 0.0;
168
+ int top1_correct = 0;
169
+ for (const Score & s : scores) {
170
+ nll -= s.logprob;
171
+ top1_correct += s.top1 == s.target;
172
+ }
173
+ const double mean_nll = nll / static_cast<double>(scores.size());
174
+ const double ppl = std::exp(mean_nll);
175
+
176
+ std::ofstream out(argv[3]);
177
+ if (!out) {
178
+ std::cerr << "cannot open output: " << argv[3] << "\n";
179
+ llama_free(ctx);
180
+ llama_model_free(model);
181
+ llama_backend_free();
182
+ return 6;
183
+ }
184
+ out << std::setprecision(12);
185
+ out << "{\"type\":\"meta\",\"commit\":\"9a9394a895b96003ca842a6041cb28ac49a108f7\","
186
+ "\"vocab\":" << n_vocab << ",\"token_count\":" << tokens.size()
187
+ << ",\"chunk_size\":512,\"chunk_starts\":[0,512],\"bos_injected\":false,"
188
+ "\"score_count\":" << scores.size() << ",\"elapsed_seconds\":" << elapsed << "}\n";
189
+ for (const Score & s : scores) {
190
+ out << "{\"type\":\"score\",\"target_index\":" << s.index
191
+ << ",\"input_index\":" << s.input_index
192
+ << ",\"target\":" << s.target
193
+ << ",\"correct_logprob\":" << s.logprob
194
+ << ",\"top1\":" << s.top1 << "}\n";
195
+ }
196
+ out << "{\"type\":\"summary\",\"score_count\":" << scores.size()
197
+ << ",\"mean_nll\":" << mean_nll
198
+ << ",\"ppl\":" << ppl
199
+ << ",\"top1_correct\":" << top1_correct
200
+ << ",\"top1_accuracy\":" << (static_cast<double>(top1_correct) / scores.size())
201
+ << ",\"elapsed_seconds\":" << elapsed << "}\n";
202
+ out.close();
203
+
204
+ llama_free(ctx);
205
+ llama_model_free(model);
206
+ llama_backend_free();
207
+ return 0;
208
+ }
evaluation/reference-teacher-score.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
licenses/README.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # License bundle
2
+
3
+ This staging bundle contains both sides of the distribution:
4
+
5
+ - `upstream-model-LICENSE` and `upstream-model-NOTICE.txt` are copied from
6
+ `prism-ml/Ternary-Bonsai-2-27B-mlx-2bit` at revision
7
+ `3f926b415992eaa2ae9dd7b573706494d6bbf787`.
8
+ - `upstream-mlx-runtime-LICENSE` preserves the MIT notice shipped by the
9
+ upstream `runtime/` component.
10
+ - `cmf-LICENSE`, `cmf-NOTICE`, and `cmf-PATENTS.md` cover the CMF runtime and
11
+ clean source patch. `cmf-NOTICE` references `cmf-PATENTS.md`.
12
+
13
+ The upstream notice also identifies Qwen3.8-27B as Apache-2.0 software and
14
+ links its license. This release does not remove or replace that attribution.
15
+ Do not represent the CMF runtime license as the model license, or vice versa.
licenses/cmf-LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Oleg Kirichenko
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
licenses/cmf-NOTICE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CMF — Cortiq Model Format
2
+ Copyright 2026 Oleg Kirichenko
3
+
4
+ This product includes software developed by Oleg Kirichenko.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ ------------------------------------------------------------------------
12
+
13
+ This software implements methods that are the subject of patent
14
+ applications filed by the author. The Apache License, Version 2.0 grants
15
+ you an irrevocable, royalty-free patent license to those claims that are
16
+ necessarily infringed by the software as distributed (see Section 3 of the
17
+ License and the file PATENTS.md for details).
licenses/cmf-PATENTS.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Patents
2
+
3
+ CMF (Cortiq Model Format) implements methods that are the subject of the
4
+ following United States patent applications filed by the author, Oleg
5
+ Urevich Kirichenko:
6
+
7
+ | # | Application Serial No. | Filed | Title |
8
+ |---|------------------------|-------|-------|
9
+ | 1 | 19/452,440 | January 19, 2026 | Resonance Routing (unsupervised task selection by reconstruction-error minimization) |
10
+ | 2 | 19/452,464 | January 19, 2026 | Dynamic Task-Guided Mask Activation (DTG-MA) Compression |
11
+ | 3 | 19/731,402 | July 6, 2026 | Unified Execution Architecture for Serving a Plurality of Specialized Language Models from a Single Shared Backbone via Dynamically Overlaid Compressed Delta Representations Without Materializing Separate Models |
12
+ | 4 | 19/738,763 | July 13, 2026 | Training-Free Constant-Memory Streaming Attention Conversion |
13
+
14
+ Where these methods appear in this repository:
15
+
16
+ - **Resonance Routing (App. 19/452,440)** — the reconstruction-error skill
17
+ selector used by the runtime and the `selection descriptor` records in the
18
+ container.
19
+ - **DTG-MA Compression (App. 19/452,464)** — the task-guided mask/skill
20
+ production path used by the converter to derive per-skill delta records.
21
+ - **Unified Execution Architecture (App. 19/731,402)** — the CMF container
22
+ itself (shared backbone stored once + per-skill full-shape replacement
23
+ tensors + byte-offset delta index) and the overlay runtime
24
+ that reads replacement tensors *in place of* the backbone at forward time
25
+ without materializing a per-skill model.
26
+ - **Streaming Attention Conversion (App. 19/738,763)** — the training-free
27
+ O(1) attention path: `cortiq convert --o1` (weights byte-identical), the
28
+ streaming sink/window/landmark-skeleton kernel with delayed insertion and
29
+ a single joint denominator (`nystrom.rs`, runtime seal that releases the
30
+ KV cache), and the generation-gated `cortiq fcd` restoration stage.
31
+
32
+ ## Patent grant
33
+
34
+ This project is licensed under the **Apache License, Version 2.0**. Section 3
35
+ of that license ("Grant of Patent License") gives every user a perpetual,
36
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license
37
+ to make, have made, use, offer to sell, sell, import, and otherwise transfer
38
+ the Work, for those patent claims of the above applications that are
39
+ necessarily infringed by this software as distributed. That patent license
40
+ terminates for any party that initiates patent litigation alleging that this
41
+ software infringes a patent (Apache-2.0 §3).
42
+
43
+ In plain terms: **you may use, modify, and redistribute this software —
44
+ including for commercial purposes — under Apache-2.0, and you receive a
45
+ patent license to the claims practiced by the code as shipped.** The
46
+ underlying inventions remain patented; this grant is scoped to this software,
47
+ consistent with Apache-2.0.
48
+
49
+ This file is informational and does not modify the Apache License, Version 2.0,
50
+ which is the sole governing license (see `LICENSE`).
licenses/upstream-mlx-runtime-LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright © 2023 Apple Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
licenses/upstream-model-LICENSE ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
licenses/upstream-model-NOTICE.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ This software is copyright 2026-present Prism ML, Inc. It is available under the Apache 2.0 license.
2
+ If you publicly deploy or redistribute this software, we would appreciate attribution such as: "Created using Bonsai by Prism ML."
3
+
4
+ This software is built from Qwen3.8-27B, Copyright 2026 Alibaba Cloud, which is available under the Apache 2.0 License: https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE
source/SOURCE_BUILD.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reproducible clean-source runtime
2
+
3
+ This model requires the small source patch shipped at
4
+ `source/patches/cmf-bonsai2-public-base-48a9.patch`. It is not compatible with
5
+ the stock `cortiq` 0.6.8 release: the version label is retained by the pinned
6
+ public base, while `q2tp_affine` and its signed-Hadamard descriptor are added
7
+ by this patch. No runtime binary is bundled here.
8
+
9
+ ## Pin and patch
10
+
11
+ ```sh
12
+ git clone https://github.com/infosave2007/cmf.git
13
+ cd cmf
14
+ git checkout --detach 48a9ca5929ea42d28ced54279b4fc9d9c4c33d10
15
+ git apply --check /path/to/source/patches/cmf-bonsai2-public-base-48a9.patch
16
+ git apply /path/to/source/patches/cmf-bonsai2-public-base-48a9.patch
17
+ ```
18
+
19
+ The patch SHA-256 is
20
+ `e6cd6a60149a8be764a323ab1f968668b524b36ec35bc1a193fcfb5218f669be`.
21
+ The patch changes only the accepted 26-file Bonsai delta and preserves the
22
+ public Qwen image modules and manifests. The source model provenance and all
23
+ changed-file hashes are in `source/SOURCE_PROVENANCE.json`.
24
+
25
+ ## Linux build
26
+
27
+ Install the normal Rust/Cargo build prerequisites plus Vulkan development and
28
+ runtime support (`build-essential pkg-config cmake libssl-dev libvulkan1
29
+ vulkan-tools`). The validated environment used stable Rust 1.98.1
30
+ (`48a229cea`, 2026-09-01), Vulkan on an NVIDIA RTX 4090, and no HF token.
31
+
32
+ ```sh
33
+ source "$HOME/.cargo/env" # when rustup installed this file
34
+ rustup toolchain install 1.98.1
35
+ export RUSTUP_TOOLCHAIN=1.98.1
36
+ export CARGO_TARGET_DIR="$PWD/target"
37
+ export CARGO_BUILD_JOBS=8 CARGO_INCREMENTAL=0
38
+ export RUSTFLAGS='-C opt-level=3'
39
+ cargo build -p cortiq-cli --features gpu
40
+ cargo build -p cortiq-cli --features gpu --example score_fixed
41
+ export PATH="$CARGO_TARGET_DIR/debug:$PATH"
42
+ ```
43
+
44
+ For Vulkan set `XDG_RUNTIME_DIR=/tmp WGPU_BACKEND=vulkan`. CPU-only checks can
45
+ force `CMF_GPU=0`. The source validation passed core 6/6, q2tp CPU 3/3, Prism
46
+ CPU 2/2, CLI 94 passed/1 ignored live-HF, and Vulkan q2tp 2/2.
47
+
48
+ ## Verify and run the uploaded model
49
+
50
+ The model repository is
51
+ `https://huggingface.co/infosave/Ternary-Bonsai-2-27B-cmf` and the
52
+ file name is `Ternary-Bonsai-2-27B-Q2TP-Affine.cmf`. Download that file and verify its SHA-256 against
53
+ `source/SOURCE_PROVENANCE.json`.
54
+
55
+ ```sh
56
+ MODEL=Ternary-Bonsai-2-27B-Q2TP-Affine.cmf
57
+ export XDG_RUNTIME_DIR=/tmp WGPU_BACKEND=vulkan CMF_GPU=wgpu
58
+ export CMF_Q2TP_GPU=1 CMF_GPU_PROBE=0 CMF_MTP=0
59
+ cortiq verify "$MODEL"
60
+ cortiq run "$MODEL" \
61
+ --prompt 'Return only a valid JSON object with exactly two keys: "city" with value "Казань" and "count" with integer value 3. Do not use Markdown.' \
62
+ --greedy --seed 42 --no-think --max-tokens 256
63
+ ```
64
+
65
+ The validated output was exactly `{"city":"Казань","count":3}`. This is a
66
+ text-generation runtime check. Vision tensors and metadata are preserved in
67
+ the CMF file, but image/text fusion is not implemented or tested by this
68
+ runtime; do not use this file as a VLM.
source/SOURCE_PROVENANCE.json ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "ternary-bonsai-2-q2tp-affine-hf-staging-1",
3
+ "intended_repo": "infosave/Ternary-Bonsai-2-27B-cmf",
4
+ "intended_model_filename": "Ternary-Bonsai-2-27B-Q2TP-Affine.cmf",
5
+ "model": {
6
+ "bytes": 8247698536,
7
+ "sha256": "fb0f1a9cdb0434bc9ce50eb6473bc2ca4a71d6994ad61314bbd7e2f11c4e29e8",
8
+ "profile": "CMF dtype16 Q2TP storage + required q2tp_affine Prism operator",
9
+ "tested_modality": "text generation only"
10
+ },
11
+ "source": {
12
+ "runtime_repository": "https://github.com/infosave2007/cmf",
13
+ "public_base_commit": "48a9ca5929ea42d28ced54279b4fc9d9c4c33d10",
14
+ "patch_file": "source/patches/cmf-bonsai2-public-base-48a9.patch",
15
+ "patch_sha256": "e6cd6a60149a8be764a323ab1f968668b524b36ec35bc1a193fcfb5218f669be",
16
+ "changed_file_count": 26,
17
+ "changed_files": [
18
+ {
19
+ "path": "README.md",
20
+ "bytes": 8911,
21
+ "sha256": "bec1ab6c898dbb3be6afa304acc26f3b2b58c3f2b52bce0d164075af3e988aeb"
22
+ },
23
+ {
24
+ "path": "crates/cortiq-cli/examples/score_fixed.rs",
25
+ "bytes": 1230,
26
+ "sha256": "d1b909ed40995249fa75c445ddf40a367ca6adca001eba31d74ac370669b779c"
27
+ },
28
+ {
29
+ "path": "crates/cortiq-cli/src/convert.rs",
30
+ "bytes": 356447,
31
+ "sha256": "35aa91d49af5231f6ca990974a337823de0ccc10062091221a7bd833870beedc"
32
+ },
33
+ {
34
+ "path": "crates/cortiq-cli/src/gguf.rs",
35
+ "bytes": 98248,
36
+ "sha256": "e1f8afbf0b7e6d8fdf7d4921cc80747a5ca9bf9bf5bc599f72c589aba8ba8139"
37
+ },
38
+ {
39
+ "path": "crates/cortiq-cli/src/main.rs",
40
+ "bytes": 249728,
41
+ "sha256": "ea4cdaf09dda0e2fcb64a8159d35d8c11877137664e7616bd8c4dc4f88ebb3d0"
42
+ },
43
+ {
44
+ "path": "crates/cortiq-core/src/format.rs",
45
+ "bytes": 85313,
46
+ "sha256": "9a8fca48b8492fdfab4eb1ac122feb28604ece4cbdd7cab74f2c02a69cfec3a7"
47
+ },
48
+ {
49
+ "path": "crates/cortiq-core/src/hadamard.rs",
50
+ "bytes": 3315,
51
+ "sha256": "264eeba873021217b594965e904a6c6b604e384e9ceadd5e03163fd9f71dc428"
52
+ },
53
+ {
54
+ "path": "crates/cortiq-core/src/lib.rs",
55
+ "bytes": 775,
56
+ "sha256": "278d49a2b121b6851acabb812d2b5ace28f9ab0a5bdd3970045110c290969286"
57
+ },
58
+ {
59
+ "path": "crates/cortiq-core/src/types.rs",
60
+ "bytes": 39778,
61
+ "sha256": "a51f36c2112ed574b03aad086f3d96148787889becdb297904446454769eb8cf"
62
+ },
63
+ {
64
+ "path": "crates/cortiq-core/tests/loop_masks.rs",
65
+ "bytes": 6567,
66
+ "sha256": "6408c23b8de1cd6db3bb00875f315565270f82bd6028ba77253ccf69fc83529b"
67
+ },
68
+ {
69
+ "path": "crates/cortiq-core/tests/roundtrip.rs",
70
+ "bytes": 37607,
71
+ "sha256": "2ddb95cf55eee59a14f34884ae595132cf18a5c1e3bb2694e4f23c473c067091"
72
+ },
73
+ {
74
+ "path": "crates/cortiq-core/tests/skill_file.rs",
75
+ "bytes": 4886,
76
+ "sha256": "af99818e3671b992da2b4b343edf9f8055b388c8c8d4e11a883bab19d3ddcd4b"
77
+ },
78
+ {
79
+ "path": "crates/cortiq-engine/src/attention.rs",
80
+ "bytes": 70420,
81
+ "sha256": "246c9c720ed82a547a9af01f0c755b6f82601cb56a3344f231b985bbb4aadde5"
82
+ },
83
+ {
84
+ "path": "crates/cortiq-engine/src/gpu.rs",
85
+ "bytes": 121790,
86
+ "sha256": "bd6e651e5cafa585263e2c24049e70c2e8cc84a31ade294e3dd92c60b172d1ad"
87
+ },
88
+ {
89
+ "path": "crates/cortiq-engine/src/gpu_metal.rs",
90
+ "bytes": 597506,
91
+ "sha256": "78b4eecbee135aac938b30b774c57cb48ceb88a8e4f3a03330569f1b1898e431"
92
+ },
93
+ {
94
+ "path": "crates/cortiq-engine/src/gpu_wgpu.rs",
95
+ "bytes": 2089683,
96
+ "sha256": "2ade4ccc62940ba23453189f14ea0a1bf4cb315e8a86ee8be373f63d04eaf2b8"
97
+ },
98
+ {
99
+ "path": "crates/cortiq-engine/src/lib.rs",
100
+ "bytes": 3901,
101
+ "sha256": "517b35207c05307d4688349ff5da1505d877bb23b15b5f73a49a28c3aee4dd89"
102
+ },
103
+ {
104
+ "path": "crates/cortiq-engine/src/pipeline.rs",
105
+ "bytes": 584307,
106
+ "sha256": "a67dbc8768bd739c7b2f950385d6144dc5cee801245f95537ed7970aa3ea98f0"
107
+ },
108
+ {
109
+ "path": "crates/cortiq-engine/src/prism.rs",
110
+ "bytes": 12114,
111
+ "sha256": "16505deed5a0a00b1d38a7a842b746f00223d1d15d3a7dbb34c1bf3a79dfe45a"
112
+ },
113
+ {
114
+ "path": "crates/cortiq-engine/src/qtensor.rs",
115
+ "bytes": 512619,
116
+ "sha256": "57135f0a4ca811135f566c1c3288c3cad98122a2371483c4eb6c821607b1c3f7"
117
+ },
118
+ {
119
+ "path": "crates/cortiq-engine/tests/fcd_train.rs",
120
+ "bytes": 19591,
121
+ "sha256": "66c2998ed92a30001701f27928fa4ded0981b087dc4c13494f91e26daf31dc5a"
122
+ },
123
+ {
124
+ "path": "crates/cortiq-engine/tests/gpu_micro.rs",
125
+ "bytes": 25495,
126
+ "sha256": "b86eb91fe01a71bf21474f69a8789b8e4af458e4292952768fb147cf7a7214c9"
127
+ },
128
+ {
129
+ "path": "crates/cortiq-engine/tests/mask_quant.rs",
130
+ "bytes": 7199,
131
+ "sha256": "115453717aeed21e06c32741e617e074a9486d1b7fec1f413a37d6c622604976"
132
+ },
133
+ {
134
+ "path": "crates/cortiq-engine/tests/skills.rs",
135
+ "bytes": 15446,
136
+ "sha256": "235f27cb98f6e20c42a107a77cef2469d98df6b440baac2c4394c0ee831e5040"
137
+ },
138
+ {
139
+ "path": "crates/cortiq-engine/tests/x86_gemm.rs",
140
+ "bytes": 28107,
141
+ "sha256": "a3c1747f6179f1ee16e8f026ab4b687f013dbbe09a59b1407cfe5996142389d8"
142
+ },
143
+ {
144
+ "path": "python/cmf_reader.py",
145
+ "bytes": 14373,
146
+ "sha256": "54aca01be03f2c57f9d62ff867420394d7e61f579876a1bf795cec8ce497f67b"
147
+ }
148
+ ],
149
+ "runtime4_delta_sha256": "55add36a786bc9697817d5b2696b2e64f810926cf34663ae995fb3ad83a1f2dd",
150
+ "binary_not_distributed": true
151
+ },
152
+ "upstream_model": {
153
+ "repository": "prism-ml/Ternary-Bonsai-2-27B-mlx-2bit",
154
+ "revision": "3f926b415992eaa2ae9dd7b573706494d6bbf787",
155
+ "weights_file": "model.safetensors",
156
+ "weights_bytes": 8595477990,
157
+ "weights_sha256": "130de5925082c168b7866b2e91b52e44abbafc99017e3ca352b77b5b55a269ed",
158
+ "license": "Apache-2.0"
159
+ },
160
+ "validated_runtime_identity": {
161
+ "version_label": "cortiq 0.6.8",
162
+ "source_build_sha256": "0ccf849b132b2216aaff5f4e6762a1182a3a44fcf2329ad20503c2e896ab6eb3",
163
+ "build_id": "2b94566b1ce9d2cb7218df3735c2f24bc8838235",
164
+ "note": "development build from the pinned base plus this patch; not stock 0.6.8"
165
+ },
166
+ "evaluation": {
167
+ "prompts_file": "evaluation/prompts.jsonl",
168
+ "prompts_sha256": "68f6b0b2ffc8526d2f37df7bb2e494531d533e336b6d4df8c1feeebd2652c1f5",
169
+ "quality_corpus_file": "evaluation/quality-corpus.txt",
170
+ "quality_corpus_sha256": "181716ce3f0a71b94f7d5d4428232c241b88f3e26d68f4ed50a191506ddb78b5",
171
+ "token_ids_file": "evaluation/quality-corpus-token-ids.txt",
172
+ "token_ids_sha256": "6dd2b70cb1d4a18a2955737b9dc3711bc20cd951c48a086ce144dcfbff8eb47b",
173
+ "official_reference_raw": "evaluation/reference-teacher-score.jsonl",
174
+ "official_reference_raw_sha256": "0fe3ce05070664d453186040a0013d1c66431f581252382bd2fe361f69577d7c",
175
+ "official_reference_mean_nll": 1.81274952826,
176
+ "official_reference_ppl": 6.12727139849,
177
+ "official_reference_top1": "603/1024",
178
+ "cmf_affine_cpu_mean_nll": 1.812992284,
179
+ "cmf_affine_vulkan_mean_nll": 1.813015751,
180
+ "cmf_affine_vulkan_ppl": 6.128902833,
181
+ "ordinary_q2tp_vulkan_mean_nll": 1.886951899,
182
+ "ordinary_q2tp_vulkan_delta_nats": 0.074202371
183
+ },
184
+ "performance": {
185
+ "measurement_source": "accepted runtime4 hardware run on RTX 4090 24GB",
186
+ "prefill_tok_s": 8.5,
187
+ "ttft_s": 6.88,
188
+ "warm_decode_tok_s": 5.2,
189
+ "clean_port_quality_reverified": true,
190
+ "clean_port_speed_rebenchmarked": false,
191
+ "interpretation": "5.2 tok/s is not a clean-port speed claim; it is the runtime4 measurement retained for context."
192
+ },
193
+ "licenses": {
194
+ "files": [
195
+ {
196
+ "path": "licenses/upstream-model-LICENSE",
197
+ "sha256": "69849221bfb90053de2134ef5e6d540287b4b98062326492f1f96f5da685524b"
198
+ },
199
+ {
200
+ "path": "licenses/upstream-model-NOTICE.txt",
201
+ "sha256": "de0e0c48fb6f691a31e74f338e3ccf93f9ecdfe2866ab769c4bf8b79a7636a30"
202
+ },
203
+ {
204
+ "path": "licenses/upstream-mlx-runtime-LICENSE",
205
+ "sha256": "ccfab7ccb2ea306f71531c8ca77bb55507606cd90768b1e32b8b52ab5b48cf01"
206
+ },
207
+ {
208
+ "path": "licenses/cmf-LICENSE",
209
+ "sha256": "0bf59d136536dea5dcf80ce96c5988e46522ce69f3ae817666c7f5d10ded6618"
210
+ },
211
+ {
212
+ "path": "licenses/cmf-NOTICE",
213
+ "sha256": "d8ee9168d48f5b0fa0012518848434a65cebb8288f3f2ed51f2738f2f4b347e4"
214
+ },
215
+ {
216
+ "path": "licenses/cmf-PATENTS.md",
217
+ "sha256": "607faa71dd5a600787f97dcc50e17221e04f57e21e19aa2d5e2a1399e21fb692"
218
+ }
219
+ ],
220
+ "model_license": "Apache-2.0",
221
+ "cmf_runtime_license": "Apache-2.0",
222
+ "upstream_mlx_runtime_license": "MIT"
223
+ }
224
+ }
source/patches/cmf-bonsai2-public-base-48a9.patch ADDED
The diff for this file is too large to render. See raw diff