Instructions to use OpenMed/GLiNER2.5-Anatomy-Small-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER2
How to use OpenMed/GLiNER2.5-Anatomy-Small-v1 with GLiNER2:
from gliner2 import AutoExtractor extractor = AutoExtractor.from_pretrained("OpenMed/GLiNER2.5-Anatomy-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-Anatomy-Small-v1 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("OpenMed/GLiNER2.5-Anatomy-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
OpenMed GLiNER2.5 Anatomy Small v1
OpenMed's open model for finding anatomy in biomedical text. It returns every anatomical mention (organs, body regions, tissues, cells and body substances) 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 | Anatomy mention extraction, one label: anatomy (the prompt it was trained with) |
| Output | text, start, end, score; text[start:end] is the exact span |
| Parameters | 73.9M |
| Default threshold | 0.3 |
| 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[gliner2]" # OpenMed 3.2 or later
from openmed import OpenMedConfig, analyze_text
text = (
"Contrast-enhanced CT of the chest showed a mass in the "
"right upper lobe of the lung with enlarged mediastinal "
"lymph nodes."
)
result = analyze_text(
text,
model_id="OpenMed/GLiNER2.5-Anatomy-Small-v1",
labels=["anatomy"],
threshold=0.05,
confidence_threshold=0.3,
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}")
28 33 chest 0.92
55 71 right upper lobe 0.41
79 83 lung 0.82
98 121 mediastinal lymph nodes 0.85
The settings
labels=["anatomy"]is the prompt the model was trained with. Keep it as written.threshold=0.05lets the model propose spans down to 0.05, andconfidence_threshold=0.3keeps those scoring 0.3 or more. This is the decoding behind the evaluation below. Raiseconfidence_thresholdfor fewer, surer spans.max_length=150makesanalyze_textgroup 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=Falsekeeps the model's own span boundaries. The SDK default merges touching spans of one label: in the longer abstract it would return Proximal tubule epithelial cells as one span instead of Proximal tubule and epithelial cells.
Long abstracts, many abstracts, GPU
- Pass a whole abstract:
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 texts. - On a GPU, pass
config=OpenMedConfig(device="cuda", use_medical_tokenizer=False).
Evaluation
MedMentions, 200 held-out abstracts: PubMed abstracts with 987 human-annotated anatomy mentions (the 11 semantic types of the UMLS Anatomy semantic group, mapped to one 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 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 Anatomy Small v1 (this model), threshold 0.3 | 57.91 | 66.36 | 61.85 |
| Before OpenMed fine-tuning: fastino/gliner2.5-small-v1, threshold 0.6 | 20.77 | 33.74 | 25.71 |
OpenMed's fine-tuning added +36.14 F1 points (95% CI +31.45 to +40.95, 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 61.74 for this model and 26.20 before fine-tuning.
The OpenMed GLiNER2.5 Small models
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 | drugs and chemicals | chemical or drug |
0.4 | 45.09 | 67.43 |
| OpenMed GLiNER2.5 Anatomy Small v1 (this model) | anatomy | anatomy |
0.3 | 25.71 | 61.85 |
Examples
Real outputs of this model through the OpenMed SDK, with the quick-start settings (default threshold 0.3), on CPU. The sentences are synthetic, written in the style of PubMed abstracts for this card. Extracted spans are in bold with their scores.
- Chest imaging: Contrast-enhanced CT of the chest0.92 showed a mass in the right upper lobe0.41 of the lung0.82 with enlarged mediastinal lymph nodes0.85.
- Immune cells: CD8+ T cells0.89 and tumor-associated macrophages0.51 infiltrated the stroma0.38 of resected pancreatic tumors.
- Histology: Biopsies of the gastric mucosa0.96 showed intestinal metaplasia and atrophy of the oxyntic glands0.96.
- Body fluids: Cerebrospinal fluid0.98, serum0.98 and urine samples0.94 were collected from each participant at enrollment.
- Neuroimaging: Resting-state MRI0.48 showed reduced connectivity between the hippocampus0.98 and the medial prefrontal cortex0.93.
- Cardiac structure: Echocardiography revealed left ventricular0.38 wall thickening, a dilated left atrium0.68 and a normal aortic valve0.43.
- Musculoskeletal: Arthroscopy of the knee0.93 showed a tear of the medial meniscus0.79 and loss of articular cartilage0.75 on the femoral condyle0.96.
- Cell components: Hepatocytes0.95 exposed to palmitate accumulated lipid droplets0.54, and their mitochondria0.89 showed reduced membrane potential.
- Embryology: In mouse embryos, closure of the neural tube0.95 was delayed and the somites0.76 were malformed.
- No anatomy: The survey asked about household income, education level and access to health insurance. (nothing extracted)
A longer abstract (938 characters, 23 spans) in one analyze_text call:
BACKGROUND: Diabetic kidney disease affects both the glomeruli and the tubulointerstitium, but early structural changes are poorly characterized.
METHODS: We analyzed kidney biopsies from 86 adults with type 2 diabetes. Sections were stained to assess the glomerular basement membrane, mesangial matrix and podocytes, and peritubular capillaries were counted in the renal cortex. Urine and plasma samples were collected on the day of biopsy.
RESULTS: Thickening of the glomerular basement membrane was present in 71 biopsies and correlated with podocyte loss. Proximal tubule epithelial cells showed lipid accumulation, and macrophages infiltrated the interstitium in advanced cases. Retinal photographs showed microaneurysms in 40 patients, and their presence was associated with mesangial expansion.
CONCLUSIONS: Structural injury to the glomerulus, tubules and peritubular capillaries begins before a marked decline in kidney function.
Good to know
- One label covers the whole anatomy group: organs (lung, hippocampus), tissues (gastric mucosa, articular cartilage), cells (CD8+ T cells, Hepatocytes), cell parts (mitochondria), body fluids (Cerebrospinal fluid, serum) and embryonic structures (neural tube, somites).
- Diseases and tumors are not anatomy: example 2 returns stroma but not pancreatic tumors, and example 3 does not return intestinal metaplasia.
- Adjectives come back on their own, sometimes with low scores: left ventricular (0.38) in example 6, Retinal and mesangial in the longer abstract.
- Spans can take in a nearby word or catch a non-anatomy term: urine samples (example 4), MRI (0.48, example 5) and microaneurysms in the longer abstract.
- Example 10, with no anatomy, 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.
- One broad label for the 11 types of the UMLS Anatomy group: organs, body regions, tissues, cells, cell components, body substances and embryonic structures. It does not tell them apart, and finer anatomical classes were not validated.
- No normalization: spans are not mapped to UMLS, FMA or UBERON 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 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 Anatomy 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.
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}
}
@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
- Downloads last month
- 10
Model tree for OpenMed/GLiNER2.5-Anatomy-Small-v1
Base model
fastino/gliner2.5-small-v1Dataset used to train OpenMed/GLiNER2.5-Anatomy-Small-v1
Papers for OpenMed/GLiNER2.5-Anatomy-Small-v1
OpenMed NER: Open-Source, Domain-Adapted State-of-the-Art Transformers for Biomedical NER Across 12 Public Datasets
GLiNER2: An Efficient Multi-Task Information Extraction System with Schema-Driven Interface
Article mentioning OpenMed/GLiNER2.5-Anatomy-Small-v1
Evaluation results
- F1 (exact span, threshold 0.3) on MedMentions (200 held-out abstracts)self-reported61.850