mlboydaisuke commited on
Commit
7793533
·
verified ·
1 Parent(s): 7e209d7

Kev-0.8B on Core AI: fp16 S=16 hidden-state decoder (.aimodel) with the pointer head, tokenizer, card, config, adapter_config, LICENSE and SHA256SUMS

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
37
+ gpu-pipelined/kev_0_8b_decode_fp16_pf16/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Alibaba Cloud
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: jaredpalmer/kev-0.8b
4
+ base_model_relation: quantized
5
+ pipeline_tag: text-classification
6
+ library_name: coreai
7
+ language:
8
+ - en
9
+ tags:
10
+ - coreai
11
+ - core-ai
12
+ - apple
13
+ - on-device
14
+ - iphone
15
+ - decision-model
16
+ - systemone
17
+ - typed-decisions
18
+ - structured-output
19
+ ---
20
+
21
+ # Kev-0.8B — Core AI
22
+
23
+ Apple Core AI (`.aimodel`) conversion of [jaredpalmer/kev-0.8b](https://huggingface.co/jaredpalmer/kev-0.8b/tree/bf75a6a8848ea6960ff2ed108d9ed44c2941174f) (tag `v1.0`, Apache-2.0): a state and typed questions in, the probability of every option of every question out.
24
+
25
+ | Variant | Path | Size | Requires | Tested on |
26
+ |---|---|---:|---|---|
27
+ | Decoder, fp16, with the host's pointer head | `gpu-pipelined/kev_0_8b_decode_fp16_pf16/` | 1,521 MB | macOS 27 / iOS 27 | M4 Max, macOS 27.0 (26A428), 2026-10-03; iPhone 18 Pro, iOS 27.0 (24A437), 2026-10-04 |
28
+
29
+ One question of 94 tokens takes 112 ms on the M4 Max and 157 ms on the iPhone 18 Pro, in Swift ([measured below](#time-per-decision-on-the-mac)).
30
+
31
+ ```swift
32
+ import Kev
33
+
34
+ let bundle = URL(filePath: "Kev-0.8B-CoreAI/gpu-pipelined/kev_0_8b_decode_fp16_pf16")
35
+ let kev = try await KevDecider(bundle: bundle) // asset: nil = the .aimodel, specialized here (GPU, frequent reshapes)
36
+ let response = try await kev.decide(requestJSON: requestData, shared: true) // shared: the state's chunks run once
37
+ print(PythonFormat.dumps(response, asciiOnly: false))
38
+ ```
39
+
40
+ The snippet uses the [`Kev`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/Kev) Swift package from the model zoo. The zoo card and the gate scripts live in [coreai-model-zoo](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/README.md); the rest of this page is the same text with repository links.
41
+
42
+ Source [jaredpalmer/kev-0.8b](https://huggingface.co/jaredpalmer/kev-0.8b/tree/bf75a6a8848ea6960ff2ed108d9ed44c2941174f) (tag `v1.0`, commit `bf75a6a`) · base [Qwen/Qwen3.5-0.8B-Base](https://huggingface.co/Qwen/Qwen3.5-0.8B-Base/tree/dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68) (revision `dc7cdfe`)
43
+
44
+ A **decision model**. Give it a state (text, or a JSON object or array) and typed questions: `noul`
45
+ (yes / no), `choice` (named options) or `score` (ordered levels). It returns a probability for every
46
+ option of every question. It never generates text. Requests and responses use the SystemOne-compatible
47
+ request shape: `{model, state, questions}` in, `{model, answers, usage}` out, one typed decision per
48
+ question.
49
+
50
+ Jared Palmer trained it as a rank-16 LoRA adapter and a pointer head on Qwen3.5-0.8B-Base (24 layers:
51
+ 18 Gated DeltaNet and 6 full attention, hidden size 1,024). The author's card: "It reads one document
52
+ (the *state*) and a set of typed questions about it, and returns a calibrated probability distribution
53
+ over the options supplied with each question, in a single forward pass and without generating text."
54
+ Each question is its own row: the state, then the question and its options. The head scores each
55
+ option's closing token against the question's last token. The author's card reports benchmark
56
+ results; none of them are re-measured here.
57
+
58
+ This port merges the adapter into the base with the author's own merge script and exports the text
59
+ backbone as one Core AI graph. The graph takes token ids, 16 per call, and returns the final-norm
60
+ hidden state at every position; it has no vocabulary head. Weights are fp16 (1.51 GB). The host runs
61
+ the pointer head from the author's head weights. The gate is probability parity with the author's own
62
+ fp32 code, on every option of every question, on a fixture of 434 questions and on a held-out set of
63
+ 130.
64
+
65
+ It runs on the Mac GPU and on an iPhone 18 Pro. On the phone the shipped `.aimodel` is specialized on
66
+ the device; an AOT asset compiled for the phone's GPU (not shipped) was measured too.
67
+
68
+ ## Readout contract
69
+
70
+ One row per question, every row from zeroed states. The ids are the author's `kev.model.encode` in its
71
+ row form (`rows_of`), with the base model's tokenizer:
72
+
73
+ ```
74
+ [<|fim_prefix|>] + render(state) + [<|fim_middle|>] + render(instructions)
75
+ + for each option: [<|box_start|>] + option_text + [<|box_end|>]
76
+ + [<|fim_suffix|>]
77
+ ```
78
+
79
+ - Delimiters, from the base tokenizer: `<|fim_prefix|>` 248060 (state), `<|fim_middle|>` 248061
80
+ (question), `<|box_start|>` 248049 / `<|box_end|>` 248050 (an option), `<|fim_suffix|>` 248062
81
+ (decide). Pad = eos = `<|endoftext|>` 248044; no bos. The `kev-4b` repository still carries Qwen3-era
82
+ `added_tokens.json` with other ids; the author's loader reads the tokenizer from the base, and so
83
+ does this port.
84
+ - User text is tokenized without special tokens after `<|name|>` is rewritten to `<¦name¦>`
85
+ (`user_tokens`), so a request can never produce a delimiter.
86
+ - `render()` (`kev.api.to_record`): a string as is; an object or an array as `key: value` lines (`- `
87
+ for array items, nesting indented by two spaces), values as Python's `str()`. Options: `noul` =
88
+ `no[: <criteria.false>]`, `yes[: <criteria.true>]`, in that order; `choice` = `name` or
89
+ `name: <description>` in criteria order; `score` = the levels in order. Keys: `choice` = the criteria
90
+ names, `noul` = `false`, `true`, `score` = `"0"`..`"n-1"`.
91
+ - The head reads the hidden state at `<|fim_suffix|>` (the row's last token) and at every
92
+ `<|box_end|>`: `z_k = ((W_k h_opt_k + b_k) · (W_q h_decide + b_q)) / 16`, `p = softmax(z / T)` within
93
+ the question, T = 2.3510958125672174 (the author's calibration, stored in `head.pt`). `W_q`, `W_k`
94
+ are `[256, 1024]` with biases, fp32.
95
+ - Response (`kev.api.to_answers`): `noul` → p(true); `choice` → the argmax key, a confidence
96
+ `(p_max − 1/K) / (1 − 1/K)` and every p; `score` → Σ level · p, the legend, every p and a confidence
97
+ `max(0, 1 − E|level − mode| / D)`; values rounded to 4 decimals. `usage` = `{input_tokens,
98
+ output_tokens}` with the author's counting (the packed request; the tokens of `json.dumps(answers)`).
99
+ - Length: a row holds at most **4,080 tokens** (the last padded call must end below the graph's 4,095
100
+ position bound). The author's server accepts states of 65,536 tokens; here a longer row is refused
101
+ before any call.
102
+ - Shared prefix (optional, exact): every row of a request starts with the same state tokens, so the
103
+ first ⌊Ls / 16⌋ chunks can run once, the four states be copied per question, and each row continue
104
+ from there. Every row's hidden state equals its direct run bit for bit (below).
105
+
106
+ `conversion/kev/oracle_kev.py` runs the author's package unchanged (`Checkpoint.load("cpu", fp32)`,
107
+ `kev.model.admit`, the row-form `forward`, one CPU thread) and records the reference:
108
+ [`fixtures-kev-0.8b.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/fixtures-kev-0.8b.json). The fixture is 384 records and 434 questions:
109
+ the first 60 lines of the author's transfer-v4 development file (`evals/v4/transfer-v4/development.jsonl`,
110
+ tag `kev-1.0`; MMLU, 4 options), the first 20 records of each of its seven other sources (140, `choice`
111
+ and `noul`), its first 20 `score` records, the 144 `choice` items of SemIf authored144, and 20 records
112
+ written for the port (70 questions: `noul`, `choice` with 2–10 options, `score` with 2–7 levels,
113
+ JSON states, three states of 1,431–1,746 tokens, one record of 8 questions). The longest row is 1,802
114
+ tokens. Fourteen questions have an oracle top-2 margin of 0.02 or less (near-ties) and are listed apart.
115
+ The held-out set is the next 130 transfer-v4 records (mmlu 61–100, records 21–30 of each other source,
116
+ `score` records 21–40), with its own oracle run.
117
+
118
+ ## Core AI shape
119
+
120
+ `conversion/kev/qwen3_5_kev_decoder.py`: the overlay's stateful Qwen3.5 text decoder
121
+ (`Qwen3_5StatefulForCausalLM`) on the merged weights, the vocabulary head replaced by the identity, the
122
+ output the final-norm hidden state at every position. One function, `main`, at a static 16 tokens; the
123
+ Gated DeltaNet recurrence is unrolled in the graph.
124
+
125
+ | | name | shape, type |
126
+ |---|---|---|
127
+ | inputs | `input_ids` | [1, 16] int32 |
128
+ | | `position_ids` | [1, seq] int32, the ramp 0 .. seq − 1 |
129
+ | states | `keyCache`, `valueCache` | [6, 1, 2, ctx, 256] fp16, ctx up to 4,096 |
130
+ | | `convState`, `recState` | [18, 1, 6144, 3], [18, 1, 16, 128, 128] fp16 |
131
+ | output | `hidden` | [1, 16, 1024] fp16, every position |
132
+
133
+ Per row of T ids, from zeroed states: ⌈T / 16⌉ calls, call k with ids[16k : 16k + 16] and position_ids
134
+ 0..16k + 15; the last call is padded with `<|endoftext|>` (248044) and its padded rows are dropped. The
135
+ rows of every call, cut to T, are the backbone's final-norm `last_hidden_state [T, 1024]`. The bundle's
136
+ `metadata.json` says `kind: decision-backbone` and carries this order, the row layout, the delimiter ids,
137
+ the render rules, the head formula and the response shape.
138
+
139
+ **Host.** Builds the rows, runs the calls, converts the hidden rows at the readout positions to float64,
140
+ applies the head (`head/head.safetensors`, `head/kev_head.json`) and the per-question softmax in float64,
141
+ rounds p to fp32 once, and writes the response. `conversion/kev/decide.py` is the Python reference;
142
+ [`apps/Kev`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/Kev) is the Swift one.
143
+
144
+ No engine is involved: the hosts drive the low-level runtime (`AIModel` + `loadFunction`, four zeroed
145
+ states per row). No runtime patch.
146
+
147
+ ## Measured (Apple M4 Max, macOS 27.0 26A428, 2026-10-03 – 10-04)
148
+
149
+ The bar, fixed before any graph ran: the argmax equal to the oracle's on every question whose oracle
150
+ top-2 margin is above 0.02 (near-ties listed apart), max |Δp| ≤ 0.02 over every option of every
151
+ question, the mean over rows of each row's mean |Δp| ≤ 0.002, and every process re-running its first row
152
+ bit for bit. The Python gates load the AOT `.aimodelc` (`coreai-build compile … --platform macOS
153
+ --preferred-compute gpu --architecture h16c --expect-frequent-reshapes`) with
154
+ `SpecializationOptions.default()`; their times are on a GPU shared with other work.
155
+
156
+ ### Before any graph: the merge and fp32 torch
157
+
158
+ - The merged checkpoint (`scripts/merge_lora_checkpoint.py`, tag `kev-1.0`; fp32, 320 tensors, 186 of
159
+ them adapted, `model.safetensors` sha256 `b5ebf92a…`) answers through the author's own loader as the
160
+ adapter checkpoint does: 434/434 questions, logits bit-equal. `W + (B @ A) × 2` reproduces three
161
+ merged tensors bit for bit (the adapter moves them by 2.8–3.6 %). The base alone moves p by up to
162
+ 0.789 (argmax 25/53), the base's Gated DeltaNet projections put back by up to 0.282 (46/53): the
163
+ check can fail ([`gate-kev-0.8b-merge.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-merge.json)).
164
+ - The decoder module in fp32 on the CPU, driven like the graph, read through the author's head: 434/434
165
+ argmax (the 14 near-ties included), max |Δp| 3.5e-6, lowest per-position hidden cosine 0.99999999999
166
+ on the 21 rows the oracle keeps. It equals the overlay's plain text decoder bit for bit (3 rows), and
167
+ S = 32, 64 and 128 give the bits of S = 16
168
+ ([`gate-kev-0.8b-torch-parity.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-torch-parity.json)).
169
+
170
+ ### The graph alone on the Mac GPU
171
+
172
+ The oracle's ids in, the fp16 hidden rows read through the author's fp32 head:
173
+
174
+ | set | questions | argmax (margin > 0.02) | near-ties agreeing | max \|Δp\| | mean of row means | bar |
175
+ |---|---:|---:|---:|---:|---:|---|
176
+ | **fixture** | 434 | **420/420** | **12/14** | **0.0117** | **0.00097** | **PASS** |
177
+ | held out | 130 | 125/125 | 5/5 | 0.0057 | 0.00081 | PASS |
178
+
179
+ The two near-ties that flip are `tv4_023` (oracle margin 0.0020) and a SemIf item (0.0032), each by at
180
+ most 0.0027. The worst row is a SemIf item (0.0117). Every value is finite and every process's re-run is
181
+ bit-equal. Two red arms move p on the same graph: a state swapped for another record's moves 4 of 5
182
+ argmaxes (max |Δp| 0.905); a grammatical "not" in five yes / no questions moves 2 of 5 (0.759); fp32
183
+ torch moves the same rows by the same amounts. Transcripts:
184
+ [`gate-kev-0.8b-readout-fp16_pf16.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-readout-fp16_pf16.json),
185
+ [`gate-kev-0.8b-heldout.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-heldout.json).
186
+
187
+ ### From the request: Python and Swift
188
+
189
+ - `conversion/kev/host.py`, without the author's package, rebuilds every oracle row from the raw
190
+ request (ids, `<|fim_suffix|>` / `<|box_end|>` indices, keys): 564/564 rows with two tokenizer
191
+ implementations; fed the oracle's p, its response bodies equal the author's on every record but
192
+ `latency_ms`. `decide.py` on the AOT graph: hidden rows bit-equal to the gate's on 564/564 rows; the
193
+ shared prefix equal to the direct run on every row, the 20 multi-question records taking 662 calls
194
+ instead of 1,830 ([`gate-kev-0.8b-host.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-host.json)).
195
+ - The Swift host ([`apps/Kev`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/Kev), Release): ids from the raw request 564/564; on the same
196
+ AOT asset every row's hidden state, every p and every answer set's `json.dumps` equal the Python
197
+ reference's bit for bit and byte for byte, and the bar is the gate's (fixture 0.0117 / 0.00097, held
198
+ out 0.0057 / 0.00081). Its text half equals CPython on 2,787 rendered values, 599 requests (21 refused
199
+ with the same messages), 203,635 doubles (`str`, `repr`, `round`) and 1,093 `json.dumps` texts. One
200
+ word changed in one question turns its record red.
201
+ - JIT: the `.aimodel` specialized by the Swift runtime (GPU preferred, `expectFrequentReshapes`) equals
202
+ the AOT asset bit for bit on 25 rows of 10 records; the specialization took 5.4 s and added
203
+ 2,510,934,016 bytes to the runtime's cache.
204
+ - Rows near the limit (a diagnosis, not a gate set): rows of 4,072, 4,030, 3,039 and 2,997 tokens built
205
+ from the fixture's long states keep every argmax, max |Δp| 0.0023, and the hidden state's cosine to
206
+ the oracle's is at least 0.99994 at every position
207
+ ([`gate-kev-0.8b-swift.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-swift.json)).
208
+
209
+ ### iPhone 18 Pro (iOS 27.0 24A437, Core AI arch h19p, 2026-10-04)
210
+
211
+ Through [`apps/KevGate`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/KevGate), a headless gate app on the Swift host, Release, without the
212
+ increased-memory-limit entitlement (3,529 MB available at launch). The phone was on USB power, the
213
+ battery at 80 % and charging; every bench item started at thermal state nominal. Every p the app wrote
214
+ was re-scored on the Mac from its bit patterns.
215
+
216
+ | load | cache | wall s | `AIModel` s | `main` s | runtime cache added | peak footprint |
217
+ |---|---|---:|---:|---:|---:|---:|
218
+ | `.aimodel` specialized on the phone (GPU preferred, `expectFrequentReshapes`) | cold | 6.65 | 5.87 | 0.42 | 2,505,661,047 B | 316 MB |
219
+ | the same | warm | 0.61 | 0.00 | 0.25 | 0 | 216 MB |
220
+ | h19p AOT asset (2,505,674,625 B), `.default` | cold | 4.64 | 3.07 | 1.22 | 2,505,681,950 B | 223 MB |
221
+
222
+ | set | asset | questions | argmax (margin > 0.02) | near-ties agreeing | max \|Δp\| | mean | bar |
223
+ |---|---|---:|---:|---:|---:|---:|---|
224
+ | fixture | specialized on the phone | 434 | 420/420 | 13/14 | 0.0102 | 0.00098 | PASS |
225
+ | held out | specialized on the phone | 130 | 125/125 | 5/5 | 0.0049 | 0.00083 | PASS |
226
+ | fixture 60 + held out 30 | h19p AOT | 90 | 80/80 | 10/10 | 0.0071 | 0.00078 | PASS |
227
+
228
+ On the phone the AOT asset and the device specialization agree bit for bit (90/90 rows). No hidden row
229
+ is bit-equal to the Mac's (M4 Max, AOT h16c): their p differ by at most 0.0027, and one near-tie
230
+ (`tv4_023`, oracle margin 0.0020) lands on the oracle's side on the phone and not on the Mac. The shared prefix equals the direct run on
231
+ all 20 multi-question records. The first decision after the cold specialization took 3.58 s; in the bench
232
+ below a 16-token call's median was 25.9–26.6 ms on every item, whatever the row length.
233
+
234
+ Bench (60 s of rest before each item, one warm-up, then the decisions back to back; `latency_ms` = state
235
+ resets, graph calls and the head):
236
+
237
+ | request | tokens | calls | median ms (specialized on the phone) | runs | h19p AOT median ms |
238
+ |---|---:|---:|---:|---|---:|
239
+ | one question (`tv4_000`) | 94 | 6 | 156.6 | 5: 156.3–157.3 | 157.2 |
240
+ | one question (`own_j03` q0) | 380 | 24 | 629.2 | 5: 628.9–630.1 | 627.8 |
241
+ | one question (`own_L02` q0) | 1,518 | 95 | 2,500.0 | 5: 2,499.4–2,502.5 | — |
242
+ | one question (`own_L01` q2) | 1,802 | 113 | 2,975.9 | 5: 2,974.1–2,981.4 | — |
243
+ | 5 questions, 137-token state (`own_m01`), direct | 240 | 51 | 1,330.5 | 5: 1,329.1–1,333.5 | — |
244
+ | the same, shared prefix | 240 | 19 | 507.8 | 5: 507.1–508.8 | 508.2 |
245
+ | 8 questions (`own_m01`), direct | 320 | 83 | 2,167.5 | 3: 2,163.8–2,182.6 | — |
246
+ | the same, shared prefix | 320 | 27 | 722.4 | 3: 721.2–732.9 | — |
247
+ | 4 questions, 1,477-token state (`own_L02`), direct | 1,622 | 380 | 10,026.3 | 2: 10,018.3–10,034.3 | — |
248
+ | the same, shared prefix | 1,622 | 104 | 2,761.9 | 2: 2,752.4–2,771.5 | — |
249
+
250
+ The last item ran 38 s back to back and ended at thermal state fair. Kev-4B on the phone: see the
251
+ [Kev-4B card](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-4b/README.md). Transcript: [`gate-kev-0.8b-iphone.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-iphone.json).
252
+
253
+ ### Time per decision on the Mac
254
+
255
+ Swift, Release CLI, AOT asset, in one machine-wide GPU lock window (2026-10-04 00:11–00:33 JST) with no
256
+ other GPU job and a CPU load of 4–10. A B A B: two processes, one warm-up, the median over 20 decisions
257
+ (p10–p90):
258
+
259
+ | request | tokens | calls | ms | p10–p90 |
260
+ |---|---:|---:|---:|---|
261
+ | one question (`tv4_000`) | 94 | 6 | 112.1 | 103.2–166.5 |
262
+ | one question (`own_j03` q0) | 380 | 24 | 472.0 | 413.9–583.1 |
263
+ | one question (`own_L02` q0) | 1,518 | 95 | 1,595.4 | 1,567.5–1,660.8 |
264
+ | one question (`own_L01` q2) | 1,802 | 113 | 1,915.0 | 1,875.8–2,117.4 |
265
+ | 5 questions (`own_m01`), direct / shared prefix | 240 | 51 / 19 | 879.9 / 342.3 | 835.3–917.1 / 323.0–345.4 |
266
+ | 8 questions (`own_m01`), direct / shared prefix | 320 | 83 / 27 | 1,454.7 / 484.5 | 1,384.9–1,555.2 / 454.9–496.6 |
267
+ | 4 questions (`own_L02`), direct / shared prefix | 1,622 | 380 / 104 | 6,415.3 / 1,785.0 | 6,266.8–6,733.8 / 1,733.2–1,884.7 |
268
+
269
+ A 16-token call took 18.6 and 17.2 ms (the two processes' medians). Loading the AOT asset with the
270
+ runtime's cache warm: 0.61 / 0.27 s at each process's first load, 0.43 / 0.24 s at its second. The Python
271
+ reference in the same window: 104.0 ms for `tv4_000` and 347.5 ms for five questions with the shared
272
+ prefix. Transcript: [`gate-kev-0.8b-timing-mac.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-timing-mac.json).
273
+
274
+ ## Precision
275
+
276
+ **int8 was measured and is not shipped.** int8 per block of 32 over every decoder linear
277
+ (`symmetric_with_clipping`, weights only; the embedding table, the Gated DeltaNet conv1d and every norm
278
+ fp16) fails the bar:
279
+
280
+ | decoder | `main.mlirb` bytes | fixture max \|Δp\| / mean | held out max \|Δp\| / mean | bar |
281
+ |---|---:|---:|---:|---|
282
+ | fp16 (shipped) | 1,506,481,909 | 0.0117 / 0.00097 | 0.0057 / 0.00081 | PASS |
283
+ | int8lin: every linear int8 | 1,040,063,350 | 0.0431 / 0.00326 | 0.0273 / 0.00294 | FAIL |
284
+ | int8mix: int8 except layers 0–11 | 1,273,276,920 | 0.0089 / 0.00103 | 0.0043 / 0.00082 | PASS |
285
+
286
+ int8lin breaks the bar on 10 fixture rows (above 0.01: 51 rows; fp16: 1). An fp32 torch bisect with the
287
+ exporter's own int8 weights (`conversion/kev/int8_bisect_torch.py`, 60 rows) reproduces it (0.0420
288
+ against the graph's 0.0431). Its rule, written before any result, asked for the worst row below 0.010
289
+ with at most half of the linear weights kept fp16; no set met it (the best: four kinds of linear kept
290
+ fp16, 45.5 % of the weights, 0.0141). Layers 0–11 kept fp16, exactly half and outside the rule's search,
291
+ give 0.0046 on the bisect rows; that is int8mix. It keeps 85 % of fp16's bytes, and it was chosen on the
292
+ fixture, so it does not ship ([`gate-kev-0.8b-int8.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-int8.json)).
293
+
294
+ **What the compiled asset holds.** `--expect-frequent-reshapes`, which this dynamic-length graph needs to
295
+ run without re-specializing, adds an fp16 copy of every linear weight to the compiled asset: the iPhone
296
+ h19p asset is 2,505,674,625 bytes with it and 1,506,400,620 without. On a toy (an embedding and two
297
+ linears) compiled with a fixed input length, the int8 version's `resources.bin` is 12,582,936 bytes on
298
+ macOS and iOS, with and without the flag, the bytes of the fp16 toy compiled without it, against an int8
299
+ `main.mlirb` of 10,623,080 bytes. An int8 `.aimodel` downloads smaller; the compiled asset is not
300
+ smaller by the same amount
301
+ ([`../kev-4b/gate-kev-4b-int8.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-4b/gate-kev-4b-int8.json)).
302
+
303
+ **Chunk width.** S = 16, 32, 64 and 128 all pass the bar (max |Δp| 0.0117, 0.0118, 0.0100, and 0.0060 on
304
+ 130 rows). A call's time grows with S: the Gated DeltaNet layers run their S steps one after another
305
+ inside the call. In one interleaved run over the fixture's 423 warm rows, S = 16 took 72.8 s of graph
306
+ calls and S = 32 74.4 s, and S = 16 pads 5.1 % of the fixture against 10.4 %. S = 16 ships
307
+ ([`gate-kev-0.8b-readout-s.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/gate-kev-0.8b-readout-s.json)).
308
+
309
+ ## ⬇️ Bundle
310
+
311
+ [mlboydaisuke/Kev-0.8B-CoreAI](https://huggingface.co/mlboydaisuke/Kev-0.8B-CoreAI), one folder under
312
+ `gpu-pipelined/`:
313
+
314
+ | file | what | bytes | sha256 |
315
+ |---|---|---:|---|
316
+ | `kev_0_8b_decode_fp16_pf16.aimodel/main.mlirb` | the decoder, fp16 | 1,506,481,909 | `4131d028…72682d` |
317
+ | `metadata.json` | `kind: decision-backbone`, the readout contract, the gate | 15,236 | `97b70e43…22b65b2` |
318
+ | `tokenizer/tokenizer.json` | the base model's, verbatim | 12,807,196 | `fe000e3e…d50d2927` |
319
+ | `tokenizer/tokenizer_config.json` | the base model's, verbatim | 16,712 | `e611fbcc…c47885de` |
320
+ | `head/head.safetensors` | the pointer head: q / k weight `[256, 1024]` and bias, fp32 | 2,099,576 | `12038b02…700893a42` |
321
+ | `head/kev_head.json` | head size, scale, temperature, delimiter ids, provenance | 2,046 | `73d51070…99d5c9d7c` |
322
+
323
+ The repository root carries the base model's `config.json`, the adapter's `adapter_config.json` and the
324
+ Apache-2.0 `LICENSE`, verbatim. `SHA256SUMS` lists every file. The Hub revision is recorded here after the
325
+ upload.
326
+
327
+ No AOT asset ships: the Swift runtime specializes the `.aimodel` correctly on the Mac and on the phone (the
328
+ JIT rows above). To compile one anyway:
329
+
330
+ ```bash
331
+ xcrun coreai-build compile kev_0_8b_decode_fp16_pf16.aimodel --output aot --preferred-compute gpu \
332
+ --platform macOS --architecture h16c --expect-frequent-reshapes # iPhone 18 Pro: --platform iOS --architecture h19p
333
+ ```
334
+
335
+ `--expect-frequent-reshapes` is required (without it the runtime specializes again for every new row
336
+ length) and makes the asset 2.5 GB. An iOS asset must not be loaded on a Mac.
337
+
338
+ ## Use it
339
+
340
+ Swift, with the [`Kev`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/Kev) package (macOS 27 / iOS 27; the system CoreAI framework,
341
+ Accelerate and swift-transformers' tokenizer), on a download of the repository:
342
+
343
+ ```swift
344
+ import Kev
345
+
346
+ let bundle = URL(filePath: "Kev-0.8B-CoreAI/gpu-pipelined/kev_0_8b_decode_fp16_pf16")
347
+ let kev = try await KevDecider(bundle: bundle) // asset: nil = the .aimodel, specialized here (GPU, frequent reshapes)
348
+ let response = try await kev.decide(requestJSON: requestData, shared: true) // shared: the state's chunks run once
349
+ print(PythonFormat.dumps(response, asciiOnly: false))
350
+ // {"model": "kev_0_8b_decode_fp16_pf16", "answers": {"team": {"type": "choice", "choice": "billing", "confidence": …,
351
+ // "probabilities": {…}}, "urgent": {"type": "noul", "noul": …}}, "usage": {"input_tokens": …, "output_tokens": …}, "latency_ms": …}
352
+ ```
353
+
354
+ The same from the Mac CLI (`swift build -c release --package-path apps/Kev` builds `kev`):
355
+
356
+ ```bash
357
+ kev run --bundle Kev-0.8B-CoreAI/gpu-pipelined/kev_0_8b_decode_fp16_pf16 --asset jit \
358
+ --request req.json --shared --out resp.json
359
+ ```
360
+
361
+ A request, in the SystemOne-compatible request shape:
362
+
363
+ ```json
364
+ {"model": "kev-0.8b",
365
+ "state": "I was charged twice for order 1182. Please refund one of the charges.",
366
+ "questions": {
367
+ "team": {"type": "choice", "instructions": "Which team should handle this?",
368
+ "criteria": {"billing": "Charges and refunds", "shipping": "Deliveries", "returns": "Exchanges"}},
369
+ "urgent": {"type": "noul", "instructions": "Does this need a reply today?"}}}
370
+ ```
371
+
372
+ Python: `conversion/kev/decide.py run --model kev-0.8b --bundle <folder> --aimodelc <asset> --request
373
+ req.json [--shared] --out resp.json` is the gates' own read-out with `coreai.runtime`. It loads an AOT
374
+ `.aimodelc` (compile one with the command above); the Python gates never used the Python runtime's JIT.
375
+
376
+ ## Reproduce
377
+
378
+ Environment: the zoo overlay venv (coreai-core 1.0.0b2, coreai-torch 0.4.1, torch 2.9.0, transformers
379
+ 4.57.6), Xcode 27.0 RC. The author's code (the oracle and the merge) runs in its own venv built from the
380
+ author's `uv.lock` at tag `kev-1.0` (torch 2.8.0, transformers 5.17.0, peft 0.21.0). The steps, in order,
381
+ with every flag, are in [`conversion/kev/README.md`](https://github.com/john-rocky/coreai-model-zoo/blob/main/conversion/kev/README.md).
382
+
383
+ ```bash
384
+ # the merged checkpoint, with the author's script (tag kev-1.0)
385
+ (cd $ZOO_WORK_ROOT/_kev/kev-src && python scripts/merge_lora_checkpoint.py \
386
+ --lora jaredpalmer/kev-0.8b@788ddbdd65715bb03a56788c822f6c632c9a551d --out $ZOO_WORK_ROOT/_kev/merged/kev-0.8b-v1.0)
387
+ # the decoder (--aot adds the h16c .aimodelc the Python gates load)
388
+ python conversion/kev/export_decoder.py fp16 --prefill-chunk 16 --aot
389
+ ```
390
+
391
+ Recipe: [`recipe.toml`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/kev-0.8b/recipe.toml). Port notes: [`knowledge/kev-port.md`](https://github.com/john-rocky/coreai-model-zoo/blob/main/knowledge/kev-port.md).
392
+
393
+ ## Other formats
394
+
395
+ On the Hub (2026-10-04), not run here:
396
+
397
+ - Core ML: [`FluidInference/kev-0.8b-coreml`](https://huggingface.co/FluidInference/kev-0.8b-coreml), a
398
+ different runtime (Core ML packages for iOS 18 / macOS 15, fp16 on the GPU): a fused multifunction
399
+ package that packs a request's questions into one call, row packages, and the pointer head.
400
+ - ONNX: [`midudev/kev-0.8b-ONNX`](https://huggingface.co/midudev/kev-0.8b-ONNX) (ONNX Runtime Web, int4
401
+ weights with the Gated DeltaNet projections and MLPs int8, the pointer head as `head.bin`).
402
+ - GGUF: [`ggml-org/Kev-0.8B-GGUF`](https://huggingface.co/ggml-org/Kev-0.8B-GGUF) ("a decision model,
403
+ to be used via `/v1/systemone` API", per its card).
404
+ - RKLLM: [`ShiWarai/kev-0.8b-rknn`](https://huggingface.co/ShiWarai/kev-0.8b-rknn) (Rockchip RK3588,
405
+ w8a8, the pointer head in NumPy on the CPU, rows up to 320 tokens).
406
+ - Merged weights: [`ayan4m1/kev-0.8b-merged`](https://huggingface.co/ayan4m1/kev-0.8b-merged).
407
+ - MLX: the author's repository serves Kev through MLX on Apple silicon.
408
+
409
+ No other Core AI conversion of Kev was listed on the Hub on 2026-10-04.
410
+
411
+ ## License
412
+
413
+ Apache-2.0: the adapter and the head (jaredpalmer/kev-0.8b) and the base (Qwen/Qwen3.5-0.8B-Base); the
414
+ bundle inherits it, and the Hugging Face repository carries the base's `LICENSE`. The author's package
415
+ runs only in the oracle and the merge, at gate time; it is not part of the bundle. The fixture file
416
+ carries its own terms: its 144 SemIf authored144 items are MIT (github.com/TheoLeeCJ/SemIf at
417
+ `ca3ba65f`), with their copyright and permission notice; the transfer-v4 records are references to the
418
+ author's file (line and row hashes), not its text; of the 20 records written for the port, 11 are
419
+ published and 9 are withheld (an invented name in each was found in use on the web), keeping their ids
420
+ and numbers.
421
+
422
+ ## Limits
423
+
424
+ From the [author's card](https://huggingface.co/jaredpalmer/kev-0.8b): English only; text generation,
425
+ chat, tool-call routing and fully automated consequential decisions about people are out of scope; the
426
+ temperature was fitted on the author's development rows (the card explains how to measure and refit it on
427
+ one's own data). This port adds one limit: a row holds at most 4,080 tokens, while the author's server
428
+ accepts states up to 65,536.
SHA256SUMS ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 50cbab8a892c5f2993b8c7351a99182507472def3b1374558308605d99b86b32 LICENSE
2
+ d21eecda6b62741ad3eadb39cf566e76194ef6e7e76a2c0d2248e3d125072773 README.md
3
+ 748acb2cda88454cb1ba69d745ba336f3fcb5486eac349e90960c8b8d8d3e854 adapter_config.json
4
+ b90b86f35c8e6925ef74ee04d0e758f0a845c83a42089ad82bbaa948de9b4204 config.json
5
+ 12038b02ecf7ece3ffb008b22ae97988293e521a86e7aadc8036c9c700893a42 gpu-pipelined/kev_0_8b_decode_fp16_pf16/head/head.safetensors
6
+ 73d510708790422d3c84bfc915e311e536d527bc032f0a07394e76999d5c9d7c gpu-pipelined/kev_0_8b_decode_fp16_pf16/head/kev_head.json
7
+ 5e53b0fa31411ab780585a1183e170407d3fcd5aac0b2053ca0ef1e37df5e87c gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/main.hash
8
+ 4131d0284899787bab6cae6ca62a706886478b4e25c4d8cb971c5ba2ad72682d gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/main.mlirb
9
+ c751b845f3c70312dab24edf1084f98321b0b8c6e89fb0ea4a8263ab51e8185c gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/metadata.json
10
+ 97b70e4393d549aada62381be4417a0ddb5ebf6491a5e824cb58ecb5f22b65b2 gpu-pipelined/kev_0_8b_decode_fp16_pf16/metadata.json
11
+ fe000e3ed39ed12b8d2481d527d44f93c65d37e87645d2dcc80d1bf9d50d2927 gpu-pipelined/kev_0_8b_decode_fp16_pf16/tokenizer/tokenizer.json
12
+ e611fbccc7c29ef3b1cafb1cb7ea548d189968632901d678fd62be68c47885de gpu-pipelined/kev_0_8b_decode_fp16_pf16/tokenizer/tokenizer_config.json
adapter_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3.5-0.8B-Base",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "kasa_config": null,
16
+ "layer_replication": null,
17
+ "layers_pattern": null,
18
+ "layers_to_transform": null,
19
+ "loftq_config": {},
20
+ "lora_alpha": 32,
21
+ "lora_bias": false,
22
+ "lora_dropout": 0.05,
23
+ "lora_ga_config": null,
24
+ "megatron_config": null,
25
+ "megatron_core": "megatron.core",
26
+ "modules_to_save": null,
27
+ "monteclora_config": null,
28
+ "peft_type": "LORA",
29
+ "peft_version": "0.21.0",
30
+ "qalora_group_size": 16,
31
+ "r": 16,
32
+ "rank_pattern": {},
33
+ "revision": null,
34
+ "target_modules": [
35
+ "in_proj_b",
36
+ "in_proj_qkv",
37
+ "gate_proj",
38
+ "v_proj",
39
+ "o_proj",
40
+ "k_proj",
41
+ "up_proj",
42
+ "in_proj_z",
43
+ "in_proj_a",
44
+ "out_proj",
45
+ "down_proj",
46
+ "q_proj"
47
+ ],
48
+ "target_parameters": null,
49
+ "task_type": "FEATURE_EXTRACTION",
50
+ "trainable_token_indices": null,
51
+ "use_bdlora": null,
52
+ "use_dora": false,
53
+ "use_qalora": false,
54
+ "use_rslora": false,
55
+ "velora_config": null
56
+ }
config.json ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "image_token_id": 248056,
6
+ "model_type": "qwen3_5",
7
+ "text_config": {
8
+ "attention_bias": false,
9
+ "attention_dropout": 0.0,
10
+ "attn_output_gate": true,
11
+ "dtype": "bfloat16",
12
+ "eos_token_id": 248044,
13
+ "full_attention_interval": 4,
14
+ "head_dim": 256,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 1024,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 3584,
19
+ "layer_types": [
20
+ "linear_attention",
21
+ "linear_attention",
22
+ "linear_attention",
23
+ "full_attention",
24
+ "linear_attention",
25
+ "linear_attention",
26
+ "linear_attention",
27
+ "full_attention",
28
+ "linear_attention",
29
+ "linear_attention",
30
+ "linear_attention",
31
+ "full_attention",
32
+ "linear_attention",
33
+ "linear_attention",
34
+ "linear_attention",
35
+ "full_attention",
36
+ "linear_attention",
37
+ "linear_attention",
38
+ "linear_attention",
39
+ "full_attention",
40
+ "linear_attention",
41
+ "linear_attention",
42
+ "linear_attention",
43
+ "full_attention"
44
+ ],
45
+ "linear_conv_kernel_dim": 4,
46
+ "linear_key_head_dim": 128,
47
+ "linear_num_key_heads": 16,
48
+ "linear_num_value_heads": 16,
49
+ "linear_value_head_dim": 128,
50
+ "max_position_embeddings": 262144,
51
+ "mlp_only_layers": [],
52
+ "model_type": "qwen3_5_text",
53
+ "mtp_num_hidden_layers": 1,
54
+ "mtp_use_dedicated_embeddings": false,
55
+ "num_attention_heads": 8,
56
+ "num_hidden_layers": 24,
57
+ "num_key_value_heads": 2,
58
+ "rms_norm_eps": 1e-06,
59
+ "tie_word_embeddings": true,
60
+ "use_cache": true,
61
+ "vocab_size": 248320,
62
+ "mamba_ssm_dtype": "float32",
63
+ "rope_parameters": {
64
+ "mrope_interleaved": true,
65
+ "mrope_section": [
66
+ 11,
67
+ 11,
68
+ 10
69
+ ],
70
+ "rope_type": "default",
71
+ "rope_theta": 10000000,
72
+ "partial_rotary_factor": 0.25
73
+ }
74
+ },
75
+ "tie_word_embeddings": true,
76
+ "transformers_version": "4.57.0.dev0",
77
+ "video_token_id": 248057,
78
+ "vision_config": {
79
+ "deepstack_visual_indexes": [],
80
+ "depth": 12,
81
+ "hidden_act": "gelu_pytorch_tanh",
82
+ "hidden_size": 768,
83
+ "in_channels": 3,
84
+ "initializer_range": 0.02,
85
+ "intermediate_size": 3072,
86
+ "model_type": "qwen3_5",
87
+ "num_heads": 12,
88
+ "num_position_embeddings": 2304,
89
+ "out_hidden_size": 1024,
90
+ "patch_size": 16,
91
+ "spatial_merge_size": 2,
92
+ "temporal_patch_size": 2
93
+ },
94
+ "vision_end_token_id": 248054,
95
+ "vision_start_token_id": 248053
96
+ }
gpu-pipelined/kev_0_8b_decode_fp16_pf16/head/head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12038b02ecf7ece3ffb008b22ae97988293e521a86e7aadc8036c9c700893a42
3
+ size 2099576
gpu-pipelined/kev_0_8b_decode_fp16_pf16/head/kev_head.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "kev-0.8b",
3
+ "hidden_size": 1024,
4
+ "head_dim": 256,
5
+ "scale": 0.0625,
6
+ "temperature": 2.3510958125672174,
7
+ "formula": "z_k = ((k.weight @ h_opt_k + k.bias) . (q.weight @ h_decide + q.bias)) * scale; p = softmax_k(z / temperature)",
8
+ "readout": {
9
+ "decide": "hidden state at the row's last token (<decide>)",
10
+ "option_k": "hidden state at option k's </opt> token",
11
+ "hidden": "the decoder's last_hidden_state (after the final RMSNorm), fp32"
12
+ },
13
+ "row": "one causal row per question: [state] + user_tokens(render(state)) + [q] + user_tokens(render(instructions)) + for each option ([opt] + user_tokens(option) + [opt_end]) + [decide]; positions 0..L-1; fresh state per row",
14
+ "user_tokens": "re.sub(r'<\\|([A-Za-z0-9_]+)\\|>', r'<¦\\1¦>', text), tokenized without special tokens",
15
+ "delimiters": {
16
+ "state": {
17
+ "token": "<|fim_prefix|>",
18
+ "id": 248060
19
+ },
20
+ "q": {
21
+ "token": "<|fim_middle|>",
22
+ "id": 248061
23
+ },
24
+ "opt": {
25
+ "token": "<|box_start|>",
26
+ "id": 248049
27
+ },
28
+ "opt_end": {
29
+ "token": "<|box_end|>",
30
+ "id": 248050
31
+ },
32
+ "decide": {
33
+ "token": "<|fim_suffix|>",
34
+ "id": 248062
35
+ }
36
+ },
37
+ "pad": {
38
+ "token": "<|endoftext|>",
39
+ "id": 248044
40
+ },
41
+ "base": {
42
+ "repo": "Qwen/Qwen3.5-0.8B-Base",
43
+ "revision": "dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68"
44
+ },
45
+ "adapter": {
46
+ "repo": "jaredpalmer/kev-0.8b",
47
+ "tag": "v1.0",
48
+ "revision": "788ddbdd65715bb03a56788c822f6c632c9a551d",
49
+ "resolved_commit": "bf75a6a8848ea6960ff2ed108d9ed44c2941174f",
50
+ "adapter_sha256": "9b908623acb162118575f4e7a94524f9c139c335be4bfb74d6cfceca01e1885a",
51
+ "head_pt_sha256": "f400bd12802b2b105ae45d6b03774a158a3db4fccff42413734ddca2e5c920b6"
52
+ },
53
+ "head_safetensors_sha256": "12038b02ecf7ece3ffb008b22ae97988293e521a86e7aadc8036c9c700893a42",
54
+ "temperature_fit": {
55
+ "rows": "runs/release/kev-08b-r15/development/rows.json",
56
+ "n": 1264,
57
+ "method": "min micro mean NLL over a 121-point log grid 0.25..4"
58
+ },
59
+ "record0_check": [
60
+ {
61
+ "record": "tv4_000",
62
+ "qid": "answer",
63
+ "bit_equal": true,
64
+ "max_abs_diff": 0.0
65
+ }
66
+ ]
67
+ }
gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ A1�(H�x{�l�l�*ph�G�N%��˗[��rh-
gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4131d0284899787bab6cae6ca62a706886478b4e25c4d8cb971c5ba2ad72682d
3
+ size 1506481909
gpu-pipelined/kev_0_8b_decode_fp16_pf16/kev_0_8b_decode_fp16_pf16.aimodel/metadata.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "assetVersion" : "2.0",
3
+ "producer" : "coreai-core 1.0.0b2",
4
+ "creationDate" : "20261003T073819Z"
5
+ }
gpu-pipelined/kev_0_8b_decode_fp16_pf16/metadata.json ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata_version": "0.2",
3
+ "kind": "decision-backbone",
4
+ "name": "kev_0_8b_decode_fp16_pf16",
5
+ "assets": {
6
+ "main": "kev_0_8b_decode_fp16_pf16.aimodel"
7
+ },
8
+ "language": {
9
+ "tokenizer": "Qwen/Qwen3.5-0.8B-Base",
10
+ "vocab_size": 248320,
11
+ "max_context_length": 4096,
12
+ "embedded_tokenizer": true,
13
+ "prefill_chunk": 16,
14
+ "static_inputs": [],
15
+ "output": "hidden [1, 16, 1024] fp16, every position",
16
+ "function_map": {
17
+ "main": [
18
+ "main"
19
+ ]
20
+ },
21
+ "tokenizer_revision": "dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68"
22
+ },
23
+ "source": {
24
+ "model_definition": "torch (coreai_models.models.macos.qwen3_5, conversion/kev/qwen3_5_kev_decoder.py)",
25
+ "adapter": {
26
+ "repo": "jaredpalmer/kev-0.8b",
27
+ "tag": "v1.0",
28
+ "tag_target": "788ddbdd65715bb03a56788c822f6c632c9a551d",
29
+ "resolved_commit": "bf75a6a8848ea6960ff2ed108d9ed44c2941174f",
30
+ "weights_identical_to": "9a45d25eb2ab761841196625383fa1dff0e56c1e (the card's weight revision; same LFS oids)",
31
+ "adapter_model_safetensors_sha256": "9b908623acb162118575f4e7a94524f9c139c335be4bfb74d6cfceca01e1885a",
32
+ "head_pt_sha256": "f400bd12802b2b105ae45d6b03774a158a3db4fccff42413734ddca2e5c920b6",
33
+ "license": "apache-2.0"
34
+ },
35
+ "base": {
36
+ "repo": "Qwen/Qwen3.5-0.8B-Base",
37
+ "revision": "dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68",
38
+ "safetensors_sha256": "c2b1e5a17d9c1e27685d92ed9b382911ebb99955ecd89052d1721241adfbab6c",
39
+ "license": "apache-2.0"
40
+ },
41
+ "merge": {
42
+ "tool": "scripts/merge_lora_checkpoint.py (https://github.com/jaredpalmer/kev tag kev-1.0, commit 6b719c3c3f367295f6ef336f4f751cf5ff970abc)",
43
+ "formula": "W + (B @ A) * alpha / r (alpha / r = 2.0) on every adapted weight, in fp32, written fp32 (12 target kinds, 186 adapted tensors); every other weight unchanged",
44
+ "weights_sha256": "ab6bd41853ef2a45d56923202e15c8c9c3dcedaec152b1fb8e529f1ec208415f",
45
+ "model_safetensors_sha256": "b5ebf92a9994a96d5c0c21b52f5eae23049c9e8b5a85fc625b4cea64076408db",
46
+ "tensors": 320,
47
+ "script": "scripts/merge_lora_checkpoint.py (github.com/jaredpalmer/kev tag kev-1.0)"
48
+ },
49
+ "hf_model_id": "jaredpalmer/kev-0.8b",
50
+ "hf_revision": "bf75a6a8848ea6960ff2ed108d9ed44c2941174f",
51
+ "tokenizer": {
52
+ "repo": "Qwen/Qwen3.5-0.8B-Base",
53
+ "revision": "dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68",
54
+ "files": {
55
+ "tokenizer.json": "fe000e3ed39ed12b8d2481d527d44f93c65d37e87645d2dcc80d1bf9d50d2927",
56
+ "tokenizer_config.json": "e611fbccc7c29ef3b1cafb1cb7ea548d189968632901d678fd62be68c47885de"
57
+ },
58
+ "shipped_in": "tokenizer/ (verbatim copies of the two files; embedded_tokenizer)"
59
+ },
60
+ "hf_revision_note": "the commit the Hub resolves the tag v1.0 to; the adapter and head.pt are the LFS objects named in source.adapter. The exporter read the merged checkpoint (source.merge) through a local cache id, which is not recorded here."
61
+ },
62
+ "compression": null,
63
+ "decision": {
64
+ "output": "hidden [1, S, 1024] per call: the final-norm hidden state at every position (no vocabulary head in the graph)",
65
+ "readout": "one row per question, fresh zero states per row; a row of T ids runs as ceil(T / 16) calls of 'main' (static S = 16): call k gets ids[16k : 16k + 16] with position_ids 0..16k+15; the last call is padded with <|endoftext|> (248044) and the hidden rows of the padded positions are discarded (causal: they cannot reach a real position). The hidden rows [1, 16, 1024] of every call, concatenated and cut to T, are the backbone's final-norm last_hidden_state [T, 1024] the head reads. A row fits when ceil(T / 16) * 16 <= 4095 (the position dim's upper bound; the KV sequence dim is allocated at 4096).",
66
+ "row": {
67
+ "source": "the author's kev.model.encode + rows_of (row form, https://github.com/jaredpalmer/kev tag kev-1.0); conversion/kev/oracle_kev.py records the oracle's rows",
68
+ "layout": "[<state>] + user_tokens(render(state)) + [<q>] + user_tokens(render(instructions)) + for each option ([<opt>] + user_tokens(option_text) + [</opt>]) + [<decide>]",
69
+ "delimiters": {
70
+ "state": {
71
+ "token": "<|fim_prefix|>",
72
+ "id": 248060
73
+ },
74
+ "q": {
75
+ "token": "<|fim_middle|>",
76
+ "id": 248061
77
+ },
78
+ "opt": {
79
+ "token": "<|box_start|>",
80
+ "id": 248049
81
+ },
82
+ "opt_end": {
83
+ "token": "<|box_end|>",
84
+ "id": 248050
85
+ },
86
+ "decide": {
87
+ "token": "<|fim_suffix|>",
88
+ "id": 248062
89
+ }
90
+ },
91
+ "pad": {
92
+ "token": "<|endoftext|>",
93
+ "id": 248044
94
+ },
95
+ "bos": null,
96
+ "positions": "0..L-1 (one causal row = the state ids then the question's branch ids)",
97
+ "user_tokens": "re.sub(r'<\\|([A-Za-z0-9_]+)\\|>', r'<¦\\1¦>', text), then tokenized without special tokens (user text can never produce a delimiter)",
98
+ "tokenizer": "tokenizer/ (the base model's pinned tokenizer.json + tokenizer_config.json)",
99
+ "readout_positions": {
100
+ "decide": "the row's last token (<decide>)",
101
+ "options": "each option's </opt> token, in option order"
102
+ },
103
+ "limits_author_serving": "state <= 65,536 tokens (the <state> token included), a row <= 73,728; this graph: one row <= the readout bound above"
104
+ },
105
+ "request": {
106
+ "source": "kev.api.to_record (SystemOne request -> internal record)",
107
+ "render": "None -> ''; str / int / float / bool -> str(v); array -> one line per item '- ' + render(item) (nested items indented by two spaces per level); object -> one line per key 'key: value', or 'key:' then the nested render indented by two spaces when the value is an object or an array",
108
+ "state": "render(state)",
109
+ "instructions": "render(instructions) (omitted -> '': the <q> token is followed by the options)",
110
+ "option_text": "name if description is None or '' else 'name: ' + render(description)",
111
+ "options": {
112
+ "noul": [
113
+ "option_text('no', criteria.false)",
114
+ "option_text('yes', criteria.true)"
115
+ ],
116
+ "choice": "option_text(name, description) for each criteria entry, in criteria order",
117
+ "score": "render(level) for each level, in order"
118
+ },
119
+ "question_keys": {
120
+ "noul": [
121
+ "false",
122
+ "true"
123
+ ],
124
+ "choice": "the criteria names, in order",
125
+ "score": "'0'..'n-1'"
126
+ },
127
+ "max_options": 255,
128
+ "validation": {
129
+ "source": "kev.api.SystemOneRequest (pydantic v2)",
130
+ "model": "string, default 'kev-latest'",
131
+ "state": "required, any JSON value (null allowed)",
132
+ "questions": "object of question id -> question, at least one",
133
+ "question": "type noul | choice | score; instructions: any JSON (optional); unknown fields ignored",
134
+ "noul": "criteria: object or null (optional); only 'true' and 'false' are read",
135
+ "choice": "criteria: object of 1..255 name -> description (any JSON; null or '' = the name alone)",
136
+ "score": "criteria: array of 1..255 levels (any JSON)",
137
+ "reject": "anything else (the author's server answers 422)"
138
+ }
139
+ },
140
+ "head": {
141
+ "files": [
142
+ "head/head.safetensors",
143
+ "head/kev_head.json"
144
+ ],
145
+ "formula": "z_k = ((k.weight @ h_opt_k + k.bias) . (q.weight @ h_decide + q.bias)) * 0.0625; p = softmax_k(z / temperature)",
146
+ "scale": 0.0625,
147
+ "temperature": "kev_head.json temperature (2.3510958125672174, the author's calibration in head.pt)",
148
+ "code": "kev.model.PointerHead.forward (q, k = nn.Linear(1024, 256)); weights from head.pt, fp32",
149
+ "dtype_of_record": "fp32 (the gate reads the graph's fp16 hidden through the fp32 head)",
150
+ "files_sha256": {
151
+ "head/head.safetensors": "12038b02ecf7ece3ffb008b22ae97988293e521a86e7aadc8036c9c700893a42",
152
+ "head/kev_head.json": "73d510708790422d3c84bfc915e311e536d527bc032f0a07394e76999d5c9d7c"
153
+ },
154
+ "temperature_value": 2.3510958125672174,
155
+ "hidden_size": 1024,
156
+ "head_dim": 256,
157
+ "host_arithmetic": "the round-5 reference host (conversion/kev/host.py) computes the head and the softmax in float64 from the fp16 hidden rows and the fp32 weights and rounds p to fp32 once; the author's PyTorch head is fp32 (on the same hidden rows they differ by fp32 rounding: max |dp| 3.0e-07 over the fixture and held-out rows)"
158
+ },
159
+ "softmax": "per question, fp32, over that question's options, after the temperature",
160
+ "response": {
161
+ "shape": "SystemOne-compatible: {model, answers: {question_id: answer}, usage: {input_tokens, output_tokens}, latency_ms} (kev.serve.Server._body)",
162
+ "noul": "{type: 'noul', noul: p(true)}",
163
+ "choice": "{type: 'choice', choice: the key of the first max p, confidence: (p_max - 1/K) / (1 - 1/K) (1 when K = 1), probabilities: {key: p}}",
164
+ "score": "{type: 'score', score: sum(i * p_i), legend: {key: render(level)}, probabilities: {key: p}, confidence: max(0, 1 - E|level - mode| / D), D = mean |i - (L-1)/2| over the L levels, mode = the first most likely level (1 when L = 1)}",
165
+ "normalize": "the confidences normalize p to sum 1 first (all zeros -> uniform)",
166
+ "rounding": "4 decimals (kev.api.round_prob)",
167
+ "usage": "input_tokens = the encoded request's tokens (the author's packed form: state once + every branch); output_tokens = tokens of json.dumps(answers) (kev.api.output_tokens)",
168
+ "sums": "every float sum in the confidences and the score is Python 3.12's sum(): left to right with Neumaier compensation (the author's runtime); p are the fp32 probabilities as doubles; round4 = Python round(x, 4)",
169
+ "model": "the author's server echoes the request's model (default 'kev-latest'); the round-5 reference host writes the bundle name",
170
+ "latency_ms": "the graph calls + the head (state allocations included; tokenizing and the answers not), 1 decimal",
171
+ "output_tokens_detail": "tokens of Python's json.dumps(answers) with its defaults (', ' and ': ' separators, ensure_ascii, floats as repr), plain tokenizer (special tokens matched, no user_tokens rewrite)"
172
+ },
173
+ "graph_context": {
174
+ "max_context_length": 4096,
175
+ "row_limit": "ceil(T / 16) * 16 <= 4095 (the position axis' upper bound = max_context_length - 1), so a row holds at most 4,080 tokens; the author's serving limits (state <= 65,536, row <= 73,728) are far above it"
176
+ },
177
+ "shared_prefix": "optional, exact: with Ls state tokens (<state> included) every question's row starts with the same k = Ls // 16 chunks; run them once, copy the four states per question (KV up to k*16 on its sequence axis, the rest zero; convState / recState as they are) and run each row's remaining tokens from position k*16 in the same chunk grid: the hidden rows are bit-equal to the direct run's (round 5, every fixture and held-out row of both models)"
178
+ },
179
+ "gate": {
180
+ "bar": {
181
+ "argmax": "every question whose oracle top-2 margin is above 0.02 (near-ties listed apart)",
182
+ "max_abs_dp": 0.02,
183
+ "mean_of_run_mean_abs_dp": 0.002,
184
+ "reset": "bit-equal in every process",
185
+ "finite": true
186
+ },
187
+ "oracle": "the author's fp32 checkpoint on the CPU (kev.model.admit + the row-form forward, threads 1)",
188
+ "fixture_434": {
189
+ "result": "PASS",
190
+ "rows": 434,
191
+ "argmax_non_near_tie": "420/420",
192
+ "argmax_near_tie": "12/14",
193
+ "max_abs_dp": 0.011679,
194
+ "mean_of_run_mean_abs_dp": 0.0009687,
195
+ "worst_row": {
196
+ "id": "semif_46b7029b9a704138b77a",
197
+ "q": 0,
198
+ "max_abs_dp": 0.011678963899612427
199
+ },
200
+ "reset_bit_equal_all_processes": true,
201
+ "finite": true,
202
+ "oracle_sha256": "1a72a45831eecc2af7ddfc68a86e9250f572d6bf9274362f96cc62bcb803cc6d",
203
+ "aimodelc_tree_sha256": "de1b6a1a12a0a7a3726bd043e9e5859b3ddea295e5c5dcec7fa87b33d25cef02",
204
+ "when": "2026-10-03T07:46:12+00:00",
205
+ "lane_file_sha256": "2c6a7846081de2e83bea6c6df792418aa8f2d5f846b96dadb7358fd0bf66219a",
206
+ "transcript": "coreai-model-zoo models/kev-0.8b/gate-kev-0.8b-readout-fp16_pf16.json"
207
+ },
208
+ "heldout_130": {
209
+ "result": "PASS",
210
+ "rows": 130,
211
+ "argmax_non_near_tie": "125/125",
212
+ "argmax_near_tie": "5/5",
213
+ "max_abs_dp": 0.005739,
214
+ "mean_of_run_mean_abs_dp": 0.0008054,
215
+ "worst_row": {
216
+ "id": "tv4h_11",
217
+ "q": 0,
218
+ "max_abs_dp": 0.005739271640777588
219
+ },
220
+ "reset_bit_equal_all_processes": true,
221
+ "finite": true,
222
+ "oracle_sha256": "f715653331a81bd0ff48d48d1f9d294b7b9b3343713a855fd0eed16dd1e505e6",
223
+ "aimodelc_tree_sha256": "de1b6a1a12a0a7a3726bd043e9e5859b3ddea295e5c5dcec7fa87b33d25cef02",
224
+ "when": "2026-10-03T10:00:46+00:00",
225
+ "lane_file_sha256": "0cbfed2c8e3a9c1cb58ecbb11de5668e7c5c2744e925be08980f589746bad603",
226
+ "transcript": "coreai-model-zoo models/kev-0.8b/gate-kev-0.8b-heldout.json"
227
+ },
228
+ "host_round5": {
229
+ "test_host": {
230
+ "sha256": "972b6ff76ad651d001de9971094b348f0fa03a92539319263904d4e5b4b22c12",
231
+ "oracle_venv_file": "results/host_test_oracle_venv.json",
232
+ "oracle_venv_sha256": "32d7ca3bbecd115df29d7a67a91ea2c5660188d52b9b5f0b56d45b7a7dd27e73",
233
+ "lane_file": "results/host_test.json"
234
+ },
235
+ "e2e_fixture": {
236
+ "sha256": "b8c3e6e3344c8899c22bf73cb8e9f51c525dbd387d3bd5b3e7245b91bc2f8851",
237
+ "rows": 434,
238
+ "hidden_bit_equal_gate": 434,
239
+ "torch_head_p_bit_equal_gate": 434,
240
+ "host_p_max_abs_dp_vs_gate": 2.980232238769531e-07,
241
+ "shared_p_bit_equal_direct": 434,
242
+ "host_bar_max_abs_dp": 0.011679,
243
+ "host_bar_mean": 0.0009687,
244
+ "lane_file": "results/e2e_kev-0.8b.json"
245
+ },
246
+ "e2e_heldout": {
247
+ "sha256": "9a04028c1c590ca17d3a27095c185412599f6fc8016361440a66a4b51dc588ad",
248
+ "rows": 130,
249
+ "hidden_bit_equal_gate": 130,
250
+ "torch_head_p_bit_equal_gate": 130,
251
+ "host_p_max_abs_dp_vs_gate": 2.384185791015625e-07,
252
+ "shared_p_bit_equal_direct": 130,
253
+ "host_bar_max_abs_dp": 0.005739,
254
+ "host_bar_mean": 0.0008054,
255
+ "lane_file": "results/e2e_kev-0.8b_heldout.json"
256
+ },
257
+ "transcript": "coreai-model-zoo models/kev-0.8b/gate-kev-0.8b-host.json"
258
+ },
259
+ "aimodelc": {
260
+ "name": "kev_0_8b_decode_fp16_pf16.h16c.aimodelc",
261
+ "tree_sha256": "de1b6a1a12a0a7a3726bd043e9e5859b3ddea295e5c5dcec7fa87b33d25cef02"
262
+ },
263
+ "fixture": "coreai-model-zoo models/kev-0.8b/fixtures-kev-0.8b.json"
264
+ },
265
+ "compilation": {
266
+ "date": "2026-10-03T07:38:20.417082+00:00",
267
+ "targets": []
268
+ },
269
+ "metadata_of_record": {
270
+ "exported_metadata_json_sha256": "01251e9649bd73421a67ee0942b047d52ea81ae12f3b3c310958bd9e9bd139f0",
271
+ "edits": [
272
+ "language.tokenizer = the base repo id (was the local id of the merged checkpoint) + tokenizer_revision",
273
+ "source.hf_model_id / hf_revision = the Kev checkpoint (was the local HF-cache id of the merged weights)",
274
+ "decision.request / response / graph_context / shared_prefix and gate: added in round 5 from the reference host (metadata.candidate.json)",
275
+ "gate transcripts named by their zoo files"
276
+ ],
277
+ "written": "2026-10-04 (round 9)"
278
+ }
279
+ }
gpu-pipelined/kev_0_8b_decode_fp16_pf16/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe000e3ed39ed12b8d2481d527d44f93c65d37e87645d2dcc80d1bf9d50d2927
3
+ size 12807196
gpu-pipelined/kev_0_8b_decode_fp16_pf16/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "248044": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "248045": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "248046": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "248047": {
29
+ "content": "<|object_ref_start|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "248048": {
37
+ "content": "<|object_ref_end|>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "248049": {
45
+ "content": "<|box_start|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "248050": {
53
+ "content": "<|box_end|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "248051": {
61
+ "content": "<|quad_start|>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "248052": {
69
+ "content": "<|quad_end|>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "248053": {
77
+ "content": "<|vision_start|>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "248054": {
85
+ "content": "<|vision_end|>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "248055": {
93
+ "content": "<|vision_pad|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "248056": {
101
+ "content": "<|image_pad|>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "248057": {
109
+ "content": "<|video_pad|>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "248058": {
117
+ "content": "<tool_call>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": false
123
+ },
124
+ "248059": {
125
+ "content": "</tool_call>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": false
131
+ },
132
+ "248060": {
133
+ "content": "<|fim_prefix|>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": false
139
+ },
140
+ "248061": {
141
+ "content": "<|fim_middle|>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": false
147
+ },
148
+ "248062": {
149
+ "content": "<|fim_suffix|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": false
155
+ },
156
+ "248063": {
157
+ "content": "<|fim_pad|>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": false
163
+ },
164
+ "248064": {
165
+ "content": "<|repo_name|>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": false
171
+ },
172
+ "248065": {
173
+ "content": "<|file_sep|>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": false
179
+ },
180
+ "248066": {
181
+ "content": "<tool_response>",
182
+ "lstrip": false,
183
+ "normalized": false,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": false
187
+ },
188
+ "248067": {
189
+ "content": "</tool_response>",
190
+ "lstrip": false,
191
+ "normalized": false,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": false
195
+ },
196
+ "248068": {
197
+ "content": "<think>",
198
+ "lstrip": false,
199
+ "normalized": false,
200
+ "rstrip": false,
201
+ "single_word": false,
202
+ "special": false
203
+ },
204
+ "248069": {
205
+ "content": "</think>",
206
+ "lstrip": false,
207
+ "normalized": false,
208
+ "rstrip": false,
209
+ "single_word": false,
210
+ "special": false
211
+ },
212
+ "248070": {
213
+ "content": "<|audio_start|>",
214
+ "lstrip": false,
215
+ "normalized": false,
216
+ "rstrip": false,
217
+ "single_word": false,
218
+ "special": true
219
+ },
220
+ "248071": {
221
+ "content": "<|audio_end|>",
222
+ "lstrip": false,
223
+ "normalized": false,
224
+ "rstrip": false,
225
+ "single_word": false,
226
+ "special": true
227
+ },
228
+ "248072": {
229
+ "content": "<tts_pad>",
230
+ "lstrip": false,
231
+ "normalized": false,
232
+ "rstrip": false,
233
+ "single_word": false,
234
+ "special": true
235
+ },
236
+ "248073": {
237
+ "content": "<tts_text_bos>",
238
+ "lstrip": false,
239
+ "normalized": false,
240
+ "rstrip": false,
241
+ "single_word": false,
242
+ "special": true
243
+ },
244
+ "248074": {
245
+ "content": "<tts_text_eod>",
246
+ "lstrip": false,
247
+ "normalized": false,
248
+ "rstrip": false,
249
+ "single_word": false,
250
+ "special": true
251
+ },
252
+ "248075": {
253
+ "content": "<tts_text_bos_single>",
254
+ "lstrip": false,
255
+ "normalized": false,
256
+ "rstrip": false,
257
+ "single_word": false,
258
+ "special": true
259
+ },
260
+ "248076": {
261
+ "content": "<|audio_pad|>",
262
+ "lstrip": false,
263
+ "normalized": false,
264
+ "rstrip": false,
265
+ "single_word": false,
266
+ "special": true
267
+ }
268
+ },
269
+ "additional_special_tokens": [
270
+ "<|im_start|>",
271
+ "<|im_end|>",
272
+ "<|object_ref_start|>",
273
+ "<|object_ref_end|>",
274
+ "<|box_start|>",
275
+ "<|box_end|>",
276
+ "<|quad_start|>",
277
+ "<|quad_end|>",
278
+ "<|vision_start|>",
279
+ "<|vision_end|>",
280
+ "<|vision_pad|>",
281
+ "<|image_pad|>",
282
+ "<|video_pad|>"
283
+ ],
284
+ "bos_token": null,
285
+ "chat_template": "{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain images.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\n {%- elif 'video' in item or item.type == 'video' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain videos.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Video ' ~ video_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {%- if content %}\n {{- '\\n\\n' + content }}\n {%- endif %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content, false)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if ns.multi_step_tool %}\n {{- raise_exception('No user query found in messages.') }}\n{%- endif %}\n{%- for message in messages %}\n {%- set content = render_content(message.content, true)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if loop.index0 > ns.last_query_index %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is true %}\n {{- '<think>\\n' }}\n {%- else %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
286
+ "clean_up_tokenization_spaces": false,
287
+ "eos_token": "<|endoftext|>",
288
+ "errors": "replace",
289
+ "model_max_length": 262144,
290
+ "pad_token": "<|endoftext|>",
291
+ "split_special_tokens": false,
292
+ "tokenizer_class": "Qwen2Tokenizer",
293
+ "unk_token": null,
294
+ "add_bos_token": false,
295
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
296
+ "extra_special_tokens": {
297
+ "audio_bos_token": "<|audio_start|>",
298
+ "audio_eos_token": "<|audio_end|>",
299
+ "audio_token": "<|audio_pad|>",
300
+ "image_token": "<|image_pad|>",
301
+ "video_token": "<|video_pad|>",
302
+ "vision_bos_token": "<|vision_start|>",
303
+ "vision_eos_token": "<|vision_end|>"
304
+ }
305
+ }