mlboydaisuke commited on
Commit
3d9e0ae
·
verified ·
1 Parent(s): 772c51f

Add files using upload-large-folder tool

Browse files
Files changed (33) hide show
  1. .gitattributes +7 -0
  2. LICENSE +202 -0
  3. README.md +474 -0
  4. SHA256SUMS +31 -0
  5. config.json +109 -0
  6. gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.hash +1 -0
  7. gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.mlirb +3 -0
  8. gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/metadata.json +5 -0
  9. gpu-pipelined/clef_flash_decode_fp16_pf64/metadata.json +148 -0
  10. gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/chat_template.jinja +154 -0
  11. gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/tokenizer.json +3 -0
  12. gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/tokenizer_config.json +30 -0
  13. gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.hash +1 -0
  14. gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.mlirb +3 -0
  15. gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/metadata.json +5 -0
  16. gpu-pipelined/clef_flash_decode_int8mix_pf64/metadata.json +272 -0
  17. gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/chat_template.jinja +154 -0
  18. gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer.json +3 -0
  19. gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer_config.json +30 -0
  20. gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.hash +1 -0
  21. gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.mlirb +3 -0
  22. gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/metadata.json +5 -0
  23. gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.hash +1 -0
  24. gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.mlirb +3 -0
  25. gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/metadata.json +5 -0
  26. gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.hash +0 -0
  27. gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.mlirb +3 -0
  28. gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/metadata.json +5 -0
  29. gpu-pipelined/clef_flash_head_bucket_fp16w32/metadata.json +115 -0
  30. host/joint_head_config.json +8 -0
  31. host/lm_head_fp16.bin +3 -0
  32. host/lm_head_fp16.json +88 -0
  33. joint_head_config.json +8 -0
