Voltline commited on
Commit
ff3dab5
·
verified ·
1 Parent(s): 8dd4f19

Add the zh-v1 batched KV sequence-head Core ML package for sentence scoring

Browse files
README.md CHANGED
@@ -33,6 +33,7 @@ This is a custom PyTorch model, not a Transformers `AutoModel` integration or an
33
  | `coreml/ios18-int8-block32-kvchunk/` | Chunked KV-cache Core ML `.mlpackage` and manifest |
34
  | `coreml/ios18-int8-block32-kvbatch/` | Batched single-step KV Core ML `.mlpackage` and manifest (pinyin beam search) |
35
  | `coreml/ios18-int8-block32-kvbatch-v2/` | Batched KV v2 Core ML `.mlpackage` and manifest: multi-token prefill and decode in one package, scored head (pinyin beam search) |
 
36
  | `source/` | Frozen VimeML Python source, scripts, configurations and requirements |
37
  | `infer.py` | FP32 candidate-scoring and phrase-prediction wrapper using the zh-v1 bundle loader |
38
  | `evaluation/summary.json` | Aggregate quality, alignment and measurement results; no benchmark texts or traces |
@@ -40,7 +41,7 @@ This is a custom PyTorch model, not a Transformers `AutoModel` integration or an
40
 
