加载中…
加载中…
OpenMed's open model for finding drugs and chemicals in biomedical text. It returns every drug and chemical mention in English biomedical text with exact character offsets and a confidence score. Trained and evaluated by OpenMed. Apache-2.0, 73.9M parameters, runs on CPU.
| Developed by | OpenMed |
|---|---|
| Task | Chemical and drug mention extraction, one label: chemical or drug (the prompt it was trained with) |
| Output | text, start, end, score; text[start:end] is the exact span |
| Parameters | 73.9M |
| Default threshold | 0.4 |
| Language | English |
| License | Apache-2.0 |
OpenMed builds open models and open-source tools for clinical and biomedical text that run on your own hardware.
pip install openmed for de-identification, clinical NER, and FHIR and HL7 tooling, all local.pip install -U "openmed[gliner2]" # OpenMed 3.2 or later
from openmed import OpenMedConfig, analyze_text
text = (
"Metformin lowered fasting glucose and insulin levels "
"in obese mice fed a high-fat diet, without changing "
"body weight."
)
result = analyze_text(
text,
model_id="OpenMed/GLiNER2.5-DrugChemical-Small-v1",
labels=["chemical or drug"],
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.confidence:.2f}")
0 9 Metformin 0.97
26 33 glucose 0.89
38 45 insulin 0.95
labels=["chemical or drug"] is the prompt the model was trained with. Keep it 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. The SDK default merges touching spans of one label: in example 6 it would return D2 receptor antagonist haloperidol as one span instead of D2 receptor antagonist and haloperidol.analyze_text splits it into sentences and returns offsets into the original text.analyze_text in a loop for many texts.config=OpenMedConfig(device="cuda", use_medical_tokenizer=False).MedMentions, 200 held-out abstracts: PubMed abstracts with 1,858 human-annotated chemical and drug mentions (the 20 semantic types of the UMLS Chemicals & Drugs semantic group, mapped to one label). The model was trained on 800 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 matches exactly. 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 DrugChemical Small v1 (this model), threshold 0.4 | 65.55 | 69.43 | 67.43 |
| Before OpenMed fine-tuning: fastino/gliner2.5-small-v1, threshold 0.5 | 40.39 | 51.02 | 45.09 |
OpenMed's fine-tuning added +22.34 F1 points (95% CI +19.27 to +25.93, 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 66.81 for this model and 45.09 before fine-tuning.
Same base model, same MedMentions source, one label each, each scored on its own held-out abstracts.
| Model | Finds | Prompt | Default threshold | F1 before fine-tuning | F1 |
|---|---|---|---|---|---|
| OpenMed GLiNER2.5 DrugChemical Small v1 (this model) | drugs and chemicals | chemical or drug |
0.4 | 45.09 | 67.43 |
| OpenMed GLiNER2.5 Anatomy Small v1 | anatomy | anatomy |
0.3 | 25.71 | 61.85 |
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 scores.
A longer abstract (939 characters, 16 spans) in one analyze_text call:
BACKGROUND: Statins lower low-density lipoprotein cholesterol, but their effect on hepatic steatosis is uncertain.
METHODS: In this randomized trial, 240 adults with nonalcoholic fatty liver disease received atorvastatin, ezetimibe or placebo for 24 weeks. Liver fat was measured by magnetic resonance imaging, and serum alanine aminotransferase, triglycerides and high-sensitivity C-reactive protein were assessed at baseline and at the end of treatment.
RESULTS: Atorvastatin reduced LDL cholesterol by 41% and alanine aminotransferase by 18%, whereas ezetimibe had no significant effect on liver fat. Combined treatment with atorvastatin and ezetimibe lowered triglycerides more than either drug alone. Myalgia was reported by six patients in the atorvastatin group, and no case of rhabdomyolysis occurred.
CONCLUSIONS: Atorvastatin, alone or with ezetimibe, improved lipid and liver enzyme profiles in nonalcoholic fatty liver disease.
OpenMed fine-tuned this model from fastino/gliner2.5-small-v1 by Fastino (Apache-2.0), built with the open-source GLiNER2 library. Training and evaluation data: the MedMentions corpus of PubMed abstracts annotated with UMLS concepts by Mohan and Li (2019, CC0); mentions of the UMLS Chemicals & Drugs semantic group were mapped to one label. 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.
@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}
}
OpenMed · Hugging Face · GitHub · PyPI · X