harshav commited on
Commit
f9da83b
·
verified ·
1 Parent(s): 2c87e88

LFM2.5-2.6B Core AI int8: card, recipe, upstream license, validation evidence

Browse files
LICENSE.upstream ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LFM Open License v1.0
2
+
3
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
+
5
+ 1. Definitions.
6
+
7
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
8
+
9
+ "Licensor" shall mean Liquid AI, Inc.
10
+
11
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
12
+
13
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
14
+
15
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
16
+
17
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
18
+
19
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
20
+
21
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
22
+
23
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
24
+
25
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
26
+
27
+ "Commercial Use" shall mean any use of the Work for direct or indirect commercial advantage or monetary compensation.
28
+
29
+ "Qualified Non-Profit Organization" shall mean a Legal Entity that is organized and operated exclusively for religious, charitable, scientific, testing for public safety, literary, or educational purposes, and which is exempt from federal income tax under Section 501(c)(3) of the United States Internal Revenue Code of 1986, as amended, or any equivalent non-profit or charitable organization in a foreign jurisdiction.
30
+
31
+ "Non-Commercial or Research Purposes" shall mean purposes that do not involve any use of the Work or a Derivative Work for Commercial Use.
32
+
33
+ "Threshold" shall mean annual revenue of 10 million United States dollars ($10,000,000) or more.
34
+
35
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
36
+
37
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
38
+
39
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
40
+
41
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
42
+
43
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
44
+
45
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
46
+
47
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
48
+
49
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
50
+
51
+ 5. Commercial Use Limitation.
52
+
53
+ (a) The rights granted under this License for Commercial Use are conditioned upon You or Your Legal Entity not exceeding the Threshold.
54
+
55
+ (b) Any Commercial Use of the Work or a Derivative Work by a Legal Entity that exceeds the Threshold is not licensed under this Agreement.
56
+
57
+ (c) The Threshold shall not apply to a Qualified Non-Profit Organization's use of the Work or a Derivative Work for Non-Commercial or Research Purposes.
58
+
59
+ 6. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
60
+
61
+ 7. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except for the reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
62
+
63
+ 8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
64
+
65
+ 9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
66
+
67
+ 10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
68
+
69
+ 11. Termination. This License will terminate automatically and immediately if You fail to comply with any of its terms and conditions. Upon termination, You must cease all use of the Work and any Derivative Works and delete all copies in Your possession.
70
+
71
+ END OF TERMS AND CONDITIONS
README.md ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: lfm-open-license-v1.0
4
+ license_link: https://huggingface.co/LiquidAI/LFM2.5-2.6B/blob/dca1825886789bd40b94368f53b1d9ada4c94598/LICENSE
5
+ base_model: LiquidAI/LFM2.5-2.6B
6
+ base_model_relation: quantized
7
+ pipeline_tag: text-generation
8
+ library_name: coreai
9
+ language:
10
+ - ar
11
+ - zh
12
+ - en
13
+ - fr
14
+ - de
15
+ - hi
16
+ - id
17
+ - it
18
+ - ja
19
+ - ko
20
+ - pl
21
+ - pt
22
+ - ru
23
+ - es
24
+ - th
25
+ - vi
26
+ tags:
27
+ - coreai
28
+ - aimodel
29
+ - aimodelc
30
+ - apple-silicon
31
+ - lfm2
32
+ - lfm2.5
33
+ - liquid
34
+ - edge
35
+ - int8
36
+ ---
37
+
38
+ # LFM2.5-2.6B — Core AI (int8)
39
+
40
+ An int8 Core AI conversion of **[LiquidAI/LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B)**
41
+ for Apple silicon. This repository contains no trained weights of its own: it is a quantized
42
+ format conversion of Liquid AI's model, and all model credit belongs to **Liquid AI**.
43
+
44
+ Converted from source revision `dca1825886789bd40b94368f53b1d9ada4c94598`. Both upstream
45
+ safetensors shards were SHA-256 verified against that revision before conversion.
46
+
47
+ ## Read this first: running it needs a runtime you may not be able to get
48
+
49
+ **This asset will not run on a stock Core AI runtime.** It requires a patch stack that lives in
50
+ Apple's `coreai-model-zoo`, which is **not a public repository**. Specifically:
51
+
52
+ - The graph uses a **per-token input contract** (`input_ids [1,1]` plus explicit KV state) that
53
+ an unpatched runtime at the pinned commit rejects. The patches involved are named
54
+ `coreai-pipelined-per-token-inputs`, `-static-inputs`, `-extra-states`,
55
+ `coreai-prefix-cache` and `coreai-shared-product`.
56
+ - Re-exporting additionally needs that repository's LFM2 **overlay**, which is what teaches the
57
+ converter this architecture at all.
58
+
59
+ Those patches are Apple's, not mine, so they are **not redistributed here** and this repository
60
+ cannot make them available to you. Practically:
61
+
62
+ - **With access to `coreai-model-zoo`:** everything needed to build the runtime and reproduce
63
+ the conversion is pinned in [`RECIPE.md`](RECIPE.md).
64
+ - **Without it:** you can download and inspect these weights, read every measurement, and reuse
65
+ the recipe — but you will not be able to execute the asset today. That is a real limitation,
66
+ stated here rather than buried.
67
+
68
+ For the same reason **no conversion toolkit is shipped**: those scripts import modules from that
69
+ non-public repo, so publishing them would either redistribute code that is not mine or hand you
70
+ something that cannot run. [`RECIPE.md`](RECIPE.md) describes the recipe precisely instead.
71
+
72
+ ## Which file do I want?
73
+
74
+ Take the portable `lfm2_5_2_6b_decode_int8hu_attnfp16_block32_sym/` directory. It runs on any
75
+ Apple silicon Mac, given the runtime above. `aimodelc-h16c/` is the same model pre-compiled for
76
+ one GPU architecture — identical output and speed, about half the cold-load time, and the
77
+ runtime rejects it on a different architecture.
78
+
79
+ ## What this is and is not
80
+
81
+ - It **is** a decode-optimized single-token-step graph, the shape a chat/completion loop uses.
82
+ - It **is not** a chunked-prefill or batch-serving asset.
83
+ - Quality here means **teacher-forced top-1 agreement and cosine similarity against an
84
+ independent fp32 Hugging Face reference**, over 5 sequences / 125 positions. That is a
85
+ regression probe, **not** a benchmark suite. No MMLU/GSM8K-style numbers are claimed.
86
+
87
+ ## Artifacts
88
+
89
+ Full SHA-256 of each file as published.
90
+
91
+ | File | Bytes | SHA-256 | Recipe | Hardware scope | Use |
92
+ | --- | ---: | --- | --- | --- | --- |
93
+ | `lfm2_5_2_6b_decode_int8hu_attnfp16_block32_sym.aimodel/main.mlirb` | 3469367807 | `80540b2ee9183b756adb1ce51f334a94f13c093a554a2538aec66f9d9f3a07b3` | int8 blockwise-32, fp16 attention + embedding | any Apple silicon | **recommended** |
94
+ | `aimodelc-h16c/…h16c.aimodelc/…/resources.bin` | 3468949676 | `793907c101a01331ffa72aff7c9db5049c89a02ea03acee3174513a93c394e22` | same weights, AOT compiled | **`h16c` only** | faster cold load |
95
+ | `aimodelc-h16c/…h16c.aimodelc/…/original_model_0.mpsgraph` | 363905 | `74a24870a8853bf797a6f12f40e7fcb988de014d98166da772b24cab643d5d4f` | compiled graph | `h16c` only | part of the above |
96
+ | `tokenizer/tokenizer.json` | 17905598 | `695be7802a0e4b8a81048f0ff5ebb7fc811a0ba5a6be63dbb24deb5a81096f41` | upstream, unmodified | — | required |
97
+
98
+ - **The two `tokenizer/tokenizer.json` copies are byte-identical** (same hash above). The one
99
+ under `aimodelc-h16c/tokenizer/` is a **convenience copy**; you do not need both.
100
+ - Portable and compiled are **the same model**, published together because the compiled one
101
+ halves cold load but only runs on one architecture, so neither dominates.
102
+ - Both were produced from the same pinned commit and have identical compiled storage budgets.
103
+
104
+ ## Recipe, and what was rejected
105
+
106
+ Oracle for every quality number: **an independent fp32 reference, Hugging Face's own
107
+ `Lfm2ForCausalLM` at transformers ≥ 5.2**, teacher-forced over 5 sequences / 125 positions.
108
+ Cosine is the minimum per-position cosine.
109
+
110
+ | Variant | Bundle | Top-1 vs fp32 oracle | Min cosine | Conversion | Shipped |
111
+ | --- | ---: | ---: | ---: | ---: | --- |
112
+ | **int8 blockwise-32, fp16 attention + embedding** | 3.25 GB | **122/125** | **0.997050** | 5/5 | **yes** |
113
+ | + attention q/k/v/out to int8 | 3.19 GB | 121/125 | 0.996949 | 5/5 | no |
114
+ | + embedding to int8 | 3.03 GB | 123/125 | 0.996848 | 5/5 | no |
115
+ | attention at fp32 (converter default) | 3.42 GB | — | 0.997210 | 5/5 | no |
116
+ | int4 blockwise-32 family | 2.07–2.34 GB | — | 0.51–0.80 | 4–5/5 | no |
117
+
118
+ The shipped arm has the highest minimum cosine of the int8 arms. The ±1 position differences
119
+ between the three int8 rows are near-tie argmax flips at 125 positions, not a systematic
120
+ ordering — do not read the embedding row's 123 as "better". int4 is excluded on **quality**, not
121
+ size: a minimum cosine of 0.51–0.80 is a different model. **Rejected variants are documented and
122
+ deliberately not uploaded.** Full detail in [`RECIPE.md`](RECIPE.md).
123
+
124
+ ## Performance, and an unresolved caveat
125
+
126
+ Decode here is **memory-bandwidth bound** — throughput tracks bytes read per token.
127
+
128
+ | Measurement | Protocol | Result |
129
+ | --- | --- | --- |
130
+ | Development runs of this recipe | cold cache + 60 s settle, 5 trials × 3 independent runs, quiet machine | **138.15 tok/s**, between-run spread 0.31 % |
131
+ | Re-measurement of *this published artifact* | same protocol, 5 trials | **107.98 tok/s**, sd 0.500 — machine demonstrably busy: load average 9–17, background disk 50–1400 MB/s |
132
+
133
+ Both are real; neither is cherry-picked; **the gap is not explained**. Established: this
134
+ artifact's storage budget is byte-identical to the one measured at 138, and its quality and
135
+ conversion gate reproduce exactly, so these are measurements of the same recipe rather than of
136
+ two different models. Not established: the cause. A bandwidth-bound workload losing throughput
137
+ to competing memory traffic is the obvious candidate, but the machine never went quiet again
138
+ during the session, so it was never isolated and another regression cannot be ruled out.
139
+
140
+ Treat 138 as what this recipe has done on an idle M4 Max and 108 as what it did under the stated
141
+ load, and **measure on your own hardware rather than trusting either.**
142
+
143
+ For reference, on the same Mac, MLX reported ~100 tok/s at 8-bit and ~60 tok/s at BF16. Those
144
+ were throughput-only observations; MLX quality was not measured, so no quality comparison against
145
+ MLX is claimed.
146
+
147
+ AOT compilation is throughput-neutral within noise and halves cold load, 9.8 s → 5.1 s.
148
+
149
+ ## Reproduce
150
+
151
+ Every pin, the full quantization spec, the four gates, the measurement protocol and the rejected
152
+ variants are in **[`RECIPE.md`](RECIPE.md)**. Summary:
153
+
154
+ ```
155
+ Source model : LiquidAI/LFM2.5-2.6B @ dca1825886789bd40b94368f53b1d9ada4c94598 (public)
156
+ Converter : github.com/apple/coreai-models @ b1cb71b8522d99408059fa0b98b8742171bcb0b8 (public)
157
+ Runtime : github.com/apple/coreai-models @ 5ed9981303b38d5a44aa6b45509bc4f6945029f5 (public)
158
+ coreai-torch : c89f6a44713249a12a84beec9f3e0cf2206ecc38 (public)
159
+ LFM2 overlay + runtime patch stack :
160
+ apple/coreai-model-zoo @ ebef921a1f358af66c9ff67e8c6e7d4e24efad0d (NOT public)
161
+ Toolchain : macOS 27.0 (26A5388g), Xcode 27.0 (27A5228h), Python 3.11.15,
162
+ torch 2.9.0, coremltools 9.0
163
+ ```
164
+
165
+ **Verify a rebuild by the gates and the storage budget, not by hashing.** The exporter names each
166
+ externalized call site with a generated UUID (391 in this graph), so two exports of identical
167
+ weights differ in a few bytes and therefore in SHA-256. The budget to match is
168
+ `Int8 2,621,243,392` + `Float16 428,342,276` + `Float32 34` + small index types.
169
+
170
+ ## Download
171
+
172
+ ```bash
173
+ # Recommended artifact only (~3.5 GB), not the whole repository.
174
+ hf download harshav/LFM2.5-2.6B-CoreAI \
175
+ --include 'lfm2_5_2_6b_decode_int8hu_attnfp16_block32_sym/*' 'tokenizer/*' \
176
+ --local-dir ./LFM2.5-2.6B-CoreAI
177
+ ```
178
+
179
+ With a runtime built as described above, the asset is driven as a pipelined Core AI language
180
+ model with `COREAI_CHUNK_THRESHOLD=1`, greedy decoding, using the model's own chat template at
181
+ `tokenizer/chat_template.jinja`. Operational notes:
182
+
183
+ - **macOS 27.0+** on **Apple silicon**. Validated on M4 Max.
184
+ - Runs on the **GPU** via an `MPSGraph` delegate. This is **not** an ANE asset: the KV dimension
185
+ is dynamic, and `--preferred-compute` does not change the emitted delegate.
186
+ - Budget roughly bundle size plus KV cache, about **5 GB** at 4096 context.
187
+ - `aimodelc-h16c/` is **architecture-locked to `h16c`**; the runtime names the architecture it
188
+ wanted when it refuses.
189
+
190
+ ## Validation evidence
191
+
192
+ Machine-readable under `evidence/`: `authored_parity_vs_huggingface.json`, `fp32_reference.json`,
193
+ `recipe_quality.json`, `conversion_gate.json`, `benchmark.json`, `compiled_storage_stats.json`.
194
+
195
+ Four **separate** questions, not interchangeable:
196
+
197
+ - **Authoring fidelity** — re-authored module vs Hugging Face, fp32: 21/21 top-1, cosine
198
+ 1.000000. This caught a real bug: the checkpoint sets `rope_parameters.rope_theta = 1e7`, and
199
+ code reading only the legacy top-level key silently defaults to `1e6` — a 10× wrong RoPE that
200
+ still produces fluent short text. Both the converter overlay and transformers 4.x hit it.
201
+ - **Quantization damage** — vs the fp32 oracle: 122/125, min cosine 0.997050.
202
+ - **Conversion fidelity** — bundle vs **its own** quantized weights run eagerly: 5/5 exact.
203
+ Comparing to fp32 here would conflate quantization damage with conversion bugs.
204
+ - **Throughput** — see the caveat above.
205
+
206
+ ## Limitations and negative results
207
+
208
+ - **Not runnable without the non-public patch stack.** See the top of this card.
209
+ - No task-benchmark evaluation; quality is a 125-position regression probe.
210
+ - Multilingual support is inherited from upstream and was **not** re-verified per language; the
211
+ probe is English.
212
+ - int4 rejected at block 32 (cosine 0.51–0.66) and at block 16 (quality recovers, 42 tok/s,
213
+ ~3× slower than int8).
214
+ - `--expect-frequent-reshapes` measured 84 tok/s and 8.3 GB; not used.
215
+ - Speculative decoding not shipped: a static-S verify graph exports and its contract gates, but
216
+ per-position logits do not match stepped decode.
217
+ - 300 tok/s was a target and was not reached by any tested configuration.
218
+
219
+ ## License and attribution
220
+
221
+ The model is **Liquid AI's**. This repository redistributes a converted, quantized copy under the
222
+ upstream license, and claims **no authorship of the model**.
223
+
224
+ - Upstream: [LiquidAI/LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B) by **Liquid AI**.
225
+ - Upstream license: **LFM Open License v1.0** — pinned copy
226
+ [here](https://huggingface.co/LiquidAI/LFM2.5-2.6B/blob/dca1825886789bd40b94368f53b1d9ada4c94598/LICENSE),
227
+ included verbatim as [`LICENSE.upstream`](LICENSE.upstream). Your use of these weights is
228
+ governed by it.
229
+ - Conversion tooling: Apple's `coreai-models`, `coreai-torch` and `coreai-model-zoo`, at the
230
+ commits pinned above. **No Apple source is redistributed here.**
231
+ - This repository contributes the conversion recipe, the gates, and the measurements.
RECIPE.md ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Conversion recipe
2
+
3
+ This document is the reproducibility record for the published asset. It is written from
4
+ scratch and contains no code from Apple's repositories; it describes **what** was done
5
+ precisely enough to redo it, for a reader who has access to the tooling described in
6
+ "Prerequisites".
7
+
8
+ No conversion scripts are shipped in this repository. They import modules from Apple's
9
+ `coreai-model-zoo`, which is not publicly available, so publishing them would either
10
+ redistribute code that is not mine or hand you something that cannot run. A precise
11
+ description is more useful than either.
12
+
13
+ ## Prerequisites
14
+
15
+ | Component | Pin | Public? |
16
+ | --- | --- | --- |
17
+ | `LiquidAI/LFM2.5-2.6B` | `dca1825886789bd40b94368f53b1d9ada4c94598` | yes |
18
+ | `github.com/apple/coreai-models` (converter) | `b1cb71b8522d99408059fa0b98b8742171bcb0b8` | yes |
19
+ | `github.com/apple/coreai-models` (runtime) | `5ed9981303b38d5a44aa6b45509bc4f6945029f5` | yes |
20
+ | `coreai-torch` | `c89f6a44713249a12a84beec9f3e0cf2206ecc38` | yes |
21
+ | `apple/coreai-model-zoo` — LFM2 overlay **and** runtime patch stack | `ebef921a1f358af66c9ff67e8c6e7d4e24efad0d` | **no** |
22
+
23
+ Toolchain used: macOS 27.0 (build `26A5388g`), Xcode 27.0 (`27A5228h`), Python 3.11.15,
24
+ torch 2.9.0, coremltools 9.0.
25
+
26
+ The zoo is the blocker for both directions, and there is no way around it from here:
27
+
28
+ - **Conversion** needs the zoo's overlay, because that overlay is what carries the LFM2
29
+ authoring module (`models/macos/lfm2.py`) — the converter alone does not know this
30
+ architecture.
31
+ - **Inference** needs the zoo's runtime patch stack
32
+ (`coreai-pipelined-per-token-inputs`, `-static-inputs`, `-extra-states`,
33
+ `coreai-prefix-cache`, `coreai-shared-product`). An unpatched runtime at the pinned
34
+ commit does not accept this asset's per-token input contract.
35
+
36
+ ## Quantization
37
+
38
+ Applied to the authored module before export, then exported to the Core AI dialect.
39
+
40
+ | Tensor group | Precision | Detail |
41
+ | --- | --- | --- |
42
+ | Linear / MLP weights | **int8** | blockwise, block size 32, per-block scales |
43
+ | `lm_head` | **int8** | blockwise 32, **symmetric**; the head is untied and is ~0.5 GB |
44
+ | Attention `q,k,v,out` projections | **fp16** | overlay default is fp32; overridden |
45
+ | Token embedding | **fp16** | left unquantized |
46
+ | Norms, RoPE tables, indices | fp16 / int32 | untouched |
47
+
48
+ The resulting compiled storage budget, which is the check that a rebuild matched:
49
+
50
+ ```
51
+ Int8 2,621,243,392
52
+ Float16 428,342,276
53
+ Float32 34
54
+ Int32 312
55
+ UInt32 71
56
+ UInt64 1
57
+ ```
58
+
59
+ Graph shape: `input_ids [1,1]` static, `position_ids` dynamic, KV cache dynamic on the
60
+ sequence axis, `max_context_length = 4096`. Decode-only; no chunked prefill entrypoint.
61
+
62
+ Two deviations from the zoo recipe's defaults were **measured** rather than inherited:
63
+
64
+ 1. **Attention projections fp16 instead of fp32.** The overlay promotes these to fp32 for
65
+ GPU-delegate exactness. On this model that precision is not needed, and fp32 costs
66
+ ~168 MB of reads on every decode step.
67
+ 2. **Attention projections were *not* taken to int8.** That is a further ~2.5 % throughput
68
+ for one lost position in 125; the higher-fidelity option was shipped instead.
69
+
70
+ One correctness fix was required on the overlay, and it matters more than either:
71
+
72
+ > The checkpoint carries no top-level `rope_theta`. It ships
73
+ > `rope_parameters.rope_theta = 1e7` (the transformers ≥ 5 layout). Code that reads only the
74
+ > legacy key silently falls back to `1e6` — a 10× wrong RoPE that still produces fluent short
75
+ > completions and only clearly breaks at long context. Both the overlay and transformers 4.x
76
+ > hit this. Any reproduction must read the nested key.
77
+
78
+ A second, latent one: the checkpoint spells tying `tie_word_embeddings`, not `tie_embedding`.
79
+ The default is correct here, so nothing breaks on this model, but it would flip silently on an
80
+ untied checkpoint.
81
+
82
+ ## Gates
83
+
84
+ Four separate questions, deliberately not collapsed into one number.
85
+
86
+ 1. **Authoring fidelity** — the re-authored module vs Hugging Face `Lfm2ForCausalLM`, both
87
+ fp32, teacher-forced. Result 21/21 top-1, cosine 1.000000. This is the gate that caught
88
+ the RoPE bug.
89
+ 2. **Quantization damage** — the quantized module vs an *independent* fp32 Hugging Face
90
+ reference (transformers ≥ 5.2), teacher-forced over 5 sequences / 125 positions. Result
91
+ 122/125 top-1, minimum per-position cosine 0.997050.
92
+ 3. **Conversion fidelity** — the exported bundle vs **its own quantized weights run eagerly**,
93
+ greedy, 5 prompts. Result 5/5 exact. Comparing the bundle to fp32 here would conflate
94
+ quantization damage with conversion bugs, so it is compared to the thing it is supposed to
95
+ equal.
96
+ 4. **Throughput** — measured *before* any gate loads the model, because loading first cost
97
+ ~10 % on an identical bundle.
98
+
99
+ Quality is teacher-forced throughout. Free-running text is not usable as a gate on this
100
+ model: every probe prompt contains at least one step with a sub-0.05 top-2 margin, so
101
+ transcripts diverge on near-ties without indicating damage.
102
+
103
+ ## Measurement protocol
104
+
105
+ Comparisons below ~5 % are meaningless without this. Early runs showed ~3 % spread on a
106
+ *byte-identical* bundle.
107
+
108
+ - Clear the Core AI specialization cache entry **for this asset only**, for the producing
109
+ binary. The asset's own `main.hash` is the content key.
110
+ - One throwaway load + short generation to absorb cold specialization.
111
+ - 60 s settle so the SoC sheds export and compile heat.
112
+ - 5 trials, prompt 64 tokens, generate 128, fixed seed.
113
+ - Report **between-run** spread across independent runs. Within-run standard deviation of
114
+ adjacent trials is repeatability, not a population statistic, and quoting it as though it
115
+ bounded the mean overstates confidence badly.
116
+
117
+ Two environment notes that changed results materially:
118
+
119
+ - `COREAI_CHUNK_THRESHOLD=1`.
120
+ - Ahead-of-time compilation must name one architecture. Compiling without that builds all 20
121
+ (~8 GB each). `--expect-frequent-reshapes` measured 84 tok/s against 160 and 8.3 GB against
122
+ 3.3 GB, so it is off.
123
+
124
+ ## Rejected
125
+
126
+ | Attempt | Outcome |
127
+ | --- | --- |
128
+ | int4 blockwise 32 | minimum cosine 0.51–0.66 — a different model |
129
+ | int4 blockwise 32, conv projections rescued to int8 | cosine 0.662, 16/21 top-1; rescuing conv does not protect the MLP bulk, which is where both the bytes and the damage are |
130
+ | int4 blockwise 16 | quality recovers, 42 tok/s — ~3× *slower* than int8, dequantization dominates |
131
+ | int8 token embedding | throughput-neutral, −214 MB; not shipped because it is not a win |
132
+ | `--preferred-compute neural-engine` | no-op; the compiled asset holds an `MPSGraph` delegate either way. A dynamic KV dimension is not an ANE-shaped graph |
133
+ | Speculative decoding, static-S verify graph | exports and gates its contract, but per-position logits do not match stepped decode; not published |
134
+
135
+ Reproduction is verified by the **gates and the storage budget above, not by hashing**. The
136
+ exporter names each externalized call site with a generated UUID — 391 such names in this
137
+ graph — so two exports of identical weights differ in a few bytes and therefore in SHA-256.
evidence/authored_parity_vs_huggingface.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "lfm25-authored-parity/1",
3
+ "result": "PASS",
4
+ "positions": 21,
5
+ "argmax_agree": 21,
6
+ "cosine_min": 0.9999999999159397,
7
+ "cosine_mean": 0.9999999999842674,
8
+ "max_abs_diff": 0.00013256072998046875,
9
+ "decisive_mismatches": [],
10
+ "rope_theta": 10000000.0
11
+ }
evidence/benchmark.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "averages": {
3
+ "generation_tps": 107.98103110995024,
4
+ "prompt_tps": 111.85706160230723
5
+ },
6
+ "generation_tokens": 256,
7
+ "model": "lfm2_5_2_6b_decode_int8hu_attnfp16_block32_sym",
8
+ "num_trials": 5,
9
+ "prompt_tokens": 128,
10
+ "trials": [
11
+ {
12
+ "gen_tps": 107.47552133732766,
13
+ "prompt_tps": 112.87514036365417
14
+ },
15
+ {
16
+ "gen_tps": 108.5075235316926,
17
+ "prompt_tps": 112.73070165254128
18
+ },
19
+ {
20
+ "gen_tps": 107.56636581127502,
21
+ "prompt_tps": 111.79149550180541
22
+ },
23
+ {
24
+ "gen_tps": 107.8480116699026,
25
+ "prompt_tps": 110.66700212601687
26
+ },
27
+ {
28
+ "gen_tps": 108.50773319955331,
29
+ "prompt_tps": 111.2209683675184
30
+ }
31
+ ]
32
+ }
evidence/compiled_storage_stats.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"computeTypes":["Bool","Float16","Float32","Int32","Int8","UInt32","UInt64"],"operationDistribution":[{"name":"constant","count":1900},{"count":348,"name":"reshape"},{"count":261,"name":"slice"},{"count":207,"name":"concat"},{"count":169,"name":"batch_matmul"},{"name":"broadcasting_batch_matmul","count":169},{"name":"transpose","count":168},{"count":167,"name":"mul"},{"count":164,"name":"broadcasting_mul"},{"name":"broadcast_to","count":157},{"name":"broadcast_in_dims","count":149},{"count":135,"name":"blockwise_shift_scale"},{"count":114,"name":"add"},{"name":"broadcasting_add","count":110},{"name":"invoke","count":85},{"name":"broadcasting_divide","count":34},{"count":34,"name":"divide"},{"count":32,"name":"broadcasting_sub"},{"name":"sub","count":32},{"count":31,"name":"exp"},{"name":"silu","count":30},{"name":"conv2d","count":22},{"name":"split","count":22},{"count":19,"name":"cast"},{"name":"read_handle","count":19},{"name":"write_handle","count":17},{"name":"get_shape","count":16},{"name":"shrink_dims","count":16},{"name":"slice_update","count":16},{"count":8,"name":"broadcast_shapes"},{"count":7,"name":"reduce"},{"name":"gather_nd","count":4},{"count":4,"name":"reduce_sum"},{"count":3,"name":"reduce_mean"},{"name":"reduce_product","count":3},{"count":3,"name":"rsqrt"},{"count":2,"name":"expand_dims"},{"count":2,"name":"gather_along_axis"},{"count":2,"name":"not"},{"name":"range","count":2},{"name":"broadcasting_greater","count":1},{"count":1,"name":"cos"},{"count":1,"name":"create_token"},{"name":"greater","count":1},{"count":1,"name":"sin"},{"name":"softmax","count":1}],"storageTypes":[{"name":"Int8","count":2621243392},{"count":428342276,"name":"Float16"},{"count":312,"name":"Int32"},{"count":71,"name":"UInt32"},{"count":34,"name":"Float32"},{"name":"UInt64","count":1}]}
evidence/conversion_gate.json ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "lfm25-conversion-gate/1",
3
+ "result": "PASS",
4
+ "bundle": "exports/lfm2_5_2_6b_decode_int8hu_attnfp16_block32_sym",
5
+ "mode": "int8hu",
6
+ "cases_exact": 5,
7
+ "cases": 5,
8
+ "word_prefix": 65,
9
+ "expected_words": 65,
10
+ "quality": {
11
+ "teacher_forced_top1_agree": 122,
12
+ "positions": 125,
13
+ "sequences": 5,
14
+ "cosine_min": 0.9970501333100017,
15
+ "cosine_mean": 0.9997748702116448,
16
+ "per_sequence": [
17
+ {
18
+ "case": 0,
19
+ "agree": 20,
20
+ "positions": 21,
21
+ "cosine_min": 0.9970501333100017
22
+ },
23
+ {
24
+ "case": 1,
25
+ "agree": 20,
26
+ "positions": 20,
27
+ "cosine_min": 0.9988472272394007
28
+ },
29
+ {
30
+ "case": 2,
31
+ "agree": 24,
32
+ "positions": 24,
33
+ "cosine_min": 0.9997840496708345
34
+ },
35
+ {
36
+ "case": 3,
37
+ "agree": 27,
38
+ "positions": 28,
39
+ "cosine_min": 0.9995996541432354
40
+ },
41
+ {
42
+ "case": 4,
43
+ "agree": 31,
44
+ "positions": 32,
45
+ "cosine_min": 0.9985697415741762
46
+ }
47
+ ]
48
+ },
49
+ "detail": [
50
+ {
51
+ "case": 0,
52
+ "prompt": "The capital of France is",
53
+ "exact": true,
54
+ "expected_text": " Paris. (A)\n* \"The capital of France is Paris.\" (",
55
+ "bundle_text": " Paris. (A)\n* \"The capital of France is Paris.\" (",
56
+ "word_prefix": 10,
57
+ "expected_words": 10
58
+ },
59
+ {
60
+ "case": 1,
61
+ "prompt": "def fibonacci(n):",
62
+ "exact": true,
63
+ "expected_text": " function that takes an integer n and returns the nth Fibonacci number. fibonacci(0",
64
+ "bundle_text": " function that takes an integer n and returns the nth Fibonacci number. fibonacci(0",
65
+ "word_prefix": 13,
66
+ "expected_words": 13
67
+ },
68
+ {
69
+ "case": 2,
70
+ "prompt": "The second law of thermodynamics states that",
71
+ "exact": true,
72
+ "expected_text": " the total entropy of an isolated system can never decrease over time. This is a",
73
+ "bundle_text": " the total entropy of an isolated system can never decrease over time. This is a",
74
+ "word_prefix": 15,
75
+ "expected_words": 15
76
+ },
77
+ {
78
+ "case": 3,
79
+ "prompt": "Q: What is 17 * 23?\nA:",
80
+ "exact": true,
81
+ "expected_text": " 391\n\nThe user is asking for a simple multiplication. I should provide the",
82
+ "bundle_text": " 391\n\nThe user is asking for a simple multiplication. I should provide the",
83
+ "word_prefix": 13,
84
+ "expected_words": 13
85
+ },
86
+ {
87
+ "case": 4,
88
+ "prompt": "Once upon a time, in a small village at the edge of a forest,",
89
+ "exact": true,
90
+ "expected_text": " there lived a young woman named Lila. She was known for her kindness and",
91
+ "bundle_text": " there lived a young woman named Lila. She was known for her kindness and",
92
+ "word_prefix": 14,
93
+ "expected_words": 14
94
+ }
95
+ ]
96
+ }
evidence/fp32_reference.json ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "lfm25-independent-reference/2",
3
+ "source": "transformers.AutoModelForCausalLM (fp32, cpu)",
4
+ "transformers_version": "5.14.1",
5
+ "model_dir": "LiquidAI/LFM2.5-2.6B",
6
+ "config_class": "Lfm2Config",
7
+ "rope_theta": 10000000.0,
8
+ "tokenizer_class": "TokenizersBackend",
9
+ "max_new_tokens": 16,
10
+ "cases": [
11
+ {
12
+ "prompt": "The capital of France is",
13
+ "input_ids": [
14
+ 597,
15
+ 5205,
16
+ 302,
17
+ 3980,
18
+ 355
19
+ ],
20
+ "gen_ids": [
21
+ 4741,
22
+ 22,
23
+ 342,
24
+ 41,
25
+ 7793,
26
+ 302,
27
+ 1456,
28
+ 17,
29
+ 342,
30
+ 41,
31
+ 7793,
32
+ 302,
33
+ 1456,
34
+ 17,
35
+ 342,
36
+ 41
37
+ ],
38
+ "gen_text": " Paris. (A statement of fact) (A statement of fact) (A"
39
+ },
40
+ {
41
+ "prompt": "def fibonacci(n):",
42
+ "input_ids": [
43
+ 3162,
44
+ 116773,
45
+ 7946,
46
+ 2770
47
+ ],
48
+ "gen_ids": [
49
+ 1446,
50
+ 395,
51
+ 5173,
52
+ 401,
53
+ 20877,
54
+ 316,
55
+ 309,
56
+ 11615,
57
+ 278,
58
+ 92189,
59
+ 91230,
60
+ 1579,
61
+ 22,
62
+ 116773,
63
+ 16,
64
+ 24
65
+ ],
66
+ "gen_text": " function that takes an integer n and returns the nth Fibonacci number. fibonacci(0"
67
+ },
68
+ {
69
+ "prompt": "The second law of thermodynamics states that",
70
+ "input_ids": [
71
+ 597,
72
+ 1840,
73
+ 2535,
74
+ 302,
75
+ 8502,
76
+ 47235,
77
+ 3977,
78
+ 395
79
+ ],
80
+ "gen_ids": [
81
+ 278,
82
+ 2925,
83
+ 35378,
84
+ 302,
85
+ 401,
86
+ 13696,
87
+ 1177,
88
+ 510,
89
+ 2966,
90
+ 10135,
91
+ 890,
92
+ 893,
93
+ 22,
94
+ 969,
95
+ 355,
96
+ 267
97
+ ],
98
+ "gen_text": " the total entropy of an isolated system can never decrease over time. This is a"
99
+ },
100
+ {
101
+ "prompt": "Q: What is 17 * 23?\nA:",
102
+ "input_ids": [
103
+ 57,
104
+ 34,
105
+ 3246,
106
+ 355,
107
+ 229,
108
+ 916,
109
+ 767,
110
+ 229,
111
+ 1467,
112
+ 1283,
113
+ 41,
114
+ 34
115
+ ],
116
+ "gen_ids": [
117
+ 229,
118
+ 30284,
119
+ 8,
120
+ 597,
121
+ 4695,
122
+ 355,
123
+ 13564,
124
+ 374,
125
+ 267,
126
+ 3547,
127
+ 37207,
128
+ 22,
129
+ 358,
130
+ 1252,
131
+ 2675,
132
+ 278
133
+ ],
134
+ "gen_text": " 391\n\nThe user is asking for a simple multiplication. I should provide the"
135
+ },
136
+ {
137
+ "prompt": "Once upon a time, in a small village at the edge of a forest,",
138
+ "input_ids": [
139
+ 13641,
140
+ 3879,
141
+ 267,
142
+ 893,
143
+ 20,
144
+ 296,
145
+ 267,
146
+ 1710,
147
+ 6813,
148
+ 462,
149
+ 278,
150
+ 8527,
151
+ 302,
152
+ 267,
153
+ 7421,
154
+ 20
155
+ ],
156
+ "gen_ids": [
157
+ 912,
158
+ 8158,
159
+ 267,
160
+ 2943,
161
+ 5893,
162
+ 5167,
163
+ 402,
164
+ 5451,
165
+ 22,
166
+ 2298,
167
+ 452,
168
+ 2037,
169
+ 374,
170
+ 949,
171
+ 41467,
172
+ 309
173
+ ],
174
+ "gen_text": " there lived a young woman named Lila. She was known for her kindness and"
175
+ }
176
+ ],
177
+ "prompt": "The capital of France is",
178
+ "input_ids": [
179
+ 597,
180
+ 5205,
181
+ 302,
182
+ 3980,
183
+ 355
184
+ ],
185
+ "gen_ids": [
186
+ 4741,
187
+ 22,
188
+ 342,
189
+ 41,
190
+ 7793,
191
+ 302,
192
+ 1456,
193
+ 17,
194
+ 342,
195
+ 41,
196
+ 7793,
197
+ 302,
198
+ 1456,
199
+ 17,
200
+ 342,
201
+ 41
202
+ ],
203
+ "gen_text": " Paris. (A statement of fact) (A statement of fact) (A",
204
+ "top2_margins": [
205
+ 0.7281018495559692,
206
+ 0.7113168835639954,
207
+ 0.11093549430370331,
208
+ 0.015672452747821808,
209
+ 0.04382406175136566,
210
+ 0.46940433979034424,
211
+ 0.9695106148719788,
212
+ 0.29527413845062256,
213
+ 0.26872625946998596,
214
+ 0.027259603142738342,
215
+ 0.29248109459877014,
216
+ 0.8996275067329407,
217
+ 0.11412087082862854,
218
+ 0.4253472089767456,
219
+ 0.5897049903869629,
220
+ 0.42489880323410034
221
+ ]
222
+ }
evidence/recipe_quality.json ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "lfm25-quant-reference/2",
3
+ "mode": "int8hu",
4
+ "head_quant": "block32",
5
+ "head_sym": true,
6
+ "int4_block": 32,
7
+ "rescue_regex": null,
8
+ "quant_attn": "keep",
9
+ "quant_embedding": "keep",
10
+ "quality": {
11
+ "teacher_forced_top1_agree": 122,
12
+ "positions": 125,
13
+ "sequences": 5,
14
+ "cosine_min": 0.9970501333100017,
15
+ "cosine_mean": 0.9997748702116448,
16
+ "per_sequence": [
17
+ {
18
+ "case": 0,
19
+ "agree": 20,
20
+ "positions": 21,
21
+ "cosine_min": 0.9970501333100017
22
+ },
23
+ {
24
+ "case": 1,
25
+ "agree": 20,
26
+ "positions": 20,
27
+ "cosine_min": 0.9988472272394007
28
+ },
29
+ {
30
+ "case": 2,
31
+ "agree": 24,
32
+ "positions": 24,
33
+ "cosine_min": 0.9997840496708345
34
+ },
35
+ {
36
+ "case": 3,
37
+ "agree": 27,
38
+ "positions": 28,
39
+ "cosine_min": 0.9995996541432354
40
+ },
41
+ {
42
+ "case": 4,
43
+ "agree": 31,
44
+ "positions": 32,
45
+ "cosine_min": 0.9985697415741762
46
+ }
47
+ ]
48
+ },
49
+ "expected": [
50
+ {
51
+ "prompt": "The capital of France is",
52
+ "input_ids": [
53
+ 597,
54
+ 5205,
55
+ 302,
56
+ 3980,
57
+ 355
58
+ ],
59
+ "gen_ids": [
60
+ 4741,
61
+ 22,
62
+ 342,
63
+ 41,
64
+ 514,
65
+ 18,
66
+ 266,
67
+ 496,
68
+ 597,
69
+ 5205,
70
+ 302,
71
+ 3980,
72
+ 355,
73
+ 4741,
74
+ 2426,
75
+ 342
76
+ ]
77
+ },
78
+ {
79
+ "prompt": "def fibonacci(n):",
80
+ "input_ids": [
81
+ 3162,
82
+ 116773,
83
+ 7946,
84
+ 2770
85
+ ],
86
+ "gen_ids": [
87
+ 1446,
88
+ 395,
89
+ 5173,
90
+ 401,
91
+ 20877,
92
+ 316,
93
+ 309,
94
+ 11615,
95
+ 278,
96
+ 92189,
97
+ 91230,
98
+ 1579,
99
+ 22,
100
+ 116773,
101
+ 16,
102
+ 24
103
+ ]
104
+ },
105
+ {
106
+ "prompt": "The second law of thermodynamics states that",
107
+ "input_ids": [
108
+ 597,
109
+ 1840,
110
+ 2535,
111
+ 302,
112
+ 8502,
113
+ 47235,
114
+ 3977,
115
+ 395
116
+ ],
117
+ "gen_ids": [
118
+ 278,
119
+ 2925,
120
+ 35378,
121
+ 302,
122
+ 401,
123
+ 13696,
124
+ 1177,
125
+ 510,
126
+ 2966,
127
+ 10135,
128
+ 890,
129
+ 893,
130
+ 22,
131
+ 969,
132
+ 355,
133
+ 267
134
+ ]
135
+ },
136
+ {
137
+ "prompt": "Q: What is 17 * 23?\nA:",
138
+ "input_ids": [
139
+ 57,
140
+ 34,
141
+ 3246,
142
+ 355,
143
+ 229,
144
+ 916,
145
+ 767,
146
+ 229,
147
+ 1467,
148
+ 1283,
149
+ 41,
150
+ 34
151
+ ],
152
+ "gen_ids": [
153
+ 229,
154
+ 30284,
155
+ 8,
156
+ 597,
157
+ 4695,
158
+ 355,
159
+ 13564,
160
+ 374,
161
+ 267,
162
+ 3547,
163
+ 37207,
164
+ 22,
165
+ 358,
166
+ 1252,
167
+ 2675,
168
+ 278
169
+ ]
170
+ },
171
+ {
172
+ "prompt": "Once upon a time, in a small village at the edge of a forest,",
173
+ "input_ids": [
174
+ 13641,
175
+ 3879,
176
+ 267,
177
+ 893,
178
+ 20,
179
+ 296,
180
+ 267,
181
+ 1710,
182
+ 6813,
183
+ 462,
184
+ 278,
185
+ 8527,
186
+ 302,
187
+ 267,
188
+ 7421,
189
+ 20
190
+ ],
191
+ "gen_ids": [
192
+ 912,
193
+ 8158,
194
+ 267,
195
+ 2943,
196
+ 5893,
197
+ 5167,
198
+ 402,
199
+ 5451,
200
+ 22,
201
+ 2298,
202
+ 452,
203
+ 2037,
204
+ 374,
205
+ 949,
206
+ 41467,
207
+ 309
208
+ ]
209
+ }
210
+ ]
211
+ }