Instructions to use OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1") model = AutoModelForMultimodalLM.from_pretrained("OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1
- SGLang
How to use OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1 with Docker Model Runner:
docker model run hf.co/OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1
OpenMed Inkling 2 Mini Medical Trial Reasoning v1
OpenMed's fine-tune of Inkling 2 Mini for reading the numbers in clinical trial results. Give it the affected and at-risk counts for two trial groups, for serious adverse events or for deaths, and ask which group had the higher or the lower rate. It answers in one short, checkable line: both fractions, both percentages to one decimal, and the group or a tie. On 120 trials from 61 sponsors it never saw in training, it gives a complete worked answer for 118 (98.3%) and picks the right group or tie on all 120. The original Inkling 2 Mini, given the same prompt and the same short answer budget, gives one for 37 (30.8%). Apache-2.0, one standalone checkpoint of about 19.5 GB in the same mixed NVFP4 and MXFP8 format as the original.
| Developed by | OpenMed |
|---|---|
| Base model | Inkling 2 Mini by Thinking Machines Lab (Apache-2.0) |
| Task | Compare the observed event rates of two trial groups from their counts, with the arithmetic shown |
| Input | An English prompt with the outcome (serious adverse events or deaths), two groups' affected and at-risk counts, and the question (higher or lower rate) |
| Output | One line: A=6/80=7.5%; B=8/160=5.0%; answer=A (group A, B or tie) |
| Evaluated on | 120 trials from 61 sponsors, none of them in training; complete worked answer 98.3% (original Inkling 2 Mini 30.8%) |
| Training | 600 trial registrations from 255 sponsors on ClinicalTrials.gov, real reported counts with exact arithmetic answers; 300 optimizer steps on the answer tokens |
| 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, clinical trials 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, 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-MedicalTrialReasoning-v1"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForMultimodalLM.from_pretrained(
repo, dtype=torch.bfloat16, device_map={"": "cuda"},
attn_implementation="eager", experts_implementation="eager",
).eval()
prompt = (
"Compare observed participant rates in a clinical trial. Divide affected by at risk for each group. "
"Round percentages to one decimal; choose A, B, or tie using unrounded rates. "
"Reply in this format: A=1/8=12.5%; B=1/5=20.0%; answer=B.\n"
"Outcome: participants with at least one serious adverse event. Group A: 6 affected of 80 at risk. "
"Group B: 8 affected of 160 at risk. Which group has the higher rate?\nResponse: "
)
inputs = tok(prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, do_sample=False, max_new_tokens=56,
pad_token_id=tok.pad_token_id or tok.eos_token_id)
print(tok.decode(out[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
For this example the exact arithmetic is 6/80 = 7.5% and 8/160 = 5.0%, so group A has the higher observed rate.
The settings
- Use this prompt. The instruction, the reply format, the
Outcome:line, the twoGrouplines, the question andResponse:are the ones used in training and evaluation. Change the counts, the outcome (serious adverse events or deaths) and higher or lower. - Greedy decoding (
do_sample=False) and 56 new tokens, as in the evaluation. The answer is one line, so it is fast. - Ties are decided on the exact fractions, not on the rounded percentages, so 3/10 and 30/100 are a tie.
- Memory: the weights are decoded to BF16 on load; the reference run used one GPU with 96 GB of memory.
Evaluation
120 trials from 61 sponsors on ClinicalTrials.gov, none of them in training, each with two reported groups and complete counts for serious adverse events (96 trials) or deaths (24). Twenty of the questions have exactly equal rates. The model and the scoring were fixed before any development answer was read. Both models answered greedily, from pinned weights loaded offline, with the same 56-token budget, which fits the one-line answer. A complete worked answer needs both source fractions, both correctly rounded percentages and the right group or tie.
| Measure (120 trials) | OpenMed Inkling 2 Mini Medical Trial Reasoning v1 | Before OpenMed fine-tuning: Inkling 2 Mini |
|---|---|---|
| Complete worked answer | 118 (98.3%) | 37 (30.8%) |
| Right group or tie | 120 (100%) | 42 (35.0%) |
| Both source fractions | 120 (100%) | 45 (37.5%) |
| Both percentages, rounded correctly | 118 (98.3%) | 46 (38.3%) |
How the original answers. In every one of the 120 answers, the original Inkling 2 Mini first copies the example line from the prompt (A=1/8=12.5%; B=1/5=20.0%; answer=B) and then starts its own answer, often with long decimals. The numbers above set that copied line aside and score the rest; we added that step after reading its answers, so the original is not marked down for echoing the example. When the original does reach a labelled answer, it names the right group or tie in 42 of its 43. Most of its misses (77 of 120) never reach a labelled answer inside the short budget. Scored as written, with the copied line counted as its answer, the original gets 18 complete answers (15.0%).
What the fine-tuning adds. The original model already knows how to compare two rates. In a separate check, both models were shown a correct worked answer and a wrong one and asked to pick, in both orders: the original picked the correct one on 82 of 120 trials and this model on 81. What the fine-tune adds is the answer itself, once, in the exact one-line format, every time: complete on 118 of 120, the right group or tie on all 120, and the same decision on all 120 when the two groups swap places. That makes it easy to check by eye and easy to parse in a pipeline.
By question type, the fine-tune gives a complete answer on 95 of 96 serious adverse event questions and 23 of 24 death questions, and on all 20 questions where the two rates are equal.
The fine-tune's numbers come from the evaluation run fixed before any answer was read; the original's come from a re-run of the pinned original weights on the same 120 prompts with the same settings (its scored-as-written result, 17 complete, matches the evaluation's 18 within one answer).
What it is for
It turns two groups' counts into a worked rate comparison you can check line by line, for example when reading adverse event tables, building evidence summaries or teaching how trial rates are compared. It reports observed rates only: these do not establish a treatment effect and do not support a decision about an individual patient. Check the arithmetic against the source table, as with any generated number. Evaluated on English prompts about serious adverse events and deaths.
Built on
OpenMed fine-tuned this model from Inkling 2 Mini by Thinking Machines Lab (Apache-2.0), using the fixed-loop release. The counts are sponsor-reported aggregate results from ClinicalTrials.gov, U.S. National Library of Medicine (accessed 23 November 2026, terms); OpenMed built the anonymous two-group questions and exact arithmetic answers from them, with no participant, sponsor or treatment names in the inputs. See NOTICE.txt. Thank you to Thinking Machines Lab for releasing Inkling 2 Mini openly.
This model is released under Apache-2.0. No registry records or training data 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}
}
OpenMed · Hugging Face · GitHub · PyPI · X
- Downloads last month
- 14
Model tree for OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1
Base model
thinkingmachines/Inkling-2-MiniPaper for OpenMed/Inkling2-Mini-MedicalTrialReasoning-v1
Evaluation results
- Complete worked answer on ClinicalTrials.gov serious adverse events and deaths (120 trials, 61 sponsors, not in training)self-reported98.330
- Correct group or tie on ClinicalTrials.gov serious adverse events and deaths (120 trials, 61 sponsors, not in training)self-reported100.000
- Same decision with the groups swapped on ClinicalTrials.gov serious adverse events and deaths (120 trials, 61 sponsors, not in training)self-reported100.000