smdesai commited on
Commit
ce68e45
·
verified ·
1 Parent(s): 24d17ed

Add a 1024-token bucket (a_t1024..d_t1024)

Browse files

Same weights; texts up to 1024 tokens run in one pass. Validated on Mac and iPhone 17 Pro.

GLiNER25-Multi-FP16.aimodel/main.hash CHANGED
@@ -1 +1 @@
1
- ��<�ؓ��qT�j�g�G�<$2�u}aN�9�
 
1
+ �)�x�m� ��Ґx����poq�������6�/
GLiNER25-Multi-FP16.aimodel/main.mlirb CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eaed8f3c9cd893edf2715413d26ab567a747b43c241a32f4757d614e821339ec
3
- size 576333147
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e129f978d56d830cac87d29078bcbab791706f71bc03b3afd6d7ccc13602882f
3
+ size 577210165
GLiNER25-Multi-FP16.aimodel/metadata.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "author" : "fastino (weights); Core AI port",
3
  "producer" : "coreai-core 1.0.0b3",
4
- "license" : "apache-2.0",
5
- "description" : "GLiNER2.5-Multi v1 (fastino\/gliner2.5-multi-v1@12fc40399dae672ce840c5e3c50a92340bff3c8c) Core AI port: a=encoder+marginals, b=pool scorer+records, c=relations, d=explicit spans; buckets 128,256,512",
6
- "creationDate" : "20260927T010956Z",
7
- "assetVersion" : "2.0"
8
  }
 
1
  {
2
  "author" : "fastino (weights); Core AI port",
3
  "producer" : "coreai-core 1.0.0b3",
4
+ "creationDate" : "20260928T045752Z",
5
+ "assetVersion" : "2.0",
6
+ "description" : "GLiNER2.5-Multi v1 (fastino\/gliner2.5-multi-v1@12fc40399dae672ce840c5e3c50a92340bff3c8c) Core AI port: a=encoder+marginals, b=pool scorer+records, c=relations, d=explicit spans; buckets 128,256,512,1024",
7
+ "license" : "apache-2.0"
8
  }
