MaziyarPanahi commited on
Commit
a68bdf9
·
0 Parent(s):

OpenMed GTE-ModernBERT-Biomedical-Embedding-Base-v1

Browse files
Files changed (7) hide show
  1. .gitattributes +35 -0
  2. LICENSE +201 -0
  3. README.md +292 -0
  4. config.json +77 -0
  5. model.safetensors +3 -0
  6. tokenizer.json +0 -0
  7. tokenizer_config.json +18 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: sentence-similarity
7
+ base_model: Alibaba-NLP/gte-modernbert-base
8
+ tags:
9
+ - sentence-similarity
10
+ - feature-extraction
11
+ - text-embeddings
12
+ - retrieval
13
+ - semantic-search
14
+ - medical
15
+ - biomedical
16
+ - scientific-literature
17
+ - pubmed
18
+ - bioasq
19
+ - modernbert
20
+ - gte
21
+ - openmed
22
+ model-index:
23
+ - name: GTE-ModernBERT-Biomedical-Embedding-Base-v1
24
+ results:
25
+ - task:
26
+ type: retrieval
27
+ name: Biomedical literature passage retrieval
28
+ dataset:
29
+ name: BioASQ (200 held-out development questions, 16,970 snippets)
30
+ type: bioasq
31
+ split: held-out development
32
+ metrics:
33
+ - type: ndcg_at_10
34
+ value: 86.81
35
+ name: NDCG@10 (known-positive)
36
+ - type: recall_at_10
37
+ value: 73.28
38
+ name: Recall@10 (known-positive)
39
+ - type: mrr_at_10
40
+ value: 92.26
41
+ name: MRR@10 (known-positive)
42
+ ---
43
+
44
+ <p align="center">
45
+ <a href="https://huggingface.co/OpenMed"><img src="https://cdn-avatars.huggingface.co/v1/production/uploads/5fd5e18a90b6dc4633f6d292/qWeFUOCMgN4q-ET102lRZ.png" alt="OpenMed" width="110"></a>
46
+ </p>
47
+
48
+ <h1 align="center">OpenMed GTE-ModernBERT Biomedical Embedding Base v1</h1>
49
+
50
+ <p align="center">
51
+ <a href="https://huggingface.co/OpenMed"><img alt="OpenMed on Hugging Face" src="https://img.shields.io/badge/OpenMed-2%2C300%2B%20open%20models-ff9d00"></a>
52
+ <a href="https://github.com/maziyarpanahi/openmed"><img alt="OpenMed SDK on GitHub" src="https://img.shields.io/github/stars/maziyarpanahi/openmed?label=OpenMed%20SDK&logo=github"></a>
53
+ <a href="https://pypi.org/project/openmed/"><img alt="pip install openmed" src="https://img.shields.io/pypi/v/openmed?label=pip%20install%20openmed&color=3775a9"></a>
54
+ <img alt="License Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue">
55
+ </p>
56
+
57
+ **OpenMed's open model for finding evidence in the biomedical literature.** It turns English research questions and PubMed-style passages into 768-dimensional vectors, so each question lands closest to the passages that answer it. Trained and evaluated by [OpenMed](https://huggingface.co/OpenMed). Apache-2.0, 149.0M parameters, runs on CPU.
58
+
59
+ | Developed by | [OpenMed](https://huggingface.co/OpenMed) |
60
+ |---|---|
61
+ | Task | Biomedical question to literature passage retrieval (dense embeddings) |
62
+ | Output | 768-dimensional vector of unit length; the dot product of two vectors is their cosine similarity |
63
+ | Parameters | 149.0M |
64
+ | Max input | 384 tokens (the length it was trained and evaluated at) |
65
+ | Pooling | first token (CLS), then L2 normalization |
66
+ | Prefixes | none |
67
+ | Language | English |
68
+ | License | Apache-2.0 |
69
+
70
+ ## About OpenMed
71
+
72
+ OpenMed builds open models and open-source tools for clinical and biomedical text that run on your own hardware.
73
+
74
+ - **[2,300+ open models on Hugging Face](https://huggingface.co/OpenMed)** for clinical NER, de-identification, retrieval and more.
75
+ - **[The OpenMed Python SDK](https://github.com/maziyarpanahi/openmed)**, Apache-2.0: `pip install openmed` for de-identification, clinical NER, and FHIR and HL7 tooling, all local.
76
+ - New models every week: follow [OpenMed on Hugging Face](https://huggingface.co/OpenMed) and [@OpenMed_AI on X](https://x.com/OpenMed_AI).
77
+
78
+ ## Quick start
79
+
80
+ ```bash
81
+ pip install -U transformers torch
82
+ ```
83
+
84
+ ```python
85
+ import torch
86
+ import torch.nn.functional as F
87
+ from transformers import AutoModel, AutoTokenizer
88
+
89
+ repo = "OpenMed/GTE-ModernBERT-Biomedical-Embedding-Base-v1"
90
+ tokenizer = AutoTokenizer.from_pretrained(repo)
91
+ model = AutoModel.from_pretrained(repo, dtype=torch.float32).eval()
92
+
93
+ def embed(texts):
94
+ # The evaluated settings: no prefix, 384 tokens, first-token (CLS) pooling, unit length
95
+ batch = tokenizer(
96
+ texts, padding=True, truncation=True, max_length=384, return_tensors="pt"
97
+ )
98
+ with torch.no_grad():
99
+ cls = model(**batch).last_hidden_state[:, 0]
100
+ return F.normalize(cls, p=2, dim=1)
101
+
102
+ questions = [
103
+ "Which drugs are CFTR modulators?",
104
+ "What type of mutation causes Huntington disease?",
105
+ ]
106
+ passages = [
107
+ (
108
+ "Cystic fibrosis is caused by mutations in the CFTR gene, which "
109
+ "encodes a chloride channel; the F508del variant is found on at "
110
+ "least one allele in most patients."
111
+ ),
112
+ (
113
+ "Ivacaftor, a CFTR potentiator, increases channel open probability "
114
+ "and improved lung function in patients carrying the G551D "
115
+ "mutation."
116
+ ),
117
+ (
118
+ "The CFTR correctors lumacaftor, tezacaftor and elexacaftor improve "
119
+ "the folding and trafficking of F508del-CFTR to the cell surface."
120
+ ),
121
+ (
122
+ "Huntington disease is caused by an expanded CAG trinucleotide "
123
+ "repeat in exon 1 of the HTT gene, and longer repeats are "
124
+ "associated with earlier onset."
125
+ ),
126
+ (
127
+ "Fragile X syndrome results from expansion of a CGG repeat in the "
128
+ "5' untranslated region of FMR1, leading to gene silencing."
129
+ ),
130
+ ]
131
+
132
+ scores = embed(questions) @ embed(passages).T # cosine similarity
133
+
134
+ for question, row in zip(questions, scores):
135
+ print(question)
136
+ for j in row.argsort(descending=True)[:3]:
137
+ print(f" {row[j]:.3f} {passages[j][:60]}...")
138
+ ```
139
+
140
+ ```text
141
+ Which drugs are CFTR modulators?
142
+ 0.675 The CFTR correctors lumacaftor, tezacaftor and elexacaftor i...
143
+ 0.573 Ivacaftor, a CFTR potentiator, increases channel open probab...
144
+ 0.370 Cystic fibrosis is caused by mutations in the CFTR gene, whi...
145
+ What type of mutation causes Huntington disease?
146
+ 0.705 Huntington disease is caused by an expanded CAG trinucleotid...
147
+ 0.482 Cystic fibrosis is caused by mutations in the CFTR gene, whi...
148
+ 0.407 Fragile X syndrome results from expansion of a CGG repeat in...
149
+ ```
150
+
151
+ ### The settings
152
+
153
+ - No prefixes or instructions: questions and passages are embedded as they are, as in training and evaluation.
154
+ - First-token (CLS) pooling, then L2 normalization, the base model's own pooling. This repository has no sentence-transformers configuration, so use the code above rather than `SentenceTransformer(...)`, which would fall back to mean pooling (see Good to know).
155
+ - `max_length=384` is the length used in training and evaluation (2 of the evaluation's 17,170 inputs were longer). The base model accepts up to 8,192 tokens; longer inputs were not evaluated after fine-tuning.
156
+ - `dtype=torch.float32` loads the stored float32 weights. On CPU the repository's own helper also runs in float32, as here; the evaluation ran on a GPU with bfloat16 autocast.
157
+ - Cosine scores rank passages for one question; they are not probabilities.
158
+
159
+ ### Large collections, GPU
160
+
161
+ - Embed the passage collection once, in batches (`embed(passages[i:i + 64])`), and store the vectors; at search time, embed only the question.
162
+ - On a GPU: `model = model.to("cuda")`, move each batch with `batch = batch.to("cuda")` inside `embed`, and wrap the forward pass in `torch.autocast("cuda", dtype=torch.bfloat16)`, the setting the evaluation used.
163
+
164
+ ## Evaluation
165
+
166
+ **BioASQ, 200 held-out development questions:** English biomedical questions written by experts for the BioASQ challenge, each with the PubMed abstract snippets the experts selected as evidence. OpenMed split the BioASQ training release into 1,467 training questions, 160 calibration questions and these 200 development questions (160 groups), keeping questions that share a paper or a snippet inside one split and leaving out papers used in OpenMed's earlier training and evaluation runs. Each question searches a catalog of 16,970 snippets: the 2,082 snippets selected for these 200 questions plus the 14,888 training snippets. The checkpoint was chosen on the calibration questions, then the model and scoring code were frozen and these questions were scored once. The official BioASQ test sets were not used, so these numbers are not comparable to published BioASQ results.
167
+
168
+ **Known-positive** scoring: only the snippets the BioASQ experts selected count as relevant. Every other snippet counts as not relevant, although some may also answer the question; they were never judged. Recall@10 is the share of a question's selected snippets that appear in the top ten; 73 of the 200 questions have more than ten selected snippets, so it cannot reach 100%.
169
+
170
+ | Model | NDCG@10 | Recall@10 | MRR@10 |
171
+ |---|---:|---:|---:|
172
+ | **OpenMed GTE-ModernBERT Biomedical Embedding Base v1** (this model) | **86.81** | 73.28 | 92.26 |
173
+ | Before OpenMed fine-tuning: [Alibaba-NLP/gte-modernbert-base](https://huggingface.co/Alibaba-NLP/gte-modernbert-base), same settings | 85.10 | 71.73 | 91.44 |
174
+
175
+ OpenMed's fine-tuning added **+1.71 NDCG@10 points** (95% CI +0.34 to +2.98, paired bootstrap over the 160 question groups, 2,000 resamples) and +1.55 Recall@10 points. **The gain is small.** The base model is already strong on this task, and the interval's lower end is near zero: expect this model to behave much like its base, slightly better on biomedical literature search.
176
+
177
+ ### By question type
178
+
179
+ | Question type | Questions | NDCG@10 before fine-tuning | NDCG@10 | Change |
180
+ |---|---:|---:|---:|---:|
181
+ | Factoid | 71 | 85.41 | 86.11 | +0.70 |
182
+ | List | 43 | 77.06 | 80.78 | +3.72 |
183
+ | Summary | 41 | 86.94 | 89.10 | +2.16 |
184
+ | Yes/no | 45 | 90.63 | 91.59 | +0.96 |
185
+
186
+ All four question types improved. These are point estimates from the same run, with no interval per type.
187
+
188
+ ## The OpenMed biomedical retrieval models
189
+
190
+ Two open OpenMed embedding models for biomedical search: one matches health questions to FAQ-style answers, the other matches research questions to literature passages. Each was scored on its own held-out questions, so their numbers are not comparable with each other.
191
+
192
+ | Model | Finds | Base model | Parameters | Dimensions | Max tokens | Prefixes | NDCG@10 before → after |
193
+ |---|---|---|---:|---:|---:|---|---|
194
+ | [OpenMed EmbeddingGemma2 BiomedicalEvidence 270M v2](https://huggingface.co/OpenMed/EmbeddingGemma2-BiomedicalEvidence-270M-v2) | the answer to a medical question (consumer health FAQ) | [google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2) | 271.0M | 768 | 512 | question and answer prefixes | 81.64 → 91.76 (MedQuAD, 1,966 questions) |
195
+ | **OpenMed GTE-ModernBERT Biomedical Embedding Base v1** (this model) | evidence passages for a biomedical research question | [Alibaba-NLP/gte-modernbert-base](https://huggingface.co/Alibaba-NLP/gte-modernbert-base) | 149.0M | 768 | 384 | none | **85.10 → 86.81 (BioASQ, known-positive, 200 questions)** |
196
+
197
+ ## Examples
198
+
199
+ Real outputs of this model with the quick-start code (same model call, prefixes and scoring), on CPU. The 13 snippets and 8 questions are synthetic, written for this card in the style of PubMed abstract sentences; none is BioASQ or PubMed text. Each question was written for one snippet (two for the list question) and searches all 13. The table gives the top three with cosine scores, the snippet written for the question in bold, and where it ranks for this model and for the base model with the same code.
200
+
201
+ | ID | Snippet |
202
+ |---|---|
203
+ | `pd1` | Pembrolizumab is a humanized IgG4 monoclonal antibody that binds the programmed death-1 (PD-1) receptor on T cells and blocks its interaction with PD-L1 and PD-L2, restoring antitumor immune responses. |
204
+ | `ctla4` | Ipilimumab blocks cytotoxic T-lymphocyte antigen 4 (CTLA-4), enhancing T-cell activation and proliferation. |
205
+ | `cftr-gene` | Cystic fibrosis is caused by mutations in the CFTR gene, which encodes a chloride channel; the F508del variant is found on at least one allele in most patients. |
206
+ | `ivacaftor` | Ivacaftor, a CFTR potentiator, increases channel open probability and improved lung function in patients carrying the G551D mutation. |
207
+ | `correctors` | The CFTR correctors lumacaftor, tezacaftor and elexacaftor improve the folding and trafficking of F508del-CFTR to the cell surface. |
208
+ | `sglt2` | In randomized trials, dapagliflozin and empagliflozin reduced the risk of hospitalization for heart failure in patients with reduced ejection fraction, with or without type 2 diabetes. |
209
+ | `metformin` | Metformin lowers blood glucose mainly by reducing hepatic gluconeogenesis, an effect partly mediated by activation of AMP-activated protein kinase. |
210
+ | `statin` | Statins inhibit HMG-CoA reductase, the rate-limiting enzyme of cholesterol synthesis, and lower LDL cholesterol. |
211
+ | `htt` | Huntington disease is caused by an expanded CAG trinucleotide repeat in exon 1 of the HTT gene, and longer repeats are associated with earlier onset. |
212
+ | `fmr1` | Fragile X syndrome results from expansion of a CGG repeat in the 5' untranslated region of FMR1, leading to gene silencing. |
213
+ | `vitd` | In a large randomized trial of community-dwelling adults, daily vitamin D3 supplementation did not lower the incidence of total, nonvertebral or hip fractures compared with placebo. |
214
+ | `brca` | Germline mutations in BRCA1 and BRCA2 substantially increase the lifetime risk of breast and ovarian cancer. |
215
+ | `olaparib` | Olaparib, an inhibitor of poly(ADP-ribose) polymerase (PARP), prolonged progression-free survival as maintenance therapy in women with BRCA-mutated advanced ovarian cancer. |
216
+
217
+ | # | Type | Question | Top three (cosine) | Rank of the written snippet: this model / base |
218
+ |---:|---|---|---|---|
219
+ | 1 | Summary | *What is the mechanism of action of pembrolizumab?* | **`pd1`** 0.743; `ctla4` 0.497; `olaparib` 0.314 | 1 / 1 |
220
+ | 2 | Factoid | *Which gene is mutated in cystic fibrosis?* | **`cftr-gene`** 0.780; `fmr1` 0.466; `correctors` 0.440 | 1 / 1 |
221
+ | 3 | List | *Which drugs are CFTR modulators?* | **`correctors`** 0.675; **`ivacaftor`** 0.573; `cftr-gene` 0.370 | 1, 2 / 1, 2 |
222
+ | 4 | Yes/no | *Do SGLT2 inhibitors reduce hospitalization for heart failure?* | **`sglt2`** 0.666; `correctors` 0.432; `ivacaftor` 0.347 | 1 / 1 |
223
+ | 5 | Factoid | *What type of mutation causes Huntington disease?* | **`htt`** 0.705; `cftr-gene` 0.482; `brca` 0.414 | 1 / 1 |
224
+ | 6 | Summary | *How does metformin lower blood glucose?* | **`metformin`** 0.801; `sglt2` 0.387; `statin` 0.378 | 1 / 1 |
225
+ | 7 | Yes/no | *Does vitamin D supplementation prevent fractures in older adults?* | **`vitd`** 0.818; `sglt2` 0.326; `correctors` 0.263 | 1 / 1 |
226
+ | 8 | Factoid | *Which PARP inhibitor is used for BRCA-mutated ovarian cancer?* | **`olaparib`** 0.711; `brca` 0.493; `pd1` 0.391 | 1 / 1 |
227
+
228
+ ## Good to know
229
+
230
+ - All four BioASQ question types work here: factoid, list, yes/no and summary questions each rank their snippet first. The list question (example 3) returns both modulator snippets on top (`correctors` 0.675, `ivacaftor` 0.573), above the CFTR gene snippet (0.370).
231
+ - Snippets on the same subject that answer a different question rank lower: in example 8 the BRCA risk snippet comes second (0.493) after olaparib (0.711); in example 5 the fragile X snippet, also about a repeat expansion, ranks fourth.
232
+ - No misses on these 8 examples, and the base model also ranks the written snippets first on all 8. They are easy; the evaluation searches 16,970 snippets, and there the fine-tuning gain is small (+1.71 NDCG@10). Expect this model to behave much like its base.
233
+ - Use the code above, not `SentenceTransformer("OpenMed/GTE-ModernBERT-Biomedical-Embedding-Base-v1")`: this repository has no sentence-transformers configuration, so sentence-transformers falls back to mean pooling. On the card's texts that gives different vectors (cosine as low as 0.75 with the evaluated CLS vectors).
234
+ - Scores are not probabilities and there is no fixed cutoff: the written snippets here score from 0.573 to 0.818. Compare scores within one question.
235
+
236
+ ## Limitations
237
+
238
+ - Evaluated on BioASQ only: expert biomedical questions and PubMed abstract snippets in English. It has not been validated on clinical notes, patient questions, full-text articles or other languages; the examples above are synthetic.
239
+ - Known-positive relevance: snippets the experts did not select were never judged, so real precision may be higher or lower than measured.
240
+ - The gain over its base model is small: +1.71 NDCG@10 points on 200 questions, 95% CI +0.34 to +2.98.
241
+ - Trained and evaluated at 384 tokens on snippet-length passages; long passages were not evaluated.
242
+ - Cosine scores rank passages for one question; they are not calibrated probabilities.
243
+ - The base model's pretraining data is not fully public, so whether it saw these BioASQ questions or PubMed snippets is unknown.
244
+ - It ranks passages. It does not check that a finding is correct or current, does not give medical advice and is not a medical device.
245
+
246
+ ## Built on
247
+
248
+ OpenMed fine-tuned this model from [Alibaba-NLP/gte-modernbert-base](https://huggingface.co/Alibaba-NLP/gte-modernbert-base) by Tongyi Lab, Alibaba Group (Apache-2.0), itself built on [ModernBERT](https://huggingface.co/answerdotai/ModernBERT-base), with the open-source [transformers](https://github.com/huggingface/transformers) library. Training and evaluation data: the [BioASQ question answering training data](https://doi.org/10.5281/zenodo.7655130) (Zenodo record 7655130; Krithara, Nentidis, Bougiatiotis and Paliouras, 2023), questions and evidence snippets written and selected by biomedical experts for the BioASQ challenge (Tsatsaronis et al., 2015), released under [CC BY 2.5](https://creativecommons.org/licenses/by/2.5/). OpenMed used the training release only (`training11b.json`) and turned its questions and snippets into retrieval training pairs. Thank you to Tongyi Lab and to the BioASQ organizers and experts for releasing their work openly; this credit does not imply their endorsement.
249
+
250
+ This model is released under Apache-2.0. No BioASQ text is included in this repository.
251
+
252
+ ## Citation
253
+
254
+ ```bibtex
255
+ @misc{panahi2025openmedner,
256
+ title={OpenMed NER: Open-Source, Domain-Adapted State-of-the-Art Transformers for Biomedical NER Across 12 Public Datasets},
257
+ author={Maziyar Panahi},
258
+ year={2025},
259
+ eprint={2508.01630},
260
+ archivePrefix={arXiv}
261
+ }
262
+
263
+ @article{tsatsaronis2015bioasq,
264
+ title={An overview of the {BIOASQ} large-scale biomedical semantic indexing and question answering competition},
265
+ author={Tsatsaronis, George and Balikas, Georgios and Malakasiotis, Prodromos and Partalas, Ioannis and Zschunke, Matthias and Alvers, Michael R. and Weissenborn, Dirk and Krithara, Anastasia and Petridis, Sergios and Polychronopoulos, Dimitris and Almirantis, Yannis and Pavlopoulos, John and Baskiotis, Nicolas and Gallinari, Patrick and Arti{\`e}res, Thierry and Ngonga Ngomo, Axel-Cyrille and Heino, Norman and Gaussier, Eric and Barrio-Alvers, Liliana and Schroeder, Michael and Androutsopoulos, Ion and Paliouras, Georgios},
266
+ journal={BMC Bioinformatics},
267
+ volume={16},
268
+ pages={138},
269
+ year={2015},
270
+ doi={10.1186/s12859-015-0564-6}
271
+ }
272
+
273
+ @article{krithara2023bioasqqa,
274
+ title={{BioASQ-QA}: A manually curated corpus for Biomedical Question Answering},
275
+ author={Krithara, Anastasia and Nentidis, Anastasios and Bougiatiotis, Konstantinos and Paliouras, Georgios},
276
+ journal={Scientific Data},
277
+ volume={10},
278
+ pages={170},
279
+ year={2023},
280
+ doi={10.1038/s41597-023-02068-4}
281
+ }
282
+
283
+ @inproceedings{zhang2024mgte,
284
+ title={mGTE: Generalized Long-Context Text Representation and Reranking Models for Multilingual Text Retrieval},
285
+ author={Zhang, Xin and Zhang, Yanzhao and Long, Dingkun and Xie, Wen and Dai, Ziqi and Tang, Jialong and Lin, Huan and Yang, Baosong and Xie, Pengjun and Huang, Fei and others},
286
+ booktitle={Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: Industry Track},
287
+ pages={1393--1412},
288
+ year={2024}
289
+ }
290
+ ```
291
+
292
+ <p align="center"><b>OpenMed</b> · <a href="https://huggingface.co/OpenMed">Hugging Face</a> · <a href="https://github.com/maziyarpanahi/openmed">GitHub</a> · <a href="https://pypi.org/project/openmed/">PyPI</a> · <a href="https://x.com/OpenMed_AI">X</a></p>
config.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "classifier_activation": "gelu",
9
+ "classifier_bias": false,
10
+ "classifier_dropout": 0.0,
11
+ "classifier_pooling": "mean",
12
+ "cls_token_id": 50281,
13
+ "decoder_bias": true,
14
+ "deterministic_flash_attn": false,
15
+ "dtype": "float32",
16
+ "embedding_dropout": 0.0,
17
+ "eos_token_id": 50282,
18
+ "global_attn_every_n_layers": 3,
19
+ "gradient_checkpointing": false,
20
+ "hidden_activation": "gelu",
21
+ "hidden_size": 768,
22
+ "initializer_cutoff_factor": 2.0,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 1152,
25
+ "layer_norm_eps": 1e-05,
26
+ "layer_types": [
27
+ "full_attention",
28
+ "sliding_attention",
29
+ "sliding_attention",
30
+ "full_attention",
31
+ "sliding_attention",
32
+ "sliding_attention",
33
+ "full_attention",
34
+ "sliding_attention",
35
+ "sliding_attention",
36
+ "full_attention",
37
+ "sliding_attention",
38
+ "sliding_attention",
39
+ "full_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "full_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "full_attention",
46
+ "sliding_attention",
47
+ "sliding_attention",
48
+ "full_attention"
49
+ ],
50
+ "local_attention": 128,
51
+ "max_position_embeddings": 8192,
52
+ "mlp_bias": false,
53
+ "mlp_dropout": 0.0,
54
+ "model_type": "modernbert",
55
+ "norm_bias": false,
56
+ "norm_eps": 1e-05,
57
+ "num_attention_heads": 12,
58
+ "num_hidden_layers": 22,
59
+ "pad_token_id": 50283,
60
+ "position_embedding_type": "absolute",
61
+ "rope_parameters": {
62
+ "full_attention": {
63
+ "rope_theta": 160000.0,
64
+ "rope_type": "default"
65
+ },
66
+ "sliding_attention": {
67
+ "rope_theta": 10000.0,
68
+ "rope_type": "default"
69
+ }
70
+ },
71
+ "sep_token_id": 50282,
72
+ "sparse_pred_ignore_index": -100,
73
+ "sparse_prediction": false,
74
+ "tie_word_embeddings": true,
75
+ "transformers_version": "5.20.2",
76
+ "vocab_size": 50368
77
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f2b5e7b88dba390a010732aabc65b8e12c1e21a7c18a2fd544f93a6de67b163
3
+ size 596070136
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "clean_up_tokenization_spaces": true,
4
+ "cls_token": "[CLS]",
5
+ "is_local": false,
6
+ "local_files_only": false,
7
+ "mask_token": "[MASK]",
8
+ "model_input_names": [
9
+ "input_ids",
10
+ "attention_mask"
11
+ ],
12
+ "model_max_length": 1000000000000000019884624838656,
13
+ "pad_token": "[PAD]",
14
+ "padding_side": "right",
15
+ "sep_token": "[SEP]",
16
+ "tokenizer_class": "TokenizersBackend",
17
+ "unk_token": "[UNK]"
18
+ }