Instructions to use OpenMed/GLiFormer-BioNER-Disease-Large-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiFormer
How to use OpenMed/GLiFormer-BioNER-Disease-Large-v1 with GLiFormer:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- GLiNER
How to use OpenMed/GLiFormer-BioNER-Disease-Large-v1 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("OpenMed/GLiFormer-BioNER-Disease-Large-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
OpenMed GLiFormer BioNER Disease Large v1
OpenMed's open model for finding diseases in medical text. It returns every disease mention in English biomedical and clinical text with exact character offsets and a confidence score. Trained and evaluated by OpenMed. Apache-2.0, runs on CPU.
| Developed by | OpenMed |
|---|---|
| Task | Disease mention extraction, one label: disease |
| Output | text, start, end, score; text[start:end] is the exact span |
| Parameters | 576M |
| Default threshold | 0.6 |
| 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 for clinical NER, de-identification and more.
- The OpenMed Python SDK, Apache-2.0:
pip install openmedfor de-identification, clinical NER, and FHIR and HL7 tooling, all local. - New models every week: follow OpenMed on Hugging Face and @OpenMed_AI on X.
Quick start
pip install -U "openmed[gliformer]" # OpenMed 3.2 or later
from openmed import analyze_text
text = (
"65-year-old man with type 2 diabetes mellitus, stage 3 "
"chronic kidney disease and atrial fibrillation, "
"admitted with community-acquired pneumonia."
)
result = analyze_text(
text,
model_id="OpenMed/GLiFormer-BioNER-Disease-Large-v1",
labels=["disease"],
threshold=0.6,
)
for e in result.entities:
print(e.start, e.end, e.text, f"{e.confidence:.2f}")
21 45 type 2 diabetes mellitus 1.00
47 77 stage 3 chronic kidney disease 0.86
82 101 atrial fibrillation 1.00
117 145 community-acquired pneumonia 0.95
Negated, family and past mentions
Add assert_context=True and OpenMed labels each mention with its negation, experiencer and timing:
from openmed import analyze_text
text = (
"Troponin was mildly elevated without dynamic change, "
"and an acute coronary syndrome was ruled out. No "
"history of stroke. Her father died of colorectal "
"cancer."
)
result = analyze_text(
text,
model_id="OpenMed/GLiFormer-BioNER-Disease-Large-v1",
labels=["disease"],
threshold=0.6,
assert_context=True,
)
for e in result.entities:
ctx = e.metadata["clinical_context"]
print(e.text, ctx["negation"], ctx["experiencer"], ctx["temporality"])
acute coronary syndrome negated patient recent
stroke negated patient historical
colorectal cancer affirmed family recent
Long notes, many notes, GPU
- Pass a whole note:
analyze_textsplits it into sentences and returns offsets into the original text. - The model loads once and stays cached, so call
analyze_textin a loop for many notes. - On a GPU, pass
config=OpenMedConfig(device="cuda")(from openmed import OpenMedConfig).
Evaluation
BC5CDR test set: 500 PubMed abstracts, 4,424 disease mentions, human annotations. A prediction counts only if its character span matches exactly. The model was trained on NCBI Disease only, so BC5CDR is a different corpus it never saw.
All rows use the same threshold, 0.5.
| Model | Precision | Recall | F1 |
|---|---|---|---|
| OpenMed GLiFormer BioNER Disease Large v1 (this model) | 73.63 | 64.94 | 69.01 |
| Before OpenMed fine-tuning: knowledgator/gliformer-large-v1 | 62.87 | 48.80 | 54.95 |
OpenMed's fine-tuning added +14.1 F1 points (95% CI +12.4 to +15.8, paired bootstrap over test documents). At the default threshold of 0.6, chosen on the development set before testing, this model scores precision 74.81, recall 63.04, F1 68.42.
The OpenMed disease family
Same training data, same task, same test set (BC5CDR, never seen in training), same threshold.
| Model | Parameters | BC5CDR F1 (0.5) |
|---|---|---|
| OpenMed GLiFormer BioNER Disease Large v1 (this model) | 576M | 69.01 |
| OpenMed GLiNER2.5 BioNER Disease Base v1 | 194M | 67.04 |
| OpenMed GLiFormer BioNER Disease Base v1 | 264M | 64.10 |
Examples
Real outputs of this model through the OpenMed SDK, at its default threshold (0.6), on CPU. The sentences are synthetic, written for this card. Extracted spans are in bold with their scores.
- Clinical note: 65-year-old man with type 2 diabetes mellitus1.00, stage 3 chronic kidney disease0.86 and atrial fibrillation1.00, admitted with community-acquired pneumonia0.95.
- Abbreviations: PMH0.86: COPD1.00, CHF1.00, T2DM1.00, OSA1.00 on CPAP. Admitted for an acute exacerbation of COPD1.00.
- Oncology genetics: Germline BRCA1 and BRCA2 variants raise the lifetime risk of breast cancer1.00 and ovarian cancer1.00.
- Rare inherited disease: Autosomal dominant polycystic kidney disease1.00 is the most common inherited cause of end-stage renal disease1.00.
- Adverse drug events: Two patients developed drug-induced liver injury and one developed Stevens-Johnson syndrome1.00 after the new regimen was started.
- Neurology differential: MRI findings were consistent with multiple sclerosis1.00; neuromyelitis optica1.00 and acute disseminated encephalomyelitis1.00 were considered less likely.
- Hematology: Biopsy confirmed diffuse large B-cell lymphoma1.00 in a patient with long-standing Sjogren's syndrome0.97 and autoimmune hemolytic anemia1.00.
- Infection before biologics: Latent tuberculosis1.00 was treated before adalimumab was started for rheumatoid arthritis1.00.
- Newborn screening: Newborn screening flagged cystic fibrosis1.00, congenital hypothyroidism1.00 and phenylketonuria1.00 for confirmatory testing.
- Cardiology: Echocardiography showed hypertrophic cardiomyopathy1.00 with moderate mitral regurgitation1.00; no pericardial effusion.
- Negation and family history: No history of asthma1.00 or epilepsy1.00. Her mother had Huntington's disease0.99.
- Medications only: Started metformin 500 mg twice daily and lisinopril 10 mg once daily; follow up in four weeks. (nothing extracted)
A longer note (1,257 characters, 24 spans) in one analyze_text call with assert_context=True. Mentions that are negated, about a family member or in the past carry that label:
DISCHARGE SUMMARY
Reason for admission: A 72-year-old woman with heart failure with reduced ejection fraction, chronic obstructive pulmonary disease and type 2 diabetes mellitus presented with three days of worsening dyspnea, orthopnea and bilateral leg swelling.
Hospital course: Chest radiograph showed pulmonary edema and a small right pleural effusion. Troponin was mildly elevated without dynamic change, and an acute coronary syndromenegated was ruled out. She was diuresed with intravenous furosemide. On day two she developed acute kidney injury, which improved after the diuretic dose was reduced. A urinary tract infection was treated with nitrofurantoin. Her course was also complicated by deliriumhistorical, which resolved by discharge.
Past history: hypertension, hyperlipidemia, osteoarthritis of both knees, gastroesophageal reflux disease and a remote history of breast cancerhistorical treated with lumpectomy and radiotherapy. No history of strokenegated, historical. Her father died of colorectal cancerfamily.
Discharge diagnoses: acute decompensated heart failure; acute kidney injuryhistorical, resolved; urinary tract infection; deliriumhistorical, resolved.
Follow-up: cardiology clinic in two weeks with a repeat basic metabolic panel; screen for sleep apnea and iron deficiency anemia as an outpatient.
Good to know
- It finds mentions, including negated ones: No history of asthma still returns
asthma(example 11).assert_context=Truecatches most negation and family history (see the longer note), but it is rule-based and can miss: in example 11, epilepsy after No history of asthma or comes back affirmed. - Abbreviations work (COPD, CHF, T2DM, OSA in example 2), with one false positive: the section header PMH.
- It can miss a mention: drug-induced liver injury in example 5, and heart failure in the first line of the longer note.
- Drug names are not diseases: example 12 returns nothing.
Limitations
- Trained and tested on PubMed abstracts. It has not been validated on hospital notes; the notes above are synthetic.
- English only, one label (
disease). Other labels and the base model's other tasks were not evaluated after fine-tuning. - No normalization: spans are not mapped to ICD-10, SNOMED CT or MeSH codes.
- It finds text spans. It does not diagnose anything and is not a medical device.
Built on
OpenMed fine-tuned this model from knowledgator/gliformer-large-v1 by Knowledgator (Apache-2.0), built with the open-source GLiFormer library. Training data: the NCBI Disease corpus (public domain). Evaluation: the BC5CDR corpus. Thank you to Knowledgator and to the corpus authors for releasing their work openly.
This model is released under Apache-2.0. No corpus text is included in this repository.
Citation
@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}
}
@article{dogan2014ncbi,
title={NCBI disease corpus: a resource for disease name recognition and concept normalization},
author={Do{\u{g}}an, Rezarta Islamaj and Leaman, Robert and Lu, Zhiyong},
journal={Journal of Biomedical Informatics},
volume={47},
pages={1--10},
year={2014}
}
@article{li2016biocreative,
title={BioCreative V CDR task corpus: a resource for chemical disease relation extraction},
author={Li, Jiao and Sun, Yueping and Johnson, Robin J and Sciaky, Daniela and Wei, Chih-Hsuan and Leaman, Robert and Davis, Allan Peter and Mattingly, Carolyn J and Wiegers, Thomas C and Lu, Zhiyong},
journal={Database},
volume={2016},
pages={baw068},
year={2016}
}
OpenMed · Hugging Face · GitHub · PyPI · X
Model tree for OpenMed/GLiFormer-BioNER-Disease-Large-v1
Base model
knowledgator/gliformer-large-v1Dataset used to train OpenMed/GLiFormer-BioNER-Disease-Large-v1
Paper for OpenMed/GLiFormer-BioNER-Disease-Large-v1
Evaluation results
- F1 (exact span, threshold 0.5) on BC5CDR (test)test set self-reported69.010