alexwengg commited on
Commit
628e2fd
·
verified ·
1 Parent(s): de8da12

GLiNER2.5-Decide Core ML: fp16/W8/LUT6 at L128, L256, L512 (mobius 01e6e6a)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LICENSE +202 -0
  2. README.md +95 -0
  3. assets.lock.json +32 -0
  4. benchmark-latency.py +52 -0
  5. compress-coreml.py +86 -0
  6. config.json +24 -0
  7. convert-coreml.py +168 -0
  8. convert_names.py +3 -0
  9. encoder_config/config.json +34 -0
  10. export_model.py +54 -0
  11. gliner2_decide_classification_fp16_L128_H4_K8.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  12. gliner2_decide_classification_fp16_L128_H4_K8.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  13. gliner2_decide_classification_fp16_L128_H4_K8.mlpackage/Manifest.json +18 -0
  14. gliner2_decide_classification_fp16_L256_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  15. gliner2_decide_classification_fp16_L256_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  16. gliner2_decide_classification_fp16_L256_H4_K32.mlpackage/Manifest.json +18 -0
  17. gliner2_decide_classification_fp16_L512_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  18. gliner2_decide_classification_fp16_L512_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  19. gliner2_decide_classification_fp16_L512_H4_K32.mlpackage/Manifest.json +18 -0
  20. gliner2_decide_classification_lut6_L128_H4_K8.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  21. gliner2_decide_classification_lut6_L128_H4_K8.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  22. gliner2_decide_classification_lut6_L128_H4_K8.mlpackage/Manifest.json +18 -0
  23. gliner2_decide_classification_lut6_L256_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  24. gliner2_decide_classification_lut6_L256_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  25. gliner2_decide_classification_lut6_L256_H4_K32.mlpackage/Manifest.json +18 -0
  26. gliner2_decide_classification_lut6_L512_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  27. gliner2_decide_classification_lut6_L512_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  28. gliner2_decide_classification_lut6_L512_H4_K32.mlpackage/Manifest.json +18 -0
  29. gliner2_decide_classification_w8_L128_H4_K8.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  30. gliner2_decide_classification_w8_L128_H4_K8.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  31. gliner2_decide_classification_w8_L128_H4_K8.mlpackage/Manifest.json +18 -0
  32. gliner2_decide_classification_w8_L256_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  33. gliner2_decide_classification_w8_L256_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  34. gliner2_decide_classification_w8_L256_H4_K32.mlpackage/Manifest.json +18 -0
  35. gliner2_decide_classification_w8_L512_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
  36. gliner2_decide_classification_w8_L512_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
  37. gliner2_decide_classification_w8_L512_H4_K32.mlpackage/Manifest.json +18 -0
  38. preprocessing.py +67 -0
  39. pyproject.toml +31 -0
  40. reports/conversion-gliner2_decide_classification_fp16_L128_H4_K8.json +105 -0
  41. reports/conversion-gliner2_decide_classification_fp16_L256_H4_K32.json +105 -0
  42. reports/conversion-gliner2_decide_classification_fp16_L512_H4_K32.json +105 -0
  43. reports/fast-decisions-coreml-embedding_w8-L512-all.json +102 -0
  44. reports/fast-decisions-coreml-fp16-L512-all.json +102 -0
  45. reports/fast-decisions-coreml-lut4-L512-all.json +102 -0
  46. reports/fast-decisions-coreml-lut6-L512-all.json +102 -0
  47. reports/fast-decisions-coreml-w8-L512-all.json +102 -0
  48. reports/fast-decisions-native.json +102 -0
  49. reports/latency.json +47 -0
  50. reports/verify-packages-L128-L256.json +26 -0
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 [yyyy] [name of copyright owner]
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,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: coremltools
4
+ pipeline_tag: text-classification
5
+ base_model: fastino/GLiNER2.5-Decide
6
+ tags:
7
+ - coreml
8
+ - gliner2
9
+ - apple-silicon
10
+ - classification
11
+ ---
12
+
13
+ # GLiNER2.5-Decide for Core ML
14
+
15
+ Fixed-shape Core ML exports of the classification path of [fastino/GLiNER2.5-Decide](https://huggingface.co/fastino/GLiNER2.5-Decide) at revision `65624f1a0265b3f612bae66a2685a06b94a68a9d`. Fastino authored the Apache-2.0 source model; Fluid Inference converted it. Each package holds the DeBERTa-v3-large encoder and the shared label classifier (436,022,273 exported parameters). The span and count heads are not exported: this release covers classification only.
16
+
17
+ One call scores up to four decision heads (for example intent, urgency and route) over the same text. The host tokenizes the schema with the upstream GLiNER2 processor and passes the position of every label marker; the package returns per-head logits. Single-label heads use softmax and multi-label heads use sigmoid with `cls_threshold`, exactly as `classify_text` does.
18
+
19
+ ## Fast Decisions
20
+
21
+ Scored on Fastino's [Fast Decisions](https://huggingface.co/datasets/fastino/fast-decisions) development split (revision `1a33070c`, 17 domains × 100 rows, 2,900 heads) with the protocol from the dataset card: one call per head with the labels as given, exact set match, mean of the 17 domain accuracies. The 512-token bucket fits every row.
22
+
23
+ | Package (L512) | Size | Average | Pooled | Heads changed vs native |
24
+ | --- | ---: | ---: | ---: | ---: |
25
+ | native PyTorch | — | 62.93% | 61.38% | — |
26
+ | `fp16` | 936 MB | 62.93% | 61.38% | 0 |
27
+ | `w8` | 477 MB | 63.01% | 61.52% | 7 |
28
+ | `lut6` | 361 MB | 63.03% | 61.52% | 42 |
29
+
30
+ The card's published 60.2% for GLiNER2.5-Decide is on the held-out test split (300 rows per domain), which is not public; the card asks that development-split scores not be reported as the benchmark. The table above shows that the Core ML packages reproduce the native checkpoint on the public split, not a new benchmark result.
31
+
32
+ Rejected variants, kept in `reports/` for reference: embedding-only W8 (805 MB, 63.00%) saves little over `w8`; per-tensor LUT4 (246 MB, 62.26%, 236 heads changed, −4 points on `paper_field`) loses accuracy. Grouped-channel palettization needs an iOS 18 deployment target and was not tried.
33
+
34
+ ## Packages
35
+
36
+ | Bucket | Tokens | Heads × labels | Fast Decisions heads that fit | `fp16` | `w8` | `lut6` |
37
+ | --- | ---: | ---: | ---: | --- | --- | --- |
38
+ | `L128_H4_K8` | 128 | 4 × 8 | 10.7% | 8.2 ms | 10.1 ms | 9.9 ms |
39
+ | `L256_H4_K32` | 256 | 4 × 32 | 95.0% | 14.7 ms | 20.6 ms | 17.6 ms |
40
+ | `L512_H4_K32` | 512 | 4 × 32 | 100% | 44.0 ms | 42.9 ms | 62.9 ms |
41
+
42
+ Latency is the p50 of 100 Python `predict` calls for a three-head request with compute units `ALL` on an M5 Pro with macOS 27.0, after 10 warmups (`benchmark-latency.py`). This is a local measurement for one request shape, not a device-wide benchmark; p95 values are in `reports/latency.json`. W8 and LUT6 are weight-only compression: they shrink the download and do not make inference faster. `CPU_AND_NE` is much slower than `ALL` for this graph (689 ms versus 14.7 ms p50 for `fp16` L256), so use `ALL`.
43
+
44
+ On the first 20 bucket-fitting rows per domain, the L128 and L256 packages agree with the native predictions: `fp16` 173/173 and 345/345, `w8` 172/173 and 345/345, `lut6` 169/173 and 342/345 (`reports/verify-packages-L128-L256.json`).
45
+
46
+ ## Usage
47
+
48
+ ```bash
49
+ uv sync
50
+ uv run python runtime.py --model-dir . --precision lut6 --length 256 \
51
+ --text "My transfer is still pending and I used the wrong sort code. Can you stop it?" \
52
+ --tasks '{"intent": ["transfer_pending", "transfer_cancel", "beneficiary_add", "card_lost"], "urgency": ["low", "normal", "high"]}'
53
+ ```
54
+
55
+ ```python
56
+ from runtime import CoreMLDecide
57
+
58
+ model = CoreMLDecide(".", precision="w8", length=256)
59
+ model.classify(
60
+ "Battery dies before lunch, but the keyboard and the screen are the best I have used.",
61
+ {"sentiment": ["positive", "negative", "mixed", "neutral"],
62
+ "aspects": {"labels": ["battery", "keyboard", "screen", "price"], "multi_label": True, "cls_threshold": 0.4}},
63
+ )
64
+ ```
65
+
66
+ The runtime loads only the tokenizer files and the Core ML package; it does not load PyTorch weights. Requests that exceed the bucket raise `ValueError`. When downloading with `huggingface_hub.snapshot_download`, pass `local_dir=` so the packages are materialized; Core ML compilation rejects the symlinked weight files in the default Hub cache.
67
+
68
+ ### Inputs and outputs
69
+
70
+ | Name | Type | Shape | Meaning |
71
+ | --- | --- | --- | --- |
72
+ | `input_ids` | int32 | `[1, L]` | Schema and text tokens from the GLiNER2 span collator, padded |
73
+ | `attention_mask` | int32 | `[1, L]` | 1 for real tokens |
74
+ | `marker_indices` | int32 | `[1, 4, K]` | Token position of each `[L]` label marker, per head |
75
+ | `marker_mask` | float32 | `[1, 4, K]` | 1 for used label slots |
76
+ | `logits` | float32 | `[1, 4, K]` | Label logits; unused slots are −10⁴ |
77
+ | `probabilities` | float32 | `[1, 4, K]` | Per-head softmax of `logits` |
78
+
79
+ ## Reproduce
80
+
81
+ ```bash
82
+ uv sync
83
+ uv run python convert-coreml.py --precision fp16 --length 512 --max-options 32
84
+ uv run python compress-coreml.py --method linear \
85
+ --source build/gliner2_decide_classification_fp16_L512_H4_K32.mlpackage \
86
+ --output build/gliner2_decide_classification_w8_L512_H4_K32.mlpackage
87
+ uv run python compress-coreml.py --method lut --bits 6 --granularity per_tensor \
88
+ --source build/gliner2_decide_classification_fp16_L512_H4_K32.mlpackage \
89
+ --output build/gliner2_decide_classification_lut6_L512_H4_K32.mlpackage
90
+ uv run python score-fast-decisions.py --backend native --out build/fast-decisions-native.json
91
+ uv run python score-fast-decisions.py --backend coreml \
92
+ --package build/gliner2_decide_classification_lut6_L512_H4_K32.mlpackage --out build/fast-decisions-lut6.json
93
+ ```
94
+
95
+ `convert-coreml.py` checks the export wrapper against the native logits (4.8e-7) and the converted package against native `classify_text` on three examples. The Core ML deployment target is iOS 17 / macOS 14. Source file hashes are in `assets.lock.json`; conversion, scoring, agreement and latency reports are in `reports/`.
assets.lock.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "files": {
7
+ "config.json": {
8
+ "size": 594,
9
+ "sha256": "e748e5b80575471c91b3f0dd00f513ba58242544fcb7e1236e0021e61abd7673"
10
+ },
11
+ "encoder_config/config.json": {
12
+ "size": 920,
13
+ "sha256": "bd32f1484ba5a199f7a63df44df3814b839fffcf6e64478323c4689868ef6015"
14
+ },
15
+ "model.safetensors": {
16
+ "size": 1945828140,
17
+ "sha256": "40a5a23ff860dc3dff426cecd1048cacdd29c648c96db209dad818e9686dc997"
18
+ },
19
+ "special_tokens_map.json": {
20
+ "size": 2414,
21
+ "sha256": "84ea70143f533d7e99b393d87f20010887a9ac2cba955828ef313886e4e83f4f"
22
+ },
23
+ "tokenizer.json": {
24
+ "size": 8333952,
25
+ "sha256": "3ad87d9ffe669147063e70850927dd2da90249e2acc5c8527f1eb65df467bcc8"
26
+ },
27
+ "tokenizer_config.json": {
28
+ "size": 3356,
29
+ "sha256": "323199a4e946039410899f3779f2aa3eaef1500213c512727ad0f623d4f21309"
30
+ }
31
+ }
32
+ }
benchmark-latency.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Median Core ML prediction latency for each package on one fixed three-head request."""
2
+ import argparse
3
+ import json
4
+ import re
5
+ import statistics
6
+ import time
7
+ from pathlib import Path
8
+
9
+ import coremltools as ct
10
+ from huggingface_hub import snapshot_download
11
+
12
+ from convert_names import MODEL_ID, MODEL_REVISION
13
+ from preprocessing import load_processor, prepare_decision
14
+
15
+ TEXT = ("From: compliance@group.example\nSubject: Protocol update — action required today\n\n"
16
+ "Please confirm the new retention rule is applied before Friday's audit.")
17
+ TASKS = {"intent": ["fyi", "request", "approval", "complaint", "newsletter", "security_alert"],
18
+ "urgency": ["low", "normal", "high", "critical"],
19
+ "route": ["support", "billing", "legal", "security", "finance", "archive"]}
20
+
21
+
22
+ def main():
23
+ parser = argparse.ArgumentParser()
24
+ parser.add_argument("--warmup", type=int, default=10)
25
+ parser.add_argument("--calls", type=int, default=100)
26
+ parser.add_argument("--compute-units", choices=["all", "cpu_ne", "cpu_gpu", "cpu"], default="all")
27
+ parser.add_argument("--out", default="build/latency.json")
28
+ parser.add_argument("packages", nargs="+")
29
+ args = parser.parse_args()
30
+ processor = load_processor(snapshot_download(MODEL_ID, revision=MODEL_REVISION))
31
+ report = {}
32
+ for package in args.packages:
33
+ bucket = tuple(map(int, re.search(r"_L(\d+)_H(\d+)_K(\d+)", package).groups()))
34
+ arrays = prepare_decision(processor, TEXT, TASKS, *bucket)
35
+ units = {"all": ct.ComputeUnit.ALL, "cpu_ne": ct.ComputeUnit.CPU_AND_NE, "cpu_gpu": ct.ComputeUnit.CPU_AND_GPU,
36
+ "cpu": ct.ComputeUnit.CPU_ONLY}[args.compute_units]
37
+ model = ct.models.MLModel(package, compute_units=units)
38
+ for _ in range(args.warmup):
39
+ model.predict(arrays)
40
+ times = []
41
+ for _ in range(args.calls):
42
+ start = time.perf_counter()
43
+ model.predict(arrays)
44
+ times.append((time.perf_counter() - start) * 1000)
45
+ report[Path(package).name] = {"p50_ms": statistics.median(times),
46
+ "p95_ms": sorted(times)[int(0.95 * (len(times) - 1))]}
47
+ print(Path(package).name, report[Path(package).name], flush=True)
48
+ Path(args.out).write_text(json.dumps(report, indent=2) + "\n")
49
+
50
+
51
+ if __name__ == "__main__":
52
+ main()
compress-coreml.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Compress a verified GLiNER2.5-Decide classification Core ML model."""
2
+ import argparse
3
+ import json
4
+ import time
5
+ from pathlib import Path
6
+
7
+ import coremltools as ct
8
+ from coremltools.optimize.coreml import (
9
+ OpLinearQuantizerConfig,
10
+ OpPalettizerConfig,
11
+ OptimizationConfig,
12
+ get_weights_metadata,
13
+ linear_quantize_weights,
14
+ palettize_weights,
15
+ )
16
+
17
+
18
+ def package_bytes(path):
19
+ return sum(item.stat().st_size for item in path.rglob("*") if item.is_file())
20
+
21
+
22
+ def main():
23
+ parser = argparse.ArgumentParser()
24
+ parser.add_argument("--source", required=True)
25
+ parser.add_argument("--output", required=True)
26
+ parser.add_argument("--bits", type=int, choices=[4, 6, 8], default=8)
27
+ parser.add_argument("--method", choices=["lut", "linear", "embedding"], default="lut")
28
+ parser.add_argument("--linear-mode", choices=["linear_symmetric", "linear"], default="linear_symmetric")
29
+ parser.add_argument("--granularity", choices=["per_tensor", "per_grouped_channel"], default="per_tensor")
30
+ parser.add_argument("--group-size", type=int, default=32)
31
+ args = parser.parse_args()
32
+ start = time.perf_counter()
33
+ model = ct.models.MLModel(args.source, skip_model_load=True)
34
+ selected_weights = None
35
+ if args.method in ("linear", "embedding"):
36
+ if args.bits != 8:
37
+ parser.error("linear quantization here supports only 8-bit weights")
38
+ quantizer = OpLinearQuantizerConfig(
39
+ mode=args.linear_mode, dtype="int8", granularity="per_channel", weight_threshold=2048,
40
+ )
41
+ if args.method == "embedding":
42
+ metadata = get_weights_metadata(model, weight_threshold=2048)
43
+ names = [
44
+ name for name, weight in metadata.items()
45
+ if "encoder_embeddings_word_embeddings" in name
46
+ and len(weight.val.shape) == 2
47
+ and any(op.op_type == "gather" for op in weight.child_ops)
48
+ ]
49
+ if len(names) != 1:
50
+ raise ValueError(f"expected one token embedding weight, found {names}")
51
+ config = OptimizationConfig(op_name_configs={names[0]: quantizer})
52
+ selected_weights = names
53
+ else:
54
+ config = OptimizationConfig(global_config=quantizer)
55
+ compressed = linear_quantize_weights(model, config=config)
56
+ variant = (
57
+ f"W8 {args.linear_mode} token embedding only"
58
+ if args.method == "embedding" else f"W8 {args.linear_mode} per-channel"
59
+ )
60
+ else:
61
+ config = OptimizationConfig(global_config=OpPalettizerConfig(
62
+ mode="kmeans", nbits=args.bits, granularity=args.granularity,
63
+ group_size=args.group_size,
64
+ enable_per_channel_scale=args.granularity == "per_grouped_channel",
65
+ num_kmeans_workers=4,
66
+ ))
67
+ compressed = palettize_weights(model, config=config)
68
+ variant = f"LUT{args.bits} {args.granularity}"
69
+ compressed.short_description = f"{model.short_description}; {variant} weights"
70
+ compressed.author = model.author
71
+ compressed.license = model.license
72
+ compressed.user_defined_metadata.update(model.user_defined_metadata)
73
+ compressed.user_defined_metadata["weight_compression"] = variant
74
+ compressed.save(args.output)
75
+ report = {"source": args.source, "output": args.output, "method": args.method,
76
+ "linear_mode": args.linear_mode if args.method in ("linear", "embedding") else None,
77
+ "granularity": "per_channel" if args.method in ("linear", "embedding") else args.granularity,
78
+ "selected_weights": selected_weights,
79
+ "source_bytes": package_bytes(Path(args.source)),
80
+ "output_bytes": package_bytes(Path(args.output)), "compression_seconds": time.perf_counter() - start}
81
+ Path(args.output).with_suffix(".json").write_text(json.dumps(report, indent=2) + "\n")
82
+ print(json.dumps(report, indent=2))
83
+
84
+
85
+ if __name__ == "__main__":
86
+ main()
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": true,
3
+ "_name_or_path": "/home/urchadezaratiana/checkpoints/checkpoint-45500",
4
+ "architecture": "span",
5
+ "architecture_version": 1,
6
+ "architectures": [
7
+ "SpanExtractor"
8
+ ],
9
+ "attn_implementation": "sdpa",
10
+ "config_version": 3,
11
+ "counting_layer": "count_lstm",
12
+ "max_len": null,
13
+ "max_width": 8,
14
+ "model_name": "microsoft/deberta-v3-large",
15
+ "model_type": "extractor",
16
+ "span_head": {
17
+ "dropout": 0.1,
18
+ "max_width": 8,
19
+ "span_mode": "markerV0"
20
+ },
21
+ "token_pooling": "first",
22
+ "transformers_version": "4.48.1",
23
+ "use_moe": false
24
+ }
convert-coreml.py ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Convert and verify the pinned GLiNER2.5-Decide multi-head classification path."""
2
+ import argparse
3
+ import json
4
+ import math
5
+ from pathlib import Path
6
+
7
+ import coremltools as ct
8
+ import numpy as np
9
+ import torch
10
+ from gliner2 import AutoExtractor
11
+ from huggingface_hub import snapshot_download
12
+ from transformers.models.deberta_v2 import modeling_deberta_v2
13
+
14
+ from convert_names import MODEL_ID, MODEL_REVISION
15
+ from export_model import GLiNER2DecideExport, coreml_safe_attention_forward
16
+ from preprocessing import classification_schema, prepare_decision
17
+ from runtime import decode, package_name
18
+
19
+ EXAMPLES = [
20
+ ("My subscription renewed on April 15 for ¥5,400 after the service was already down. "
21
+ "Can I get that charge refunded?",
22
+ {"intent": ["order_status", "refund_request", "cancel_subscription", "update_payment", "login_problem",
23
+ "shipping_delay", "bug_report", "speak_to_human"]}),
24
+ ("Battery dies before lunch, but the keyboard and the screen are the best I have used on a laptop.",
25
+ {"sentiment": ["positive", "negative", "mixed", "neutral"],
26
+ "aspects": {"labels": ["battery", "keyboard", "screen", "camera", "price", "support"],
27
+ "multi_label": True, "cls_threshold": 0.4}}),
28
+ ("From: compliance@group.example\nSubject: Protocol update — action required today\n\n"
29
+ "Please confirm the new retention rule is applied before Friday's audit.",
30
+ {"intent": ["fyi", "request", "approval", "complaint", "newsletter", "security_alert"],
31
+ "urgency": ["low", "normal", "high", "critical"],
32
+ "route": ["support", "billing", "legal", "security", "finance", "archive"]}),
33
+ ]
34
+
35
+
36
+ def native_logits(native, text, tasks):
37
+ """Per-head native logits via the upstream span collator, encoder and shared classifier."""
38
+ from gliner2.training.trainer import ExtractorCollator
39
+
40
+ collator = ExtractorCollator(native.processor, is_training=False, max_len=None, architecture="span")
41
+ batch = collator([(text, classification_schema(tasks).build())])
42
+ _, schema_embs = native._encode_batch(batch)
43
+ return [native.classifier(torch.stack(embs[1:])).squeeze(-1) for embs in schema_embs[0]]
44
+
45
+
46
+ def main():
47
+ parser = argparse.ArgumentParser()
48
+ parser.add_argument("--output-dir", default="build")
49
+ parser.add_argument("--length", type=int, default=128)
50
+ parser.add_argument("--max-heads", type=int, default=4)
51
+ parser.add_argument("--max-options", type=int, default=8)
52
+ parser.add_argument("--precision", choices=["fp16", "fp32"], default="fp16")
53
+ args = parser.parse_args()
54
+ torch.set_num_threads(4)
55
+ source = snapshot_download(
56
+ MODEL_ID, revision=MODEL_REVISION,
57
+ allow_patterns=[
58
+ "config.json", "encoder_config/*", "model.safetensors", "tokenizer.json", "tokenizer_config.json",
59
+ "special_tokens_map.json",
60
+ ],
61
+ )
62
+ native = AutoExtractor.from_pretrained(source, map_location="cpu").eval()
63
+ wrapper = GLiNER2DecideExport(native).eval()
64
+ bucket = (args.length, args.max_heads, args.max_options)
65
+ text, tasks = EXAMPLES[2]
66
+ arrays = prepare_decision(native.processor, text, tasks, *bucket)
67
+ tensors = tuple(torch.from_numpy(value) for value in arrays.values())
68
+
69
+ def wrapper_error():
70
+ with torch.no_grad():
71
+ expected = native_logits(native, text, tasks)
72
+ actual = wrapper(*tensors)[0][0]
73
+ return max(float((row - actual[h, : len(row)]).abs().max()) for h, row in enumerate(expected))
74
+
75
+ error = wrapper_error()
76
+ if error > 1e-4:
77
+ raise RuntimeError(f"Wrapper/native logit mismatch: {error}")
78
+ # The upstream scale is a constant for a fixed DeBERTa attention head width.
79
+ # Its traced int32 sqrt is rejected by Core ML; freeze the identical float32
80
+ # value while tracing, and restore the upstream implementation immediately.
81
+ original_scale = modeling_deberta_v2.scaled_size_sqrt
82
+ original_rpos = modeling_deberta_v2.build_rpos
83
+ original_attention = modeling_deberta_v2.DisentangledSelfAttention.forward
84
+
85
+ def static_scale(query_layer, scale_factor):
86
+ value = math.sqrt(float(query_layer.shape[-1] * scale_factor))
87
+ return torch.tensor(value, dtype=torch.float32, device=query_layer.device)
88
+
89
+ modeling_deberta_v2.scaled_size_sqrt = static_scale
90
+ # The encoder only uses self-attention: query and key sequence lengths are
91
+ # identical, so the scripted build_rpos returns relative_pos unchanged.
92
+ modeling_deberta_v2.build_rpos = lambda query, key, relative_pos, buckets, max_pos: relative_pos
93
+ modeling_deberta_v2.DisentangledSelfAttention.forward = coreml_safe_attention_forward
94
+ try:
95
+ frozen_error = wrapper_error()
96
+ if frozen_error > 1e-4:
97
+ raise RuntimeError(f"Frozen attention scale changed native logits: {frozen_error}")
98
+ with torch.no_grad():
99
+ traced = torch.jit.trace(wrapper, tensors, check_trace=False)
100
+ finally:
101
+ modeling_deberta_v2.scaled_size_sqrt = original_scale
102
+ modeling_deberta_v2.build_rpos = original_rpos
103
+ modeling_deberta_v2.DisentangledSelfAttention.forward = original_attention
104
+ grid = (1, args.max_heads, args.max_options)
105
+ converted = ct.convert(
106
+ traced, convert_to="mlprogram", minimum_deployment_target=ct.target.iOS17,
107
+ compute_precision=ct.precision.FLOAT16 if args.precision == "fp16" else ct.precision.FLOAT32,
108
+ compute_units=ct.ComputeUnit.CPU_ONLY,
109
+ inputs=[
110
+ ct.TensorType(name="input_ids", shape=(1, args.length), dtype=np.int32),
111
+ ct.TensorType(name="attention_mask", shape=(1, args.length), dtype=np.int32),
112
+ ct.TensorType(name="marker_indices", shape=grid, dtype=np.int32),
113
+ ct.TensorType(name="marker_mask", shape=grid, dtype=np.float32),
114
+ ],
115
+ outputs=[ct.TensorType(name="logits", dtype=np.float32), ct.TensorType(name="probabilities", dtype=np.float32)],
116
+ )
117
+ converted.short_description = "GLiNER2.5-Decide multi-head schema classification path"
118
+ converted.author = "Fastino (original); Fluid Inference (Core ML conversion)"
119
+ converted.license = "Apache-2.0"
120
+ converted.user_defined_metadata.update({
121
+ "source_model": MODEL_ID, "source_revision": MODEL_REVISION,
122
+ "scope": "classification only; span and count heads not exported",
123
+ "length": str(args.length), "max_heads": str(args.max_heads), "max_options": str(args.max_options),
124
+ })
125
+ out = Path(args.output_dir)
126
+ out.mkdir(parents=True, exist_ok=True)
127
+ package = out / package_name(args.precision, *bucket)
128
+ converted.save(str(package))
129
+ runtime = ct.models.MLModel(str(package), compute_units=ct.ComputeUnit.ALL)
130
+ cases = []
131
+ for text, tasks in EXAMPLES:
132
+ native_output = native.classify_text(text, tasks, include_confidence=True)
133
+ logits = np.asarray(runtime.predict(prepare_decision(native.processor, text, tasks, *bucket))["logits"])[0]
134
+ coreml_output = decode(tasks, logits)
135
+ if json.dumps(labels_only(native_output)) != json.dumps(labels_only(coreml_output)):
136
+ raise RuntimeError(f"Core ML/native mismatch: {coreml_output} != {native_output}")
137
+ cases.append({"text": text, "native": native_output, "coreml": coreml_output,
138
+ "max_confidence_error": confidence_error(native_output, coreml_output)})
139
+ report = {
140
+ "source_model": MODEL_ID, "source_revision": MODEL_REVISION, "package": str(package),
141
+ "package_bytes": sum(f.stat().st_size for f in package.rglob("*") if f.is_file()),
142
+ "native_total_parameters": sum(p.numel() for p in native.parameters()),
143
+ "exported_parameters": sum(p.numel() for p in wrapper.parameters()),
144
+ "wrapper_max_logit_error": error, "coremltools": ct.__version__, "torch": torch.__version__,
145
+ "cases": cases,
146
+ }
147
+ (out / f"conversion-{package.stem}.json").write_text(json.dumps(report, indent=2, ensure_ascii=False) + "\n")
148
+ print(json.dumps(report, indent=2, ensure_ascii=False))
149
+
150
+
151
+ def _entries(value):
152
+ return value if isinstance(value, list) else [value]
153
+
154
+
155
+ def labels_only(result: dict) -> dict:
156
+ return {task: sorted(entry["label"] for entry in _entries(value)) for task, value in result.items()}
157
+
158
+
159
+ def confidence_error(native: dict, coreml: dict) -> float:
160
+ errors = []
161
+ for task, value in native.items():
162
+ predicted = {entry["label"]: entry["confidence"] for entry in _entries(coreml[task])}
163
+ errors += [abs(entry["confidence"] - predicted[entry["label"]]) for entry in _entries(value)]
164
+ return max(errors)
165
+
166
+
167
+ if __name__ == "__main__":
168
+ main()
convert_names.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ """Pinned source checkpoint shared by the conversion, verification and scoring scripts."""
2
+ MODEL_ID = "fastino/GLiNER2.5-Decide"
3
+ MODEL_REVISION = "65624f1a0265b3f612bae66a2685a06b94a68a9d"
encoder_config/config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": true,
3
+ "_name_or_path": "/home/urchadezaratiana/checkpoints/checkpoint-45500/encoder_config/config.json",
4
+ "attention_probs_dropout_prob": 0.1,
5
+ "dtype": "float32",
6
+ "hidden_act": "gelu",
7
+ "hidden_dropout_prob": 0.1,
8
+ "hidden_size": 1024,
9
+ "initializer_range": 0.02,
10
+ "intermediate_size": 4096,
11
+ "layer_norm_eps": 1e-07,
12
+ "legacy": true,
13
+ "max_position_embeddings": 512,
14
+ "max_relative_positions": -1,
15
+ "model_type": "deberta-v2",
16
+ "norm_rel_ebd": "layer_norm",
17
+ "num_attention_heads": 16,
18
+ "num_hidden_layers": 24,
19
+ "pad_token_id": 0,
20
+ "pooler_dropout": 0,
21
+ "pooler_hidden_act": "gelu",
22
+ "pooler_hidden_size": 1024,
23
+ "pos_att_type": [
24
+ "p2c",
25
+ "c2p"
26
+ ],
27
+ "position_biased_input": false,
28
+ "position_buckets": 256,
29
+ "relative_attention": true,
30
+ "share_att_key": true,
31
+ "transformers_version": "4.48.1",
32
+ "type_vocab_size": 0,
33
+ "vocab_size": 128011
34
+ }
export_model.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Native GLiNER2.5-Decide multi-head classification path with explicit marker routing."""
2
+ import torch
3
+ from torch import nn
4
+ from transformers.models.deberta_v2 import modeling_deberta_v2
5
+
6
+
7
+ def coreml_safe_attention_forward(
8
+ self, hidden_states, attention_mask, output_attentions=False,
9
+ query_states=None, relative_pos=None, rel_embeddings=None,
10
+ ):
11
+ """Native DeBERTa attention with a finite mask sentinel for FP16 Core ML."""
12
+ if query_states is None:
13
+ query_states = hidden_states
14
+ query = self.transpose_for_scores(self.query_proj(query_states), self.num_attention_heads)
15
+ key = self.transpose_for_scores(self.key_proj(hidden_states), self.num_attention_heads)
16
+ value = self.transpose_for_scores(self.value_proj(hidden_states), self.num_attention_heads)
17
+ factor = 1 + int("c2p" in self.pos_att_type) + int("p2c" in self.pos_att_type)
18
+ scale = modeling_deberta_v2.scaled_size_sqrt(query, factor)
19
+ scores = torch.bmm(query, key.transpose(-1, -2) / scale.to(dtype=query.dtype))
20
+ if self.relative_attention:
21
+ relative = self.disentangled_attention_bias(
22
+ query, key, relative_pos, self.pos_dropout(rel_embeddings), factor
23
+ )
24
+ scores = scores + relative
25
+ scores = scores.view(-1, self.num_attention_heads, scores.size(-2), scores.size(-1))
26
+ scores = scores.masked_fill(~attention_mask.bool(), -1e4)
27
+ probabilities = self.dropout(torch.softmax(scores, dim=-1))
28
+ context = torch.bmm(probabilities.view(-1, probabilities.size(-2), probabilities.size(-1)), value)
29
+ context = context.view(-1, self.num_attention_heads, context.size(-2), context.size(-1))
30
+ context = context.permute(0, 2, 1, 3).contiguous()
31
+ context = context.view(context.size()[:-2] + (-1,))
32
+ return (context, probabilities) if output_attentions else (context, None)
33
+
34
+
35
+ class GLiNER2DecideExport(nn.Module):
36
+ """Encoder plus the shared label classifier, scored for every (head, label) marker at once.
37
+
38
+ Logits are returned per head so the host can apply softmax (single-label) or sigmoid
39
+ (multi-label) exactly as the native runtime does. Probabilities are the per-head softmax.
40
+ """
41
+
42
+ def __init__(self, native: nn.Module):
43
+ super().__init__()
44
+ self.encoder = native.encoder
45
+ self.classifier = native.classifier
46
+
47
+ def forward(self, input_ids, attention_mask, marker_indices, marker_mask):
48
+ hidden = self.encoder(input_ids=input_ids.long(), attention_mask=attention_mask.long()).last_hidden_state
49
+ heads, options = marker_indices.shape[1], marker_indices.shape[2]
50
+ flat = marker_indices.long().reshape(1, heads * options, 1).expand(-1, -1, hidden.shape[-1])
51
+ states = hidden.gather(1, flat)
52
+ logits = self.classifier(states).reshape(1, heads, options)
53
+ logits = torch.where(marker_mask > 0.5, logits, torch.full_like(logits, -1e4))
54
+ return logits, torch.softmax(logits, dim=-1)
gliner2_decide_classification_fp16_L128_H4_K8.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b61f4548bb86b1b61153b3a5d3a22637f54bc19493c6864e030493a2fbac88e
3
+ size 1446151
gliner2_decide_classification_fp16_L128_H4_K8.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54501158f56baf0ebe295d99ac251eb0204cea2594881062b731bef9154032e2
3
+ size 921351616
gliner2_decide_classification_fp16_L128_H4_K8.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "7194425C-FE01-46D6-87D7-5F4E30A614E1": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "7E5E91C3-28CD-4FE6-BA8B-03B642A946C5": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "7194425C-FE01-46D6-87D7-5F4E30A614E1"
18
+ }
gliner2_decide_classification_fp16_L256_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:626d74aac1448e0666e5a80d79302139dfd84d5ca80c44ec213c1c6a5497d823
3
+ size 4331797
gliner2_decide_classification_fp16_L256_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54501158f56baf0ebe295d99ac251eb0204cea2594881062b731bef9154032e2
3
+ size 921351616
gliner2_decide_classification_fp16_L256_H4_K32.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "0F28C467-EA06-471F-A536-2845C1EA04D2": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Weights",
7
+ "name": "weights",
8
+ "path": "com.apple.CoreML/weights"
9
+ },
10
+ "8A724345-8447-41EA-846B-8CF427172126": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "8A724345-8447-41EA-846B-8CF427172126"
18
+ }
gliner2_decide_classification_fp16_L512_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b215d623b792e4a107fc0a060c5d0ef921283f79ad45a1d275042419f2858564
3
+ size 14821667
gliner2_decide_classification_fp16_L512_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54501158f56baf0ebe295d99ac251eb0204cea2594881062b731bef9154032e2
3
+ size 921351616
gliner2_decide_classification_fp16_L512_H4_K32.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "2659AFFA-867C-410F-8AE6-0C4B3FC40276": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "39168FBF-EED8-4E6F-8E39-C3EB7295282B": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "2659AFFA-867C-410F-8AE6-0C4B3FC40276"
18
+ }
gliner2_decide_classification_lut6_L128_H4_K8.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f570cf44266c1707e8cdeafebba8084003c6399fab7a6b1961cb650e602733ab
3
+ size 1475563
gliner2_decide_classification_lut6_L128_H4_K8.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:042712feeb1b1bc105603ec82b634eb05b1be58eeef878d840112b39bc8c8a93
3
+ size 345968704
gliner2_decide_classification_lut6_L128_H4_K8.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "0DA7B173-7F8F-44B1-80B4-525B4613CCC3": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Weights",
7
+ "name": "weights",
8
+ "path": "com.apple.CoreML/weights"
9
+ },
10
+ "8533DAB7-36CE-4FCA-9EB3-D60A75900CDF": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "8533DAB7-36CE-4FCA-9EB3-D60A75900CDF"
18
+ }
gliner2_decide_classification_lut6_L256_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cdcb3bd54a8786aa05cdd8dbb1f34603ce3b0e64403d5973a3b971fb3ea036c
3
+ size 4361209
gliner2_decide_classification_lut6_L256_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:042712feeb1b1bc105603ec82b634eb05b1be58eeef878d840112b39bc8c8a93
3
+ size 345968704
gliner2_decide_classification_lut6_L256_H4_K32.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "BA61F74E-CA59-40B3-AADF-349CF3AED909": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "D5E517C8-12C8-4580-BFDC-5DE8AEFA3B99": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "BA61F74E-CA59-40B3-AADF-349CF3AED909"
18
+ }
gliner2_decide_classification_lut6_L512_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ace980c0a72efd57b3654772a542a0c4fbb6c9b669a9d1fa759eae970d4b98b
3
+ size 14851079
gliner2_decide_classification_lut6_L512_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:042712feeb1b1bc105603ec82b634eb05b1be58eeef878d840112b39bc8c8a93
3
+ size 345968704
gliner2_decide_classification_lut6_L512_H4_K32.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "8EA312DA-C4A4-4D24-AF9E-6801A601CD31": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "D0A89611-DC9B-492B-ABFC-59000B9C7DD7": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "8EA312DA-C4A4-4D24-AF9E-6801A601CD31"
18
+ }
gliner2_decide_classification_w8_L128_H4_K8.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9aaa4d0481ebea87aa200c9a5a6e6f2e091d802aadb54de2077f1e7dc734fcd0
3
+ size 1489740
gliner2_decide_classification_w8_L128_H4_K8.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b509230b2fa7889c97086cc4c8da34adb5acab96feba286514a72dbdc681666
3
+ size 461915648
gliner2_decide_classification_w8_L128_H4_K8.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "3E810636-76F0-484E-A35D-0C7E6A6C6C1A": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Weights",
7
+ "name": "weights",
8
+ "path": "com.apple.CoreML/weights"
9
+ },
10
+ "ED9FF073-F8B5-4635-9513-F227567098FD": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "ED9FF073-F8B5-4635-9513-F227567098FD"
18
+ }
gliner2_decide_classification_w8_L256_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:999189808b876e9de8ebddbc33609881a84401a2dda9a64ecd82fdeb8722f95b
3
+ size 4375386
gliner2_decide_classification_w8_L256_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b509230b2fa7889c97086cc4c8da34adb5acab96feba286514a72dbdc681666
3
+ size 461915648
gliner2_decide_classification_w8_L256_H4_K32.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "37FC6834-7FAB-400D-A13F-DCBA6347753E": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "40CA9F0D-ADE7-424B-A117-8A5AFC0F0995": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "37FC6834-7FAB-400D-A13F-DCBA6347753E"
18
+ }
gliner2_decide_classification_w8_L512_H4_K32.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:400df7ec9300d4ccd0cd01e369df98ff45b24ae06a93774a6cd8591720220b39
3
+ size 14865256
gliner2_decide_classification_w8_L512_H4_K32.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b509230b2fa7889c97086cc4c8da34adb5acab96feba286514a72dbdc681666
3
+ size 461915648
gliner2_decide_classification_w8_L512_H4_K32.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "468F166A-BA65-4AE3-8D30-BDFC6296FD38": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "A069AFC1-E62E-49D5-AB90-C7DCCB259A61": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "468F166A-BA65-4AE3-8D30-BDFC6296FD38"
18
+ }
preprocessing.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Native GLiNER2 span-architecture schema preprocessing for a fixed Core ML bucket."""
2
+ import numpy as np
3
+ from gliner2 import Schema
4
+ from gliner2.models.base import load_extractor_tokenizer
5
+ from gliner2.processor import SchemaTransformer
6
+ from gliner2.training.trainer import ExtractorCollator
7
+
8
+
9
+ def load_processor(tokenizer_dir: str):
10
+ """Load only the tokenizer and schema formatter needed by the Core ML model."""
11
+ return SchemaTransformer(tokenizer=load_extractor_tokenizer(tokenizer_dir), token_pooling="first")
12
+
13
+
14
+ def classification_schema(tasks: dict) -> Schema:
15
+ """Same task-dict handling as native ``classify_text``."""
16
+ schema = Schema()
17
+ for name, config in tasks.items():
18
+ if isinstance(config, dict) and "labels" in config:
19
+ cfg = config.copy()
20
+ labels = cfg.pop("labels")
21
+ schema.classification(name, labels, **cfg)
22
+ else:
23
+ schema.classification(name, config)
24
+ return schema
25
+
26
+
27
+ def task_labels(tasks: dict) -> dict[str, list[str]]:
28
+ result = {}
29
+ for name, config in tasks.items():
30
+ labels = config["labels"] if isinstance(config, dict) and "labels" in config else config
31
+ result[name] = list(labels.keys()) if isinstance(labels, dict) else list(labels)
32
+ return result
33
+
34
+
35
+ def prepare_decision(processor, text: str, tasks: dict, length: int, max_heads: int, max_options: int):
36
+ """Tokenize ``tasks`` exactly as the native span collator does and pad into the bucket."""
37
+ if not 1 <= len(tasks) <= max_heads:
38
+ raise ValueError(f"Expected 1..{max_heads} decision heads, got {len(tasks)}")
39
+ labels = task_labels(tasks)
40
+ for name, values in labels.items():
41
+ if not 1 <= len(values) <= max_options:
42
+ raise ValueError(f"Head {name!r} has {len(values)} labels; bucket holds 1..{max_options}")
43
+ collator = ExtractorCollator(processor, is_training=False, max_len=None, architecture="span")
44
+ batch = collator([(text, classification_schema(tasks).build())])
45
+ ids = batch.input_ids.numpy()
46
+ if ids.shape[1] > length:
47
+ raise ValueError(f"Schema and text require {ids.shape[1]} subwords; bucket holds {length}")
48
+ groups = batch.schema_special_indices[0]
49
+ if len(groups) != len(labels):
50
+ raise ValueError("Schema head count does not match the requested tasks")
51
+ indices = np.zeros((1, max_heads, max_options), dtype=np.int32)
52
+ mask = np.zeros((1, max_heads, max_options), dtype=np.float32)
53
+ for head, (positions, values) in enumerate(zip(groups, labels.values())):
54
+ # positions[0] is the [P] prompt marker; the rest are one [L] marker per label.
55
+ markers = list(positions[1:])
56
+ if len(markers) != len(values):
57
+ raise ValueError("Label markers were truncated or merged")
58
+ indices[0, head, : len(markers)] = markers
59
+ mask[0, head, : len(markers)] = 1.0
60
+ attention = batch.attention_mask.numpy()
61
+ pad = processor.tokenizer.pad_token_id
62
+ return {
63
+ "input_ids": np.pad(ids, ((0, 0), (0, length - ids.shape[1])), constant_values=pad).astype(np.int32),
64
+ "attention_mask": np.pad(attention, ((0, 0), (0, length - attention.shape[1]))).astype(np.int32),
65
+ "marker_indices": indices,
66
+ "marker_mask": mask,
67
+ }
pyproject.toml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "gliner2-decide-coreml"
3
+ version = "0.1.0"
4
+ description = "Pinned GLiNER2.5-Decide Core ML classification export"
5
+ requires-python = ">=3.12,<3.13"
6
+ dependencies = [
7
+ "coremltools==9.0",
8
+ "gliner2[local]==2.0.0",
9
+ "huggingface-hub>=0.34,<1",
10
+ "numpy<2.3",
11
+ "protobuf>=5,<7",
12
+ "psutil>=7,<8",
13
+ "sentencepiece>=0.2,<0.3",
14
+ "torch==2.7.0",
15
+ "transformers==4.57.6",
16
+ ]
17
+
18
+ [dependency-groups]
19
+ dev = ["pytest>=8.4", "ruff>=0.13"]
20
+ compression = ["scikit-learn==1.5.1"]
21
+
22
+ [tool.pytest.ini_options]
23
+ testpaths = ["tests"]
24
+ pythonpath = ["."]
25
+
26
+ [tool.ruff]
27
+ line-length = 120
28
+ target-version = "py312"
29
+
30
+ [tool.ruff.lint]
31
+ select = ["E", "F", "I"]
reports/conversion-gliner2_decide_classification_fp16_L128_H4_K8.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_model": "fastino/GLiNER2.5-Decide",
3
+ "source_revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "package": "build/gliner2_decide_classification_fp16_L128_H4_K8.mlpackage",
5
+ "package_bytes": 922798384,
6
+ "native_total_parameters": 486444053,
7
+ "exported_parameters": 436022273,
8
+ "wrapper_max_logit_error": 4.76837158203125e-07,
9
+ "coremltools": "9.0",
10
+ "torch": "2.7.0",
11
+ "cases": [
12
+ {
13
+ "text": "My subscription renewed on April 15 for ¥5,400 after the service was already down. Can I get that charge refunded?",
14
+ "native": {
15
+ "intent": {
16
+ "label": "refund_request",
17
+ "confidence": 0.9982081651687622
18
+ }
19
+ },
20
+ "coreml": {
21
+ "intent": {
22
+ "label": "refund_request",
23
+ "confidence": 0.9982183726849228
24
+ }
25
+ },
26
+ "max_confidence_error": 1.0207516160543051e-05
27
+ },
28
+ {
29
+ "text": "Battery dies before lunch, but the keyboard and the screen are the best I have used on a laptop.",
30
+ "native": {
31
+ "sentiment": {
32
+ "label": "positive",
33
+ "confidence": 0.9994937181472778
34
+ },
35
+ "aspects": [
36
+ {
37
+ "label": "battery",
38
+ "confidence": 0.7610353231430054
39
+ },
40
+ {
41
+ "label": "keyboard",
42
+ "confidence": 0.9939987659454346
43
+ },
44
+ {
45
+ "label": "screen",
46
+ "confidence": 0.9846210479736328
47
+ }
48
+ ]
49
+ },
50
+ "coreml": {
51
+ "sentiment": {
52
+ "label": "positive",
53
+ "confidence": 0.9994971447974256
54
+ },
55
+ "aspects": [
56
+ {
57
+ "label": "battery",
58
+ "confidence": 0.7611836278339746
59
+ },
60
+ {
61
+ "label": "keyboard",
62
+ "confidence": 0.9940428462362503
63
+ },
64
+ {
65
+ "label": "screen",
66
+ "confidence": 0.9846346585586978
67
+ }
68
+ ]
69
+ },
70
+ "max_confidence_error": 0.0001483046909692698
71
+ },
72
+ {
73
+ "text": "From: compliance@group.example\nSubject: Protocol update — action required today\n\nPlease confirm the new retention rule is applied before Friday's audit.",
74
+ "native": {
75
+ "intent": {
76
+ "label": "request",
77
+ "confidence": 0.4523202180862427
78
+ },
79
+ "urgency": {
80
+ "label": "critical",
81
+ "confidence": 0.4121380150318146
82
+ },
83
+ "route": {
84
+ "label": "legal",
85
+ "confidence": 0.5795720219612122
86
+ }
87
+ },
88
+ "coreml": {
89
+ "intent": {
90
+ "label": "request",
91
+ "confidence": 0.45214515554103
92
+ },
93
+ "urgency": {
94
+ "label": "critical",
95
+ "confidence": 0.4120186418236959
96
+ },
97
+ "route": {
98
+ "label": "legal",
99
+ "confidence": 0.5799514106438567
100
+ }
101
+ },
102
+ "max_confidence_error": 0.0003793886826445325
103
+ }
104
+ ]
105
+ }
reports/conversion-gliner2_decide_classification_fp16_L256_H4_K32.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_model": "fastino/GLiNER2.5-Decide",
3
+ "source_revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "package": "build/gliner2_decide_classification_fp16_L256_H4_K32.mlpackage",
5
+ "package_bytes": 925684030,
6
+ "native_total_parameters": 486444053,
7
+ "exported_parameters": 436022273,
8
+ "wrapper_max_logit_error": 4.76837158203125e-07,
9
+ "coremltools": "9.0",
10
+ "torch": "2.7.0",
11
+ "cases": [
12
+ {
13
+ "text": "My subscription renewed on April 15 for ¥5,400 after the service was already down. Can I get that charge refunded?",
14
+ "native": {
15
+ "intent": {
16
+ "label": "refund_request",
17
+ "confidence": 0.9982081651687622
18
+ }
19
+ },
20
+ "coreml": {
21
+ "intent": {
22
+ "label": "refund_request",
23
+ "confidence": 0.9982183726849228
24
+ }
25
+ },
26
+ "max_confidence_error": 1.0207516160543051e-05
27
+ },
28
+ {
29
+ "text": "Battery dies before lunch, but the keyboard and the screen are the best I have used on a laptop.",
30
+ "native": {
31
+ "sentiment": {
32
+ "label": "positive",
33
+ "confidence": 0.9994937181472778
34
+ },
35
+ "aspects": [
36
+ {
37
+ "label": "battery",
38
+ "confidence": 0.7610353231430054
39
+ },
40
+ {
41
+ "label": "keyboard",
42
+ "confidence": 0.9939987659454346
43
+ },
44
+ {
45
+ "label": "screen",
46
+ "confidence": 0.9846210479736328
47
+ }
48
+ ]
49
+ },
50
+ "coreml": {
51
+ "sentiment": {
52
+ "label": "positive",
53
+ "confidence": 0.9994971447974256
54
+ },
55
+ "aspects": [
56
+ {
57
+ "label": "battery",
58
+ "confidence": 0.7611836278339746
59
+ },
60
+ {
61
+ "label": "keyboard",
62
+ "confidence": 0.9940428462362503
63
+ },
64
+ {
65
+ "label": "screen",
66
+ "confidence": 0.9846346585586978
67
+ }
68
+ ]
69
+ },
70
+ "max_confidence_error": 0.0001483046909692698
71
+ },
72
+ {
73
+ "text": "From: compliance@group.example\nSubject: Protocol update — action required today\n\nPlease confirm the new retention rule is applied before Friday's audit.",
74
+ "native": {
75
+ "intent": {
76
+ "label": "request",
77
+ "confidence": 0.4523202180862427
78
+ },
79
+ "urgency": {
80
+ "label": "critical",
81
+ "confidence": 0.4121380150318146
82
+ },
83
+ "route": {
84
+ "label": "legal",
85
+ "confidence": 0.5795720219612122
86
+ }
87
+ },
88
+ "coreml": {
89
+ "intent": {
90
+ "label": "request",
91
+ "confidence": 0.45214515554103
92
+ },
93
+ "urgency": {
94
+ "label": "critical",
95
+ "confidence": 0.4120186418236959
96
+ },
97
+ "route": {
98
+ "label": "legal",
99
+ "confidence": 0.5799514106438567
100
+ }
101
+ },
102
+ "max_confidence_error": 0.0003793886826445325
103
+ }
104
+ ]
105
+ }
reports/conversion-gliner2_decide_classification_fp16_L512_H4_K32.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_model": "fastino/GLiNER2.5-Decide",
3
+ "source_revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "package": "build/gliner2_decide_classification_fp16_L512_H4_K32.mlpackage",
5
+ "package_bytes": 936173900,
6
+ "native_total_parameters": 486444053,
7
+ "exported_parameters": 436022273,
8
+ "wrapper_max_logit_error": 4.76837158203125e-07,
9
+ "coremltools": "9.0",
10
+ "torch": "2.7.0",
11
+ "cases": [
12
+ {
13
+ "text": "My subscription renewed on April 15 for ¥5,400 after the service was already down. Can I get that charge refunded?",
14
+ "native": {
15
+ "intent": {
16
+ "label": "refund_request",
17
+ "confidence": 0.9982081651687622
18
+ }
19
+ },
20
+ "coreml": {
21
+ "intent": {
22
+ "label": "refund_request",
23
+ "confidence": 0.9982183726849228
24
+ }
25
+ },
26
+ "max_confidence_error": 1.0207516160543051e-05
27
+ },
28
+ {
29
+ "text": "Battery dies before lunch, but the keyboard and the screen are the best I have used on a laptop.",
30
+ "native": {
31
+ "sentiment": {
32
+ "label": "positive",
33
+ "confidence": 0.9994937181472778
34
+ },
35
+ "aspects": [
36
+ {
37
+ "label": "battery",
38
+ "confidence": 0.7610353231430054
39
+ },
40
+ {
41
+ "label": "keyboard",
42
+ "confidence": 0.9939987659454346
43
+ },
44
+ {
45
+ "label": "screen",
46
+ "confidence": 0.9846210479736328
47
+ }
48
+ ]
49
+ },
50
+ "coreml": {
51
+ "sentiment": {
52
+ "label": "positive",
53
+ "confidence": 0.9994971447974256
54
+ },
55
+ "aspects": [
56
+ {
57
+ "label": "battery",
58
+ "confidence": 0.7611836278339746
59
+ },
60
+ {
61
+ "label": "keyboard",
62
+ "confidence": 0.9940428462362503
63
+ },
64
+ {
65
+ "label": "screen",
66
+ "confidence": 0.9846346585586978
67
+ }
68
+ ]
69
+ },
70
+ "max_confidence_error": 0.0001483046909692698
71
+ },
72
+ {
73
+ "text": "From: compliance@group.example\nSubject: Protocol update — action required today\n\nPlease confirm the new retention rule is applied before Friday's audit.",
74
+ "native": {
75
+ "intent": {
76
+ "label": "request",
77
+ "confidence": 0.4523202180862427
78
+ },
79
+ "urgency": {
80
+ "label": "critical",
81
+ "confidence": 0.4121380150318146
82
+ },
83
+ "route": {
84
+ "label": "legal",
85
+ "confidence": 0.5795720219612122
86
+ }
87
+ },
88
+ "coreml": {
89
+ "intent": {
90
+ "label": "request",
91
+ "confidence": 0.45214515554103
92
+ },
93
+ "urgency": {
94
+ "label": "critical",
95
+ "confidence": 0.4120186418236959
96
+ },
97
+ "route": {
98
+ "label": "legal",
99
+ "confidence": 0.5799514106438567
100
+ }
101
+ },
102
+ "max_confidence_error": 0.0003793886826445325
103
+ }
104
+ ]
105
+ }
reports/fast-decisions-coreml-embedding_w8-L512-all.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "split": "development (public, 100 rows per domain); published card scores use the held-out test split",
7
+ "backend": "coreml",
8
+ "package": "build/gliner2_decide_classification_embedding_w8_L512_H4_K32.mlpackage",
9
+ "compute_units": "all",
10
+ "average_accuracy": 0.6299509803921568,
11
+ "pooled_accuracy": 0.6141379310344828,
12
+ "model_call_p50_ms": 41.95125005207956,
13
+ "model_call_p95_ms": 45.35062506329268,
14
+ "seconds": 133.38757445802912,
15
+ "domains": {
16
+ "support_intent": {
17
+ "heads": 100,
18
+ "hits": 76,
19
+ "accuracy": 0.76
20
+ },
21
+ "support_topic": {
22
+ "heads": 100,
23
+ "hits": 44,
24
+ "accuracy": 0.44
25
+ },
26
+ "document_type": {
27
+ "heads": 100,
28
+ "hits": 79,
29
+ "accuracy": 0.79
30
+ },
31
+ "review_sentiment": {
32
+ "heads": 100,
33
+ "hits": 84,
34
+ "accuracy": 0.84
35
+ },
36
+ "agent_handoff": {
37
+ "heads": 100,
38
+ "hits": 77,
39
+ "accuracy": 0.77
40
+ },
41
+ "email_triage": {
42
+ "heads": 400,
43
+ "hits": 237,
44
+ "accuracy": 0.5925
45
+ },
46
+ "ticket_route": {
47
+ "heads": 300,
48
+ "hits": 145,
49
+ "accuracy": 0.48333333333333334
50
+ },
51
+ "product_feedback": {
52
+ "heads": 200,
53
+ "hits": 104,
54
+ "accuracy": 0.52
55
+ },
56
+ "banking_intent": {
57
+ "heads": 100,
58
+ "hits": 64,
59
+ "accuracy": 0.64
60
+ },
61
+ "clinic_request": {
62
+ "heads": 200,
63
+ "hits": 129,
64
+ "accuracy": 0.645
65
+ },
66
+ "travel_request": {
67
+ "heads": 100,
68
+ "hits": 63,
69
+ "accuracy": 0.63
70
+ },
71
+ "news_topic": {
72
+ "heads": 100,
73
+ "hits": 69,
74
+ "accuracy": 0.69
75
+ },
76
+ "paper_field": {
77
+ "heads": 100,
78
+ "hits": 47,
79
+ "accuracy": 0.47
80
+ },
81
+ "sports_recap": {
82
+ "heads": 300,
83
+ "hits": 226,
84
+ "accuracy": 0.7533333333333333
85
+ },
86
+ "restaurant_review": {
87
+ "heads": 200,
88
+ "hits": 93,
89
+ "accuracy": 0.465
90
+ },
91
+ "benefits_request": {
92
+ "heads": 200,
93
+ "hits": 151,
94
+ "accuracy": 0.755
95
+ },
96
+ "screen_tags": {
97
+ "heads": 200,
98
+ "hits": 93,
99
+ "accuracy": 0.465
100
+ }
101
+ }
102
+ }
reports/fast-decisions-coreml-fp16-L512-all.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "split": "development (public, 100 rows per domain); published card scores use the held-out test split",
7
+ "backend": "coreml",
8
+ "package": "build/gliner2_decide_classification_fp16_L512_H4_K32.mlpackage",
9
+ "compute_units": "all",
10
+ "average_accuracy": 0.629264705882353,
11
+ "pooled_accuracy": 0.6137931034482759,
12
+ "model_call_p50_ms": 49.66187500394881,
13
+ "model_call_p95_ms": 64.96874999720603,
14
+ "seconds": 158.56965945789125,
15
+ "domains": {
16
+ "support_intent": {
17
+ "heads": 100,
18
+ "hits": 76,
19
+ "accuracy": 0.76
20
+ },
21
+ "support_topic": {
22
+ "heads": 100,
23
+ "hits": 44,
24
+ "accuracy": 0.44
25
+ },
26
+ "document_type": {
27
+ "heads": 100,
28
+ "hits": 79,
29
+ "accuracy": 0.79
30
+ },
31
+ "review_sentiment": {
32
+ "heads": 100,
33
+ "hits": 84,
34
+ "accuracy": 0.84
35
+ },
36
+ "agent_handoff": {
37
+ "heads": 100,
38
+ "hits": 76,
39
+ "accuracy": 0.76
40
+ },
41
+ "email_triage": {
42
+ "heads": 400,
43
+ "hits": 237,
44
+ "accuracy": 0.5925
45
+ },
46
+ "ticket_route": {
47
+ "heads": 300,
48
+ "hits": 145,
49
+ "accuracy": 0.48333333333333334
50
+ },
51
+ "product_feedback": {
52
+ "heads": 200,
53
+ "hits": 104,
54
+ "accuracy": 0.52
55
+ },
56
+ "banking_intent": {
57
+ "heads": 100,
58
+ "hits": 64,
59
+ "accuracy": 0.64
60
+ },
61
+ "clinic_request": {
62
+ "heads": 200,
63
+ "hits": 129,
64
+ "accuracy": 0.645
65
+ },
66
+ "travel_request": {
67
+ "heads": 100,
68
+ "hits": 63,
69
+ "accuracy": 0.63
70
+ },
71
+ "news_topic": {
72
+ "heads": 100,
73
+ "hits": 69,
74
+ "accuracy": 0.69
75
+ },
76
+ "paper_field": {
77
+ "heads": 100,
78
+ "hits": 47,
79
+ "accuracy": 0.47
80
+ },
81
+ "sports_recap": {
82
+ "heads": 300,
83
+ "hits": 227,
84
+ "accuracy": 0.7566666666666667
85
+ },
86
+ "restaurant_review": {
87
+ "heads": 200,
88
+ "hits": 93,
89
+ "accuracy": 0.465
90
+ },
91
+ "benefits_request": {
92
+ "heads": 200,
93
+ "hits": 150,
94
+ "accuracy": 0.75
95
+ },
96
+ "screen_tags": {
97
+ "heads": 200,
98
+ "hits": 93,
99
+ "accuracy": 0.465
100
+ }
101
+ }
102
+ }
reports/fast-decisions-coreml-lut4-L512-all.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "split": "development (public, 100 rows per domain); published card scores use the held-out test split",
7
+ "backend": "coreml",
8
+ "package": "build/gliner2_decide_classification_lut4_L512_H4_K32.mlpackage",
9
+ "compute_units": "all",
10
+ "average_accuracy": 0.6226470588235294,
11
+ "pooled_accuracy": 0.606551724137931,
12
+ "model_call_p50_ms": 43.17912494298071,
13
+ "model_call_p95_ms": 48.890333040617406,
14
+ "seconds": 132.74362174991984,
15
+ "domains": {
16
+ "support_intent": {
17
+ "heads": 100,
18
+ "hits": 75,
19
+ "accuracy": 0.75
20
+ },
21
+ "support_topic": {
22
+ "heads": 100,
23
+ "hits": 46,
24
+ "accuracy": 0.46
25
+ },
26
+ "document_type": {
27
+ "heads": 100,
28
+ "hits": 78,
29
+ "accuracy": 0.78
30
+ },
31
+ "review_sentiment": {
32
+ "heads": 100,
33
+ "hits": 85,
34
+ "accuracy": 0.85
35
+ },
36
+ "agent_handoff": {
37
+ "heads": 100,
38
+ "hits": 73,
39
+ "accuracy": 0.73
40
+ },
41
+ "email_triage": {
42
+ "heads": 400,
43
+ "hits": 234,
44
+ "accuracy": 0.585
45
+ },
46
+ "ticket_route": {
47
+ "heads": 300,
48
+ "hits": 143,
49
+ "accuracy": 0.4766666666666667
50
+ },
51
+ "product_feedback": {
52
+ "heads": 200,
53
+ "hits": 102,
54
+ "accuracy": 0.51
55
+ },
56
+ "banking_intent": {
57
+ "heads": 100,
58
+ "hits": 63,
59
+ "accuracy": 0.63
60
+ },
61
+ "clinic_request": {
62
+ "heads": 200,
63
+ "hits": 129,
64
+ "accuracy": 0.645
65
+ },
66
+ "travel_request": {
67
+ "heads": 100,
68
+ "hits": 64,
69
+ "accuracy": 0.64
70
+ },
71
+ "news_topic": {
72
+ "heads": 100,
73
+ "hits": 70,
74
+ "accuracy": 0.7
75
+ },
76
+ "paper_field": {
77
+ "heads": 100,
78
+ "hits": 43,
79
+ "accuracy": 0.43
80
+ },
81
+ "sports_recap": {
82
+ "heads": 300,
83
+ "hits": 223,
84
+ "accuracy": 0.7433333333333333
85
+ },
86
+ "restaurant_review": {
87
+ "heads": 200,
88
+ "hits": 90,
89
+ "accuracy": 0.45
90
+ },
91
+ "benefits_request": {
92
+ "heads": 200,
93
+ "hits": 151,
94
+ "accuracy": 0.755
95
+ },
96
+ "screen_tags": {
97
+ "heads": 200,
98
+ "hits": 90,
99
+ "accuracy": 0.45
100
+ }
101
+ }
102
+ }
reports/fast-decisions-coreml-lut6-L512-all.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "split": "development (public, 100 rows per domain); published card scores use the held-out test split",
7
+ "backend": "coreml",
8
+ "package": "build/gliner2_decide_classification_lut6_L512_H4_K32.mlpackage",
9
+ "compute_units": "all",
10
+ "average_accuracy": 0.6302941176470588,
11
+ "pooled_accuracy": 0.6151724137931035,
12
+ "model_call_p50_ms": 41.30370810162276,
13
+ "model_call_p95_ms": 45.43866601306945,
14
+ "seconds": 125.51691958296578,
15
+ "domains": {
16
+ "support_intent": {
17
+ "heads": 100,
18
+ "hits": 75,
19
+ "accuracy": 0.75
20
+ },
21
+ "support_topic": {
22
+ "heads": 100,
23
+ "hits": 45,
24
+ "accuracy": 0.45
25
+ },
26
+ "document_type": {
27
+ "heads": 100,
28
+ "hits": 79,
29
+ "accuracy": 0.79
30
+ },
31
+ "review_sentiment": {
32
+ "heads": 100,
33
+ "hits": 84,
34
+ "accuracy": 0.84
35
+ },
36
+ "agent_handoff": {
37
+ "heads": 100,
38
+ "hits": 76,
39
+ "accuracy": 0.76
40
+ },
41
+ "email_triage": {
42
+ "heads": 400,
43
+ "hits": 234,
44
+ "accuracy": 0.585
45
+ },
46
+ "ticket_route": {
47
+ "heads": 300,
48
+ "hits": 149,
49
+ "accuracy": 0.49666666666666665
50
+ },
51
+ "product_feedback": {
52
+ "heads": 200,
53
+ "hits": 103,
54
+ "accuracy": 0.515
55
+ },
56
+ "banking_intent": {
57
+ "heads": 100,
58
+ "hits": 64,
59
+ "accuracy": 0.64
60
+ },
61
+ "clinic_request": {
62
+ "heads": 200,
63
+ "hits": 129,
64
+ "accuracy": 0.645
65
+ },
66
+ "travel_request": {
67
+ "heads": 100,
68
+ "hits": 63,
69
+ "accuracy": 0.63
70
+ },
71
+ "news_topic": {
72
+ "heads": 100,
73
+ "hits": 69,
74
+ "accuracy": 0.69
75
+ },
76
+ "paper_field": {
77
+ "heads": 100,
78
+ "hits": 47,
79
+ "accuracy": 0.47
80
+ },
81
+ "sports_recap": {
82
+ "heads": 300,
83
+ "hits": 229,
84
+ "accuracy": 0.7633333333333333
85
+ },
86
+ "restaurant_review": {
87
+ "heads": 200,
88
+ "hits": 94,
89
+ "accuracy": 0.47
90
+ },
91
+ "benefits_request": {
92
+ "heads": 200,
93
+ "hits": 152,
94
+ "accuracy": 0.76
95
+ },
96
+ "screen_tags": {
97
+ "heads": 200,
98
+ "hits": 92,
99
+ "accuracy": 0.46
100
+ }
101
+ }
102
+ }
reports/fast-decisions-coreml-w8-L512-all.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "split": "development (public, 100 rows per domain); published card scores use the held-out test split",
7
+ "backend": "coreml",
8
+ "package": "build/gliner2_decide_classification_w8_L512_H4_K32.mlpackage",
9
+ "compute_units": "all",
10
+ "average_accuracy": 0.6301470588235294,
11
+ "pooled_accuracy": 0.6151724137931035,
12
+ "model_call_p50_ms": 46.61016596946865,
13
+ "model_call_p95_ms": 52.74316598661244,
14
+ "seconds": 150.09406595793553,
15
+ "domains": {
16
+ "support_intent": {
17
+ "heads": 100,
18
+ "hits": 76,
19
+ "accuracy": 0.76
20
+ },
21
+ "support_topic": {
22
+ "heads": 100,
23
+ "hits": 44,
24
+ "accuracy": 0.44
25
+ },
26
+ "document_type": {
27
+ "heads": 100,
28
+ "hits": 79,
29
+ "accuracy": 0.79
30
+ },
31
+ "review_sentiment": {
32
+ "heads": 100,
33
+ "hits": 84,
34
+ "accuracy": 0.84
35
+ },
36
+ "agent_handoff": {
37
+ "heads": 100,
38
+ "hits": 76,
39
+ "accuracy": 0.76
40
+ },
41
+ "email_triage": {
42
+ "heads": 400,
43
+ "hits": 239,
44
+ "accuracy": 0.5975
45
+ },
46
+ "ticket_route": {
47
+ "heads": 300,
48
+ "hits": 146,
49
+ "accuracy": 0.4866666666666667
50
+ },
51
+ "product_feedback": {
52
+ "heads": 200,
53
+ "hits": 104,
54
+ "accuracy": 0.52
55
+ },
56
+ "banking_intent": {
57
+ "heads": 100,
58
+ "hits": 64,
59
+ "accuracy": 0.64
60
+ },
61
+ "clinic_request": {
62
+ "heads": 200,
63
+ "hits": 129,
64
+ "accuracy": 0.645
65
+ },
66
+ "travel_request": {
67
+ "heads": 100,
68
+ "hits": 63,
69
+ "accuracy": 0.63
70
+ },
71
+ "news_topic": {
72
+ "heads": 100,
73
+ "hits": 69,
74
+ "accuracy": 0.69
75
+ },
76
+ "paper_field": {
77
+ "heads": 100,
78
+ "hits": 47,
79
+ "accuracy": 0.47
80
+ },
81
+ "sports_recap": {
82
+ "heads": 300,
83
+ "hits": 226,
84
+ "accuracy": 0.7533333333333333
85
+ },
86
+ "restaurant_review": {
87
+ "heads": 200,
88
+ "hits": 93,
89
+ "accuracy": 0.465
90
+ },
91
+ "benefits_request": {
92
+ "heads": 200,
93
+ "hits": 151,
94
+ "accuracy": 0.755
95
+ },
96
+ "screen_tags": {
97
+ "heads": 200,
98
+ "hits": 94,
99
+ "accuracy": 0.47
100
+ }
101
+ }
102
+ }
reports/fast-decisions-native.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "fastino/GLiNER2.5-Decide",
3
+ "revision": "65624f1a0265b3f612bae66a2685a06b94a68a9d",
4
+ "dataset": "fastino/fast-decisions",
5
+ "dataset_revision": "1a33070cabf94ce2e29105482dd2ef6c157ad7f2",
6
+ "split": "development (public, 100 rows per domain); published card scores use the held-out test split",
7
+ "backend": "native",
8
+ "package": null,
9
+ "compute_units": null,
10
+ "average_accuracy": 0.629264705882353,
11
+ "pooled_accuracy": 0.6137931034482759,
12
+ "model_call_p50_ms": null,
13
+ "model_call_p95_ms": null,
14
+ "seconds": 794.7205639999593,
15
+ "domains": {
16
+ "support_intent": {
17
+ "heads": 100,
18
+ "hits": 76,
19
+ "accuracy": 0.76
20
+ },
21
+ "support_topic": {
22
+ "heads": 100,
23
+ "hits": 44,
24
+ "accuracy": 0.44
25
+ },
26
+ "document_type": {
27
+ "heads": 100,
28
+ "hits": 79,
29
+ "accuracy": 0.79
30
+ },
31
+ "review_sentiment": {
32
+ "heads": 100,
33
+ "hits": 84,
34
+ "accuracy": 0.84
35
+ },
36
+ "agent_handoff": {
37
+ "heads": 100,
38
+ "hits": 76,
39
+ "accuracy": 0.76
40
+ },
41
+ "email_triage": {
42
+ "heads": 400,
43
+ "hits": 237,
44
+ "accuracy": 0.5925
45
+ },
46
+ "ticket_route": {
47
+ "heads": 300,
48
+ "hits": 145,
49
+ "accuracy": 0.48333333333333334
50
+ },
51
+ "product_feedback": {
52
+ "heads": 200,
53
+ "hits": 104,
54
+ "accuracy": 0.52
55
+ },
56
+ "banking_intent": {
57
+ "heads": 100,
58
+ "hits": 64,
59
+ "accuracy": 0.64
60
+ },
61
+ "clinic_request": {
62
+ "heads": 200,
63
+ "hits": 129,
64
+ "accuracy": 0.645
65
+ },
66
+ "travel_request": {
67
+ "heads": 100,
68
+ "hits": 63,
69
+ "accuracy": 0.63
70
+ },
71
+ "news_topic": {
72
+ "heads": 100,
73
+ "hits": 69,
74
+ "accuracy": 0.69
75
+ },
76
+ "paper_field": {
77
+ "heads": 100,
78
+ "hits": 47,
79
+ "accuracy": 0.47
80
+ },
81
+ "sports_recap": {
82
+ "heads": 300,
83
+ "hits": 227,
84
+ "accuracy": 0.7566666666666667
85
+ },
86
+ "restaurant_review": {
87
+ "heads": 200,
88
+ "hits": 93,
89
+ "accuracy": 0.465
90
+ },
91
+ "benefits_request": {
92
+ "heads": 200,
93
+ "hits": 150,
94
+ "accuracy": 0.75
95
+ },
96
+ "screen_tags": {
97
+ "heads": 200,
98
+ "hits": 93,
99
+ "accuracy": 0.465
100
+ }
101
+ }
102
+ }
reports/latency.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "machine": "Apple M5 Pro, macOS 27.0, compute units ALL",
3
+ "request": "three-head email triage request (benchmark-latency.py), 10 warmups, 100 calls, Python coremltools predict",
4
+ "gliner2_decide_classification_fp16_L128_H4_K8.mlpackage": {
5
+ "p50_ms": 8.18,
6
+ "p95_ms": 10.33
7
+ },
8
+ "gliner2_decide_classification_w8_L128_H4_K8.mlpackage": {
9
+ "p50_ms": 10.09,
10
+ "p95_ms": 12.98
11
+ },
12
+ "gliner2_decide_classification_lut6_L128_H4_K8.mlpackage": {
13
+ "p50_ms": 9.89,
14
+ "p95_ms": 14.45
15
+ },
16
+ "gliner2_decide_classification_fp16_L256_H4_K32.mlpackage": {
17
+ "p50_ms": 14.71,
18
+ "p95_ms": 16.69
19
+ },
20
+ "gliner2_decide_classification_w8_L256_H4_K32.mlpackage": {
21
+ "p50_ms": 20.58,
22
+ "p95_ms": 38.79
23
+ },
24
+ "gliner2_decide_classification_lut6_L256_H4_K32.mlpackage": {
25
+ "p50_ms": 17.58,
26
+ "p95_ms": 24.61
27
+ },
28
+ "gliner2_decide_classification_fp16_L512_H4_K32.mlpackage": {
29
+ "p50_ms": 44.02,
30
+ "p95_ms": 98.99
31
+ },
32
+ "gliner2_decide_classification_w8_L512_H4_K32.mlpackage": {
33
+ "p50_ms": 42.93,
34
+ "p95_ms": 66.93
35
+ },
36
+ "gliner2_decide_classification_lut6_L512_H4_K32.mlpackage": {
37
+ "p50_ms": 62.95,
38
+ "p95_ms": 71.11
39
+ },
40
+ "cpu_and_ne": {
41
+ "gliner2_decide_classification_fp16_L256_H4_K32.mlpackage": {
42
+ "p50_ms": 689.15,
43
+ "p95_ms": 1266.79,
44
+ "calls": 30
45
+ }
46
+ }
47
+ }
reports/verify-packages-L128-L256.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "gliner2_decide_classification_fp16_L128_H4_K8.mlpackage": {
3
+ "checked_heads": 173,
4
+ "agree_with_native": 173
5
+ },
6
+ "gliner2_decide_classification_w8_L128_H4_K8.mlpackage": {
7
+ "checked_heads": 173,
8
+ "agree_with_native": 172
9
+ },
10
+ "gliner2_decide_classification_lut6_L128_H4_K8.mlpackage": {
11
+ "checked_heads": 173,
12
+ "agree_with_native": 169
13
+ },
14
+ "gliner2_decide_classification_fp16_L256_H4_K32.mlpackage": {
15
+ "checked_heads": 345,
16
+ "agree_with_native": 345
17
+ },
18
+ "gliner2_decide_classification_w8_L256_H4_K32.mlpackage": {
19
+ "checked_heads": 345,
20
+ "agree_with_native": 345
21
+ },
22
+ "gliner2_decide_classification_lut6_L256_H4_K32.mlpackage": {
23
+ "checked_heads": 345,
24
+ "agree_with_native": 342
25
+ }
26
+ }