41
  - Source: [Voltline/VimeML](https://github.com/Voltline/VimeML), commit `54ace39b7fbbce4c362d55677c638ea2db7b83c6`.
42
  - FP32 inference manifest: `9d9dad19c573c84c84e6a78060d1999a0a7e978c90a9bd78ca844da565a6ae74`.
43
- - Core ML manifests: stateless `50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276`, chunked KV `c5bc759d4a224cf389d9ae28304df194e7e1b0ba3eb3945a94ecea9ddd82abc7`, batched KV `472d148a5c87948e5dad0d2ef3a352d34117715bf0a8fb6664f04d5bf2e8bf2a`, batched KV v2 `33c90e2a82e78e0ee52e7471f1a61c7e7e7b8dc9bdf233cc363702d5bc8147de`.
44
  - Tokenizer: `68bd37c45bcb018b32b2eef5b241561ab5b6dc1b77c1c3aadcc1b41c4bf47e5a`.
45
  - Original training checkpoint: `44c423a1e7cb0e32161afc94d6167cabb439a3d25fd9de6d1fbb150a927542d4`; the optimizer-bearing checkpoint is not distributed. The inference weights equal the checkpoint's model tensors exactly (the tied LM head is stored once).
46
 
@@ -108,6 +109,7 @@ Most of the advantage over Rime comes from using left context: with empty contex
108
  - **Chunked KV (22,830,199 bytes):** `input_ids` INT32 `[1,T]`, `position` INT32 `[1]` (current cache length, position+T≤128), `key_cache`/`value_cache` FLOAT32 `(9,1,6,128,64)` → logits for the new tokens plus updated caches. The caller owns cache snapshots and rollback.
109
  - **Batched KV (22,762,761 bytes; added 2026-11-15):** advances B independent hypotheses by one token in one call. `input_ids` INT32 `[B,1]`, `position` INT32 `[B]` (each row's cache length), `key_cache`/`value_cache` FLOAT32 `(9,B,6,S,64)` with B flexible 1..16 and S flexible 1..128 (pass `max(position)+1` slots) → `logits` FLOAT32 `[B,12288]` for the new token plus `new_key`/`new_value` `(9,B,6,64)`, which the caller writes into slot `position[b]` of row b. Rows never attend across each other. The prompt is prefilled once with the chunked package. It matches the stateless INT8 package within 4.8e-5 (atol/rtol 3e-4, all argmax equal), and a per-key-position beam search (beam 16) over it returns exactly the results of the same search run on the stateless INT8 package. Apple M3 Mac, CPU_ONLY, p50 per call: B=16 3.35 ms (S=16) / 3.76 ms (S=32); B=8 2.69 / 2.92 ms; B=1 1.64 ms. It was converted at VimeML commit `a8440c5d8c613e7e4964104089cff824e804637b` (`src/vimeml/deployment/zh_v1_batch.py`); `source/` stays the original release's snapshot.
110
  - **Batched KV v2 (22,774,484 bytes; added 2026-11-15; recommended for beam search):** one package for both the prompt and the beam steps, so the chunked package is not needed. `input_ids` INT32 `[B,T]` (B flexible 1..16, T flexible 1..128), `position` INT32 `[B]` (each row's cache length, position+T≤128), `key_cache`/`value_cache` FLOAT32 `(9,B,6,S,64)` with S flexible 1..128 and S ≥ max(position) (the caches are read only), `allowed` INT32 `[K]` (1≤K≤1024, one id list shared by all rows) → `logsumexp` FLOAT32 `[B]` over all 12,288 logits of the last new token, `allowed_logits` FLOAT32 `[B,K]` (log P = allowed_logits − logsumexp), and `new_key`/`new_value` `(9,B,6,T,64)`, which the caller writes into slots `position[b]..` of row b. Prompt: B=1, T = prompt length, position 0, S=1. It matches the stateless INT8 package within 3.0e-5 (atol/rtol 3e-4), and the per-key-position beam search (beam 16) over it returns exactly the results of the v1 batched package on all 125 fixture cases. Apple M3 Mac, CPU_ONLY, p50 per decode call: B=16 3.8–4.4 ms and B=8 3.0–3.5 ms at S up to 128; a 32-token prompt is one 3.8 ms call; search p50 79 ms per generation. It was converted at VimeML commit `65c42fdf15e6167d52a752a2db06863c6842a8b4` (`src/vimeml/deployment/zh_v1_batch2.py`).
 
111
 
112
  ```sh
113
  xcrun coremlcompiler compile coreml/ios18-int8-block32/model.mlpackage compiled-int8 --platform ios --deployment-target 18.0
 
33
  | `coreml/ios18-int8-block32-kvchunk/` | Chunked KV-cache Core ML `.mlpackage` and manifest |
34
  | `coreml/ios18-int8-block32-kvbatch/` | Batched single-step KV Core ML `.mlpackage` and manifest (pinyin beam search) |
35
  | `coreml/ios18-int8-block32-kvbatch-v2/` | Batched KV v2 Core ML `.mlpackage` and manifest: multi-token prefill and decode in one package, scored head (pinyin beam search) |
36
+ | `coreml/ios18-int8-block32-kvsequence/` | Batched KV sequence-head Core ML `.mlpackage` and manifest: log-probability of a given token at every new position, so a batch of known continuations is scored in one call (sentence scoring) |
37
  | `source/` | Frozen VimeML Python source, scripts, configurations and requirements |
38
  | `infer.py` | FP32 candidate-scoring and phrase-prediction wrapper using the zh-v1 bundle loader |
39
  | `evaluation/summary.json` | Aggregate quality, alignment and measurement results; no benchmark texts or traces |
 
41
 
42
  - Source: [Voltline/VimeML](https://github.com/Voltline/VimeML), commit `54ace39b7fbbce4c362d55677c638ea2db7b83c6`.
43
  - FP32 inference manifest: `9d9dad19c573c84c84e6a78060d1999a0a7e978c90a9bd78ca844da565a6ae74`.
44
+ - Core ML manifests: stateless `50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276`, chunked KV `c5bc759d4a224cf389d9ae28304df194e7e1b0ba3eb3945a94ecea9ddd82abc7`, batched KV `472d148a5c87948e5dad0d2ef3a352d34117715bf0a8fb6664f04d5bf2e8bf2a`, batched KV v2 `33c90e2a82e78e0ee52e7471f1a61c7e7e7b8dc9bdf233cc363702d5bc8147de`, batched KV sequence `c7b9e791bbebe58ebec384c92944803157a12d98af51459be11a61484c39bcc3`.
45
  - Tokenizer: `68bd37c45bcb018b32b2eef5b241561ab5b6dc1b77c1c3aadcc1b41c4bf47e5a`.
46
  - Original training checkpoint: `44c423a1e7cb0e32161afc94d6167cabb439a3d25fd9de6d1fbb150a927542d4`; the optimizer-bearing checkpoint is not distributed. The inference weights equal the checkpoint's model tensors exactly (the tied LM head is stored once).
47
 
 
109
  - **Chunked KV (22,830,199 bytes):** `input_ids` INT32 `[1,T]`, `position` INT32 `[1]` (current cache length, position+T≤128), `key_cache`/`value_cache` FLOAT32 `(9,1,6,128,64)` → logits for the new tokens plus updated caches. The caller owns cache snapshots and rollback.
110
  - **Batched KV (22,762,761 bytes; added 2026-11-15):** advances B independent hypotheses by one token in one call. `input_ids` INT32 `[B,1]`, `position` INT32 `[B]` (each row's cache length), `key_cache`/`value_cache` FLOAT32 `(9,B,6,S,64)` with B flexible 1..16 and S flexible 1..128 (pass `max(position)+1` slots) → `logits` FLOAT32 `[B,12288]` for the new token plus `new_key`/`new_value` `(9,B,6,64)`, which the caller writes into slot `position[b]` of row b. Rows never attend across each other. The prompt is prefilled once with the chunked package. It matches the stateless INT8 package within 4.8e-5 (atol/rtol 3e-4, all argmax equal), and a per-key-position beam search (beam 16) over it returns exactly the results of the same search run on the stateless INT8 package. Apple M3 Mac, CPU_ONLY, p50 per call: B=16 3.35 ms (S=16) / 3.76 ms (S=32); B=8 2.69 / 2.92 ms; B=1 1.64 ms. It was converted at VimeML commit `a8440c5d8c613e7e4964104089cff824e804637b` (`src/vimeml/deployment/zh_v1_batch.py`); `source/` stays the original release's snapshot.
111
  - **Batched KV v2 (22,774,484 bytes; added 2026-11-15; recommended for beam search):** one package for both the prompt and the beam steps, so the chunked package is not needed. `input_ids` INT32 `[B,T]` (B flexible 1..16, T flexible 1..128), `position` INT32 `[B]` (each row's cache length, position+T≤128), `key_cache`/`value_cache` FLOAT32 `(9,B,6,S,64)` with S flexible 1..128 and S ≥ max(position) (the caches are read only), `allowed` INT32 `[K]` (1≤K≤1024, one id list shared by all rows) → `logsumexp` FLOAT32 `[B]` over all 12,288 logits of the last new token, `allowed_logits` FLOAT32 `[B,K]` (log P = allowed_logits − logsumexp), and `new_key`/`new_value` `(9,B,6,T,64)`, which the caller writes into slots `position[b]..` of row b. Prompt: B=1, T = prompt length, position 0, S=1. It matches the stateless INT8 package within 3.0e-5 (atol/rtol 3e-4), and the per-key-position beam search (beam 16) over it returns exactly the results of the v1 batched package on all 125 fixture cases. Apple M3 Mac, CPU_ONLY, p50 per decode call: B=16 3.8–4.4 ms and B=8 3.0–3.5 ms at S up to 128; a 32-token prompt is one 3.8 ms call; search p50 79 ms per generation. It was converted at VimeML commit `65c42fdf15e6167d52a752a2db06863c6842a8b4` (`src/vimeml/deployment/zh_v1_batch2.py`).
112
+ - **Batched KV sequence (22,772,997 bytes; added 2026-11-16; for sentence scoring):** the v2 graph, inputs and cache rules, with a sequence head. Extra input `targets` INT32 `[B,T]` (the token that follows `input_ids[b,t]`) → `target_logprobs` FLOAT32 `[B,T]`, log P(`targets[b,t]` | row b through `input_ids[b,t]`) over all 12,288 logits, plus `new_key`/`new_value` `(9,B,6,T,64)` as in v2. Scoring rule: prefill the shared prefix without its last token; then one call per 16 candidates with `input_ids` = [last shared token] + candidate[:-1], `targets` = candidate, `position` = shared length − 1, every row reading the same cache; a candidate's score is the sum of its `target_logprobs`. Rows of different lengths are right-padded and their padded outputs ignored. It matches PyTorch FP32 and the stateless INT8 package within 3.4e-5 (3e-4 per position, 1e-3 per sum), and on 8 fixture cases (39 candidates) it ranks the candidates exactly as PyTorch FP32. Apple M3 Mac, CPU_ONLY, p50: one B=16, T=16 call 17.5–18.4 ms against 54.5–62.2 ms for 16 batched KV v2 decode calls (3.1–3.4×); B=16, T=8 10.5–11.2 ms. Memory grows with T because the head runs at every position: up to T=8 the footprint equals the v2 package's (~40 MiB over the stateless package); T=16 adds ~9 MiB retained (peak ~67 MiB), T=64 ~63 MiB. Cap T per call at 8 (or 16) and split longer continuations; the second call reads the first call's new keys and values from the cache. It does not replace the v2 package for beam search. It was converted at VimeML commit `fcc17501841f355ce849619354b102987bd54e71` (`src/vimeml/deployment/zh_v1_batch2.py`).
113
 
114
  ```sh
115
  xcrun coremlcompiler compile coreml/ios18-int8-block32/model.mlpackage compiled-int8 --platform ios --deployment-target 18.0
RELEASE.json CHANGED
@@ -12,7 +12,8 @@
12
  "stateless_int8": "50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276",
13
  "kvchunk_int8": "c5bc759d4a224cf389d9ae28304df194e7e1b0ba3eb3945a94ecea9ddd82abc7",
14
  "kvbatch_int8": "472d148a5c87948e5dad0d2ef3a352d34117715bf0a8fb6664f04d5bf2e8bf2a",
15
- "kvbatch_v2_int8": "33c90e2a82e78e0ee52e7471f1a61c7e7e7b8dc9bdf233cc363702d5bc8147de"
 
16
  },
17
  "files": {
18
  "LICENSE": {
@@ -28,8 +29,8 @@
28
  "sha256": "701f85d85eafb692ceab0a187487bcef31d7411d3814d8862604c54cac8a93f3"
29
  },
30
  "README.md": {
31
- "bytes": 18547,
32
- "sha256": "f6e67774733f533bfb2e56fee4bf9d1a3eb8091f575379782b34115bd07d38d3"
33
  },
34
  "coreml/ios18-int8-block32-kvbatch-v2/manifest.json": {
35
  "bytes": 26398,
@@ -79,6 +80,22 @@
79
  "bytes": 617,
80
  "sha256": "b7f6cffcf4ab46f9d2be7c2eaa97e543a1fba60de1e55ed60e557ed59502042b"
81
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  "coreml/ios18-int8-block32/manifest.json": {
83
  "bytes": 25571,
84
  "sha256": "50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276"
@@ -1504,5 +1521,5 @@
1504
  "sha256": "c094f5a7f449935469d948d4b665288319f2d5bb7f50d078adcce8843acd86da"
1505
  }
1506
  },
1507
- "updated_utc": "2026-11-15"
1508
  }
 
12
  "stateless_int8": "50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276",
13
  "kvchunk_int8": "c5bc759d4a224cf389d9ae28304df194e7e1b0ba3eb3945a94ecea9ddd82abc7",
14
  "kvbatch_int8": "472d148a5c87948e5dad0d2ef3a352d34117715bf0a8fb6664f04d5bf2e8bf2a",
15
+ "kvbatch_v2_int8": "33c90e2a82e78e0ee52e7471f1a61c7e7e7b8dc9bdf233cc363702d5bc8147de",
16
+ "kvsequence_int8": "c7b9e791bbebe58ebec384c92944803157a12d98af51459be11a61484c39bcc3"
17
  },
18
  "files": {
19
  "LICENSE": {
 
29
  "sha256": "701f85d85eafb692ceab0a187487bcef31d7411d3814d8862604c54cac8a93f3"
30
  },
31
  "README.md": {
32
+ "bytes": 20508,
33
+ "sha256": "7e2fb0d9536f6e1054109e3dac287e8d2748d43b02d56afef642f8cfb247fb02"
34
  },
35
  "coreml/ios18-int8-block32-kvbatch-v2/manifest.json": {
36
  "bytes": 26398,
 
80
  "bytes": 617,
81
  "sha256": "b7f6cffcf4ab46f9d2be7c2eaa97e543a1fba60de1e55ed60e557ed59502042b"
82
  },
83
+ "coreml/ios18-int8-block32-kvsequence/manifest.json": {
84
+ "bytes": 26792,
85
+ "sha256": "c7b9e791bbebe58ebec384c92944803157a12d98af51459be11a61484c39bcc3"
86
+ },
87
+ "coreml/ios18-int8-block32-kvsequence/model.mlpackage/Data/com.apple.CoreML/model.mlmodel": {
88
+ "bytes": 143388,
89
+ "sha256": "8543b82bd89ef7fbd1fde584f80c63dddb17cb73fa83b5670436087b7a216006"
90
+ },
91
+ "coreml/ios18-int8-block32-kvsequence/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin": {
92
+ "bytes": 22628992,
93
+ "sha256": "7fa1b5c803017953dfcd56552e328b3d4a6ddecd30042b35f6ba8532bb49b822"
94
+ },
95
+ "coreml/ios18-int8-block32-kvsequence/model.mlpackage/Manifest.json": {
96
+ "bytes": 617,
97
+ "sha256": "136d6f9361388960c0fc4218d3f2e374dd089c0eca0c783c1f008a7c694d1cbb"
98
+ },
99
  "coreml/ios18-int8-block32/manifest.json": {
100
  "bytes": 25571,
101
  "sha256": "50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276"
 
1521
  "sha256": "c094f5a7f449935469d948d4b665288319f2d5bb7f50d078adcce8843acd86da"
1522
  }
1523
  },
1524
+ "updated_utc": "2026-11-16"
1525
  }