README.md CHANGED
@@ -38,7 +38,7 @@ and the [GLiNER2](https://github.com/fastino-ai/GLiNER2) authors. The original m
38
 
39
  | File | Purpose |
40
  |---|---|
41
- | `GLiNER25-Multi-FP16.aimodel/` | Core AI source asset, FP16 (550 MB). Twelve functions share one set of weights |
42
  | `tokenizer.json`, `tokenizer_config.json` | Checkpoint tokenizer: SentencePiece Unigram, 250k vocabulary, GLiNER2 special tokens |
43
  | `constants.json` | Weights and settings used by the decoder: `RecordHead.null_embed` and the checkpoint's `boundary_head` settings |
44
  | `functions.json` | Input and output names, shapes and dtypes of every function |
@@ -65,7 +65,8 @@ and the [GLiNER2](https://github.com/fastino-ai/GLiNER2) authors. The original m
65
 
66
  GLiNER2.5's boundary architecture has data-dependent steps between its neural parts, so the model
67
  is exported as four stages. The host runs the logic between them. For each sequence bucket
68
- T ∈ {128, 256, 512} tokens, the functions are `a_t<T>`, `b_t<T>`, `c_t<T>` and `d_t<T>`:
 
69
 
70
  | Function | Computes | Main inputs → outputs |
71
  |---|---|---|
@@ -119,7 +120,9 @@ The reference is upstream GLiNER2 in PyTorch FP32, run through its public extrac
119
  multi-label classification, relations, legacy structures, natural/latent/anchorless records,
120
  exclusive fields, choice fields, entity attributes, joint tasks.
121
  - Ten languages.
122
- - All three buckets.
 
 
123
 
124
  **Boundary items:** the iPhone GPU's FP16 kernels differ slightly from the Mac's, by up to about
125
  0.03 on boundary logits. Items that sit at a decision boundary can therefore flip on device. "FP32
@@ -136,20 +139,21 @@ boundary items" were precomputed at FP32 before any device run:
136
  | ≤128 tokens | 13.4 ms |
137
  | ≤256 tokens | 19.6 ms |
138
  | ≤512 tokens | 39.3 ms |
 
139
  | 18-chunk long document | 684 ms |
140
 
141
- **Memory:** process footprint is about 200 MB after load and about 310 MB after the first run of all
142
- 12 functions. The weights are memory-mapped.
143
 
144
  **Load time:** about 4 s the first time (on-device specialization), about 1 s from the system cache.
145
 
146
  ## Limitations
147
 
148
- - A single call handles up to 512 tokens. Longer texts need chunking. Upstream `extract_long`
149
  splits into overlapping word windows; with this model, windows of 256 words and 48 words of
150
- overlap, shrunk to fit 512 tokens, work well.
151
  - Constrained classification (`Classifier`) and `JointIE` from the upstream card are separate
152
- decoders and are not covered by this port.
153
  - Weight compression was evaluated and not adopted:
154
  - int8 word embeddings (384 MB) kept every decision, but lowered on-device PSNR to 53 dB and raised
155
  peak memory, because the GPU keeps a dequantized copy.
 
38
 
39
  | File | Purpose |
40
  |---|---|
41
+ | `GLiNER25-Multi-FP16.aimodel/` | Core AI source asset, FP16 (550 MB). Sixteen functions share one set of weights |
42
  | `tokenizer.json`, `tokenizer_config.json` | Checkpoint tokenizer: SentencePiece Unigram, 250k vocabulary, GLiNER2 special tokens |
43
  | `constants.json` | Weights and settings used by the decoder: `RecordHead.null_embed` and the checkpoint's `boundary_head` settings |
44
  | `functions.json` | Input and output names, shapes and dtypes of every function |
 
65
 
66
  GLiNER2.5's boundary architecture has data-dependent steps between its neural parts, so the model
67
  is exported as four stages. The host runs the logic between them. For each sequence bucket
68
+ T ∈ {128, 256, 512, 1024} tokens, the functions are `a_t<T>`, `b_t<T>`, `c_t<T>` and `d_t<T>`. The
69
+ encoder uses only relative positions, so the 1024 bucket runs the same weights:
70
 
71
  | Function | Computes | Main inputs → outputs |
72
  |---|---|---|
 
120
  multi-label classification, relations, legacy structures, natural/latent/anchorless records,
121
  exclusive fields, choice fields, entity attributes, joint tasks.
122
  - Ten languages.
123
+ - The 128, 256 and 512 buckets. The 1024 bucket was checked separately: stage A against eager FP32
124
+ at 991 tokens (60.9 dB and above on the Mac), and a 991-token clinical note end to end on the
125
+ iPhone (the same 16 items as upstream, max confidence error 0.0033).
126
 
127
  **Boundary items:** the iPhone GPU's FP16 kernels differ slightly from the Mac's, by up to about
128
  0.03 on boundary logits. Items that sit at a decision boundary can therefore flip on device. "FP32
 
139
  | ≤128 tokens | 13.4 ms |
140
  | ≤256 tokens | 19.6 ms |
141
  | ≤512 tokens | 39.3 ms |
142
+ | ≤1024 tokens (991-token note) | 117 ms |
143
  | 18-chunk long document | 684 ms |
144
 
145
+ **Memory:** process footprint is about 360 MB after load and about 460 MB after the first run of all
146
+ 16 functions (about 200 and 310 MB without the 1024 bucket). The weights are memory-mapped.
147
 
148
  **Load time:** about 4 s the first time (on-device specialization), about 1 s from the system cache.
149
 
150
  ## Limitations
151
 
152
+ - A single call handles up to 1024 tokens. Longer texts need chunking. Upstream `extract_long`
153
  splits into overlapping word windows; with this model, windows of 256 words and 48 words of
154
+ overlap, shrunk to fit 512 tokens, work well and keep every chunk in the faster 512 bucket.
155
  - Constrained classification (`Classifier`) and `JointIE` from the upstream card are separate
156
+ decoders on top of the same stages; the Swift runtime ports both.
157
  - Weight compression was evaluated and not adopted:
158
  - int8 word embeddings (384 MB) kept every decision, but lowered on-device PSNR to 53 dB and raised
159
  peak memory, because the GPU keeps a dequantized copy.
functions.json CHANGED
@@ -895,5 +895,304 @@
895
  "outputs": [
896
  "explicit_logits"
897
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
898
  }
899
  }
 
895
  "outputs": [
896
  "explicit_logits"
897
  ]
898
+ },
899
+ "a_t1024": {
900
+ "inputs": {
901
+ "input_ids": [
902
+ [
903
+ 1,
904
+ 1024
905
+ ],
906
+ "int32"
907
+ ],
908
+ "attention_mask": [
909
+ [
910
+ 1,
911
+ 1024
912
+ ],
913
+ "int32"
914
+ ],
915
+ "word_idx": [
916
+ [
917
+ 1,
918
+ 1024
919
+ ],
920
+ "int32"
921
+ ],
922
+ "word_mask": [
923
+ [
924
+ 1,
925
+ 1024
926
+ ],
927
+ "int32"
928
+ ],
929
+ "query_idx": [
930
+ [
931
+ 1,
932
+ 32
933
+ ],
934
+ "int32"
935
+ ],
936
+ "query_mask": [
937
+ [
938
+ 1,
939
+ 32
940
+ ],
941
+ "int32"
942
+ ],
943
+ "cls_idx": [
944
+ [
945
+ 1,
946
+ 32
947
+ ],
948
+ "int32"
949
+ ]
950
+ },
951
+ "outputs": [
952
+ "text_states",
953
+ "query_states",
954
+ "cls_logits",
955
+ "boundary_states",
956
+ "start_logits",
957
+ "end_logits",
958
+ "inside_logits",
959
+ "pool_start",
960
+ "pool_end",
961
+ "null_logits",
962
+ "count_logits",
963
+ "record_field"
964
+ ]
965
+ },
966
+ "b_t1024": {
967
+ "inputs": {
968
+ "boundary_states": [
969
+ [
970
+ 1,
971
+ 1025,
972
+ 128
973
+ ],
974
+ "float16"
975
+ ],
976
+ "query_states": [
977
+ [
978
+ 1,
979
+ 32,
980
+ 768
981
+ ],
982
+ "float16"
983
+ ],
984
+ "text_states": [
985
+ [
986
+ 1,
987
+ 1024,
988
+ 768
989
+ ],
990
+ "float16"
991
+ ],
992
+ "word_mask": [
993
+ [
994
+ 1,
995
+ 1024
996
+ ],
997
+ "int32"
998
+ ],
999
+ "query_mask": [
1000
+ [
1001
+ 1,
1002
+ 32
1003
+ ],
1004
+ "int32"
1005
+ ],
1006
+ "start_logits": [
1007
+ [
1008
+ 1,
1009
+ 32,
1010
+ 1025
1011
+ ],
1012
+ "float16"
1013
+ ],
1014
+ "end_logits": [
1015
+ [
1016
+ 1,
1017
+ 32,
1018
+ 1025
1019
+ ],
1020
+ "float16"
1021
+ ],
1022
+ "inside_logits": [
1023
+ [
1024
+ 1,
1025
+ 32,
1026
+ 1024
1027
+ ],
1028
+ "float16"
1029
+ ],
1030
+ "pool_idx": [
1031
+ [
1032
+ 1,
1033
+ 192,
1034
+ 2
1035
+ ],
1036
+ "int32"
1037
+ ],
1038
+ "pool_mask": [
1039
+ [
1040
+ 1,
1041
+ 192
1042
+ ],
1043
+ "int32"
1044
+ ],
1045
+ "pool_prior": [
1046
+ [
1047
+ 1,
1048
+ 192
1049
+ ],
1050
+ "float16"
1051
+ ]
1052
+ },
1053
+ "outputs": [
1054
+ "pair_logits",
1055
+ "record_cand",
1056
+ "record_inst",
1057
+ "latent_seed",
1058
+ "anchorless_inst",
1059
+ "anchorless_object"
1060
+ ]
1061
+ },
1062
+ "c_t1024": {
1063
+ "inputs": {
1064
+ "text_states": [
1065
+ [
1066
+ 1,
1067
+ 1024,
1068
+ 768
1069
+ ],
1070
+ "float16"
1071
+ ],
1072
+ "word_mask": [
1073
+ [
1074
+ 1,
1075
+ 1024
1076
+ ],
1077
+ "int32"
1078
+ ],
1079
+ "relation_query": [
1080
+ [
1081
+ 1,
1082
+ 8,
1083
+ 1536
1084
+ ],
1085
+ "float16"
1086
+ ],
1087
+ "pairs": [
1088
+ [
1089
+ 1,
1090
+ 512,
1091
+ 4
1092
+ ],
1093
+ "int32"
1094
+ ],
1095
+ "pair_relation": [
1096
+ [
1097
+ 1,
1098
+ 512
1099
+ ],
1100
+ "int32"
1101
+ ],
1102
+ "pair_mask": [
1103
+ [
1104
+ 1,
1105
+ 512
1106
+ ],
1107
+ "int32"
1108
+ ]
1109
+ },
1110
+ "outputs": [
1111
+ "relation_logits"
1112
+ ]
1113
+ },
1114
+ "d_t1024": {
1115
+ "inputs": {
1116
+ "boundary_states": [
1117
+ [
1118
+ 1,
1119
+ 1025,
1120
+ 128
1121
+ ],
1122
+ "float16"
1123
+ ],
1124
+ "query_states": [
1125
+ [
1126
+ 1,
1127
+ 32,
1128
+ 768
1129
+ ],
1130
+ "float16"
1131
+ ],
1132
+ "text_states": [
1133
+ [
1134
+ 1,
1135
+ 1024,
1136
+ 768
1137
+ ],
1138
+ "float16"
1139
+ ],
1140
+ "word_mask": [
1141
+ [
1142
+ 1,
1143
+ 1024
1144
+ ],
1145
+ "int32"
1146
+ ],
1147
+ "query_mask": [
1148
+ [
1149
+ 1,
1150
+ 32
1151
+ ],
1152
+ "int32"
1153
+ ],
1154
+ "start_logits": [
1155
+ [
1156
+ 1,
1157
+ 32,
1158
+ 1025
1159
+ ],
1160
+ "float16"
1161
+ ],
1162
+ "end_logits": [
1163
+ [
1164
+ 1,
1165
+ 32,
1166
+ 1025
1167
+ ],
1168
+ "float16"
1169
+ ],
1170
+ "inside_logits": [
1171
+ [
1172
+ 1,
1173
+ 32,
1174
+ 1024
1175
+ ],
1176
+ "float16"
1177
+ ],
1178
+ "spans": [
1179
+ [
1180
+ 1,
1181
+ 64,
1182
+ 2
1183
+ ],
1184
+ "int32"
1185
+ ],
1186
+ "span_mask": [
1187
+ [
1188
+ 1,
1189
+ 64
1190
+ ],
1191
+ "int32"
1192
+ ]
1193
+ },
1194
+ "outputs": [
1195
+ "explicit_logits"
1196
+ ]
1197
  }
1198
  }