join3r commited on
Commit
dae4f76
·
verified ·
1 Parent(s): 9e86a3e

Release Stem GTE Memory epoch2 q8 with calibrated thresholds and evaluation documentation

Browse files
Files changed (12) hide show
  1. .gitattributes +1 -0
  2. LICENSE +202 -0
  3. NOTICE +17 -0
  4. README.md +117 -0
  5. SHA256SUMS +10 -0
  6. config.json +50 -0
  7. example.mjs +27 -0
  8. onnx/model_quantized.onnx +3 -0
  9. special_tokens_map.json +51 -0
  10. stem-model.json +42 -0
  11. tokenizer.json +3 -0
  12. tokenizer_config.json +61 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [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.
NOTICE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Stem GTE Memory
2
+
3
+ Derived from Alibaba-NLP/gte-multilingual-reranker-base by the GTE authors
4
+ at Alibaba Group. The upstream model declares Apache License 2.0.
5
+ https://huggingface.co/Alibaba-NLP/gte-multilingual-reranker-base
6
+ Model revision: 8215cf04918ba6f7b6a62bb44238ce2953d8831c
7
+ Upstream implementation: Alibaba-NLP/new-impl
8
+ Code revision: 40ced75c3017eb27626c9d4ea981bde21a2662f4
9
+
10
+ Stem modifications (September 2026): fine-tuned encoder and classification
11
+ head for personal-memory relevance using fictional profiles and Czech,
12
+ Slovak, German and English queries; exported epoch2 to ONNX and dynamically
13
+ quantized weights to int8; calibrated separate fact and skill thresholds.
14
+ The supplied model configuration and tokenizer match the tested export.
15
+
16
+ This notice describes attribution and modifications; it does not imply
17
+ endorsement by the upstream authors. See LICENSE for Apache License 2.0.
README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - cs
5
+ - sk
6
+ - de
7
+ - en
8
+ base_model: Alibaba-NLP/gte-multilingual-reranker-base
9
+ base_model_relation: finetune
10
+ pipeline_tag: text-ranking
11
+ tags:
12
+ - onnx
13
+ - reranker
14
+ - memory
15
+ - stem
16
+ - quantized
17
+ - experimental
18
+ ---
19
+
20
+ # Stem GTE Memory
21
+
22
+ A custom GTE reranker fine-tuned for Stem's personal-memory retrieval, with training queries in **Czech, Slovak, German, and English**. It scores how relevant a stored memory is to a user's message. Stem also uses the same weights for skill selection with a separately calibrated threshold.
23
+
24
+ This is the selected **epoch2 q8 ONNX** release, model ID `gte-memory-20260905-epoch2`. The five inference files total **358,119,455 bytes (341.53 MiB)**; Stem's dropdown rounds this to approximately 342 MB. The quantized graph alone is 341,032,790 bytes.
25
+
26
+ In Stem's fresh synthetic memory benchmark, this checkpoint improved recall from **43.1% to 64.7%** and reduced irrelevant selections from **166 to 87**, compared with the configured Qwen3 Reranker 0.6B baseline. A separate local timing experiment measured **320 ms vs 3,116 ms median** for the benchmark pipeline, approximately **9.74× faster**. These are scoped benchmark results, not universal model rankings or end-to-end chat speed guarantees.
27
+
28
+ ## Intended use
29
+
30
+ Rerank a shortlist of memory facts, or skill descriptions, before an assistant responds. Training and the reported multilingual evaluations used English stored facts or descriptions with multilingual user requests. Broader language coverage inherited from the base model has not been established by this fine-tune's evaluation.
31
+
32
+ This is an experimental, opt-in release. Publishing the files does not enable automatic downloading in existing Stem versions; that app integration is separate.
33
+
34
+ ## Files and integrity
35
+
36
+ - `onnx/model_quantized.onnx`: selected q8 inference graph, ONNX opset 17.
37
+ - `config.json`, `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json`: the exact measured inference configuration and tokenizer.
38
+ - `stem-model.json`: immutable model identity, upstream revisions, per-file SHA-256 hashes and sizes, and Stem thresholds.
39
+ - `example.mjs`: local Node.js inference example using Transformers.js 3.8.1.
40
+ - `LICENSE` and `NOTICE`: licensing and modification notices.
41
+
42
+ Pin a Hub commit revision when downloading, then verify all five inference files against `stem-model.json`. Hashes are also pinned in Stem's runtime. No training datasets, chat transcripts, benchmark examples, FP32 weights, or training checkpoints are included.
43
+
44
+ `config.json` retains an inert temporary export path in `_name_or_path` to preserve its measured hash. It does not need to exist. Its upstream `auto_map` metadata is likewise preserved; the supported ONNX path below does not execute remote Python code.
45
+
46
+ ## Inference contract
47
+
48
+ Use **Transformers.js 3.8.1 `PreTrainedModel`**, not its auto sequence-classification loader: this export retains the upstream custom `model_type: new`. This repository contains ONNX weights, not a PyTorch checkpoint.
49
+
50
+ 1. Tokenize a `(query, document)` text pair with the supplied tokenizer.
51
+ 2. Score **one pair per forward pass**, sequentially. Do not silently truncate. Stem rejects pairs longer than 8,192 tokens, including special tokens; long-context quality has not been validated here.
52
+ 3. Read the single finite **raw logit**. Higher means more relevant. Do not apply sigmoid or reinterpret it as a probability.
53
+
54
+ Install `@huggingface/transformers@3.8.1` in a Node.js project, download this repository's files to a local folder, and run:
55
+
56
+ ```sh
57
+ node example.mjs /absolute/path/to/downloaded/model
58
+ ```
59
+
60
+ For Stem's measured configuration:
61
+
62
+ | Purpose | Raw-logit threshold |
63
+ |---|---:|
64
+ | Memory facts | -1.6370911598205566 |
65
+ | Skill selection | -3.9743599891662598 |
66
+ | Additional margin for sensitive facts | +2 |
67
+
68
+ These thresholds belong to this exact graph, tokenizer, and pipeline. They are not interchangeable or universal cutoffs. Stem uses a Qwen3 Embedding 0.6B shortlist, up to 24 fact candidates and at most 16 relevant selected facts (subject to a smaller user setting). Pinned facts are handled separately.
69
+
70
+ For fact retrieval with conversational context, Stem takes at most two preceding eligible user messages in chronological order, clipping each to 400 Unicode code points, and formats the query as:
71
+
72
+ ```text
73
+ Earlier messages from the user in this conversation:
74
+ - <earlier user message>
75
+ - <later user message>
76
+
77
+ Current message: <current user message>
78
+ ```
79
+
80
+ With no eligible history, use the current message alone. Skill selection uses the current message alone and its own threshold.
81
+
82
+ ## Training
83
+
84
+ Base: [Alibaba-NLP/gte-multilingual-reranker-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-reranker-base), revision `8215cf04918ba6f7b6a62bb44238ce2953d8831c`. Upstream implementation: `Alibaba-NLP/new-impl`, revision `40ced75c3017eb27626c9d4ea981bde21a2662f4`.
85
+
86
+ Fine-tuning used **23,684 binary pairs from 88 fictional training profiles**, including 797 relevant pairs. Query-language pair counts: Czech 5,905; Slovak 6,051; German 5,963; English 5,765. Borderline examples were excluded. Real personal-memory benchmarks were not used for training and are not published.
87
+
88
+ The encoder and classification head were trained (113,920,513 trainable parameters); token embeddings were frozen. AdamW used learning rate 1e-5, weight decay 0.01, batch size 16, 10% linear warmup, gradient clipping 1.0 and BCE positive weight 3. The maximum tokenized training pair length was 94; no training examples were truncated. Three epochs were planned; epoch2 was selected after q8 export using development data. Feasible settings had to meet the configured Qwen baseline recall overall and per language, then minimize `3 * false negatives + false positives`.
89
+
90
+ Export used PyTorch 2.8.0 and ONNX Runtime 1.22.1. Dynamic weight quantization used QInt8, per-channel quantization, reduced range, symmetric weights and constant-matrix-only MatMul quantization. Four synthetic export probes had maximum FP32/PyTorch error 0.0000019074 and q8/FP32 error 0.065004; these probes do not establish broad numerical parity.
91
+
92
+ ## Evaluation and limitations
93
+
94
+ The fresh memory test contained 192 requests from 16 fictional profiles, 48 in each language. Its references were synthetic author/reviewer judgments, with disagreements treated as borderline, not human gold. Labels covered the reviewed union of candidate pools, so facts missed by both retrieval paths remained unjudged.
95
+
96
+ | Request language | Configured Qwen recall | Stem GTE recall |
97
+ |---|---:|---:|
98
+ | Czech | 19.4% | 58.1% |
99
+ | Slovak | 10.3% | 53.8% |
100
+ | German | 48.7% | 64.1% |
101
+ | English | 74.1% | 75.9% |
102
+
103
+ Two previously seen real-data regression sets showed small recall changes (15.4% to 19.2%, and 23.5% to 25.7%) and fewer irrelevant selections. Their recall-difference intervals included zero; they do not establish a large real-world recall gain. No real-data examples are distributed.
104
+
105
+ The timing result above measured 64 warm observations per model on a local Mac. Each observation embedded a contextual query, sequentially scored 24 candidates and applied the gate. Candidate retrieval, database work, IPC, model loading and answer generation were excluded. Repeated observations were correlated. This is not a promise about complete response latency, other hardware, or application-wide memory consumption.
106
+
107
+ Linux validation found numerical differences from macOS despite identical tokenized inputs (maximum absolute logit difference 0.645472 on 16 probes). With the frozen fact threshold, Linux selected 106 useful and 84 irrelevant facts on the same fresh synthetic set, versus macOS GTE's 108 and 87. An English-only same-server rerun selected 42 useful facts with GTE versus 39 with Qwen; other languages' Qwen baselines were not rerun on Linux. Validate your target runtime; do not assume bitwise portability.
108
+
109
+ Sensitive-fact selection remains a limitation: in the fresh macOS test, GTE selected 3 irrelevant sensitive facts versus Qwen's 1 while finding more useful sensitive facts. The inherited +2 margin is not equally calibrated across models.
110
+
111
+ A separate fresh skill test found the correct skill on 39/48 positive requests versus Qwen's 33/48, with false loads on 11/48 negative requests versus 12/48. GTE still **missed the predeclared 90% correct-loading target** (81.25%). Both models found the correct skill on only 15/24 concise conversational positives. The weights were not trained again for this skill evaluation; only the threshold was calibrated beforehand.
112
+
113
+ These experiments do not establish improved final answers, long-input accuracy, performance outside the four training languages, or universal superiority over other rerankers. The model should remain a selectable option while broader evaluation continues.
114
+
115
+ ## License and attribution
116
+
117
+ Released under Apache License 2.0, following the upstream model's declared license. See `LICENSE` and `NOTICE`. Stem modifications comprise memory-relevance fine-tuning, ONNX export, quantization and task-specific calibration. This release is a Stem adaptation, not an official Alibaba release.
SHA256SUMS ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
2
+ c943475cbb6f4cf48f04e009ba003ebc63b6fc5f7a9c1329bda7ef294bc9bef2 NOTICE
3
+ d1ebe6222bfaf23ac515be79aced8ca113d5d95b4bfe96d54a97645ad5d8d86a README.md
4
+ e5f2efd1e04e5e4465b8c6c2f6af1f00a5d66a839e825b0af8edba68ceb8b1bb config.json
5
+ 7702e5276936c92f0283150c5032c5a74dfb5bc25e00d53b75c062a01c28f3b8 example.mjs
6
+ 5cbb66c672aa71fb6609880ba8e8370ff5be3376fc95215317c92e41e7743e4e onnx/model_quantized.onnx
7
+ 8c785abebea9ae3257b61681b4e6fd8365ceafde980c21970d001e834cf10835 special_tokens_map.json
8
+ 196a6a4a0d4973bbc39095cb8b95d519df1a093fcf84124b720ddcd8096d9b2b stem-model.json
9
+ 3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20 tokenizer.json
10
+ 6f00514620aff01ba8b7291b2394e98daca5be264cb743805232d9ae27494b2a tokenizer_config.json
config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/private/tmp/stem-gte-finetune-20260905-2008/checkpoints/epoch2",
3
+ "architectures": [
4
+ "NewForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "Alibaba-NLP/new-impl--configuration.NewConfig",
9
+ "AutoModel": "Alibaba-NLP/new-impl--modeling.NewModel",
10
+ "AutoModelForMaskedLM": "Alibaba-NLP/new-impl--modeling.NewForMaskedLM",
11
+ "AutoModelForMultipleChoice": "Alibaba-NLP/new-impl--modeling.NewForMultipleChoice",
12
+ "AutoModelForQuestionAnswering": "Alibaba-NLP/new-impl--modeling.NewForQuestionAnswering",
13
+ "AutoModelForSequenceClassification": "Alibaba-NLP/new-impl--modeling.NewForSequenceClassification",
14
+ "AutoModelForTokenClassification": "Alibaba-NLP/new-impl--modeling.NewForTokenClassification"
15
+ },
16
+ "classifier_dropout": 0.0,
17
+ "hidden_act": "gelu",
18
+ "hidden_dropout_prob": 0.1,
19
+ "hidden_size": 768,
20
+ "id2label": {
21
+ "0": "LABEL_0"
22
+ },
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 3072,
25
+ "label2id": {
26
+ "LABEL_0": 0
27
+ },
28
+ "layer_norm_eps": 1e-12,
29
+ "layer_norm_type": "layer_norm",
30
+ "logn_attention_clip1": false,
31
+ "logn_attention_scale": false,
32
+ "max_position_embeddings": 8192,
33
+ "model_type": "new",
34
+ "num_attention_heads": 12,
35
+ "num_hidden_layers": 12,
36
+ "pack_qkv": true,
37
+ "pad_token_id": 1,
38
+ "position_embedding_type": "rope",
39
+ "rope_scaling": {
40
+ "factor": 8.0,
41
+ "type": "ntk"
42
+ },
43
+ "rope_theta": 20000,
44
+ "torch_dtype": "float32",
45
+ "transformers_version": "4.44.2",
46
+ "type_vocab_size": 1,
47
+ "unpad_inputs": false,
48
+ "use_memory_efficient_attention": false,
49
+ "vocab_size": 250048
50
+ }
example.mjs ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { resolve } from 'node:path';
2
+ import { AutoTokenizer, PreTrainedModel, env } from '@huggingface/transformers';
3
+
4
+ if (!process.argv[2]) throw new Error('Usage: node example.mjs /path/to/model');
5
+ const directory = resolve(process.argv[2]);
6
+ env.allowRemoteModels = false;
7
+ const tokenizer = await AutoTokenizer.from_pretrained(directory, { local_files_only: true });
8
+ const model = await PreTrainedModel.from_pretrained(directory, {
9
+ dtype: 'q8', local_files_only: true, session_options: { enableCpuMemArena: false }
10
+ });
11
+ try {
12
+ const query = 'Suggest a vegetarian dinner.';
13
+ const documents = ['The user is vegetarian.', 'The user plays the violin.'];
14
+ for (const document of documents) {
15
+ const inputs = tokenizer([query], { text_pair: [document], padding: true, truncation: false });
16
+ const [batch, length] = inputs.input_ids.dims;
17
+ if (batch !== 1 || length < 1 || length > 8192) throw new Error('Unsupported pair length');
18
+ const { logits } = await model(inputs);
19
+ const score = Number(logits.data[0]);
20
+ if (logits.data.length !== 1 || logits.dims.some(n => n !== 1) || !Number.isFinite(score)) {
21
+ throw new Error('Expected one finite raw logit');
22
+ }
23
+ console.log(JSON.stringify({ document, score }));
24
+ }
25
+ } finally {
26
+ await model.dispose();
27
+ }
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cbb66c672aa71fb6609880ba8e8370ff5be3376fc95215317c92e41e7743e4e
3
+ size 341032790
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
stem-model.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 1,
3
+ "model_id": "gte-memory-20260905-epoch2",
4
+ "display_name": "Stem GTE Memory",
5
+ "base_model": "Alibaba-NLP/gte-multilingual-reranker-base",
6
+ "base_revision": "8215cf04918ba6f7b6a62bb44238ce2953d8831c",
7
+ "upstream_code_revision": "40ced75c3017eb27626c9d4ea981bde21a2662f4",
8
+ "checkpoint": "epoch2",
9
+ "dtype": "q8",
10
+ "scoring": "gte-scalar",
11
+ "fact_threshold": -1.6370911598205566,
12
+ "skill_threshold": -3.9743599891662598,
13
+ "sensitive_fact_margin": 2,
14
+ "languages": [
15
+ "cs",
16
+ "sk",
17
+ "de",
18
+ "en"
19
+ ],
20
+ "files": {
21
+ "config.json": {
22
+ "sha256": "e5f2efd1e04e5e4465b8c6c2f6af1f00a5d66a839e825b0af8edba68ceb8b1bb",
23
+ "bytes": 1627
24
+ },
25
+ "tokenizer.json": {
26
+ "sha256": "3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20",
27
+ "bytes": 17082734
28
+ },
29
+ "tokenizer_config.json": {
30
+ "sha256": "6f00514620aff01ba8b7291b2394e98daca5be264cb743805232d9ae27494b2a",
31
+ "bytes": 1340
32
+ },
33
+ "special_tokens_map.json": {
34
+ "sha256": "8c785abebea9ae3257b61681b4e6fd8365ceafde980c21970d001e834cf10835",
35
+ "bytes": 964
36
+ },
37
+ "onnx/model_quantized.onnx": {
38
+ "sha256": "5cbb66c672aa71fb6609880ba8e8370ff5be3376fc95215317c92e41e7743e4e",
39
+ "bytes": 341032790
40
+ }
41
+ }
42
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20
3
+ size 17082734
tokenizer_config.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "mask_token": "<mask>",
49
+ "max_length": 512,
50
+ "model_max_length": 32768,
51
+ "pad_to_multiple_of": null,
52
+ "pad_token": "<pad>",
53
+ "pad_token_type_id": 0,
54
+ "padding_side": "right",
55
+ "sep_token": "</s>",
56
+ "stride": 0,
57
+ "tokenizer_class": "XLMRobertaTokenizer",
58
+ "truncation_side": "right",
59
+ "truncation_strategy": "longest_first",
60
+ "unk_token": "<unk>"
61
+ }