SHA256SUMS.txt CHANGED
@@ -1,8 +1,8 @@
1
  230184f60bae2feaf244f10a8bac053c8ff33a183bcc365b4d8b876d2b7f4809 LICENSE
2
  6e488424f0b9cba0a5783478b15dd649e258df3bba140d71bd4a9c442c861c29 LICENSE-EXCEPTION
3
  701f85d85eafb692ceab0a187487bcef31d7411d3814d8862604c54cac8a93f3 NOTICE.md
4
- f6e67774733f533bfb2e56fee4bf9d1a3eb8091f575379782b34115bd07d38d3 README.md
5
- 8b925fb78cb0a2220ccafff586e64e49604118ad86831f71ece23f186e05d916 RELEASE.json
6
  33c90e2a82e78e0ee52e7471f1a61c7e7e7b8dc9bdf233cc363702d5bc8147de coreml/ios18-int8-block32-kvbatch-v2/manifest.json
7
  ae3bd7ddce15c24edf212f7b782b916033288acbc6a0a1fd0e0604c6b381000e coreml/ios18-int8-block32-kvbatch-v2/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
8
  7fa1b5c803017953dfcd56552e328b3d4a6ddecd30042b35f6ba8532bb49b822 coreml/ios18-int8-block32-kvbatch-v2/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
@@ -15,6 +15,10 @@ c5bc759d4a224cf389d9ae28304df194e7e1b0ba3eb3945a94ecea9ddd82abc7 coreml/ios18-i
15
  3a1bb4a40f0d567eb0f38e1f9a4c0427b49d3dac702ef12e518a376836d77f6d coreml/ios18-int8-block32-kvchunk/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
16
  692cbd69d74092a5a6224ebd03a88e05990ae952526c33199b698f470c53b4aa coreml/ios18-int8-block32-kvchunk/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
17
  b7f6cffcf4ab46f9d2be7c2eaa97e543a1fba60de1e55ed60e557ed59502042b coreml/ios18-int8-block32-kvchunk/model.mlpackage/Manifest.json
 
 
 
 
18
  50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276 coreml/ios18-int8-block32/manifest.json
19
  fdad38e89ff548429d3311f13cdc45263aebc67ec89f40ab3527cd449ec038ad coreml/ios18-int8-block32/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
20
  692cbd69d74092a5a6224ebd03a88e05990ae952526c33199b698f470c53b4aa coreml/ios18-int8-block32/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
 
1
  230184f60bae2feaf244f10a8bac053c8ff33a183bcc365b4d8b876d2b7f4809 LICENSE
2
  6e488424f0b9cba0a5783478b15dd649e258df3bba140d71bd4a9c442c861c29 LICENSE-EXCEPTION
3
  701f85d85eafb692ceab0a187487bcef31d7411d3814d8862604c54cac8a93f3 NOTICE.md