.gitattributes CHANGED
@@ -33,3 +33,10 @@ 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/clef_flash_decode_fp16_pf64/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
39
+ gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
40
+ gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
41
+ gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
42
+ gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.mlirb 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,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Cloudflare/clef-flash
4
+ base_model_relation: quantized
5
+ pipeline_tag: image-text-to-text
6
+ library_name: coreai
7
+ language:
8
+ - en
9
+ tags:
10
+ - coreai
11
+ - core-ai
12
+ - apple
13
+ - on-device
14
+ - decision-model
15
+ - systemone
16
+ - typed-decisions
17
+ - vision-language
18
+ - structured-output
19
+ ---
20
+
21
+ # clef-flash — Core AI
22
+
23
+ Apple Core AI (`.aimodel`) conversion of [Cloudflare/clef-flash](https://huggingface.co/Cloudflare/clef-flash/tree/17f0b0ad64efb65d273590632833508766b2aae6) (revision `17f0b0a`, Apache-2.0): a state (text, JSON or an image) and typed questions in, the probability of every option of every question out, from one prefill.
24
+
25
+ | Variant | Path | Size | Requires | Tested on |
26
+ |---|---|---:|---|---|
27
+ | Decoder, fp16 (default) | `gpu-pipelined/clef_flash_decode_fp16_pf64/` | 15,900 MB | macOS 27 | M4 Max, macOS 27.0 (26A428), 2026-10-03 |
28
+ | Decoder, int8 except layers 0–11 | `gpu-pipelined/clef_flash_decode_int8mix_pf64/` | 11,847 MB | macOS 27 | M4 Max, macOS 27.0 (26A428), 2026-10-03 |
29
+ | Joint schema head (graph) | `gpu-pipelined/clef_flash_head_bucket_fp16w32/` | 244 MB | macOS 27 | M4 Max, macOS 27.0 (26A428), 2026-10-03 |
30
+ | lm_head gather table (host) | `host/lm_head_fp16.bin` | 2,034 MB | — | M4 Max, macOS 27.0 (26A428), 2026-10-03 |
31
+ | Vision tower, 256×256 → 64 image rows | `gpu-pipelined/clef_flash_g256_vision_fp16w32/` | 909 MB | macOS 27 | M4 Max, macOS 27.0 (26A428), 2026-10-03 |
32
+ | Vision tower, 448×448 → 196 image rows | `gpu-pipelined/clef_flash_g448_vision_fp16w32/` | 912 MB | macOS 27 | M4 Max, macOS 27.0 (26A428), 2026-10-03 |
33
+
34
+ A decision needs one decoder, the head and the table; an image adds one tower. Mac only: the decoder alone is 15.9 GB (fp16) or 11.8 GB (int8mix). On the M4 Max a 436-token decision takes 0.95 s in Swift ([measured below](#time-per-decision)).
35
+
36
+ ```swift
37
+ import CoreAI
38
+ import ClefFlash
39
+
40
+ let root = URL(filePath: "clef-flash-CoreAI") // a download of the HF repo
41
+ let gp = root.appending(path: "gpu-pipelined")
42
+ var decoderOptions = SpecializationOptions(preferredComputeUnitKind: .gpu)
43
+ decoderOptions.expectFrequentReshapes = true
44
+ let gpu = SpecializationOptions(preferredComputeUnitKind: .gpu)
45
+ let decider = try await ClefDecider(
46
+ assets: .init(decoderBundle: gp.appending(path: "clef_flash_decode_fp16_pf64"),
47
+ head: gp.appending(path: "clef_flash_head_bucket_fp16w32"),
48
+ table: root.appending(path: "host/lm_head_fp16.bin"),
49
+ towers: [.g448: gp.appending(path: "clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel")]),
50
+ decoderOptions: decoderOptions, headOptions: gpu, towerOptions: gpu) // nil decoder / headAsset = the .aimodel (JIT)
51
+ let request = try SystemOneRequest(data: try Data(contentsOf: requestURL))
52
+ let response = try await decider.decide(request: request, image: cgImage, grid: .g448) // image: nil = text only
53
+ print(PythonJSON.dumps(response, sortKeys: false))
54
+ // {"model":"clef-flash","answers":{"department":{"type":"choice","choice":…,"confidence":…,"probabilities":{…}},…},
55
+ // "usage":{"input_tokens":…,"output_tokens":0}}
56
+ ```
57
+
58
+ The snippet uses the [`ClefFlash`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/ClefFlash) 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/clef-flash/README.md); the rest of this page is the same text with repository links.
59
+
60
+ Source [Cloudflare/clef-flash](https://huggingface.co/Cloudflare/clef-flash/tree/17f0b0ad64efb65d273590632833508766b2aae6) (revision `17f0b0a`) · base Qwen/Qwen3.5-9B
61
+
62
+ A **decision model**. Give it a state (text, JSON or an image) and typed questions: `noul` (true /
63
+ false), `choice` (named options) or `score` (ordered levels). It returns a probability for every
64
+ allowed option of every question from one prefill. It never generates text. Requests and responses
65
+ use the SystemOne-compatible request shape: `{model, state, questions}` in, `{model, answers, usage}`
66
+ out, one typed decision per question.
67
+
68
+ Cloudflare post-trained it from Qwen3.5-9B. Their announcement: "By freezing Qwen3.8-27B for Clef and
69
+ Qwen3.5-9B for Clef-flash, we jointly optimized the routing head alongside rank-256 low-rank
70
+ adapters." The checkpoint ships the backbone (24 Gated DeltaNet + 8 full-attention layers, a
71
+ 27-block vision tower) as sharded safetensors, plus a 121.8M-parameter joint schema head that reads
72
+ the backbone's final hidden states. The author's card reports benchmark results; none of them are
73
+ re-measured here.
74
+
75
+ This port runs that readout as three Core AI graphs and one host table. The **decoder** is the
76
+ Qwen3.5 hybrid with token ids in, the image rows as a static input and M-RoPE derived inside the
77
+ graph. It returns the final-norm hidden state at every position and has no vocabulary head. One
78
+ call takes 64 tokens. Two bundles: fp16 (15.9 GB, the default) and int8mix (int8 per block of 32
79
+ except layers 0–11, 11.8 GB). The **vision tower** is baked at a fixed grid, `g256` (64 image
80
+ tokens) or `g448` (196), fp16 weights read through a cast with fp32 math (909 / 912 MB). The
81
+ **head** is the author's joint schema head written as plain matrices, 244 MB, with four static key
82
+ lengths. The untied `lm_head.weight` stays on the host as a 2.03 GB fp16 gather table for the head's
83
+ lexical term. The gate is probability parity with the author's own fp32 code, on every option of
84
+ every question, on a self-made fixture and on a held-out record set written after the int8 layers
85
+ were chosen.
86
+
87
+ The port runs on the Mac GPU. iPhone is not a target: the decoder alone is 15.9 GB (fp16) or
88
+ 11.8 GB (int8mix), and an iOS app had about 6.4 GB available on an iPhone 18 Pro with the
89
+ increased-memory-limit entitlement ([decider-2b-vision](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/decider-2b-vision/README.md)).
90
+
91
+ ## Readout contract
92
+
93
+ One record per request, every question answered in the same pass. The ids are the checkpoint's
94
+ `encode_record()`: prefix + [image block] + state + schema + suffix, each piece tokenized on its own
95
+ without special tokens, then concatenated:
96
+
97
+ ```
98
+ <|im_start|>system\nRead the complete state and schema. Decide every field jointly. Each answer must be exactly one of that field's allowed options.<|im_end|>\n<|im_start|>user\nSTATE:\n[<|vision_start|><N image tokens><|vision_end|>\n]<state>\n\nSCHEMA FIELDS:\n\nFIELD 1\nID: <question id>\nTYPE: <type>\nINSTRUCTION: <instructions>\nALLOWED OPTIONS:\nOPTION 1: {"description":"…","option_id":"…"}\nOPTION 2: …\nEND FIELD\n\nFIELD 2\n…END FIELD\n\n<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nJOINT SCHEMA DECISIONS:
99
+ ```
100
+
101
+ - The prefix is 36 tokens for every record and the suffix 18, ending in `:` (25). The image block
102
+ starts at index 36: `<|vision_start|>` (248053), N image tokens, `<|vision_end|>` (248054), `\n`.
103
+ - `render()`: a string as is, anything else `json.dumps(sort_keys=True, ensure_ascii=False,
104
+ separators=(",", ":"))`. The state is rendered this way; so is each question's instructions (the
105
+ question id when there are none) and each option's `{"option_id", "description"}`.
106
+ - A question's span is its rendered instructions; an option's span is its rendered object. The head
107
+ averages the hidden rows over each span, reads the last token as a global vector, and averages the
108
+ `lm_head.weight` rows of each option span's ids (the lexical term).
109
+ - Option order: `noul` = (true, false), with the default descriptions "The proposition is true or the
110
+ answer is yes." / "…false or the answer is no." unless the request overrides them; `choice` = option
111
+ ids sorted as strings; `score` = levels 0..n−1.
112
+ - Probabilities: a float32 softmax per question over that question's options. Response: `noul` →
113
+ p(true); `choice` → the argmax id, its p, every p; `score` → Σ level·p, the largest p, the legend,
114
+ every p; all rounded to 4 decimals. `usage` = `{input_tokens: T, output_tokens: 0}`.
115
+ - Image: one image per request. RGB → Pillow BICUBIC resize to 256×256 or 448×448 (the aspect ratio is
116
+ not kept) → /255 → (x − 0.5) / 0.5 → merge-block-major patches `[4G², 1536]`, the frame repeated at
117
+ both temporal slots. The author's processor picks a grid per image (at least 256×256);
118
+ [what a fixed grid costs](#what-a-fixed-grid-costs-the-authors-code-only) is measured below. The
119
+ graph takes the image tokens as ids V + k (V = 248,320, k row-major over the merged grid), so each
120
+ token names its tower row.
121
+ - Text-only record: no image block, the same bundle, zero image rows and `rope_shift_start` = 2³⁰.
122
+ - Length: a record and its padded last call must fit 4,096 tokens, the image block included. The
123
+ author's own cut at 16,384 tokens is never reached.
124
+
125
+ `conversion/clef_flash/oracle_clef.py` runs the checkpoint's own `joint_schema_model.py`
126
+ (`load_release_model()` + `systemone()`, fp32, CPU) and records the reference:
127
+ [`fixtures-clef-flash.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/fixtures-clef-flash.json). It holds 216 records with their requests,
128
+ ids, spans, option logits and probabilities: 186 written for the port (16 text states, three of
129
+ them about 2,000 tokens; 12 JSON states; 10 images drawn by `make_fixtures.py`; 4 CC0 photographs;
130
+ the 144 `choice` items of SemIf authored144) and 30 written later as a held-out set. Each image
131
+ record runs at `g256`, `g448` and `native` (the processor's own grid): 214 runs, 405 questions. The
132
+ gates use 213 runs and 401 questions: `photo_01` at `native` has 1,200 image rows, more than the
133
+ graph's 1,024-row buffer. Four questions have an oracle top-2 margin of 0.02 or less (near-ties) and
134
+ are listed apart. The held-out set runs text, `g256` and `g448`: 40 runs, 188 questions, 2 near-ties.
135
+
136
+ ## Core AI shape
137
+
138
+ **Decoder.** `conversion/clef_flash/qwen3_5_clef_decoder.py`: decider-2b-vision's ids-input Qwen3.5
139
+ VL decoder (`conversion/decider_vision/qwen3_5_vl_pipelined.py`) at 9B, without the vocabulary head,
140
+ returning the hidden state at every position. One function, `main`, at a static 64 tokens; the Gated
141
+ DeltaNet recurrence is unrolled in the graph.
142
+
143
+ | | name | shape, type |
144
+ |---|---|---|
145
+ | inputs | `input_ids` | [1, 64] int32 |
146
+ | | `position_ids` | [1, seq] int32, the ramp 0 .. seq − 1 |
147
+ | static inputs | `image_embeds` | [1024, 4096] fp16: tower rows 0..N−1, the rest zero |
148
+ | | `image_rc` | [1024, 2] int32: (k // W, k % W) for image token k |
149
+ | | `rope_shift_start` | [1] int32: 37 + N, the `<\|vision_end\|>` index |
150
+ | | `rope_shift_amount` | [1] int32: N − max(H, W) |
151
+ | states | `keyCache`, `valueCache` | [8, 1, 4, ctx, 256] fp16, ctx up to 4,096 |
152
+ | | `convState`, `recState` | [24, 1, 8192, 3], [24, 1, 32, 128, 128] fp16 |
153
+ | output | `hidden` | [1, 64, 4096] fp16, every position |
154
+
155
+ Per record, from zeroed states: ⌈T / 64⌉ calls, call k with ids[64k : 64k + 64] and position_ids
156
+ 0..64k + 63; the last call is padded with `<|endoftext|>` (248044) and its padded rows are dropped.
157
+ The rows of every call, cut to T, are the backbone's final-norm `last_hidden_state [T, 4096]`. The
158
+ bundle's `metadata.json` says `kind: decision-backbone` and carries this order, the prompt pieces,
159
+ the span rules, the option order and the response shape.
160
+
161
+ **Towers.** The overlay's `qwen3_5_vision.Qwen3_5VisionEncoder` through
162
+ `conversion/export_qwen38vl_pipelined.py --skip-decoder --vision-dtype fp16w32`, baked at 8×8 or
163
+ 14×14 merged tokens: patches `[4G², 1536]` f32 → `image_embeds [G², 4096]` f32.
164
+
165
+ **Head.** `conversion/clef_flash/clef_head.py`, `ClefHeadGraph`: the author's `JointSchemaHead` (its
166
+ own submodules, `load_state_dict(strict=True)`) for one record, its Python loops over questions and
167
+ options written as matrices, fp16 weights read through a cast with fp32 math. Ten inputs: `hidden
168
+ [T, 4096]` f32, `key_valid [T]`, `q_avg [Q, T]` and `o_avg [O, T]` (1/len over each span), `g_avg
169
+ [1, T]` (the last real token), `lexical [O, 4096]`, `member [Q, O]`, `type_ids [Q]` int32, `q_valid
170
+ [Q]`, `o_valid [O]`; output `logits [O]` f32. Four functions share the weights, `t512`, `t1024`,
171
+ `t2048`, `t4096`; the host pads T to the smallest that holds it, Q to 16 and O to 128, with zero rows
172
+ and valid flags 0. Its `metadata.json` says `kind: decision-head`. Above 2,048 keys the head's
173
+ attention runs in key blocks of at most 2,048 (see [Precision](#precision)).
174
+
175
+ **Host.** Builds the ids and spans, preprocesses the image, runs the decoder calls, converts the
176
+ hidden rows to f32 and builds the ten head arrays (the lexical rows from `host/lm_head_fp16.bin`,
177
+ `[248320, 4096]` fp16, row t at byte offset t × 8192), then the per-question softmax and the
178
+ response. `conversion/clef_flash/decide.py` is the Python reference; `apps/ClefFlash` is the Swift
179
+ one.
180
+
181
+ No engine is involved: the hosts drive the low-level runtime (`AIModel` + `loadFunction`, four
182
+ zeroed states per record). No runtime patch.
183
+
184
+ ## Measured (Apple M4 Max, macOS 27.0 26A428, 2026-10-03)
185
+
186
+ The bar, fixed before any graph ran: the argmax equal to the oracle's on every question whose oracle
187
+ top-2 margin is above 0.02 (near-ties listed apart), max |Δp| ≤ 0.02 over every option of every
188
+ question, the mean over runs of each run's mean |Δp| ≤ 0.002, and every process re-running its first
189
+ run bit for bit. The Python gates load AOT `.aimodelc` assets (`coreai-build compile … --platform
190
+ macOS --preferred-compute gpu --architecture h16c`, `--expect-frequent-reshapes` for the decoder) with
191
+ `SpecializationOptions.default()`; their times are on a GPU shared with other work.
192
+
193
+ ### Before any graph: fp32 torch
194
+
195
+ The decoder module in fp32 on the CPU, driven like the graph (chunks from zeroed states, the unrolled
196
+ recurrence, M-RoPE in the module, the oracle's own tower rows), read through the author's head: 214
197
+ runs, argmax 405/405, max |Δp| 9.6e-6, lowest per-position hidden cosine 0.99999939; its M-RoPE
198
+ planes equal the oracle's on 214/214 runs. With zero image inputs its hidden state equals the
199
+ overlay's plain Qwen3.5 text decoder bit for bit (3/3 runs). Zeroing the image rows changes 2 of 3
200
+ answers on `img_07` at `g448` and on `img_01` at `g256` (max |Δp| 0.66 / 0.75)
201
+ ([`gate-clef-flash-torch-parity.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-torch-parity.json)).
202
+
203
+ The host spec (`conversion/clef_flash/host.py`) rebuilds every oracle run's ids, image offset, spans,
204
+ option order and M-RoPE planes: 242/242 runs with two tokenizer implementations. Its Pillow-resized
205
+ patches equal the processor's `pixel_values` bit for bit on all 56 fixed-grid runs.
206
+
207
+ ### Vision tower
208
+
209
+ The shipped fp16w32 tower, AOT for the Mac GPU, fed the host's patches, against the oracle's fp32
210
+ tower rows: `g256` 14/14 images, worst image cosine 0.9999999994, worst row 0.99999995; `g448`
211
+ 14/14, 0.9999999994 and 0.99999995; 31 / 79 ms per image on the shared GPU. Patches in raster order
212
+ instead of merge-block order miss on every image ([`gate-clef-flash-tower.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-tower.json)).
213
+
214
+ ### Decoder alone on the Mac GPU: 213 fixture runs
215
+
216
+ The oracle's ids and fp32 image rows in, the fp16 hidden read through the author's fp32 head:
217
+
218
+ | decoder | chunk | argmax (margin > 0.02) | near-ties agreeing | max \|Δp\| | mean of run means | bar |
219
+ |---|---:|---:|---:|---:|---:|---|
220
+ | **fp16 (default)** | 64 | **397/397** | **4/4** | **0.0112** | **0.00054** | **PASS** |
221
+ | **int8mix: int8 except layers 0–11** | 64 | **397/397** | **4/4** | **0.0153** | **0.00089** | **PASS** |
222
+ | int8lin: every decoder linear int8 | 64 | 397/397 | 3/4 | 0.0748 | 0.00192 | FAIL |
223
+ | fp16 | 16 | 397/397 | 4/4 | 0.0127 | 0.00053 | PASS |
224
+
225
+ int8 is per block of 32 (`symmetric_with_clipping`, weights only); the embedding table, the Gated
226
+ DeltaNet conv1d and every norm stay fp16. int8lin misses on 9 of 213 runs, worst a SemIf record at
227
+ 0.0748 (fp16 on the same record: 0.0105), and flips the `img_06` `g448` near-tie (margin 0.0175).
228
+ The red arm, the image rows zeroed on `img_07` `g448` and `img_01` `g256`, moves p by 0.66 and 0.75
229
+ and changes one or two of the three answers on every bundle that ran it. Transcripts:
230
+ `gate-clef-flash-readout-<bundle>.json`.
231
+
232
+ ### The head graph
233
+
234
+ The head graph alone on the oracle's fp32 hidden: 214 runs, argmax 405/405, max |Δp| 1.8e-7; held
235
+ out, 40 runs, 188/188, 1.8e-7. End to end in Python from the fp16 decoder's hidden through the host
236
+ arrays and the head graph: the same values as the author's fp32 head on that hidden (0.0112 fixture,
237
+ 0.0085 held out), within 1.8e-7 / 2.4e-7. Three perturbed arms on 4 runs each move p: span rows one
238
+ token late by 0.003–0.056, the lexical term zeroed by 0.017–0.055, option membership rotated by
239
+ 0.051–0.348. `decide.py` from the raw request, on 12 fixture and 12 held-out requests: ids and spans
240
+ equal the oracle's 24/24, every choice equal (18/18, 32/32), the 4-decimal values within 0.0082
241
+ ([`gate-clef-flash-head.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-head.json)).
242
+
243
+ ### Held out: 40 runs that no choice was made on
244
+
245
+ 30 records written after the int8 layers were chosen, with new names, drawings and photographs and a
246
+ novelty check against the fixture (no shared record, image, name or 8-word run), and their own fp32
247
+ oracle run:
248
+
249
+ | decoder | argmax (margin > 0.02) | near-ties agreeing | max \|Δp\| | mean of run means | bar |
250
+ |---|---:|---:|---:|---:|---|
251
+ | fp16 (default) | 186/186 | 2/2 | 0.0085 | 0.00036 | PASS |
252
+ | int8mix | 186/186 | 1/2 | 0.0171 | 0.00063 | PASS |
253
+
254
+ int8mix flips the `ho_t07` near-tie (oracle margin 0.0117: p 0.4102 / 0.3985, int8mix 0.3979 /
255
+ 0.4059) ([`gate-clef-flash-heldout.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-heldout.json)).
256
+
257
+ ### What a fixed grid costs (the author's code only)
258
+
259
+ `conversion/clef_flash/grid_price.py` runs the checkpoint's own code on the 14 image records (50
260
+ questions), the image resized to a square grid first, against the processor's own grid (`native`),
261
+ fp32 on the CPU:
262
+
263
+ | arm | image tokens | argmax = native | max \|Δp\| vs native | mean \|Δp\| vs native | gold correct |
264
+ |---|---:|---:|---:|---:|---:|
265
+ | native | 412 (mean) | — | — | — | 35/38 |
266
+ | `g256` | 64 | 46/50 | 0.959 | 0.039 | 33/38 |
267
+ | `g448` | 196 | 48/50 | 0.436 | 0.018 | 36/38 |
268
+ | 672×672 | 441 | 48/50 | 0.350 | 0.016 | 36/38 |
269
+ | 896×896 | 784 | 48/50 | 0.244 | 0.013 | 36/38 |
270
+
271
+ The two larger grids agree with `native` no more often than `g448`, so only `g256` and `g448` ship
272
+ ([`gate-clef-flash-variants.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-variants.json)).
273
+
274
+ ### Swift ([`apps/ClefFlash`](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/ClefFlash), Mac, Release)
275
+
276
+ Images through the Swift tower; the 13 `native` fixture runs fed the oracle's rows:
277
+
278
+ | decoder asset | fixture 213: argmax / near-ties / max \|Δp\| / mean | held-out 40 |
279
+ |---|---|---|
280
+ | fp16, AOT `.aimodelc` | 397/397, 4/4, 0.0122, 0.00054 | 186/186, 2/2, 0.0082, 0.00037 |
281
+ | fp16, JIT: the `.aimodel` specialized by the Swift runtime | the same values | the same values |
282
+ | int8mix, AOT | 397/397, 4/4, 0.0153, 0.00089 | 186/186, 1/2, 0.0171, 0.00065 |
283
+ | int8mix, JIT | 397/397, 4/4, 0.0148, 0.00089 | 186/186, 1/2, 0.0173, 0.00065 |
284
+
285
+ - On identical inputs Swift computes what Python computes: ids and spans from the raw request
286
+ 253/253 runs; the renderer = CPython's `json.dumps` / `repr` / `round(x, 4)` on 2,204 values and
287
+ 199,994 doubles; tiles and patches = Pillow and the oracle's `pixel_values` on 48/48; tower rows =
288
+ the Python runtime's on 48/48; with fp16 AOT, hidden rows and head logits bit-equal on 185 + 20
289
+ runs and on the 48 runs fed the oracle's image rows (int8mix AOT: hidden rows bit-equal on the
290
+ same runs), and responses = `decide.py`'s on 24/24. The image runs differ from the Python table
291
+ above only through the tower rows (the Python readout fed the oracle's).
292
+ - JIT against AOT: fp16 bit-equal on 253/253 runs (hidden, logits, responses). int8mix is not
293
+ bit-equal on any run: max |Δp| 0.0014, max |Δlogit| 0.020, argmax 589/589.
294
+ - The JIT's first specialization: fp16 56.1 s (the decoder 50.0 s), the runtime's cache +31.8 GB,
295
+ 4.5 s from the cache; int8mix 42.3 s (39.2 s), +17.0 GB, 3.0 s.
296
+ - Changing one word of one question moves the ids and spans off the oracle's and moves p (up to
297
+ 0.0056 on `own_t01`).
298
+
299
+ Transcript: [`gate-clef-flash-swift.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-swift.json).
300
+
301
+ ### Time per decision
302
+
303
+ Swift, Release CLI, AOT assets, the machine-wide GPU lock taken with the GPU at 0 %. Two passes per
304
+ bundle, each in its own process, one warm-up decision, then 11 decisions × 3; wall time from the file
305
+ read to the response, ms:
306
+
307
+ | record | T | decoder calls | head | fp16 median (min–max) | int8mix median | tokenize | image decode + resize + patches | tower | decoder | head |
308
+ |---|---:|---:|---|---:|---:|---:|---:|---:|---:|---:|
309
+ | SemIf `a3f18f3a` | 185 | 3 | t512 | 411 (411–416) | 412 | 0.8 | – | – | 401 | 7.4 |
310
+ | SemIf `6149a17b` | 200 | 4 | t512 | 545 (544–547) | 547 | 0.9 | – | – | 535 | 7.4 |
311
+ | `own_t01` | 436 | 7 | t512 | 949 (947–949) | 951 | 1.9 | – | – | 938 | 7.4 |
312
+ | `own_t11` | 497 | 8 | t512 | 1,084 (1,082–1,085) | 1,085 | 2.2 | – | – | 1,073 | 7.4 |
313
+ | `own_t12` | 967 | 16 | t1024 | 2,165 (2,157–2,167) | 2,168 | 3.9 | – | – | 2,147 | 12.0 |
314
+ | `own_t16` | 2,494 | 39 | t4096 | 5,289 (5,280–5,293) | 5,291 | 10.8 | – | – | 5,249 | 27.7 |
315
+ | `own_t15` | 2,603 | 41 | t4096 | 5,563 (5,551–5,576) | 5,572 | 11.7 | – | – | 5,522 | 27.5 |
316
+ | `photo_02` `g256` | 499 | 8 | t512 | 1,138 (1,136–1,142) | 1,139 | 1.7 | 11.6 | 39.6 | 1,073 | 10.0 |
317
+ | `img_04` `g256` | 558 | 9 | t1024 | 1,273 (1,271–1,276) | 1,276 | 1.7 | 8.9 | 40.0 | 1,207 | 12.3 |
318
+ | `photo_02` `g448` | 631 | 10 | t1024 | 1,457 (1,455–1,459) | 1,459 | 1.8 | 13.4 | 87.1 | 1,342 | 12.1 |
319
+ | `img_04` `g448` | 690 | 11 | t1024 | 1,586 (1,584–1,600) | 1,587 | 2.0 | 11.3 | 87.2 | 1,475 | 9.9 |
320
+
321
+ The stage columns are the fp16 medians. One decoder call (64 tokens) takes 134.2 ms with fp16 (936
322
+ calls, 132.6–145.3) and 134.3 ms with int8mix (132.7–149.8). Load from the runtime's cache 3.3 s
323
+ (fp16); int8mix 13.3 s in its first pass, right after the fp16 passes, and 2.9 s in the second. The
324
+ first decision of a process takes 3.4–3.7 s, its first decoder call 2.6–2.8 s. Zeroing the four
325
+ states takes 1.3 ms. Transcript: [`gate-clef-flash-timing.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-timing.json).
326
+
327
+ ## Precision
328
+
329
+ **int8.** int8 over every decoder linear misses the bar (int8lin above). An fp32 torch bisect with
330
+ the exporter's own int8 weights (`conversion/clef_flash/int8_bisect_torch.py`, the six runs int8lin
331
+ misses worst) puts the error in layers 0–15: those 16 layers in fp16 leave the worst run at 0.0023,
332
+ layers 16–31 in fp16 change nothing (0.0845, all int8: 0.0842). The error is spread out and partly
333
+ cancels: one kind of linear alone in int8 is already large (Gated DeltaNet projections 0.0752, MLP
334
+ 0.0342, attention 0.0230), no single fp16 layer brings the worst run below 0.0492, and some single
335
+ layers make it worse (layer 3: 0.1164).
336
+
337
+ The rule was written before any bisect result: worst run ≤ 0.010, no run worse than int8lin, at most
338
+ six fp16 layers, the smallest set. No set met it; the ranked sets of two to six layers stayed at
339
+ 0.0260–0.0350. Contiguous fp16 blocks, run after the rule's search and outside it:
340
+
341
+ | fp16 layers | 0–7 | 0–8 | 0–9 | 0–10 | 0–11 | 4–15 | 8–15 | 12–15 |
342
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|
343
+ | worst run max \|Δp\| | 0.0568 | 0.0509 | 0.0232 | 0.0116 | 0.0069 | 0.0207 | 0.0296 | 0.0939 |
344
+
345
+ int8mix keeps layers 0–11 fp16, twelve layers, outside the rule's cap. It was chosen on the
346
+ fixture; the held-out records above are its test (186/186, max 0.0171). It saves 4.05 GB against
347
+ fp16 (`main.mlirb` 11,826,520,241 vs 15,880,253,283 bytes) and no time: on the same 202 runs a call
348
+ takes 134.4 ms (int8mix), 134.3 (int8lin) and 134.2 (fp16); why int8 buys no time is not isolated
349
+ ([`gate-clef-flash-int8-bisect.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-int8-bisect.json)).
350
+
351
+ **fp16.** The fp16 decoder passes with room, but a few hidden rows drift: 50 of 73,343 positions
352
+ have a cosine below 0.99 against the oracle (34 of them image rows), 6 below 0.9, one below 0.5,
353
+ 0.41 at an image row of `photo_04` `g448`, a run whose max |Δp| is 1.1e-4. The fp16 module in torch
354
+ on MPS finds the same row hardest but keeps it at 0.877. Computing the full-attention linears and SDPA
355
+ in fp32 does not lift it (38 runs: lowest 0.378 vs 0.407, 53 vs 48 positions below 0.99, max |Δp|
356
+ 0.0075 in both, 7% slower per call). Which op opens the gap is not isolated
357
+ ([`gate-clef-flash-variants.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-variants.json)).
358
+
359
+ **Chunk width.** 64 tokens per call: 134.2 ms per call, 2.26 ms per token, against 58.8 ms and 3.77
360
+ ms per token at 16 (202 runs, shared GPU), the argmax equal on all 213 runs and p within 0.0043. 128
361
+ tokens per call bought nothing on 19 runs: 2.14 vs 2.19 ms per token, 1.227 vs 1.210 s per run with
362
+ the longer padding.
363
+
364
+ **Head attention over long inputs.** On this GPU stack the plain `softmax(q kᵀ · s + b) v` chain
365
+ compiled for the head gave wrong values, different on every call, from 4,032 keys on (exact at
366
+ 3,584), while each op alone was exact at 4,096. Keys in blocks of at most 2,048 with one shared max
367
+ are exact at 4,032 and 4,096 (max |d| 5.7e-7), so the `t4096` function uses that form. The decoder's
368
+ own attention showed nothing of the kind on a 4,050-token row whose last calls attend 4,032 and 4,096
369
+ keys: one position of 4,050 is below a cosine of 0.99 (index 1,300, 0.9585), max |Δp| 6.1e-4
370
+ ([`gate-clef-flash-head.json`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/gate-clef-flash-head.json)).
371
+
372
+ **The lm_head table.** fp16 rows move p by at most 1.8e-7 (the fp32 table's own re-run floor); int8 per
373
+ row would move it by 4.4e-4 and save 1.0 GB. The table ships in fp16.
374
+
375
+ ## ⬇️ Bundle
376
+
377
+ Five folders under `gpu-pipelined/` and the table under `host/`. A decision needs one decoder, the head and the
378
+ table; an image adds one tower.
379
+
380
+ | folder | what | main.mlirb bytes | main.mlirb sha256 |
381
+ |---|---|---:|---|
382
+ | `gpu-pipelined/clef_flash_decode_fp16_pf64/` | decoder, fp16 (default): `.aimodel` + `metadata.json` + `tokenizer/` | 15,880,253,283 | `0b7dfa30…b9bea8` |
383
+ | `gpu-pipelined/clef_flash_decode_int8mix_pf64/` | decoder, int8 except layers 0–11, same layout | 11,826,520,241 | `2c19a0e7…6a67b9` |
384
+ | `gpu-pipelined/clef_flash_g256_vision_fp16w32/` | tower, 256×256 → 64 rows (`.aimodel`) | 909,207,876 | `b2adb039…64f31d` |
385
+ | `gpu-pipelined/clef_flash_g448_vision_fp16w32/` | tower, 448×448 → 196 rows (`.aimodel`) | 911,945,013 | `04d8629b…3a1eaa` |
386
+ | `gpu-pipelined/clef_flash_head_bucket_fp16w32/` | joint schema head, `t512`–`t4096` (`.aimodel` + `metadata.json`) | 243,978,965 | `51e512ad…6856fe` |
387
+
388
+ | file | what | bytes | sha256 |
389
+ |---|---|---:|---|
390
+ | `host/lm_head_fp16.bin` | the untied `lm_head.weight`, `[248320, 4096]` fp16, row-major, no header | 2,034,237,440 | `bfccf00b…1ba36d` |
391
+ | `host/lm_head_fp16.json` | its shape, dtype, source tensor and read-back check | 2,939 | `ef89e2fb…b75e86a` |
392
+
393
+ `SHA256SUMS` in the repository lists every file. The Hub revision is filled in after the upload.
394
+
395
+ No AOT asset ships: the Swift runtime specializes the `.aimodel` files correctly on the Mac (the JIT
396
+ rows above); the decoder's AOT compile is 29.7 GB (fp16) / 25.7 GB (int8mix). The author's
397
+ `joint_head.safetensors` is not included, because the head graph carries its weights. The source's
398
+ `config.json` and `joint_head_config.json` are in the repository verbatim, with its Apache-2.0
399
+ `LICENSE`.
400
+
401
+ ## Use it
402
+
403
+ Swift: the snippet at the top of this page.
404
+
405
+ The same from the CLI (`swift build -c release --package-path apps/ClefFlash` builds `clef-flash`):
406
+
407
+ ```bash
408
+ R=clef-flash-CoreAI; G=$R/gpu-pipelined
409
+ clef-flash ask --decoder-asset jit --decoder $G/clef_flash_decode_fp16_pf64 --head $G/clef_flash_head_bucket_fp16w32 \
410
+ --table $R/host/lm_head_fp16.bin \
411
+ --tower-g448 $G/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel \
412
+ --request req.json --image x.png --grid 448 --out resp.json
413
+ ```
414
+
415
+ A request, in the SystemOne-compatible request shape:
416
+
417
+ ```json
418
+ {"model": "clef-flash",
419
+ "state": "Our checkout started returning errors and orders are blocked.",
420
+ "questions": {
421
+ "department": {"type": "choice", "instructions": "Which team should handle the message?",
422
+ "criteria": {"billing": "Payments or invoices", "technical": "Bugs or outages"}},
423
+ "urgency": {"type": "score", "criteria": ["Can wait", "This week", "Today"]},
424
+ "outage": {"type": "noul", "instructions": "Is a service down?"}}}
425
+ ```
426
+
427
+ Python: `conversion/clef_flash/decide.py run --request req.json [--image x.png --grid 448] --out
428
+ resp.json` is the gates' own read-out with `coreai.runtime`. It loads AOT `.aimodelc` assets only
429
+ (compile each `.aimodel` with the `aot` line of [`recipe.toml`](https://github.com/john-rocky/coreai-model-zoo/blob/main/models/clef-flash/recipe.toml)); the Python gates never
430
+ used the Python runtime's JIT.
431
+
432
+ ## Reproduce
433
+
434
+ Environment: the zoo overlay venv (coreai-core 1.0.0b2, coreai-torch 0.4.1, torch 2.9.0,
435
+ transformers 4.57.6), the source snapshot pinned at `17f0b0a` in `HF_HOME`, `HF_HUB_OFFLINE=1`,
436
+ Xcode 27.0 RC. The author's code runs in its own venv (transformers 5.17.0, torch 2.9.0). The steps,
437
+ in order, with every flag, are in [`conversion/clef_flash/README.md`](https://github.com/john-rocky/coreai-model-zoo/blob/main/conversion/clef_flash/README.md).
438
+
439
+ ```bash
440
+ # towers: the Qwen3.8-27B vision exporter with the HF id and the grid set
441
+ python conversion/export_qwen38vl_pipelined.py --hf-id Cloudflare/clef-flash --name clef_flash_g256 \
442
+ --grid-h 8 --grid-w 8 --skip-decoder --vision-dtype fp16w32 --out-dir <work>/_clefflash/exports
443
+ python conversion/export_qwen38vl_pipelined.py --hf-id Cloudflare/clef-flash --name clef_flash_g448 \
444
+ --grid-h 14 --grid-w 14 --skip-decoder --vision-dtype fp16w32 --out-dir <work>/_clefflash/exports
445
+ # decoders (--aot adds the h16c .aimodelc the Python gates load)
446
+ python conversion/clef_flash/export_decoder.py fp16 --prefill-chunk 64 --aot
447
+ python conversion/clef_flash/export_decoder.py int8mix --fp16-layers 0,1,2,3,4,5,6,7,8,9,10,11 --prefill-chunk 64 --aot
448
+ # head and host table
449
+ python conversion/clef_flash/export_head.py --shape bucket --weights fp16w32 --aot
450
+ python conversion/clef_flash/export_lm_head_table.py
451
+ ```
452
+
453
+ Port notes: [`knowledge/clef-flash-port.md`](https://github.com/john-rocky/coreai-model-zoo/blob/main/knowledge/clef-flash-port.md).
454
+
455
+ ## Other formats
456
+
457
+ On the Hub (2026-10-03), not run here: MLX conversions with the joint head,
458
+ `mlx-community/clef-flash-4bit` and `-8bit` and `TrevorJS/clef-flash-mlx-4bit` and `-8bit`; an
459
+ OpenVINO conversion with the head, `meossistant/clef-flash-openvino`; GGUF conversions such as
460
+ `bartowski/Cloudflare_clef-flash-GGUF`, which carry no joint head file. mlx-community's card on the
461
+ backbone alone: "It is not a chat model — `mlx_vlm.generate`, `mlx_lm.generate`, and LM Studio will
462
+ load the backbone but produce meaningless text." No other Core AI conversion of clef-flash was
463
+ listed on the Hub on 2026-10-03.
464
+
465
+ ## License
466
+
467
+ Source Apache-2.0 (Cloudflare/clef-flash, following its base Qwen/Qwen3.5-9B, also Apache-2.0); the
468
+ bundles inherit it, and the Hugging Face repository carries the source's `LICENSE`. The author's
469
+ `joint_schema_model.py` runs only in the oracle and the reference scripts at gate time; it is not
470
+ part of the bundles. The fixture's drawn images are generated by `make_fixtures.py` (CC0-1.0); its
471
+ photographs are Wikimedia Commons files marked CC0 (each file page, thumbnail URL and sha256 is in
472
+ the fixture); its 144 SemIf authored144 items are MIT (github.com/TheoLeeCJ/SemIf at `ca3ba65f`), and
473
+ the fixture carries their copyright and permission notice. The records written for the port use
474
+ invented people, organisations and places.
SHA256SUMS ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ bbedc3fda3305820b977265f01b8619d87570a6739de3a5582c3464840f1e57a LICENSE
2
+ b0d697896e40d9cb44ab811247be0a9b22d99d8d79c50896818c3b42be65b058 README.md
3
+ 66f87f6fb2616b46604daf2a9c67ddc87938296d07156efa34d59b5be49e3238 config.json
4
+ b9698210f9294274f55231d2ca521dcf3c28d767800508af89303f025c33ef76 gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.hash
5
+ 0b7dfa30a0597ead745d8f3ed9ed11fa5ac639a4c578a33a7cca7ced11b9bea8 gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.mlirb
6
+ eab5bf891361488d40409bdf287f0c5379ee820f25d421d468e765508cbb8f50 gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/metadata.json
7
+ bbd4401e72dd055c9fb9998aecf3fcd1b43ea789698bec9040c0d89412a77ae3 gpu-pipelined/clef_flash_decode_fp16_pf64/metadata.json
8
+ a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715 gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/chat_template.jinja
9
+ 06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523 gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/tokenizer.json
10
+ 91a08f825d370d085d692e04cf117cdd7faad7bf18e996f1e6031b6dab03db72 gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/tokenizer_config.json
11
+ 79cfb36d716b67f5f945f5819ef1342b278959867a541f449a6a2e09b7af571b gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.hash
12
+ 2c19a0e765a659e0f726b4b7099a62490fed6ab2e4db1246eb63fd70996a67b9 gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.mlirb
13
+ 4e838a8bd4ba48a1e5ca5cbd340a32d969ab8287984af4018aefde10372333e8 gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/metadata.json
14
+ 1eafaedf47981c83c82bf4f609615e2a33f28093b8fab3d89f86dec0e520fc36 gpu-pipelined/clef_flash_decode_int8mix_pf64/metadata.json
15
+ a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715 gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/chat_template.jinja
16
+ 06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523 gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer.json
17
+ 91a08f825d370d085d692e04cf117cdd7faad7bf18e996f1e6031b6dab03db72 gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer_config.json
18
+ 1d3470bf90972417bc5bad9e3930080a05206e887a36f15a1e70fe983812b806 gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.hash
19
+ b2adb0396f6f37f3178c0d7b413d10cddc31271c0dc7a56b2416125e9664f31d gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.mlirb
20
+ 630d7f7cbba089b019bd50db9ce9a4901232fca86415b4ff66ae1d9eb944f3bb gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/metadata.json
21
+ 4f01fd00bb557446ba3c64dec72dfe77f53313667c0c35fbc3186b6dacae6d06 gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.hash
22
+ 04d8629bedeb1af76a2e63ed677a931c187289a6478fc66bf33a7bfa523a1eaa gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.mlirb
23
+ b40a1fff26dbc2ba59d7583f8bf804b58c3d1d536e51abfbd7196fdd05ba2145 gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/metadata.json
24
+ f5fcb38a55e72369072fc1623a49bcd1b69209830abff7ac1c057955b7223a08 gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.hash
25
+ 51e512ad1e4d3bcfdc7af43c1100124bd94d539de01f09651afc9b98486856fe gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.mlirb
26
+ bfa78017346ae7bbf9e6709dff02a4c53ee2fd749d2307fe45e5c1c4ab50e4f7 gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/metadata.json
27
+ c7c4f1b1c054d938eb3523da52505a93eda8d253d94ab7cc20d2192724971fbe gpu-pipelined/clef_flash_head_bucket_fp16w32/metadata.json
28
+ 77efe959a38b5b17b241543e129e695f3c77465ece55a25985279bd8176279a0 host/joint_head_config.json
29
+ bfccf00b8d5d3f6d810839a52c2ec627700a9aaebaa26aedcb96931bd21ba36d host/lm_head_fp16.bin
30
+ ef89e2fb12d286cff9a4069365bfddad1a3455af0db7f17d7bc3156e4b75e86a host/lm_head_fp16.json
31
+ 77efe959a38b5b17b241543e129e695f3c77465ece55a25985279bd8176279a0 joint_head_config.json
config.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_token_id": 248056,
7
+ "model_type": "qwen3_5",
8
+ "text_config": {
9
+ "attention_bias": false,
10
+ "attention_dropout": 0.0,
11
+ "attn_output_gate": true,
12
+ "bos_token_id": null,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 248044,
15
+ "full_attention_interval": 4,
16
+ "head_dim": 256,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 4096,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 12288,
21
+ "layer_types": [
22
+ "linear_attention",
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "full_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "linear_attention",
29
+ "full_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "linear_attention",
33
+ "full_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "linear_attention",
37
+ "full_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "linear_attention",
41
+ "full_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "linear_attention",
45
+ "full_attention",
46
+ "linear_attention",
47
+ "linear_attention",
48
+ "linear_attention",
49
+ "full_attention",
50
+ "linear_attention",
51
+ "linear_attention",
52
+ "linear_attention",
53
+ "full_attention"
54
+ ],
55
+ "linear_conv_kernel_dim": 4,
56
+ "linear_key_head_dim": 128,
57
+ "linear_num_key_heads": 16,
58
+ "linear_num_value_heads": 32,
59
+ "linear_value_head_dim": 128,
60
+ "mamba_ssm_dtype": "float32",
61
+ "max_position_embeddings": 262144,
62
+ "mlp_only_layers": [],
63
+ "model_type": "qwen3_5_text",
64
+ "mtp_num_hidden_layers": 0,
65
+ "mtp_use_dedicated_embeddings": false,
66
+ "num_attention_heads": 16,
67
+ "num_hidden_layers": 32,
68
+ "num_key_value_heads": 4,
69
+ "pad_token_id": null,
70
+ "partial_rotary_factor": 0.25,
71
+ "rms_norm_eps": 1e-06,
72
+ "rope_parameters": {
73
+ "mrope_interleaved": true,
74
+ "mrope_section": [
75
+ 11,
76
+ 11,
77
+ 10
78
+ ],
79
+ "partial_rotary_factor": 0.25,
80
+ "rope_theta": 10000000,
81
+ "rope_type": "default"
82
+ },
83
+ "tie_word_embeddings": false,
84
+ "use_cache": true,
85
+ "vocab_size": 248320
86
+ },
87
+ "tie_word_embeddings": false,
88
+ "transformers_version": "5.10.2",
89
+ "video_token_id": 248057,
90
+ "vision_config": {
91
+ "deepstack_visual_indexes": [],
92
+ "depth": 27,
93
+ "dtype": "bfloat16",
94
+ "hidden_act": "gelu_pytorch_tanh",
95
+ "hidden_size": 1152,
96
+ "in_channels": 3,
97
+ "initializer_range": 0.02,
98
+ "intermediate_size": 4304,
99
+ "model_type": "qwen3_5_vision",
100
+ "num_heads": 16,
101
+ "num_position_embeddings": 2304,
102
+ "out_hidden_size": 4096,
103
+ "patch_size": 16,
104
+ "spatial_merge_size": 2,
105
+ "temporal_patch_size": 2
106
+ },
107
+ "vision_end_token_id": 248054,
108
+ "vision_start_token_id": 248053
109
+ }
gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ }�0�Y~�t]�>���Z�9��x�:|�|����
gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b7dfa30a0597ead745d8f3ed9ed11fa5ac639a4c578a33a7cca7ced11b9bea8
3
+ size 15880253283
gpu-pipelined/clef_flash_decode_fp16_pf64/clef_flash_decode_fp16_pf64.aimodel/metadata.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "assetVersion" : "2.0",
3
+ "producer" : "coreai-core 1.0.0b2",
4
+ "creationDate" : "20261003T025329Z"
5
+ }
gpu-pipelined/clef_flash_decode_fp16_pf64/metadata.json ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata_version": "0.2",
3
+ "kind": "decision-backbone",
4
+ "name": "clef_flash_decode_fp16_pf64",
5
+ "assets": {
6
+ "main": "clef_flash_decode_fp16_pf64.aimodel"
7
+ },
8
+ "language": {
9
+ "tokenizer": "Cloudflare/clef-flash",
10
+ "vocab_size": 248320,
11
+ "max_context_length": 4096,
12
+ "embedded_tokenizer": true,
13
+ "prefill_chunk": 64,
14
+ "static_inputs": [
15
+ "image_embeds",
16
+ "image_rc",
17
+ "rope_shift_start",
18
+ "rope_shift_amount"
19
+ ],
20
+ "image_tokens_max": 1024,
21
+ "output": "hidden [1, 64, 4096] fp16, every position",
22
+ "function_map": {
23
+ "main": [
24
+ "main"
25
+ ]
26
+ }
27
+ },
28
+ "source": {
29
+ "model_definition": "torch",
30
+ "hf_model_id": "Cloudflare/clef-flash",
31
+ "hf_revision": "17f0b0ad64efb65d273590632833508766b2aae6"
32
+ },
33
+ "compression": null,
34
+ "decision": {
35
+ "output": "hidden [1, S, 4096] per call: the final-norm hidden state at every position (no vocabulary head in the graph)",
36
+ "readout": "fresh zero states; a row of T ids runs as ceil(T / 64) calls of 'main' (static S = 64): call k gets ids[64k : 64k + 64] with position_ids 0..64k+63; 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, 64, 4096] of every call, concatenated and cut to T, are the backbone's final-norm last_hidden_state [T, 4096] the head reads.",
37
+ "prompt": {
38
+ "source": "the author's encode_record() (joint_schema_model.py at the pinned revision, sha256 0e304cf7c6500e8bb59bef7e2afd2c6373f82596dfb3b57d1aa93c175e2dc3a3); every piece tokenized on its own without special tokens, then concatenated (conversion/clef_flash/host.py build_ids)",
39
+ "layout": "prefix + [image block] + state + schema + suffix",
40
+ "prefix": "<|im_start|>system\\n{system prompt}<|im_end|>\\n<|im_start|>user\\nSTATE:\\n",
41
+ "prefix_tokens": 36,
42
+ "system_prompt": "Read the complete state and schema. Decide every field jointly. Each answer must be exactly one of that field's allowed options.",
43
+ "image_block": "at index 36 (right after the prefix): <|vision_start|> (248053), N <|image_pad|> (248056) sent to the graph as ids V+k (k = 0..N-1 row-major over the merged grid, V = 248320), <|vision_end|> (248054), '\\n'; N + 3 ids",
44
+ "state": "render(state): a string as is, anything else compact JSON (sorted keys, ensure_ascii off); cut so the whole row fits max_length",
45
+ "schema": "'\\n\\nSCHEMA FIELDS:\\n', then per question i (1-based) '\\nFIELD {i}\\nID: {id}\\nTYPE: {type}\\nINSTRUCTION: ' + render(instructions or id) + '\\nALLOWED OPTIONS:\\n' + per option j (1-based) 'OPTION {j}: ' + render({option_id, description}) + '\\n', then 'END FIELD\\n'",
46
+ "suffix": "\\n<|im_end|>\\n<|im_start|>assistant\\n<think>\\n\\n</think>\\n\\nJOINT SCHEMA DECISIONS:",
47
+ "suffix_tokens": 18,
48
+ "last_token": "':' (25)",
49
+ "add_special_tokens": false,
50
+ "chat_template": null,
51
+ "max_length_author": 16384,
52
+ "max_tokens_this_graph": "max_context_length (the row and its last padded call must fit)"
53
+ },
54
+ "spans": {
55
+ "question": "[start, end) of the render(instructions or id) tokens of the question",
56
+ "option": "[start, end) of the render({option_id, description}) tokens of each option",
57
+ "ids": "spans index the processor-form ids (N x <|image_pad|>), the same positions as the graph's"
58
+ },
59
+ "option_order": {
60
+ "noul": [
61
+ "true",
62
+ "false"
63
+ ],
64
+ "choice": "option ids sorted as strings",
65
+ "score": "levels 0..n-1"
66
+ },
67
+ "question_types": {
68
+ "noul": 0,
69
+ "choice": 1,
70
+ "score": 2
71
+ },
72
+ "noul_default_criteria": {
73
+ "true": "The proposition is true or the answer is yes.",
74
+ "false": "The proposition is false or the answer is no."
75
+ },
76
+ "head": {
77
+ "files": [
78
+ "joint_head.safetensors",
79
+ "joint_head_config.json"
80
+ ],
81
+ "code": "JointSchemaHead in the checkpoint's joint_schema_model.py (sha256 0e304cf7c6500e8bb59bef7e2afd2c6373f82596dfb3b57d1aa93c175e2dc3a3)",
82
+ "reads": "last_hidden_state [T, 4096] at every position; LayerNorm(4096) -> memory; the global vector = the last token; question / option vectors = the mean of the LayerNorm-ed rows over each span",
83
+ "lexical": "lm_head.weight rows (untied [248320, 4096], model-00001-of-00004.safetensors) averaged over each option span's ids; the table is not in this graph",
84
+ "dtype_of_record": "fp32 (the gate reads the graph's fp16 hidden through the fp32 head)"
85
+ },
86
+ "softmax": "per question, fp32, over that question's options (temperature 1)",
87
+ "response": {
88
+ "shape": "SystemOne-compatible: {model, answers: {question_id: answer}, usage: {input_tokens: T, output_tokens: 0}}",
89
+ "noul": "{type: 'noul', noul: p(true)}",
90
+ "choice": "{type: 'choice', choice: argmax option id, confidence: its p, probabilities: {id: p}}",
91
+ "score": "{type: 'score', score: sum(level * p), confidence: max p, legend: {level: criterion}, probabilities: {level: p}}",
92
+ "rounding": "4 decimals"
93
+ }
94
+ },
95
+ "vision": {
96
+ "n_image_max": 1024,
97
+ "image_token_base": 248320,
98
+ "image_embeds": "tower rows 0..N-1 (N = H*W merged tokens) as fp16, rows N.. zero",
99
+ "image_rc": "image_rc[k] = (k // W, k % W) for k < N, rows N.. zero",
100
+ "rope_shift_start": "37 + H*W (the <|vision_end|> index; the image block starts at 36)",
101
+ "rope_shift_amount": "H*W - max(H, W)",
102
+ "text_only": {
103
+ "rope_shift_start": 1073741824,
104
+ "rope_shift_amount": 0,
105
+ "image_embeds": "zero",
106
+ "image_rc": "zero"
107
+ },
108
+ "towers": [
109
+ {
110
+ "name": "clef_flash_g256_vision_fp16w32",
111
+ "merged_grid": [
112
+ 8,
113
+ 8
114
+ ],
115
+ "tile": 256,
116
+ "patches": [
117
+ 256,
118
+ 1536
119
+ ],
120
+ "image_embeds": [
121
+ 64,
122
+ 4096
123
+ ]
124
+ },
125
+ {
126
+ "name": "clef_flash_g448_vision_fp16w32",
127
+ "merged_grid": [
128
+ 14,
129
+ 14
130
+ ],
131
+ "tile": 448,
132
+ "patches": [
133
+ 784,
134
+ 1536
135
+ ],
136
+ "image_embeds": [
137
+ 196,
138
+ 4096
139
+ ]
140
+ }
141
+ ],
142
+ "host_preprocess": "RGB -> Pillow BICUBIC resize to (32*grid) x (32*grid), aspect not kept -> /255 -> (x - 0.5) / 0.5 -> merge-block-major patchify, the frame repeated at both temporal slots (conversion/clef_flash/host.py preprocess)"
143
+ },
144
+ "compilation": {
145
+ "date": "2026-10-03T02:53:35.119832+00:00",
146
+ "targets": []
147
+ }
148
+ }
gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\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>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- 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 %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523
3
+ size 19989325
gpu-pipelined/clef_flash_decode_fp16_pf64/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "model_max_length": 262144,
13
+ "model_specific_special_tokens": {
14
+ "audio_bos_token": "<|audio_start|>",
15
+ "audio_eos_token": "<|audio_end|>",
16
+ "audio_token": "<|audio_pad|>",
17
+ "image_token": "<|image_pad|>",
18
+ "video_token": "<|video_pad|>",
19
+ "vision_bos_token": "<|vision_start|>",
20
+ "vision_eos_token": "<|vision_end|>"
21
+ },
22
+ "pad_token": "<|endoftext|>",
23
+ "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+",
24
+ "split_special_tokens": false,
25
+ "tokenizer_class": "Qwen2Tokenizer",
26
+ "unk_token": null,
27
+ "video_token": "<|video_pad|>",
28
+ "vision_bos_token": "<|vision_start|>",
29
+ "vision_eos_token": "<|vision_end|>"
30
+ }
gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ ,��e�Y��&�� �bI�j���F�c�p�jg�
gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c19a0e765a659e0f726b4b7099a62490fed6ab2e4db1246eb63fd70996a67b9
3
+ size 11826520241
gpu-pipelined/clef_flash_decode_int8mix_pf64/clef_flash_decode_int8mix_pf64.aimodel/metadata.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "assetVersion" : "2.0",
3
+ "producer" : "coreai-core 1.0.0b2",
4
+ "creationDate" : "20261003T035712Z"
5
+ }
gpu-pipelined/clef_flash_decode_int8mix_pf64/metadata.json ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata_version": "0.2",
3
+ "kind": "decision-backbone",
4
+ "name": "clef_flash_decode_int8mix_pf64",
5
+ "assets": {
6
+ "main": "clef_flash_decode_int8mix_pf64.aimodel"
7
+ },
8
+ "language": {
9
+ "tokenizer": "Cloudflare/clef-flash",
10
+ "vocab_size": 248320,
11
+ "max_context_length": 4096,
12
+ "embedded_tokenizer": true,
13
+ "prefill_chunk": 64,
14
+ "static_inputs": [
15
+ "image_embeds",
16
+ "image_rc",
17
+ "rope_shift_start",
18
+ "rope_shift_amount"
19
+ ],
20
+ "image_tokens_max": 1024,
21
+ "output": "hidden [1, 64, 4096] fp16, every position",
22
+ "function_map": {
23
+ "main": [
24
+ "main"
25
+ ]
26
+ }
27
+ },
28
+ "source": {
29
+ "model_definition": "torch",
30
+ "hf_model_id": "Cloudflare/clef-flash",
31
+ "hf_revision": "17f0b0ad64efb65d273590632833508766b2aae6"
32
+ },
33
+ "compression": {
34
+ "scheme": "int8mix",
35
+ "linear": "int8 per-block-32 symmetric_with_clipping (weight only)",
36
+ "excluded": "fp16: the embedding table, the GDN conv1d, every RMSNorm (RMSNorm, RMSNormPlusOne, RMSNormGated), SDPA, RoPE, the GDN A_log / dt_bias",
37
+ "excluded_types": [
38
+ "coreai_models.primitives.macos.rms_norm.RMSNorm",
39
+ "coreai_models.primitives.macos.rms_norm.RMSNormGated",
40
+ "coreai_models.primitives.macos.rms_norm.RMSNormPlusOne",
41
+ "coreai_models.primitives.macos.rope.RoPE",
42
+ "coreai_models.primitives.macos.sdpa.SDPA",
43
+ "torch.nn.modules.conv.Conv1d",
44
+ "torch.nn.modules.sparse.Embedding"
45
+ ],
46
+ "int8_linear_modules": 155,
47
+ "fp16_layers": [
48
+ 0,
49
+ 1,
50
+ 2,
51
+ 3,
52
+ 4,
53
+ 5,
54
+ 6,
55
+ 7,
56
+ 8,
57
+ 9,
58
+ 10,
59
+ 11
60
+ ],
61
+ "fp16_linear_modules": [
62
+ "model.layers.0.linear_attn.in_proj_qkv",
63
+ "model.layers.0.linear_attn.in_proj_z",
64
+ "model.layers.0.linear_attn.in_proj_b",
65
+ "model.layers.0.linear_attn.in_proj_a",
66
+ "model.layers.0.linear_attn.out_proj",
67
+ "model.layers.0.mlp.gate_proj",
68
+ "model.layers.0.mlp.up_proj",
69
+ "model.layers.0.mlp.down_proj",
70
+ "model.layers.1.linear_attn.in_proj_qkv",
71
+ "model.layers.1.linear_attn.in_proj_z",
72
+ "model.layers.1.linear_attn.in_proj_b",
73
+ "model.layers.1.linear_attn.in_proj_a",
74
+ "model.layers.1.linear_attn.out_proj",
75
+ "model.layers.1.mlp.gate_proj",
76
+ "model.layers.1.mlp.up_proj",
77
+ "model.layers.1.mlp.down_proj",
78
+ "model.layers.2.linear_attn.in_proj_qkv",
79
+ "model.layers.2.linear_attn.in_proj_z",
80
+ "model.layers.2.linear_attn.in_proj_b",
81
+ "model.layers.2.linear_attn.in_proj_a",
82
+ "model.layers.2.linear_attn.out_proj",
83
+ "model.layers.2.mlp.gate_proj",
84
+ "model.layers.2.mlp.up_proj",
85
+ "model.layers.2.mlp.down_proj",
86
+ "model.layers.3.self_attn.q_proj",
87
+ "model.layers.3.self_attn.k_proj",
88
+ "model.layers.3.self_attn.v_proj",
89
+ "model.layers.3.self_attn.o_proj",
90
+ "model.layers.3.mlp.gate_proj",
91
+ "model.layers.3.mlp.up_proj",
92
+ "model.layers.3.mlp.down_proj",
93
+ "model.layers.4.linear_attn.in_proj_qkv",
94
+ "model.layers.4.linear_attn.in_proj_z",
95
+ "model.layers.4.linear_attn.in_proj_b",
96
+ "model.layers.4.linear_attn.in_proj_a",
97
+ "model.layers.4.linear_attn.out_proj",
98
+ "model.layers.4.mlp.gate_proj",
99
+ "model.layers.4.mlp.up_proj",
100
+ "model.layers.4.mlp.down_proj",
101
+ "model.layers.5.linear_attn.in_proj_qkv",
102
+ "model.layers.5.linear_attn.in_proj_z",
103
+ "model.layers.5.linear_attn.in_proj_b",
104
+ "model.layers.5.linear_attn.in_proj_a",
105
+ "model.layers.5.linear_attn.out_proj",
106
+ "model.layers.5.mlp.gate_proj",
107
+ "model.layers.5.mlp.up_proj",
108
+ "model.layers.5.mlp.down_proj",
109
+ "model.layers.6.linear_attn.in_proj_qkv",
110
+ "model.layers.6.linear_attn.in_proj_z",
111
+ "model.layers.6.linear_attn.in_proj_b",
112
+ "model.layers.6.linear_attn.in_proj_a",
113
+ "model.layers.6.linear_attn.out_proj",
114
+ "model.layers.6.mlp.gate_proj",
115
+ "model.layers.6.mlp.up_proj",
116
+ "model.layers.6.mlp.down_proj",
117
+ "model.layers.7.self_attn.q_proj",
118
+ "model.layers.7.self_attn.k_proj",
119
+ "model.layers.7.self_attn.v_proj",
120
+ "model.layers.7.self_attn.o_proj",
121
+ "model.layers.7.mlp.gate_proj",
122
+ "model.layers.7.mlp.up_proj",
123
+ "model.layers.7.mlp.down_proj",
124
+ "model.layers.8.linear_attn.in_proj_qkv",
125
+ "model.layers.8.linear_attn.in_proj_z",
126
+ "model.layers.8.linear_attn.in_proj_b",
127
+ "model.layers.8.linear_attn.in_proj_a",
128
+ "model.layers.8.linear_attn.out_proj",
129
+ "model.layers.8.mlp.gate_proj",
130
+ "model.layers.8.mlp.up_proj",
131
+ "model.layers.8.mlp.down_proj",
132
+ "model.layers.9.linear_attn.in_proj_qkv",
133
+ "model.layers.9.linear_attn.in_proj_z",
134
+ "model.layers.9.linear_attn.in_proj_b",
135
+ "model.layers.9.linear_attn.in_proj_a",
136
+ "model.layers.9.linear_attn.out_proj",
137
+ "model.layers.9.mlp.gate_proj",
138
+ "model.layers.9.mlp.up_proj",
139
+ "model.layers.9.mlp.down_proj",
140
+ "model.layers.10.linear_attn.in_proj_qkv",
141
+ "model.layers.10.linear_attn.in_proj_z",
142
+ "model.layers.10.linear_attn.in_proj_b",
143
+ "model.layers.10.linear_attn.in_proj_a",
144
+ "model.layers.10.linear_attn.out_proj",
145
+ "model.layers.10.mlp.gate_proj",
146
+ "model.layers.10.mlp.up_proj",
147
+ "model.layers.10.mlp.down_proj",
148
+ "model.layers.11.self_attn.q_proj",
149
+ "model.layers.11.self_attn.k_proj",
150
+ "model.layers.11.self_attn.v_proj",
151
+ "model.layers.11.self_attn.o_proj",
152
+ "model.layers.11.mlp.gate_proj",
153
+ "model.layers.11.mlp.up_proj",
154
+ "model.layers.11.mlp.down_proj"
155
+ ],
156
+ "head": "none in the graph (the untied lm_head table stays on the host)"
157
+ },
158
+ "decision": {
159
+ "output": "hidden [1, S, 4096] per call: the final-norm hidden state at every position (no vocabulary head in the graph)",
160
+ "readout": "fresh zero states; a row of T ids runs as ceil(T / 64) calls of 'main' (static S = 64): call k gets ids[64k : 64k + 64] with position_ids 0..64k+63; 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, 64, 4096] of every call, concatenated and cut to T, are the backbone's final-norm last_hidden_state [T, 4096] the head reads.",
161
+ "prompt": {
162
+ "source": "the author's encode_record() (joint_schema_model.py at the pinned revision, sha256 0e304cf7c6500e8bb59bef7e2afd2c6373f82596dfb3b57d1aa93c175e2dc3a3); every piece tokenized on its own without special tokens, then concatenated (conversion/clef_flash/host.py build_ids)",
163
+ "layout": "prefix + [image block] + state + schema + suffix",
164
+ "prefix": "<|im_start|>system\\n{system prompt}<|im_end|>\\n<|im_start|>user\\nSTATE:\\n",
165
+ "prefix_tokens": 36,
166
+ "system_prompt": "Read the complete state and schema. Decide every field jointly. Each answer must be exactly one of that field's allowed options.",
167
+ "image_block": "at index 36 (right after the prefix): <|vision_start|> (248053), N <|image_pad|> (248056) sent to the graph as ids V+k (k = 0..N-1 row-major over the merged grid, V = 248320), <|vision_end|> (248054), '\\n'; N + 3 ids",
168
+ "state": "render(state): a string as is, anything else compact JSON (sorted keys, ensure_ascii off); cut so the whole row fits max_length",
169
+ "schema": "'\\n\\nSCHEMA FIELDS:\\n', then per question i (1-based) '\\nFIELD {i}\\nID: {id}\\nTYPE: {type}\\nINSTRUCTION: ' + render(instructions or id) + '\\nALLOWED OPTIONS:\\n' + per option j (1-based) 'OPTION {j}: ' + render({option_id, description}) + '\\n', then 'END FIELD\\n'",
170
+ "suffix": "\\n<|im_end|>\\n<|im_start|>assistant\\n<think>\\n\\n</think>\\n\\nJOINT SCHEMA DECISIONS:",
171
+ "suffix_tokens": 18,
172
+ "last_token": "':' (25)",
173
+ "add_special_tokens": false,
174
+ "chat_template": null,
175
+ "max_length_author": 16384,
176
+ "max_tokens_this_graph": "max_context_length (the row and its last padded call must fit)"
177
+ },
178
+ "spans": {
179
+ "question": "[start, end) of the render(instructions or id) tokens of the question",
180
+ "option": "[start, end) of the render({option_id, description}) tokens of each option",
181
+ "ids": "spans index the processor-form ids (N x <|image_pad|>), the same positions as the graph's"
182
+ },
183
+ "option_order": {
184
+ "noul": [
185
+ "true",
186
+ "false"
187
+ ],
188
+ "choice": "option ids sorted as strings",
189
+ "score": "levels 0..n-1"
190
+ },
191
+ "question_types": {
192
+ "noul": 0,
193
+ "choice": 1,
194
+ "score": 2
195
+ },
196
+ "noul_default_criteria": {
197
+ "true": "The proposition is true or the answer is yes.",
198
+ "false": "The proposition is false or the answer is no."
199
+ },
200
+ "head": {
201
+ "files": [
202
+ "joint_head.safetensors",
203
+ "joint_head_config.json"
204
+ ],
205
+ "code": "JointSchemaHead in the checkpoint's joint_schema_model.py (sha256 0e304cf7c6500e8bb59bef7e2afd2c6373f82596dfb3b57d1aa93c175e2dc3a3)",
206
+ "reads": "last_hidden_state [T, 4096] at every position; LayerNorm(4096) -> memory; the global vector = the last token; question / option vectors = the mean of the LayerNorm-ed rows over each span",
207
+ "lexical": "lm_head.weight rows (untied [248320, 4096], model-00001-of-00004.safetensors) averaged over each option span's ids; the table is not in this graph",
208
+ "dtype_of_record": "fp32 (the gate reads the graph's fp16 hidden through the fp32 head)"
209
+ },
210
+ "softmax": "per question, fp32, over that question's options (temperature 1)",
211
+ "response": {
212
+ "shape": "SystemOne-compatible: {model, answers: {question_id: answer}, usage: {input_tokens: T, output_tokens: 0}}",
213
+ "noul": "{type: 'noul', noul: p(true)}",
214
+ "choice": "{type: 'choice', choice: argmax option id, confidence: its p, probabilities: {id: p}}",
215
+ "score": "{type: 'score', score: sum(level * p), confidence: max p, legend: {level: criterion}, probabilities: {level: p}}",
216
+ "rounding": "4 decimals"
217
+ }
218
+ },
219
+ "vision": {
220
+ "n_image_max": 1024,
221
+ "image_token_base": 248320,
222
+ "image_embeds": "tower rows 0..N-1 (N = H*W merged tokens) as fp16, rows N.. zero",
223
+ "image_rc": "image_rc[k] = (k // W, k % W) for k < N, rows N.. zero",
224
+ "rope_shift_start": "37 + H*W (the <|vision_end|> index; the image block starts at 36)",
225
+ "rope_shift_amount": "H*W - max(H, W)",
226
+ "text_only": {
227
+ "rope_shift_start": 1073741824,
228
+ "rope_shift_amount": 0,
229
+ "image_embeds": "zero",
230
+ "image_rc": "zero"
231
+ },
232
+ "towers": [
233
+ {
234
+ "name": "clef_flash_g256_vision_fp16w32",
235
+ "merged_grid": [
236
+ 8,
237
+ 8
238
+ ],
239
+ "tile": 256,
240
+ "patches": [
241
+ 256,
242
+ 1536
243
+ ],
244
+ "image_embeds": [
245
+ 64,
246
+ 4096
247
+ ]
248
+ },
249
+ {
250
+ "name": "clef_flash_g448_vision_fp16w32",
251
+ "merged_grid": [
252
+ 14,
253
+ 14
254
+ ],
255
+ "tile": 448,
256
+ "patches": [
257
+ 784,
258
+ 1536
259
+ ],
260
+ "image_embeds": [
261
+ 196,
262
+ 4096
263
+ ]
264
+ }
265
+ ],
266
+ "host_preprocess": "RGB -> Pillow BICUBIC resize to (32*grid) x (32*grid), aspect not kept -> /255 -> (x - 0.5) / 0.5 -> merge-block-major patchify, the frame repeated at both temporal slots (conversion/clef_flash/host.py preprocess)"
267
+ },
268
+ "compilation": {
269
+ "date": "2026-10-03T03:57:16.550932+00:00",
270
+ "targets": []
271
+ }
272
+ }
gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\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>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- 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 %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523
3
+ size 19989325
gpu-pipelined/clef_flash_decode_int8mix_pf64/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "model_max_length": 262144,
13
+ "model_specific_special_tokens": {
14
+ "audio_bos_token": "<|audio_start|>",
15
+ "audio_eos_token": "<|audio_end|>",
16
+ "audio_token": "<|audio_pad|>",
17
+ "image_token": "<|image_pad|>",
18
+ "video_token": "<|video_pad|>",
19
+ "vision_bos_token": "<|vision_start|>",
20
+ "vision_eos_token": "<|vision_end|>"
21
+ },
22
+ "pad_token": "<|endoftext|>",
23
+ "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+",
24
+ "split_special_tokens": false,
25
+ "tokenizer_class": "Qwen2Tokenizer",
26
+ "unk_token": null,
27
+ "video_token": "<|video_pad|>",
28
+ "vision_bos_token": "<|vision_start|>",
29
+ "vision_eos_token": "<|vision_end|>"
30
+ }
gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ ���9oo7��
gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2adb0396f6f37f3178c0d7b413d10cddc31271c0dc7a56b2416125e9664f31d
3
+ size 909207876
gpu-pipelined/clef_flash_g256_vision_fp16w32/clef_flash_g256_vision_fp16w32.aimodel/metadata.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "assetVersion" : "2.0",
3
+ "creationDate" : "20261003T010220Z",
4
+ "producer" : "coreai-core 1.0.0b2"
5
+ }
gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ �b����j.c�gz�r��G��k�:{�R:�
gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04d8629bedeb1af76a2e63ed677a931c187289a6478fc66bf33a7bfa523a1eaa
3
+ size 911945013
gpu-pipelined/clef_flash_g448_vision_fp16w32/clef_flash_g448_vision_fp16w32.aimodel/metadata.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "assetVersion" : "2.0",
3
+ "producer" : "coreai-core 1.0.0b2",
4
+ "creationDate" : "20261003T010241Z"
5
+ }
gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.hash ADDED
Binary file (32 Bytes). View file
 
gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51e512ad1e4d3bcfdc7af43c1100124bd94d539de01f09651afc9b98486856fe
3
+ size 243978965
gpu-pipelined/clef_flash_head_bucket_fp16w32/clef_flash_head_bucket_fp16w32.aimodel/metadata.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "creationDate" : "20261003T045330Z",
3
+ "assetVersion" : "2.0",
4
+ "producer" : "coreai-core 1.0.0b2"
5
+ }
gpu-pipelined/clef_flash_head_bucket_fp16w32/metadata.json ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata_version": "0.2",
3
+ "kind": "decision-head",
4
+ "name": "clef_flash_head_bucket_fp16w32",
5
+ "assets": {
6
+ "main": "clef_flash_head_bucket_fp16w32.aimodel"
7
+ },
8
+ "head": {
9
+ "graph": "conversion/clef_flash/clef_head.py ClefHeadGraph: the author's JointSchemaHead for one record, tensor inputs only",
10
+ "shape": "bucket",
11
+ "functions": [
12
+ "t512",
13
+ "t1024",
14
+ "t2048",
15
+ "t4096"
16
+ ],
17
+ "buckets": [
18
+ [
19
+ "t512",
20
+ 512
21
+ ],
22
+ [
23
+ "t1024",
24
+ 1024
25
+ ],
26
+ [
27
+ "t2048",
28
+ 2048
29
+ ],
30
+ [
31
+ "t4096",
32
+ 4096
33
+ ]
34
+ ],
35
+ "dims": null,
36
+ "host_pad": "bucket",
37
+ "host_pad_rule": "T to the smallest bucket >= T (512, 1024, 2048, 4096), Q to 16, O to 128; padding rows / columns zero, their valid flags 0",
38
+ "inputs": {
39
+ "hidden": "[T, 4096] f32",
40
+ "key_valid": "[T] f32",
41
+ "q_avg": "[Q, T] f32",
42
+ "o_avg": "[O, T] f32",
43
+ "g_avg": "[1, T] f32",
44
+ "lexical": "[O, 4096] f32",
45
+ "member": "[Q, O] f32",
46
+ "type_ids": "[Q] i32",
47
+ "q_valid": "[Q] f32",
48
+ "o_valid": "[O] f32"
49
+ },
50
+ "input_order": [
51
+ "hidden",
52
+ "key_valid",
53
+ "q_avg",
54
+ "o_avg",
55
+ "g_avg",
56
+ "lexical",
57
+ "member",
58
+ "type_ids",
59
+ "q_valid",
60
+ "o_valid"
61
+ ],
62
+ "outputs": {
63
+ "logits": "[O] f32; padding options 0"
64
+ },
65
+ "weights": "fp16w32",
66
+ "softmax": "host: per question, fp32, over that question's options",
67
+ "lexical": "host: lm_head_fp16.bin rows of each option span's ids, averaged (clef_head.lexical_rows)",
68
+ "source": {
69
+ "hf_id": "Cloudflare/clef-flash",
70
+ "revision": "17f0b0ad64efb65d273590632833508766b2aae6",
71
+ "joint_schema_model_sha256": "0e304cf7c6500e8bb59bef7e2afd2c6373f82596dfb3b57d1aa93c175e2dc3a3",
72
+ "joint_head_safetensors_sha256": "19cdcec8c81dc9212be320fff47462ab342fbc1278be4368fb3da71241cf5ba0",
73
+ "joint_head_config_sha256": "77efe959a38b5b17b241543e129e695f3c77465ece55a25985279bd8176279a0"
74
+ }
75
+ },
76
+ "export": {
77
+ "aimodel_bytes": 243979102,
78
+ "main_mlirb": {
79
+ "bytes": 243978965,
80
+ "sha256": "51e512ad1e4d3bcfdc7af43c1100124bd94d539de01f09651afc9b98486856fe"
81
+ },
82
+ "seconds": {
83
+ "build": 0.19440945898531936,
84
+ "export": 10.82508116599638,
85
+ "optimize": 0.031602208997355774,
86
+ "save": 0.2501100410008803,
87
+ "total": 11.301202874979936
88
+ },
89
+ "export_attempts": [
90
+ {
91
+ "externalize": "default externalize specs",
92
+ "ok": true,
93
+ "seconds": 9.44808970799204
94
+ }
95
+ ]
96
+ },
97
+ "aot": {
98
+ "note": "compiled for the gates with: xcrun coreai-build compile <this .aimodel> --output <dir> --platform macOS --preferred-compute gpu --architecture h16c (not shipped; the Swift host specializes the .aimodel)",
99
+ "flags": [
100
+ "--platform",
101
+ "macOS",
102
+ "--preferred-compute",
103
+ "gpu",
104
+ "--architecture",
105
+ "h16c"
106
+ ],
107
+ "seconds": 0.5527557500172406
108
+ },
109
+ "compilation": {
110
+ "date": "2026-10-03T13:53:31+09:00",
111
+ "targets": [
112
+ "h16c"
113
+ ]
114
+ }
115
+ }
host/joint_head_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "hidden_size": 4096,
3
+ "width": 1024,
4
+ "routing_layers": 2,
5
+ "layers": 4,
6
+ "heads": 16,
7
+ "feedforward": 4096
8
+ }
host/lm_head_fp16.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfccf00b8d5d3f6d810839a52c2ec627700a9aaebaa26aedcb96931bd21ba36d
3
+ size 2034237440
host/lm_head_fp16.json ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "file": "lm_head_fp16.bin",
3
+ "shape": [
4
+ 248320,
5
+ 4096
6
+ ],
7
+ "dtype": "float16",
8
+ "byte_order": "little-endian",
9
+ "layout": "row-major, no header: row t at byte offset t * 8192",
10
+ "bytes": 2034237440,
11
+ "sha256": "bfccf00b8d5d3f6d810839a52c2ec627700a9aaebaa26aedcb96931bd21ba36d",
12
+ "row_t": "lm_head.weight[t] (the untied output embedding) rounded bf16 -> fp16, round to nearest even",
13
+ "use": "lexical[o] = mean over option o's span ids of the rows, accumulated in f32 or wider (clef_head.lexical_rows: f64); the head graph's `lexical` input",
14
+ "source": {
15
+ "hf_id": "Cloudflare/clef-flash",
16
+ "revision": "17f0b0ad64efb65d273590632833508766b2aae6",
17
+ "shard": "model-00001-of-00004.safetensors",
18
+ "shard_sha256": "8b45a8e968141cdcc58fb71c9adfc258e2c77b5f062bc636c1fd5bc5d916b565",
19
+ "tensor": "lm_head.weight",
20
+ "header": {
21
+ "dtype": "BF16",
22
+ "shape": [
23
+ 248320,
24
+ 4096
25
+ ],
26
+ "data_offsets": [
27
+ 0,
28
+ 2034237440
29
+ ]
30
+ },
31
+ "data_start": 4680
32
+ },
33
+ "rounding": {
34
+ "nonzero_elements": 1017118720,
35
+ "elements_below_fp16_normal_min": 3317193,
36
+ "elements_flushed_to_zero": 1649,
37
+ "elements_fp16_subnormal": 3315544,
38
+ "elements_inf": 0,
39
+ "max_rel_error_nonzero": 1.0,
40
+ "max_rel_error_not_flushed": 0.9844961166381836,
41
+ "max_rel_error_fp16_normal_range": 0.0,
42
+ "max_abs_error": 2.9802322387695312e-08,
43
+ "absmax": 0.35546875,
44
+ "fp16_normal_min": 6.103515625e-05,
45
+ "note": "bf16 values with |x| >= 2^-14 are exact in fp16; below that they become fp16 subnormals (rounded) or 0; max_rel_error_nonzero = 1.0 comes from the flushed ones"
46
+ },
47
+ "round1_check": {
48
+ "file": "results/lm_head_table.json",
49
+ "expected": {
50
+ "elements_below_fp16_normal_min": 3317193,
51
+ "elements_flushed_to_zero": 1649
52
+ },
53
+ "got": {
54
+ "elements_below_fp16_normal_min": 3317193,
55
+ "elements_flushed_to_zero": 1649
56
+ },
57
+ "equal": true,
58
+ "effect_at_the_head": "results/lm_head_table_effect.json: fp16 table max |dp| 1.8e-7 (= the fp32 re-run floor), argmax 405/405"
59
+ },
60
+ "readback": {
61
+ "rows_checked": 1200,
62
+ "first_rows": 100,
63
+ "last_rows": 100,
64
+ "random_rows": 1000,
65
+ "seed": 0,
66
+ "path": "safetensors.safe_open(framework='pt') get_slice -> torch bf16 -> float16",
67
+ "mismatched_elements": 0,
68
+ "bit_equal": true
69
+ },
70
+ "head_files": {
71
+ "joint_head.safetensors": {
72
+ "bytes": 243538016,
73
+ "sha256": "19cdcec8c81dc9212be320fff47462ab342fbc1278be4368fb3da71241cf5ba0",
74
+ "source": "Cloudflare/clef-flash@17f0b0ad64efb65d273590632833508766b2aae6: joint_head.safetensors"
75
+ },
76
+ "joint_head_config.json": {
77
+ "bytes": 119,
78
+ "sha256": "77efe959a38b5b17b241543e129e695f3c77465ece55a25985279bd8176279a0",
79
+ "source": "Cloudflare/clef-flash@17f0b0ad64efb65d273590632833508766b2aae6: joint_head_config.json"
80
+ }
81
+ },
82
+ "script_sha256": "663b7f5c65faa14b3387ae775b2d7e0f4cc7f3213466916de5fb11b7d00f7fb8",
83
+ "seconds": {
84
+ "convert_write": 5.24923904199386,
85
+ "total": 8.231139292009175
86
+ },
87
+ "written": "2026-10-03T13:41:43+09:00"
88
+ }
joint_head_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "hidden_size": 4096,
3
+ "width": 1024,
4
+ "routing_layers": 2,
5
+ "layers": 4,
6
+ "heads": 16,
7
+ "feedforward": 4096
8
+ }