Token Classification
Safetensors
GLiNER2
GLiNER
English
openmed
extractor
medical
biomedical
named-entity-recognition
procedure
diagnostic-procedure
laboratory-procedure
therapeutic-procedure
Eval Results (legacy)
Instructions to use OpenMed/GLiNER2.5-ProceduresTests-Small-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER2
How to use OpenMed/GLiNER2.5-ProceduresTests-Small-v1 with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("OpenMed/GLiNER2.5-ProceduresTests-Small-v1") # Extract entities text = "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday." result = extractor.extract_entities(text, ["company", "person", "product", "location"]) print(result) - GLiNER
How to use OpenMed/GLiNER2.5-ProceduresTests-Small-v1 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("OpenMed/GLiNER2.5-ProceduresTests-Small-v1") text = "Cristiano Ronaldo dos Santos Aveiro was born on 5 February 1985 in Funchal, Madeira, Portugal." labels = ["person", "date", "location"] entities = model.predict_entities(text, labels) for entity in entities: print(entity["text"], "=>", entity["label"]) - Notebooks
- Google Colab
- Kaggle
Commit ·
2a40b2f
0
Parent(s):
OpenMed GLiNER2.5-ProceduresTests-Small-v1
Browse filesFiles changed (9)
- .gitattributesAdded+35
- LICENSEAdded+201
- README.mdAdded+233
- config.jsonAdded+134
- encoder_config/config.jsonAdded+32
- model.safetensorsAdded+3
- special_tokens_map.jsonAdded+123
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+155
1234567891011121314151617181920212223242526272829303132333435*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tar filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233---license: apache-2.0language:- enlibrary_name: openmedpipeline_tag: token-classificationbase_model: fastino/gliner2.5-small-v1datasets:- bigbio/medmentionstags:- medical- biomedical- named-entity-recognition- procedure- diagnostic-procedure- laboratory-procedure- therapeutic-procedure- gliner2- gliner- openmedmodel-index:- name: GLiNER2.5-ProceduresTests-Small-v1 results: - task: type: token-classification name: Procedure mention extraction dataset: name: MedMentions (200 held-out abstracts) type: bigbio/medmentions split: held-out metrics: - type: f1 value: 48.02 name: F1 (exact span, micro-averaged over the three labels, threshold 0.4) - type: f1 value: 45.75 name: F1 Diagnostic_Procedure (exact span, threshold 0.4) - type: f1 value: 28.91 name: F1 Laboratory_Procedure (exact span, threshold 0.4) - type: f1 value: 54.30 name: F1 Therapeutic_Procedure (exact span, threshold 0.4)---
<p align="center"> <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></p>
<h1 align="center">OpenMed GLiNER2.5 ProceduresTests Small v1</h1>
<p align="center"> <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> <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> <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> <img alt="License Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue"></p>
**OpenMed's open model for finding procedures and tests in biomedical text.** It returns diagnostic, laboratory and therapeutic procedure mentions in English biomedical text, labeled by type, with exact character offsets and a confidence score. Trained and evaluated by [OpenMed](https://huggingface.co/OpenMed). Apache-2.0, 73.9M parameters, runs on CPU.
| Developed by | [OpenMed](https://huggingface.co/OpenMed) ||---|---|| Task | Procedure mention extraction, three labels: `diagnostic procedure`, `laboratory procedure`, `therapeutic or preventive procedure` (the prompts it was trained with) || Output | `text`, `start`, `end`, `label`, `score`; `text[start:end]` is the exact span || Parameters | 73.9M || Default threshold | 0.4 || Language | English || License | Apache-2.0 |
## About OpenMed
OpenMed builds open models and open-source tools for clinical and biomedical text that run on your own hardware.
- **[2,300+ open models on Hugging Face](https://huggingface.co/OpenMed)** for clinical NER, de-identification and more.- **[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.- New models every week: follow [OpenMed on Hugging Face](https://huggingface.co/OpenMed) and [@OpenMed_AI on X](https://x.com/OpenMed_AI).
## Quick start
```bashpip install -U "openmed[gliner2]" # OpenMed 3.2 or later```
```pythonfrom openmed import OpenMedConfig, analyze_text
text = ( "Patients underwent screening colonoscopy, and polyps " "larger than 10 mm were removed by endoscopic mucosal " "resection.")result = analyze_text( text, model_id="OpenMed/GLiNER2.5-ProceduresTests-Small-v1", labels=[ "diagnostic procedure", "laboratory procedure", "therapeutic or preventive procedure", ], threshold=0.05, confidence_threshold=0.4, max_length=150, config=OpenMedConfig(use_medical_tokenizer=False),)for e in result.entities: print(e.start, e.end, e.text, f"[{e.label}]", f"{e.confidence:.2f}")```
```text19 40 screening colonoscopy [PROCEDURE] 0.8887 115 endoscopic mucosal resection [therapeutic or preventive procedure] 0.95```
### The settings
- `labels` holds the three prompts the model was trained with, one per label. Keep them as written and pass all of them: the evaluation below ran with all three together.- Each span comes back with the prompt that found it as its `label`, except `diagnostic procedure`, which the SDK reports under its standard label `PROCEDURE`. `laboratory procedure` and `therapeutic or preventive procedure` come back as written.- `threshold=0.05` lets the model propose spans down to 0.05, and `confidence_threshold=0.4` keeps those scoring 0.4 or more. This is the decoding behind the evaluation below. Raise `confidence_threshold` for fewer, surer spans.- `max_length=150` makes `analyze_text` group sentences into pieces of at most 600 characters, the window size used in training and evaluation. It only matters for long texts.- `use_medical_tokenizer=False` keeps the model's own span boundaries.
### Long abstracts, many abstracts, GPU
- Pass a whole abstract: `analyze_text` splits it into sentences and returns offsets into the original text.- The model loads once and stays cached, so call `analyze_text` in a loop for many texts.- On a GPU, pass `config=OpenMedConfig(device="cuda", use_medical_tokenizer=False)`.
## Evaluation
**MedMentions, 200 held-out abstracts:** PubMed abstracts with 1,017 human-annotated procedure mentions (216 diagnostic, 189 laboratory and 612 therapeutic or preventive; three of the seven semantic types of the UMLS Procedures semantic group, each kept as its own label). The model was trained on 1,000 other MedMentions abstracts, both thresholds were chosen on 200 more, and these 200 were scored once at the end, with the model, thresholds and scoring code frozen first. A prediction counts only if its character span and its label both match exactly. Scores pool all labels (micro-average). All abstracts come from the official MedMentions training partition; the official test set was not used, so these numbers are not comparable to published MedMentions results.
| Model | Precision | Recall | F1 ||---|---:|---:|---:|| **OpenMed GLiNER2.5 ProceduresTests Small v1** (this model), threshold 0.4 | 50.21 | 46.02 | **48.02** || Before OpenMed fine-tuning: [fastino/gliner2.5-small-v1](https://huggingface.co/fastino/gliner2.5-small-v1), threshold 0.3 | 9.31 | 19.37 | 12.57 |
OpenMed's fine-tuning added **+35.45 F1 points** over all labels (95% CI +31.33 to +39.62, paired bootstrap over the 200 abstracts, 2,000 resamples). Each model runs at its own best threshold, chosen on the calibration abstracts before testing. At the same threshold, 0.5, the scores are 47.56 for this model and 11.45 before fine-tuning.
### By label
| Label | Prompt | Mentions | Precision | Recall | F1 before fine-tuning | F1 | F1 change (95% CI) ||---|---|---:|---:|---:|---:|---:|---:|| Diagnostic_Procedure | `diagnostic procedure` | 216 | 46.63 | 44.91 | 8.26 | 45.75 | +37.49 (+29.24 to +46.33) || **Laboratory_Procedure** | `laboratory procedure` | 189 | 32.67 | 25.93 | 11.00 | **28.91** | +17.90 (+12.41 to +23.92) || Therapeutic_Procedure | `therapeutic or preventive procedure` | 612 | 56.10 | 52.61 | 18.73 | 54.30 | +35.57 (+29.61 to +41.84) |
**Laboratory procedures are the weak label: 28.91 F1, with recall 25.93.** On these abstracts the model finds about one laboratory procedure mention in four, and 67% of the spans it labels laboratory do not match an annotated laboratory procedure exactly. Review its laboratory spans before relying on them. All three labels improved with fine-tuning: each label's 95% interval is above zero.
## The OpenMed GLiNER2.5 Small models
Same base model, same MedMentions source, each scored on its own held-out abstracts. ProceduresTests has three labels and its F1 pools them; the others have one label each.
| Model | Finds | Prompt | Default threshold | F1 before fine-tuning | F1 ||---|---|---|---:|---:|---:|| [OpenMed GLiNER2.5 DrugChemical Small v1](https://huggingface.co/OpenMed/GLiNER2.5-DrugChemical-Small-v1) | drugs and chemicals | `chemical or drug` | 0.4 | 45.09 | 67.43 || [OpenMed GLiNER2.5 Anatomy Small v1](https://huggingface.co/OpenMed/GLiNER2.5-Anatomy-Small-v1) | anatomy | `anatomy` | 0.3 | 25.71 | 61.85 || **OpenMed GLiNER2.5 ProceduresTests Small v1** (this model) | diagnostic, laboratory and therapeutic procedures | `diagnostic procedure`, `laboratory procedure`, `therapeutic or preventive procedure` | 0.4 | 12.57 | **48.02** |
## Examples
Real outputs of this model through the OpenMed SDK, with the quick-start settings (default threshold 0.4), on CPU. The sentences are synthetic, written in the style of PubMed abstracts for this card. Extracted spans are in bold with their label (diagnostic, laboratory, therapeutic) and score.
1. *Screening and removal:* Patients underwent **screening colonoscopy**<sub>diagnostic 0.88</sub>, and polyps larger than 10 mm were removed by **endoscopic mucosal resection**<sub>therapeutic 0.95</sub>.2. *Laboratory panel:* Complete **blood count**<sub>laboratory 0.45</sub>, **serum creatinine**<sub>laboratory 0.58</sub> and **liver function tests**<sub>diagnostic 0.55</sub> were obtained at baseline and every four weeks.3. *Molecular testing:* SARS-CoV-2 infection was confirmed by **reverse transcription PCR**<sub>laboratory 0.53</sub> of **nasopharyngeal swabs**<sub>laboratory 0.52</sub>.4. *Cardiac workup:* **Transthoracic echocardiography**<sub>diagnostic 0.99</sub> and **cardiac magnetic resonance imaging**<sub>diagnostic 1.00</sub> were performed before **percutaneous coronary intervention**<sub>therapeutic 0.98</sub>.5. *Breast cancer treatment:* After **neoadjuvant chemotherapy**<sub>therapeutic 0.85</sub>, patients underwent **breast-conserving surgery**<sub>therapeutic 0.71</sub> followed by **whole-breast radiotherapy**<sub>therapeutic 0.88</sub>.6. *Pathology:* Immunohistochemistry for HER2 and Ki-67 was performed on core needle biopsy specimens. *(nothing extracted)*7. *Prevention:* Influenza vaccination coverage rose from 41% to 63% after the reminder program. *(nothing extracted)*8. *Dialysis unit:* Patients on maintenance hemodialysis had **blood cultures**<sub>laboratory 0.92</sub> drawn at each febrile episode.9. *Lung function:* Spirometry and a six-minute walk test were repeated 12 months after **lung transplantation**<sub>therapeutic 0.93</sub>.10. *No procedures:* Participants reported their sleep duration, dietary habits and daily screen time in an online survey. *(nothing extracted)*
**A longer abstract** (829 characters, 11 spans) in one `analyze_text` call:
> BACKGROUND: Early detection of colorectal cancer relies on screening, but adherence to **colonoscopy**<sub>diagnostic</sub> remains low. > METHODS: We enrolled 1,200 adults aged 50 to 75 years. Participants completed a **fecal immunochemical test**<sub>laboratory</sub>, and those with a positive result were referred for **colonoscopy**<sub>diagnostic</sub>. Biopsy specimens were examined by histopathology, and KRAS mutation status was determined by **polymerase chain reaction**<sub>laboratory</sub>. **Hemoglobin**<sub>laboratory</sub> and **serum ferritin**<sub>laboratory</sub> were measured in all participants. > RESULTS: **Colonoscopy**<sub>diagnostic</sub> detected advanced adenomas in 84 participants, all of whom underwent **polypectomy**<sub>therapeutic</sub>. Eleven patients with invasive cancer were treated with **laparoscopic colectomy**<sub>therapeutic</sub>, and six received **adjuvant chemotherapy**<sub>therapeutic</sub>. > CONCLUSIONS: A stepwise screening program combining stool testing and colonoscopy increased detection and allowed **early surgical treatment**<sub>therapeutic</sub>.
## Good to know
- One call returns all three types: example 4 gives *Transthoracic echocardiography* and *cardiac magnetic resonance imaging* as diagnostic and *percutaneous coronary intervention* as therapeutic; example 8 gives *blood cultures* as laboratory.- Laboratory procedures are where it misses most, as in the evaluation: example 6 returns nothing for *Immunohistochemistry*, example 2 labels *liver function tests* diagnostic, and the longer abstract misses *stool testing*. It also returns *nasopharyngeal swabs*, the specimen, as a laboratory procedure in example 3.- It misses procedures of the other types too: *core needle biopsy* (example 6), *Influenza vaccination* (example 7), *maintenance hemodialysis* (example 8), *Spirometry* and the *six-minute walk test* (example 9).- Span edges can be off by a word: *blood count* without *Complete* (example 2), and *early surgical treatment* in the longer abstract.- Example 10, with no procedures, returns nothing.
## Limitations
- Trained and tested on English PubMed abstracts (MedMentions). It has not been validated on hospital notes or other clinical text; the examples above are synthetic.- Laboratory procedures are the weak label: 28.91 F1 and 25.93 recall on the held-out abstracts, so most laboratory procedure mentions are missed.- It covers three of the seven types of the UMLS Procedures group. Educational activities, health care activities, molecular biology research techniques and research activities are not labeled.- It finds procedure mentions only. It does not extract test results or values, billing codes or doses, and does not say whether a procedure was done, planned or refused.- No normalization: spans are not mapped to CPT, LOINC, SNOMED CT or UMLS codes.- Scores rank spans; they are not calibrated probabilities.- The base model's pretraining data is not public, so whether it saw these abstracts is unknown.- It finds text spans. It does not give medical advice and is not a medical device.
## Built on
OpenMed fine-tuned this model from [fastino/gliner2.5-small-v1](https://huggingface.co/fastino/gliner2.5-small-v1) by Fastino (Apache-2.0), built with the open-source [GLiNER2](https://github.com/fastino-ai/GLiNER2) library. Training and evaluation data: the [MedMentions corpus](https://github.com/chanzuckerberg/MedMentions) of PubMed abstracts annotated with UMLS concepts by Mohan and Li (2019, CC0); mentions of three types of the UMLS Procedures semantic group (Diagnostic Procedure, Laboratory Procedure and Therapeutic or Preventive Procedure) were kept as three labels. Thank you to Fastino and to the MedMentions authors for releasing their work openly.
This model is released under Apache-2.0. No corpus text, UMLS concept IDs or terminology files are included in this repository.
## Citation
```bibtex@misc{panahi2025openmedner, title={OpenMed NER: Open-Source, Domain-Adapted State-of-the-Art Transformers for Biomedical NER Across 12 Public Datasets}, author={Maziyar Panahi}, year={2025}, eprint={2508.01630}, archivePrefix={arXiv}}
@inproceedings{mohan2019medmentions, title={MedMentions: A Large Biomedical Corpus Annotated with {UMLS} Concepts}, author={Mohan, Sunil and Li, Donghui}, booktitle={Proceedings of the 2019 Conference on Automated Knowledge Base Construction (AKBC)}, year={2019}}
@misc{zaratiana2025gliner2, title={GLiNER2: An Efficient Multi-Task Information Extraction System with Schema-Driven Interface}, author={Urchade Zaratiana and Gil Pasternak and Oliver Boyd and George Hurn-Maloney and Ash Lewis}, year={2025}, eprint={2507.18546}, archivePrefix={arXiv}}```
<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>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134{ "architecture": "boundary", "architecture_version": 1, "architectures": [ "BoundaryExtractor" ], "attn_implementation": "sdpa", "boundary_head": { "abstention_loss_weight": 0.2, "abstention_threshold": 0.5, "adaptive_threshold": false, "bidirectional_proposals": true, "boundary_attention_heads": 4, "boundary_attention_layers": 2, "boundary_attention_window": 128, "boundary_dim": 128, "boundary_ffn_multiplier": 2.0, "boundary_focal_clip": 0.05, "boundary_focal_gamma_negative": 2.0, "boundary_focal_gamma_positive": 0.0, "boundary_marginal_loss": "asymmetric_focal", "boundary_negative_weight": 0.5, "boundary_refinement_layers": 1, "boundary_top_k_alpha": 0.08, "boundary_top_k_bucket": 8, "boundary_top_k_max": 128, "candidate_attention_heads": 4, "candidate_attention_layers": 0, "candidate_budget": 192, "candidate_pool": "shared", "classification_loss_weight": 1.0, "classification_temperature": 1.0, "consistency_loss_weight": 0.1, "consistency_warmup_steps": 2000, "content_dim": 64, "content_soft_max_pool": false, "count_loss_weight": 0.2, "directional_relation_states": true, "dropout": 0.1, "enable_abstention": true, "enable_count_head": true, "enable_records": true, "enable_relations": true, "enable_rotary_endpoints": true, "enable_span_content": true, "end_block_size": 256, "end_top_k": 24, "endpoint_difference_features": true, "ends_per_start": 12, "export_mode": "auto", "hard_negative_keep_all_when_absent": true, "hard_negatives_per_positive": 20, "loss_reduction": "sum", "max_gold_per_query": 64, "max_negative_queries_per_batch": 64, "min_pool_per_query": 8, "minimum_hard_negatives": 16, "multihead_pair_compat_heads": 8, "negative_query_ratio": 1.0, "overlap_policy": "flat", "pair_dim": 128, "pair_temperature": 1.0, "pool_boundary_top_k": 32, "pool_size": 192, "proposal_loss_weight": 0.3, "query_attention_layers": 0, "query_conditioned_inside_weight": true, "record_anchor_proposal_threshold": 0.2, "record_anchor_threshold": 0.5, "record_dim": 128, "record_field_threshold": 0.5, "record_instance_queries": 32, "record_loss_weight": 1.0, "record_temperature": 1.0, "relation_argument_proposal_threshold": 0.2, "relation_biaffine_content": true, "relation_heads_per_type": 32, "relation_loss_weight": 1.0, "relation_pair_cap": 64, "relation_tails_per_type": 32, "relation_temperature": 1.0, "rerank_listwise_weight": 0.3, "reranker_endpoint_compat": true, "rotary_base": 10000.0, "soft_iou_anneal_steps": 20000, "soft_iou_aux_weight": 0.2, "start_top_k": 24, "starts_per_end": 12, "training_candidate_budget": 192, "use_inside_evidence": true, "vectorized_pair_elements": 16777216 }, "config_version": 3, "encoder_config": { "attention_probs_dropout_prob": 0.1, "bos_token_id": null, "dtype": "float16", "eos_token_id": null, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 384, "initializer_range": 0.02, "intermediate_size": 1536, "layer_norm_eps": 1e-07, "legacy": true, "max_position_embeddings": 512, "max_relative_positions": -1, "model_type": "deberta-v2", "norm_rel_ebd": "layer_norm", "num_attention_heads": 6, "num_hidden_layers": 12, "pad_token_id": 0, "pooler_dropout": 0.0, "pooler_hidden_act": "gelu", "pooler_hidden_size": 384, "pos_att_type": [ "p2c", "c2p" ], "position_biased_input": false, "position_buckets": 256, "relative_attention": true, "share_att_key": true, "tie_word_embeddings": true, "transformers_version": "5.8.0", "type_vocab_size": 0, "vocab_size": 128011 }, "max_len": 4096, "model_name": "microsoft/deberta-v3-xsmall", "model_type": "extractor", "token_pooling": "first", "transformers_version": "4.57.6"}1234567891011121314151617181920212223242526272829303132{ "attention_probs_dropout_prob": 0.1, "dtype": "float16", "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 384, "initializer_range": 0.02, "intermediate_size": 1536, "layer_norm_eps": 1e-07, "legacy": true, "max_position_embeddings": 512, "max_relative_positions": -1, "model_type": "deberta-v2", "norm_rel_ebd": "layer_norm", "num_attention_heads": 6, "num_hidden_layers": 12, "pad_token_id": 0, "pooler_dropout": 0.0, "pooler_hidden_act": "gelu", "pooler_hidden_size": 384, "pos_att_type": [ "p2c", "c2p" ], "position_biased_input": false, "position_buckets": 256, "relative_attention": true, "share_att_key": true, "transformers_version": "4.57.6", "type_vocab_size": 0, "vocab_size": 128011}123version https://git-lfs.github.com/spec/v1oid sha256:6471bac3cbf49e5f9504f242a1ef64facc32fd5fa4eb34ef09d5c24d21a72216size 295567700123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ "additional_special_tokens": [ { "content": "[SEP_STRUCT]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[SEP_TEXT]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[P]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[C]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[E]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[R]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[L]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[EXAMPLE]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[OUTPUT]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "[DESCRIPTION]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false } ], "bos_token": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "cls_token": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "mask_token": { "content": "[MASK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "[PAD]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "sep_token": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "[UNK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155{ "add_prefix_space": true, "added_tokens_decoder": { "0": { "content": "[PAD]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "1": { "content": "[CLS]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "2": { "content": "[SEP]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "3": { "content": "[UNK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128000": { "content": "[MASK]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128001": { "content": "[SEP_STRUCT]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128002": { "content": "[SEP_TEXT]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128003": { "content": "[P]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128004": { "content": "[C]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128005": { "content": "[E]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128006": { "content": "[R]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128007": { "content": "[L]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128008": { "content": "[EXAMPLE]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128009": { "content": "[OUTPUT]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "128010": { "content": "[DESCRIPTION]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "additional_special_tokens": [ "[SEP_STRUCT]", "[SEP_TEXT]", "[P]", "[C]", "[E]", "[R]", "[L]", "[EXAMPLE]", "[OUTPUT]", "[DESCRIPTION]" ], "backend": "tokenizers", "bos_token": "[CLS]", "clean_up_tokenization_spaces": false, "cls_token": "[CLS]", "do_lower_case": false, "eos_token": "[SEP]", "extra_special_tokens": {}, "is_local": true, "local_files_only": false, "mask_token": "[MASK]", "model_max_length": 1000000000000000019884624838656, "pad_token": "[PAD]", "sep_token": "[SEP]", "split_by_punct": false, "tokenizer_class": "DebertaV2TokenizerFast", "unk_id": 3, "unk_token": "[UNK]", "vocab_type": "spm"}.gitattributesAdded+35
LICENSEAdded+201
README.mdAdded+233
config.jsonAdded+134
encoder_config/config.jsonAdded+32
model.safetensorsAdded+3
special_tokens_map.jsonAdded+123
tokenizer.jsonAdded
tokenizer_config.jsonAdded+155