---
license: apache-2.0
language:
- en
library_name: openmed
pipeline_tag: token-classification
base_model: knowledgator/gliformer-base-v1
datasets:
- ncbi/ncbi_disease
tags:
- medical
- biomedical
- clinical-nlp
- named-entity-recognition
- disease
- gliformer
- gliner
- openmed
model-index:
- name: GLiFormer-BioNER-Disease-Base-v1
results:
- task:
type: token-classification
name: Disease mention extraction
dataset:
name: NCBI Disease (test)
type: ncbi/ncbi_disease
split: test
metrics:
- type: f1
value: 85.74
name: F1 (exact span, threshold 0.5)
---
OpenMed GLiFormer BioNER Disease Base 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](https://huggingface.co/OpenMed). Apache-2.0, runs on CPU.
| Developed by | [OpenMed](https://huggingface.co/OpenMed) |
|---|---|
| Task | Disease mention extraction, one label: `disease` |
| Output | `text`, `start`, `end`, `score`; `text[start:end]` is the exact span |
| Parameters | 264M |
| Default threshold | 0.7 |
| 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
```bash
pip install -U "openmed[gliformer]" # OpenMed 3.2 or later
```
```python
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-Base-v1",
labels=["disease"],
threshold=0.7,
)
for e in result.entities:
print(e.start, e.end, e.text, f"{e.confidence:.2f}")
```
```text
21 45 type 2 diabetes mellitus 1.00
47 77 stage 3 chronic kidney disease 0.96
82 101 atrial fibrillation 1.00
117 145 community-acquired pneumonia 1.00
```
### Negated, family and past mentions
Add `assert_context=True` and OpenMed labels each mention with its negation, experiencer and timing:
```python
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-Base-v1",
labels=["disease"],
threshold=0.7,
assert_context=True,
)
for e in result.entities:
ctx = e.metadata["clinical_context"]
print(e.text, ctx["negation"], ctx["experiencer"], ctx["temporality"])
```
```text
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_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 notes.
- On a GPU, pass `config=OpenMedConfig(device="cuda")` (`from openmed import OpenMedConfig`).
## Evaluation
**NCBI Disease test set:** 100 PubMed abstracts, 960 disease mentions, human annotations. A prediction counts only if its character span matches exactly. The test set was not used for training or for choosing the threshold.
All rows use the same threshold, 0.5.
| Model | Precision | Recall | F1 |
|---|---:|---:|---:|
| **OpenMed GLiFormer BioNER Disease Base v1** (this model) | 84.15 | 87.40 | **85.74** |
| Before OpenMed fine-tuning: [knowledgator/gliformer-base-v1](https://huggingface.co/knowledgator/gliformer-base-v1) | 75.60 | 55.52 | 64.02 |
| [fastino/gliner2.5-base-v1](https://huggingface.co/fastino/gliner2.5-base-v1), not fine-tuned | 63.56 | 55.42 | 59.21 |
OpenMed's fine-tuning added **+21.7 F1 points** (95% CI +18.2 to +25.1, paired bootstrap over test documents). At the default threshold of 0.7, chosen on the development set before testing, this model scores precision 86.39, recall 83.96, F1 85.16.
**On a corpus it never saw:** BC5CDR test, 500 abstracts and 4,424 disease mentions: precision 66.35, recall 62.00, F1 64.10 at 0.5. BC5CDR was annotated by a different team with different guidelines, so expect lower scores outside the training corpus.
## 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](https://huggingface.co/OpenMed/GLiFormer-BioNER-Disease-Large-v1) | 576M | 69.01 |
| [OpenMed GLiNER2.5 BioNER Disease Base v1](https://huggingface.co/OpenMed/GLiNER2.5-BioNER-Disease-Base-v1) | 194M | 67.04 |
| **OpenMed GLiFormer BioNER Disease Base v1** (this model) | 264M | 64.10 |
## Examples
Real outputs of this model through the OpenMed SDK, at its default threshold (0.7), on CPU. The sentences are synthetic, written for this card. Extracted spans are in bold with their scores.
1. *Clinical note:* 65-year-old man with **type 2 diabetes mellitus**1.00, **stage 3 chronic kidney disease**0.96 and **atrial fibrillation**1.00, admitted with **community-acquired pneumonia**1.00.
2. *Abbreviations:* PMH: **COPD**1.00, **CHF**1.00, **T2DM**0.98, **OSA**0.99 on CPAP. Admitted for an acute exacerbation of **COPD**1.00.
3. *Oncology genetics:* Germline BRCA1 and BRCA2 variants raise the lifetime risk of **breast cancer**1.00 and **ovarian cancer**1.00.
4. *Rare inherited disease:* **Autosomal dominant polycystic kidney disease**1.00 is the most common inherited cause of **end-stage renal disease**1.00.
5. *Adverse drug events:* Two patients developed **drug-induced liver injury**0.86 and one developed **Stevens-Johnson syndrome**1.00 after the new regimen was started.
6. *Neurology differential:* MRI findings were consistent with **multiple sclerosis**1.00; **neuromyelitis optica**1.00 and **acute disseminated encephalomyelitis**1.00 were considered less likely.
7. *Hematology:* Biopsy confirmed **diffuse large B-cell lymphoma**0.99 in a patient with long-standing **Sjogren's syndrome**1.00 and **autoimmune hemolytic anemia**1.00.
8. *Infection before biologics:* **Latent tuberculosis**1.00 was treated before adalimumab was started for **rheumatoid arthritis**1.00.
9. *Newborn screening:* Newborn screening flagged **cystic fibrosis**1.00, **congenital hypothyroidism**1.00 and **phenylketonuria**1.00 for confirmatory testing.
10. *Cardiology:* Echocardiography showed **hypertrophic cardiomyopathy**1.00 with moderate **mitral regurgitation**1.00; no **pericardial effusion**1.00.
11. *Negation and family history:* No history of **asthma**1.00 or **epilepsy**0.99. Her mother had **Huntington's disease**1.00.
12. *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, 26 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 syndrome**negated 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 **delirium**historical, which resolved by discharge.
> Past history: **hypertension**, **hyperlipidemia**, **osteoarthritis of both knees**, **gastroesophageal reflux disease** and a remote history of **breast cancer**historical treated with lumpectomy and radiotherapy. No history of **stroke**negated, historical. Her father died of **colorectal cancer**family.
> Discharge diagnoses: **acute decompensated heart failure**; **acute kidney injury**historical, resolved; **urinary tract infection**; **delirium**historical, 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=True` catches 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 and OSA are all found in example 2.
- Drug names are not diseases: example 12 returns nothing.
- Symptoms and findings sometimes come back too (dyspnea, orthopnea and pulmonary edema in the longer note), and a long phrase can be split (*heart failure* and *reduced ejection fraction*).
## 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-base-v1](https://huggingface.co/knowledgator/gliformer-base-v1) by Knowledgator (Apache-2.0), built with the open-source [GLiFormer](https://github.com/Knowledgator/GLiFormer) library. Training data: the [NCBI Disease corpus](https://www.ncbi.nlm.nih.gov/CBBresearch/Dogan/DISEASE/) (public domain). Evaluation: the NCBI Disease test set and the [BC5CDR corpus](https://ftp.ncbi.nlm.nih.gov/pub/lu/BC5CDR/). 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
```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}
}
@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