4
+ 7e2fb0d9536f6e1054109e3dac287e8d2748d43b02d56afef642f8cfb247fb02 README.md
5
+ b934bff55f0d58f8c831f0c569ac7b0042c9e270386726cdf5c30e77c4fc8d51 RELEASE.json
6
  33c90e2a82e78e0ee52e7471f1a61c7e7e7b8dc9bdf233cc363702d5bc8147de coreml/ios18-int8-block32-kvbatch-v2/manifest.json
7
  ae3bd7ddce15c24edf212f7b782b916033288acbc6a0a1fd0e0604c6b381000e coreml/ios18-int8-block32-kvbatch-v2/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
8
  7fa1b5c803017953dfcd56552e328b3d4a6ddecd30042b35f6ba8532bb49b822 coreml/ios18-int8-block32-kvbatch-v2/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
 
15
  3a1bb4a40f0d567eb0f38e1f9a4c0427b49d3dac702ef12e518a376836d77f6d coreml/ios18-int8-block32-kvchunk/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
16
  692cbd69d74092a5a6224ebd03a88e05990ae952526c33199b698f470c53b4aa coreml/ios18-int8-block32-kvchunk/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
17
  b7f6cffcf4ab46f9d2be7c2eaa97e543a1fba60de1e55ed60e557ed59502042b coreml/ios18-int8-block32-kvchunk/model.mlpackage/Manifest.json
18
+ c7b9e791bbebe58ebec384c92944803157a12d98af51459be11a61484c39bcc3 coreml/ios18-int8-block32-kvsequence/manifest.json
19
+ 8543b82bd89ef7fbd1fde584f80c63dddb17cb73fa83b5670436087b7a216006 coreml/ios18-int8-block32-kvsequence/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
20
+ 7fa1b5c803017953dfcd56552e328b3d4a6ddecd30042b35f6ba8532bb49b822 coreml/ios18-int8-block32-kvsequence/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
21
+ 136d6f9361388960c0fc4218d3f2e374dd089c0eca0c783c1f008a7c694d1cbb coreml/ios18-int8-block32-kvsequence/model.mlpackage/Manifest.json
22
  50a5524592117ff2c4775792213009e6aeb9f388524746fb8d8eda99fa248276 coreml/ios18-int8-block32/manifest.json
23
  fdad38e89ff548429d3311f13cdc45263aebc67ec89f40ab3527cd449ec038ad coreml/ios18-int8-block32/model.mlpackage/Data/com.apple.CoreML/model.mlmodel
24
  692cbd69d74092a5a6224ebd03a88e05990ae952526c33199b698f470c53b4aa coreml/ios18-int8-block32/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin
