Instructions to use OpenMed/Inkling2-Mini-BiomedicalSections-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMed/Inkling2-Mini-BiomedicalSections-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="OpenMed/Inkling2-Mini-BiomedicalSections-v1")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenMed/Inkling2-Mini-BiomedicalSections-v1") model = AutoModelForMultimodalLM.from_pretrained("OpenMed/Inkling2-Mini-BiomedicalSections-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
OpenMed Inkling 2 Mini Biomedical Sections v1
OpenMed's fine-tune of Inkling 2 Mini for reading biomedical abstracts. Give it one sentence from an abstract and it names the sentence's role: background, objective, methods, results or conclusions. On 300 sentences from 181 articles not used in training, it scores 78.40 macro F1, better than the original Inkling 2 Mini on all five roles, and it finds 93.3% of methods sentences and 90.0% of results sentences. It ships as one standalone checkpoint of about 19.5 GB in the same mixed NVFP4 and MXFP8 format as the original, under Apache-2.0.
| Developed by | OpenMed |
|---|---|
| Base model | Inkling 2 Mini by Thinking Machines Lab (Apache-2.0) |
| Task | Name the role of one sentence in a biomedical abstract |
| Input | One English sentence, up to 160 tokens |
| Output | background, objective, methods, results or conclusions, the label with the highest score |
| Evaluated on | 300 sentences (60 per role) from 181 articles, none of them in training; macro F1 78.40 (original Inkling 2 Mini 77.13) |
| Training | 600 labeled sentences from 509 open-access trial abstracts; rank-8 LoRA on the query and value projections of the last four layers (278,528 trained parameters), 100 steps, then merged into this checkpoint |
| 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, literature search 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
The checkpoint loads directly with Transformers on one CUDA GPU. The code below was checked against this repository with the tested Transformers revision.
pip install -U accelerate torch https://github.com/huggingface/transformers/archive/046bdb8cc2cee29d233964bb77fe6fd37cfe4aa3.zip
import torch
from transformers import AutoModelForMultimodalLM, AutoTokenizer
repo = "OpenMed/Inkling2-Mini-BiomedicalSections-v1"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForMultimodalLM.from_pretrained(
repo, dtype=torch.bfloat16, device_map={"": "cuda"},
attn_implementation="eager", experts_implementation="eager",
).eval()
labels = ["background", "objective", "methods", "results", "conclusions"]
codes = "ABCDE"[:len(labels)]
instruction = "Classify the role of this sentence in a biomedical abstract."
legend = "\n".join(f"{code} = {label}" for code, label in zip(codes, labels))
def encode(text):
return tokenizer.encode(text, add_special_tokens=False)
text = "We randomly assigned volunteers to two groups."
ids = encode(instruction + "\n" + legend + "\nText: ") + encode(text)[:160] + encode("\nAnswer:")
inputs = torch.tensor([ids], device=model.device)
choices = [encode(" " + code)[0] for code in codes]
with torch.inference_mode():
logits = model(input_ids=inputs, attention_mask=torch.ones_like(inputs),
use_cache=False, logits_to_keep=1).logits
print(labels[logits[0, -1, choices].argmax().item()])
How it decides
- One forward pass, no generation. The prompt lists the five roles as answer codes
AtoE, and the model's next-token scores for those codes pick the role. Nothing is sampled. - Use this exact prompt. The instruction, the role legend, the
Text:andAnswer:markers and the 160-token cap are the ones used in training and evaluation. - A whole abstract: split it into sentences and score each one with the same prompt.
- Memory: the weights are decoded to BF16 on load; the reference run used one GPU with 96 GB of memory.
Evaluation
300 sentences from 181 biomedical articles, 60 for each role, from an independently sourced 2024 set of abstracts. None of these articles is in the training data. Each sentence's role comes from the heading its authors gave it in a structured abstract, and the headings were removed before scoring. The model trained for one fixed epoch, with no checkpoint chosen on these sentences, and every model below scored the same 300 sentences.
| Model | Macro F1 | Accuracy |
|---|---|---|
| OpenMed Inkling 2 Mini Biomedical Sections v1 (this model) | 78.40 | 78.67 |
| Before OpenMed fine-tuning: thinkingmachines/Inkling-2-Mini | 77.13 | 77.33 |
| TF-IDF and logistic regression trained on the same 600 sentences | 66.14 | 66.33 |
F1 by role:
| Role | This model | Before OpenMed fine-tuning | This model's precision / recall |
|---|---|---|---|
| Methods | 88.19 | 85.94 | 83.58 / 93.33 |
| Results | 84.38 | 83.46 | 79.41 / 90.00 |
| Conclusions | 81.08 | 79.63 | 88.24 / 75.00 |
| Background | 69.84 | 68.75 | 66.67 / 73.33 |
| Objective | 68.52 | 67.89 | 77.08 / 61.67 |
- OpenMed's fine-tuning added +1.27 macro F1 points over the original Inkling 2 Mini (95% interval +0.19 to +2.65, paired bootstrap over articles, 2,000 resamples) and raised F1 on every role. It is +12.26 points over the TF-IDF baseline (+7.02 to +17.40).
- Methods, results and conclusions are the strongest roles. Background and objective sentences are the ones it most often confuses with each other.
- This standalone checkpoint gives the same role as the trained adapter on all 300 sentences.
What it is for
It adds structure to abstracts that have none: tag each sentence, then pull the methods and results sentences for screening, evidence tables or search. It has been evaluated on English abstracts of biomedical studies.
For CPU-sized models on the same task, see OpenMed/ModernBERT-BiomedicalSections-Base-v1 and OpenMed/GLiNER2.5-BiomedicalSections-Small-v1.
Built on
OpenMed fine-tuned this model from Inkling 2 Mini by Thinking Machines Lab (Apache-2.0), using the fixed-loop release. Training used sentences from 509 CC BY abstracts of randomized controlled trials; every article, with its authors and DOI, is credited in NOTICE.txt. Thank you to Thinking Machines Lab for releasing Inkling 2 Mini openly, and to the authors who published their work open access.
This model is released under Apache-2.0. No abstract text or training data 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}
}
OpenMed · Hugging Face · GitHub · PyPI · X
- Downloads last month
- -
Model tree for OpenMed/Inkling2-Mini-BiomedicalSections-v1
Base model
thinkingmachines/Inkling-2-MiniPaper for OpenMed/Inkling2-Mini-BiomedicalSections-v1
Evaluation results
- Macro F1 (five roles) on Sentences from structured biomedical abstracts (300 sentences, 181 articles, not in training)self-reported78.400
- Accuracy on Sentences from structured biomedical abstracts (300 sentences, 181 articles, not in training)self-reported78.670
- F1 methods on Sentences from structured biomedical abstracts (300 sentences, 181 articles, not in training)self-reported88.190
- F1 results on Sentences from structured biomedical abstracts (300 sentences, 181 articles, not in training)self-reported84.380