coreml/ios18-int8-block32-kvsequence/manifest.json ADDED
@@ -0,0 +1,1043 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "vimeml_coreml_zh_v1_kv_batch_v2",
3
+ "status": "complete",
4
+ "architecture": "tiny_gpt_zh13",
5
+ "release_name": "vimeml-tiny-zh-v1",
6
+ "minimum_ios": 18,
7
+ "bundle": {
8
+ "architecture": "tiny_gpt_zh13",
9
+ "release_name": "vimeml-tiny-zh-v1",
10
+ "checkpoint_sha256": "44c423a1e7cb0e32161afc94d6167cabb439a3d25fd9de6d1fbb150a927542d4",
11
+ "checkpoint_step": 844730,
12
+ "deployment_checkpoint_sha256": "7959fea43926381636ebda4795df6c360e3760bc50f1c3eb59fe8617cdb25d9a",
13
+ "tokenizer_sha256": "68bd37c45bcb018b32b2eef5b241561ab5b6dc1b77c1c3aadcc1b41c4bf47e5a",
14
+ "bundle_manifest_sha256": "9d9dad19c573c84c84e6a78060d1999a0a7e978c90a9bd78ca844da565a6ae74",
15
+ "model": {
16
+ "vocab_size": 12288,
17
+ "context_length": 128,
18
+ "d_model": 384,
19
+ "n_heads": 6,
20
+ "n_layers": 9,
21
+ "d_ff": 960,
22
+ "dropout": 0.0,
23
+ "norm": "rmsnorm",
24
+ "norm_eps": 1e-05,
25
+ "activation": "swiglu",
26
+ "bias": false,
27
+ "tie_embeddings": true,
28
+ "position_embedding": "learned"
29
+ },
30
+ "precision": "fp32",
31
+ "device": "cpu",
32
+ "environment": {
33
+ "python": "3.11.17",
34
+ "platform": "macOS-27.3-arm64-arm-64bit",
35
+ "machine": "arm64",
36
+ "packages": {
37
+ "torch": "2.7.1",
38
+ "numpy": "2.3.5",
39
+ "sentencepiece": "0.2.1",
40
+ "coremltools": "9.0"
41
+ }
42
+ }
43
+ },
44
+ "batch": "flexible 1..16 (RangeDim)",
45
+ "batch_range": [
46
+ 1,
47
+ 16
48
+ ],
49
+ "tokens": "flexible 1..128 (RangeDim)",
50
+ "head": "sequence",
51
+ "cache_shape": [
52
+ 9,
53
+ "B",
54
+ 6,
55
+ "S",
56
+ 64
57
+ ],
58
+ "cache_slots": "S flexible 1..128 (RangeDim)",
59
+ "cache_dtype": "float32",
60
+ "compute_units": "CPU_ONLY",
61
+ "interface": {
62
+ "input_ids": "int32 [B,T]",
63
+ "position": "int32 [B]; row cache length; position[b]+T <= 128",
64
+ "key_cache/value_cache": "float32 (9,B,6,S,64); S >= max(position), S >= 1; row b slots >= position[b] are masked but must be finite (zero new buffers): NaN/Inf there reaches the outputs",
65
+ "targets": "int32 [B,T]; the token that follows input_ids[b,t] (right padding: any id)",
66
+ "target_logprobs": "float32 [B,T]; log P(targets[b,t] | row b through input_ids[b,t]), normalized over all 12,288 logits; ignore padded positions",
67
+ "new_key/new_value": "float32 (9,B,6,T,64); the caller writes them into slots position[b].. of row b"
68
+ },
69
+ "rows": "independent; padding rows (token 0, position 0) do not affect others",
70
+ "prompt": "B=1, T=prompt length, position 0, S=1 (any finite values, e.g. zeros)",
71
+ "graph": "vimeml.deployment.zh_v1_batch2.KVBatchGraphZhV2 (read-only caches, sequence head)",
72
+ "policy": "Caller owns all cache buffers; inputs are never modified.",
73
+ "scoring": "one call per batch of candidates: input = [last shared token] + candidate[:-1], targets = candidate, position = shared length - 1, every row reading the shared cache; sum target_logprobs over the candidate's tokens (zh_v1_batch2.score_continuations)",
74
+ "kind": "int8-b32_fp32_compute",
75
+ "recipe": "int8-b32",
76
+ "source_manifest_sha256": "7dc19a6a24f00bc7083aeb27d1d7581c17d285f3387d0e9767452f23634a5024",
77
+ "fp32_alignment_sha256": "f85f0be08c87c64225dc6bee1bf7144d6885e26150b07361817a298e80a8694d",
78
+ "compression": {
79
+ "method": "linear_symmetric",
80
+ "bits": 8,
81
+ "granularity": "per_block",
82
+ "block_size": 32,
83
+ "weight_threshold": 2048,
84
+ "selection": {
85
+ "policy": "V2 finite linear matrices and named embedding tables only; norms/masks unchanged",
86
+ "selected_constants": [
87
+ {
88
+ "name": "model_token_embedding_weight",
89
+ "shape": [
90
+ 12288,
91
+ 384
92
+ ],
93
+ "elements": 4718592,
94
+ "dtype": "float32",
95
+ "consumers": [
96
+ {
97
+ "name": "op_273",
98
+ "type": "gather",
99
+ "inputs": {
100
+ "x": "model_token_embedding_weight"
101
+ }
102
+ },
103
+ {
104
+ "name": "linear_45",
105
+ "type": "linear",
106
+ "inputs": {
107
+ "weight": "model_token_embedding_weight",
108
+ "bias": "linear_45_bias_0"
109
+ }
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "name": "model_position_embedding_weight",
115
+ "shape": [
116
+ 128,
117
+ 384
118
+ ],
119
+ "elements": 49152,
120
+ "dtype": "float32",
121
+ "consumers": [
122
+ {
123
+ "name": "op_293",
124
+ "type": "gather",
125
+ "inputs": {
126
+ "x": "model_position_embedding_weight"
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "name": "model_blocks_0_attention_qkv_weight",
133
+ "shape": [
134
+ 1152,
135
+ 384
136
+ ],
137
+ "elements": 442368,
138
+ "dtype": "float32",
139
+ "consumers": [
140
+ {
141
+ "name": "linear_0",
142
+ "type": "linear",
143
+ "inputs": {
144
+ "weight": "model_blocks_0_attention_qkv_weight"
145
+ }
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "name": "model_blocks_0_attention_projection_weight",
151
+ "shape": [
152
+ 384,
153
+ 384
154
+ ],
155
+ "elements": 147456,
156
+ "dtype": "float32",
157
+ "consumers": [
158
+ {
159
+ "name": "linear_1",
160
+ "type": "linear",
161
+ "inputs": {
162
+ "weight": "model_blocks_0_attention_projection_weight"
163
+ }
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "name": "model_blocks_0_ffn_gate_weight",
169
+ "shape": [
170
+ 960,
171
+ 384
172
+ ],
173
+ "elements": 368640,
174
+ "dtype": "float32",
175
+ "consumers": [
176
+ {
177
+ "name": "linear_2",
178
+ "type": "linear",
179
+ "inputs": {
180
+ "weight": "model_blocks_0_ffn_gate_weight"
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "name": "model_blocks_0_ffn_up_weight",
187
+ "shape": [
188
+ 960,
189
+ 384
190
+ ],
191
+ "elements": 368640,
192
+ "dtype": "float32",
193
+ "consumers": [
194
+ {
195
+ "name": "linear_3",
196
+ "type": "linear",
197
+ "inputs": {
198
+ "weight": "model_blocks_0_ffn_up_weight"
199
+ }
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ "name": "model_blocks_0_ffn_down_weight",
205
+ "shape": [
206
+ 384,
207
+ 960
208
+ ],
209
+ "elements": 368640,
210
+ "dtype": "float32",
211
+ "consumers": [
212
+ {
213
+ "name": "linear_4",
214
+ "type": "linear",
215
+ "inputs": {
216
+ "weight": "model_blocks_0_ffn_down_weight"
217
+ }
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ "name": "model_blocks_1_attention_qkv_weight",
223
+ "shape": [
224
+ 1152,
225
+ 384
226
+ ],
227
+ "elements": 442368,
228
+ "dtype": "float32",
229
+ "consumers": [
230
+ {
231
+ "name": "linear_5",
232
+ "type": "linear",
233
+ "inputs": {
234
+ "weight": "model_blocks_1_attention_qkv_weight"
235
+ }
236
+ }
237
+ ]
238
+ },
239
+ {
240
+ "name": "model_blocks_1_attention_projection_weight",
241
+ "shape": [
242
+ 384,
243
+ 384
244
+ ],
245
+ "elements": 147456,
246
+ "dtype": "float32",
247
+ "consumers": [
248
+ {
249
+ "name": "linear_6",
250
+ "type": "linear",
251
+ "inputs": {
252
+ "weight": "model_blocks_1_attention_projection_weight"
253
+ }
254
+ }
255
+ ]
256
+ },
257
+ {
258
+ "name": "model_blocks_1_ffn_gate_weight",
259
+ "shape": [
260
+ 960,
261
+ 384
262
+ ],
263
+ "elements": 368640,
264
+ "dtype": "float32",
265
+ "consumers": [
266
+ {
267
+ "name": "linear_7",
268
+ "type": "linear",
269
+ "inputs": {
270
+ "weight": "model_blocks_1_ffn_gate_weight"
271
+ }
272
+ }
273
+ ]
274
+ },
275
+ {
276
+ "name": "model_blocks_1_ffn_up_weight",
277
+ "shape": [
278
+ 960,
279
+ 384
280
+ ],
281
+ "elements": 368640,
282
+ "dtype": "float32",
283
+ "consumers": [
284
+ {
285
+ "name": "linear_8",
286
+ "type": "linear",
287
+ "inputs": {
288
+ "weight": "model_blocks_1_ffn_up_weight"
289
+ }
290
+ }
291
+ ]
292
+ },
293
+ {
294
+ "name": "model_blocks_1_ffn_down_weight",
295
+ "shape": [
296
+ 384,
297
+ 960
298
+ ],
299
+ "elements": 368640,
300
+ "dtype": "float32",
301
+ "consumers": [
302
+ {
303
+ "name": "linear_9",
304
+ "type": "linear",
305
+ "inputs": {
306
+ "weight": "model_blocks_1_ffn_down_weight"
307
+ }
308
+ }
309
+ ]
310
+ },
311
+ {
312
+ "name": "model_blocks_2_attention_qkv_weight",
313
+ "shape": [
314
+ 1152,
315
+ 384
316
+ ],
317
+ "elements": 442368,
318
+ "dtype": "float32",
319
+ "consumers": [
320
+ {
321
+ "name": "linear_10",
322
+ "type": "linear",
323
+ "inputs": {
324
+ "weight": "model_blocks_2_attention_qkv_weight"
325
+ }
326
+ }
327
+ ]
328
+ },
329
+ {
330
+ "name": "model_blocks_2_attention_projection_weight",
331
+ "shape": [
332
+ 384,
333
+ 384
334
+ ],
335
+ "elements": 147456,
336
+ "dtype": "float32",
337
+ "consumers": [
338
+ {
339
+ "name": "linear_11",
340
+ "type": "linear",
341
+ "inputs": {
342
+ "weight": "model_blocks_2_attention_projection_weight"
343
+ }
344
+ }
345
+ ]
346
+ },
347
+ {
348
+ "name": "model_blocks_2_ffn_gate_weight",
349
+ "shape": [
350
+ 960,
351
+ 384
352
+ ],
353
+ "elements": 368640,
354
+ "dtype": "float32",
355
+ "consumers": [
356
+ {
357
+ "name": "linear_12",
358
+ "type": "linear",
359
+ "inputs": {
360
+ "weight": "model_blocks_2_ffn_gate_weight"
361
+ }
362
+ }
363
+ ]
364
+ },
365
+ {
366
+ "name": "model_blocks_2_ffn_up_weight",
367
+ "shape": [
368
+ 960,
369
+ 384
370
+ ],
371
+ "elements": 368640,
372
+ "dtype": "float32",
373
+ "consumers": [
374
+ {
375
+ "name": "linear_13",
376
+ "type": "linear",
377
+ "inputs": {
378
+ "weight": "model_blocks_2_ffn_up_weight"
379
+ }
380
+ }
381
+ ]
382
+ },
383
+ {
384
+ "name": "model_blocks_2_ffn_down_weight",
385
+ "shape": [
386
+ 384,
387
+ 960
388
+ ],
389
+ "elements": 368640,
390
+ "dtype": "float32",
391
+ "consumers": [
392
+ {
393
+ "name": "linear_14",
394
+ "type": "linear",
395
+ "inputs": {
396
+ "weight": "model_blocks_2_ffn_down_weight"
397
+ }
398
+ }
399
+ ]
400
+ },
401
+ {
402
+ "name": "model_blocks_3_attention_qkv_weight",
403
+ "shape": [
404
+ 1152,
405
+ 384
406
+ ],
407
+ "elements": 442368,
408
+ "dtype": "float32",
409
+ "consumers": [
410
+ {
411
+ "name": "linear_15",
412
+ "type": "linear",
413
+ "inputs": {
414
+ "weight": "model_blocks_3_attention_qkv_weight"
415
+ }
416
+ }
417
+ ]
418
+ },
419
+ {
420
+ "name": "model_blocks_3_attention_projection_weight",
421
+ "shape": [
422
+ 384,
423
+ 384
424
+ ],
425
+ "elements": 147456,
426
+ "dtype": "float32",
427
+ "consumers": [
428
+ {
429
+ "name": "linear_16",
430
+ "type": "linear",
431
+ "inputs": {
432
+ "weight": "model_blocks_3_attention_projection_weight"
433
+ }
434
+ }
435
+ ]
436
+ },
437
+ {
438
+ "name": "model_blocks_3_ffn_gate_weight",
439
+ "shape": [
440
+ 960,
441
+ 384
442
+ ],
443
+ "elements": 368640,
444
+ "dtype": "float32",
445
+ "consumers": [
446
+ {
447
+ "name": "linear_17",
448
+ "type": "linear",
449
+ "inputs": {
450
+ "weight": "model_blocks_3_ffn_gate_weight"
451
+ }
452
+ }
453
+ ]
454
+ },
455
+ {
456
+ "name": "model_blocks_3_ffn_up_weight",
457
+ "shape": [
458
+ 960,
459
+ 384
460
+ ],
461
+ "elements": 368640,
462
+ "dtype": "float32",
463
+ "consumers": [
464
+ {
465
+ "name": "linear_18",
466
+ "type": "linear",
467
+ "inputs": {
468
+ "weight": "model_blocks_3_ffn_up_weight"
469
+ }
470
+ }
471
+ ]
472
+ },
473
+ {
474
+ "name": "model_blocks_3_ffn_down_weight",
475
+ "shape": [
476
+ 384,
477
+ 960
478
+ ],
479
+ "elements": 368640,
480
+ "dtype": "float32",
481
+ "consumers": [
482
+ {
483
+ "name": "linear_19",
484
+ "type": "linear",
485
+ "inputs": {
486
+ "weight": "model_blocks_3_ffn_down_weight"
487
+ }
488
+ }
489
+ ]
490
+ },
491
+ {
492
+ "name": "model_blocks_4_attention_qkv_weight",
493
+ "shape": [
494
+ 1152,
495
+ 384
496
+ ],
497
+ "elements": 442368,
498
+ "dtype": "float32",
499
+ "consumers": [
500
+ {
501
+ "name": "linear_20",
502
+ "type": "linear",
503
+ "inputs": {
504
+ "weight": "model_blocks_4_attention_qkv_weight"
505
+ }
506
+ }
507
+ ]
508
+ },
509
+ {
510
+ "name": "model_blocks_4_attention_projection_weight",
511
+ "shape": [
512
+ 384,
513
+ 384
514
+ ],
515
+ "elements": 147456,
516
+ "dtype": "float32",
517
+ "consumers": [
518
+ {
519
+ "name": "linear_21",
520
+ "type": "linear",
521
+ "inputs": {
522
+ "weight": "model_blocks_4_attention_projection_weight"
523
+ }
524
+ }
525
+ ]
526
+ },
527
+ {
528
+ "name": "model_blocks_4_ffn_gate_weight",
529
+ "shape": [
530
+ 960,
531
+ 384
532
+ ],
533
+ "elements": 368640,
534
+ "dtype": "float32",
535
+ "consumers": [
536
+ {
537
+ "name": "linear_22",
538
+ "type": "linear",
539
+ "inputs": {
540
+ "weight": "model_blocks_4_ffn_gate_weight"
541
+ }
542
+ }
543
+ ]
544
+ },
545
+ {
546
+ "name": "model_blocks_4_ffn_up_weight",
547
+ "shape": [
548
+ 960,
549
+ 384
550
+ ],
551
+ "elements": 368640,
552
+ "dtype": "float32",
553
+ "consumers": [
554
+ {
555
+ "name": "linear_23",
556
+ "type": "linear",
557
+ "inputs": {
558
+ "weight": "model_blocks_4_ffn_up_weight"
559
+ }
560
+ }
561
+ ]
562
+ },
563
+ {
564
+ "name": "model_blocks_4_ffn_down_weight",
565
+ "shape": [
566
+ 384,
567
+ 960
568
+ ],
569
+ "elements": 368640,
570
+ "dtype": "float32",
571
+ "consumers": [
572
+ {
573
+ "name": "linear_24",
574
+ "type": "linear",
575
+ "inputs": {
576
+ "weight": "model_blocks_4_ffn_down_weight"
577
+ }
578
+ }
579
+ ]
580
+ },
581
+ {
582
+ "name": "model_blocks_5_attention_qkv_weight",
583
+ "shape": [
584
+ 1152,
585
+ 384
586
+ ],
587
+ "elements": 442368,
588
+ "dtype": "float32",
589
+ "consumers": [
590
+ {
591
+ "name": "linear_25",
592
+ "type": "linear",
593
+ "inputs": {
594
+ "weight": "model_blocks_5_attention_qkv_weight"
595
+ }
596
+ }
597
+ ]
598
+ },
599
+ {
600
+ "name": "model_blocks_5_attention_projection_weight",
601
+ "shape": [
602
+ 384,
603
+ 384
604
+ ],
605
+ "elements": 147456,
606
+ "dtype": "float32",
607
+ "consumers": [
608
+ {
609
+ "name": "linear_26",
610
+ "type": "linear",
611
+ "inputs": {
612
+ "weight": "model_blocks_5_attention_projection_weight"
613
+ }
614
+ }
615
+ ]
616
+ },
617
+ {
618
+ "name": "model_blocks_5_ffn_gate_weight",
619
+ "shape": [
620
+ 960,
621
+ 384
622
+ ],
623
+ "elements": 368640,
624
+ "dtype": "float32",
625
+ "consumers": [
626
+ {
627
+ "name": "linear_27",
628
+ "type": "linear",
629
+ "inputs": {
630
+ "weight": "model_blocks_5_ffn_gate_weight"
631
+ }
632
+ }
633
+ ]
634
+ },
635
+ {
636
+ "name": "model_blocks_5_ffn_up_weight",
637
+ "shape": [
638
+ 960,
639
+ 384
640
+ ],
641
+ "elements": 368640,
642
+ "dtype": "float32",
643
+ "consumers": [
644
+ {
645
+ "name": "linear_28",
646
+ "type": "linear",
647
+ "inputs": {
648
+ "weight": "model_blocks_5_ffn_up_weight"
649
+ }
650
+ }
651
+ ]
652
+ },
653
+ {
654
+ "name": "model_blocks_5_ffn_down_weight",
655
+ "shape": [
656
+ 384,
657
+ 960
658
+ ],
659
+ "elements": 368640,
660
+ "dtype": "float32",
661
+ "consumers": [
662
+ {
663
+ "name": "linear_29",
664
+ "type": "linear",
665
+ "inputs": {
666
+ "weight": "model_blocks_5_ffn_down_weight"
667
+ }
668
+ }
669
+ ]
670
+ },
671
+ {
672
+ "name": "model_blocks_6_attention_qkv_weight",
673
+ "shape": [
674
+ 1152,
675
+ 384
676
+ ],
677
+ "elements": 442368,
678
+ "dtype": "float32",
679
+ "consumers": [
680
+ {
681
+ "name": "linear_30",
682
+ "type": "linear",
683
+ "inputs": {
684
+ "weight": "model_blocks_6_attention_qkv_weight"
685
+ }
686
+ }
687
+ ]
688
+ },
689
+ {
690
+ "name": "model_blocks_6_attention_projection_weight",
691
+ "shape": [
692
+ 384,
693
+ 384
694
+ ],
695
+ "elements": 147456,
696
+ "dtype": "float32",
697
+ "consumers": [
698
+ {
699
+ "name": "linear_31",
700
+ "type": "linear",
701
+ "inputs": {
702
+ "weight": "model_blocks_6_attention_projection_weight"
703
+ }
704
+ }
705
+ ]
706
+ },
707
+ {
708
+ "name": "model_blocks_6_ffn_gate_weight",
709
+ "shape": [
710
+ 960,
711
+ 384
712
+ ],
713
+ "elements": 368640,
714
+ "dtype": "float32",
715
+ "consumers": [
716
+ {
717
+ "name": "linear_32",
718
+ "type": "linear",
719
+ "inputs": {
720
+ "weight": "model_blocks_6_ffn_gate_weight"
721
+ }
722
+ }
723
+ ]
724
+ },
725
+ {
726
+ "name": "model_blocks_6_ffn_up_weight",
727
+ "shape": [
728
+ 960,
729
+ 384
730
+ ],
731
+ "elements": 368640,
732
+ "dtype": "float32",
733
+ "consumers": [
734
+ {
735
+ "name": "linear_33",
736
+ "type": "linear",
737
+ "inputs": {
738
+ "weight": "model_blocks_6_ffn_up_weight"
739
+ }
740
+ }
741
+ ]
742
+ },
743
+ {
744
+ "name": "model_blocks_6_ffn_down_weight",
745
+ "shape": [
746
+ 384,
747
+ 960
748
+ ],
749
+ "elements": 368640,
750
+ "dtype": "float32",
751
+ "consumers": [
752
+ {
753
+ "name": "linear_34",
754
+ "type": "linear",
755
+ "inputs": {
756
+ "weight": "model_blocks_6_ffn_down_weight"
757
+ }
758
+ }
759
+ ]
760
+ },
761
+ {
762
+ "name": "model_blocks_7_attention_qkv_weight",
763
+ "shape": [
764
+ 1152,
765
+ 384
766
+ ],
767
+ "elements": 442368,
768
+ "dtype": "float32",
769
+ "consumers": [
770
+ {
771
+ "name": "linear_35",
772
+ "type": "linear",
773
+ "inputs": {
774
+ "weight": "model_blocks_7_attention_qkv_weight"
775
+ }
776
+ }
777
+ ]
778
+ },
779
+ {
780
+ "name": "model_blocks_7_attention_projection_weight",
781
+ "shape": [
782
+ 384,
783
+ 384
784
+ ],
785
+ "elements": 147456,
786
+ "dtype": "float32",
787
+ "consumers": [
788
+ {
789
+ "name": "linear_36",
790
+ "type": "linear",
791
+ "inputs": {
792
+ "weight": "model_blocks_7_attention_projection_weight"
793
+ }
794
+ }
795
+ ]
796
+ },
797
+ {
798
+ "name": "model_blocks_7_ffn_gate_weight",
799
+ "shape": [
800
+ 960,
801
+ 384
802
+ ],
803
+ "elements": 368640,
804
+ "dtype": "float32",
805
+ "consumers": [
806
+ {
807
+ "name": "linear_37",
808
+ "type": "linear",
809
+ "inputs": {
810
+ "weight": "model_blocks_7_ffn_gate_weight"
811
+ }
812
+ }
813
+ ]
814
+ },
815
+ {
816
+ "name": "model_blocks_7_ffn_up_weight",
817
+ "shape": [
818
+ 960,
819
+ 384
820
+ ],
821
+ "elements": 368640,
822
+ "dtype": "float32",
823
+ "consumers": [
824
+ {
825
+ "name": "linear_38",
826
+ "type": "linear",
827
+ "inputs": {
828
+ "weight": "model_blocks_7_ffn_up_weight"
829
+ }
830
+ }
831
+ ]
832
+ },
833
+ {
834
+ "name": "model_blocks_7_ffn_down_weight",
835
+ "shape": [
836
+ 384,
837
+ 960
838
+ ],
839
+ "elements": 368640,
840
+ "dtype": "float32",
841
+ "consumers": [
842
+ {
843
+ "name": "linear_39",
844
+ "type": "linear",
845
+ "inputs": {
846
+ "weight": "model_blocks_7_ffn_down_weight"
847
+ }
848
+ }
849
+ ]
850
+ },
851
+ {
852
+ "name": "model_blocks_8_attention_qkv_weight",
853
+ "shape": [
854
+ 1152,
855
+ 384
856
+ ],
857
+ "elements": 442368,
858
+ "dtype": "float32",
859
+ "consumers": [
860
+ {
861
+ "name": "linear_40",
862
+ "type": "linear",
863
+ "inputs": {
864
+ "weight": "model_blocks_8_attention_qkv_weight"
865
+ }
866
+ }
867
+ ]
868
+ },
869
+ {
870
+ "name": "model_blocks_8_attention_projection_weight",
871
+ "shape": [
872
+ 384,
873
+ 384
874
+ ],
875
+ "elements": 147456,
876
+ "dtype": "float32",
877
+ "consumers": [
878
+ {
879
+ "name": "linear_41",
880
+ "type": "linear",
881
+ "inputs": {
882
+ "weight": "model_blocks_8_attention_projection_weight"
883
+ }
884
+ }
885
+ ]
886
+ },
887
+ {
888
+ "name": "model_blocks_8_ffn_gate_weight",
889
+ "shape": [
890
+ 960,
891
+ 384
892
+ ],
893
+ "elements": 368640,
894
+ "dtype": "float32",
895
+ "consumers": [
896
+ {
897
+ "name": "linear_42",
898
+ "type": "linear",
899
+ "inputs": {
900
+ "weight": "model_blocks_8_ffn_gate_weight"
901
+ }
902
+ }
903
+ ]
904
+ },
905
+ {
906
+ "name": "model_blocks_8_ffn_up_weight",
907
+ "shape": [
908
+ 960,
909
+ 384
910
+ ],
911
+ "elements": 368640,
912
+ "dtype": "float32",
913
+ "consumers": [
914
+ {
915
+ "name": "linear_43",
916
+ "type": "linear",
917
+ "inputs": {
918
+ "weight": "model_blocks_8_ffn_up_weight"
919
+ }
920
+ }
921
+ ]
922
+ },
923
+ {
924
+ "name": "model_blocks_8_ffn_down_weight",
925
+ "shape": [
926
+ 384,
927
+ 960
928
+ ],
929
+ "elements": 368640,
930
+ "dtype": "float32",
931
+ "consumers": [
932
+ {
933
+ "name": "linear_44",
934
+ "type": "linear",
935
+ "inputs": {
936
+ "weight": "model_blocks_8_ffn_down_weight"
937
+ }
938
+ }
939
+ ]
940
+ }
941
+ ],
942
+ "excluded_constants": [
943
+ {
944
+ "name": "linear_45_bias_0",
945
+ "shape": [
946
+ 12288
947
+ ],
948
+ "elements": 12288,
949
+ "dtype": "float32",
950
+ "consumers": [
951
+ {
952
+ "name": "linear_45",
953
+ "type": "linear",
954
+ "inputs": {
955
+ "weight": "model_token_embedding_weight",
956
+ "bias": "linear_45_bias_0"
957
+ }
958
+ }
959
+ ],
960
+ "reason": "Structural constant, mask or non-matrix; left unchanged",
961
+ "nonfinite_elements": 0
962
+ }
963
+ ],
964
+ "selected_elements": 20029440
965
+ }
966
+ },
967
+ "precision_policy": "INT8 block32 parameter matrices, FP32 compute; norms unchanged; no activation quantization.",
968
+ "conversion_source_sha256": "ba9d8802d1387663edf293b407a030f291db9959a0ce40427b205d86e8107956",
969
+ "environment": {
970
+ "python": "3.11.17",
971
+ "platform": "macOS-27.3-arm64-arm-64bit",
972
+ "machine": "arm64",
973
+ "packages": {
974
+ "torch": "2.7.1",
975
+ "numpy": "2.3.5",
976
+ "sentencepiece": "0.2.1",
977
+ "coremltools": "9.0"
978
+ }
979
+ },
980
+ "spec": {
981
+ "specification_version": 9,
982
+ "operations": {
983
+ "constexpr_blockwise_shift_scale": 47,
984
+ "const": 473,
985
+ "shape": 2,
986
+ "gather": 5,
987
+ "range_1d": 2,
988
+ "greater_equal": 5,
989
+ "add": 79,
990
+ "select": 4,
991
+ "expand_dims": 9,
992
+ "cast": 2,
993
+ "mul": 67,
994
+ "greater": 1,
995
+ "pow": 19,
996
+ "reduce_mean": 19,
997
+ "rsqrt": 19,
998
+ "linear": 46,
999
+ "concat": 2,
1000
+ "reshape": 18,
1001
+ "transpose": 18,
1002
+ "split": 9,
1003
+ "squeeze": 28,
1004
+ "slice_by_index": 18,
1005
+ "matmul": 36,
1006
+ "reduce_max": 18,
1007
+ "maximum": 9,
1008
+ "sub": 19,
1009
+ "exp": 18,
1010
+ "reduce_sum": 18,
1011
+ "real_div": 9,
1012
+ "silu": 9,
1013
+ "gather_along_axis": 1,
1014
+ "reduce_log_sum_exp": 1,
1015
+ "stack": 2
1016
+ },
1017
+ "inputs": [
1018
+ "input_ids",
1019
+ "position",
1020
+ "key_cache",
1021
+ "value_cache",
1022
+ "targets"
1023
+ ],
1024
+ "outputs": [
1025
+ "target_logprobs",
1026
+ "new_key",
1027
+ "new_value"
1028
+ ]
1029
+ },
1030
+ "package_files": {
1031
+ "Data/com.apple.CoreML/model.mlmodel": {
1032
+ "bytes": 143388
1033
+ },
1034
+ "Data/com.apple.CoreML/weights/weight.bin": {
1035
+ "bytes": 22628992
1036
+ },
1037
+ "Manifest.json": {
1038
+ "bytes": 617
1039
+ }
1040
+ },
1041
+ "package_bytes": 22772997,
1042
+ "note": "Logical package bytes; compiled size, resident memory and device footprint are separate."
1043
+ }
coreml/ios18-int8-block32-kvsequence/model.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8543b82bd89ef7fbd1fde584f80c63dddb17cb73fa83b5670436087b7a216006
3
+ size 143388
coreml/ios18-int8-block32-kvsequence/model.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7fa1b5c803017953dfcd56552e328b3d4a6ddecd30042b35f6ba8532bb49b822
3
+ size 22628992
coreml/ios18-int8-block32-kvsequence/model.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "1480226B-C8CD-4891-99B5-CF590CE1EBD5": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "C2C77742-4FFE-407F-870B-A219D0C65DBE": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "1480226B-C8CD-4891-99B5-CF590CE1EBD5"
18
+ }