Instructions to use lion-ai/MedDecider-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lion-ai/MedDecider-9B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "lion-ai/MedDecider-9B") - Notebooks
- Google Colab
- Kaggle
MedDecider-9B
MedDecider-9B is a medical decision model. Given a clinical state (a note, a patient record, a trial record or any JSON) and a question with 2 to 10 answer options, it returns a calibrated probability for every option in a single scoring pass, without generating text. It is a LoRA adapter on Qwen3.5-9B, built for high-volume decision steps: questions over long patient records, medication and diagnosis checks, trial eligibility and medical knowledge.
Highlights
- Reads real clinical records: 89.7% balanced accuracy over eight clinical-record benchmarks (LongHealth, EHRNoteQA and six MIMIC-based tasks), on records of up to 24,000 tokens.
- Calibrated probabilities: expected calibration error 0.008 on 12,697 held-out decisions; at a 5% error budget it can answer 57.7% of them automatically.
- Hard to steer: it follows an instruction planted in a note or trial record 2.9% of the time.
Evaluation
All numbers are on held-out test halves that were not used for training, model selection or calibration. The clinical-record benchmarks, the unseen exams and the unseen problem types were not in the training data; the MIMIC and LongHealth records were used for evaluation only.
| Benchmark (held-out test halves) | MedDecider-27B | MedDecider-9B |
|---|---|---|
| Clinical records, 8 datasets (balanced accuracy) | 90.7% | 89.7% |
| Unseen medical exams, 6 datasets | 65.3% | 58.7% |
| Unseen clinical problem types, 6 datasets | 90.1% | 89.3% |
| TrialGPT trial criteria | 85.0% | 83.9% |
| NLI4CT macro-F1 | 0.841 | 0.801 |
| Robustness, 4 tests | 86.8% | 80.5% |
| Follows a planted instruction (lower is better) | 3.7% | 2.9% |
| Pharmacy decisions | 86.9% | 83.9% |
| Calibration error, ECE (lower is better) | 0.017 | 0.008 |
Per-dataset results, calibration per dataset and the in-distribution test halves are in EVALUATION.md.
Quickstart
pip install "transformers>=5.18" peft torch flash-linear-attention causal-conv1d
import sys
from huggingface_hub import snapshot_download
path = snapshot_download("lion-ai/MedDecider-9B")
sys.path.insert(0, path)
from meddecider_infer import MedDecider
md = MedDecider(path) # downloads Qwen/Qwen3.5-9B and merges the adapter
note = """HPI: 53-year-old male seen in clinic for swelling of both ankles. He is otherwise stable.
Past medical history: Active problems include systemic lupus erythematosus. Active problems include HIV infection. Active problems include ulcerative colitis.
Medications: He is maintained on carvedilol at his usual dose.
Allergies: Reports a severe allergic reaction to empagliflozin.
Results: HbA1c = 11.5 %. LVEF = 34 %."""
md.decide(note, "Is the patient currently taking empagliflozin?", ["Yes", "No"], qtype="noul")
# Yes 0.031
# No 0.969
# correct: No
record = {"patient": {"age": 71, "sex": "F"}, "labs": [{"test": "eGFR", "value": 38, "unit": "mL/min/1.73 m2", "date": "2026-03-02"}, {"test": "eGFR", "value": 52, "unit": "mL/min/1.73 m2", "date": "2025-11-14"}], "medications": [{"name": "metformin", "status": "active"}, {"name": "apixaban", "status": "stopped", "stop_date": "2025-12-01"}]}
md.decide(record, "Did the eGFR fall below 45 mL/min/1.73 m2 in the most recent measurement?", ["Yes", "No"], qtype="noul")
# Yes 0.995
# No 0.005
# correct: Yes
Each call returns a probability for every option (both option orders averaged, calibrated). The outputs shown are this model's own, rounded to three decimals; the records are synthetic.
Model details
| Base model | Qwen/Qwen3.5-9B (9.7B parameters) |
| Adapter | LoRA rank 64 on all linear layers, 346 MB |
| Attention | the full-attention layers read the whole prompt in both directions; serve with Hugging Face transformers (meddecider_infer.py), not vLLM or SGLang |
| Readout | logits of the option letters after a chat prompt with reasoning off; both option orders scored and averaged |
| Calibration | one temperature (1.6) fitted on in-distribution calibration data |
| Input | any string or JSON state, evaluated up to 24,000 tokens; English |
Training
One epoch over 20,000 decisions (10.1M tokens), 58 minutes on one NVIDIA RTX PRO 6000 Blackwell:
- 16,000 audited general decision items: medical exams (MedQA, MedMCQA, PubMedQA), differential diagnosis (DDXPlus), code-generated clinical notes and trial criteria, pharmacy decisions, evidence and inference sets (Evidence Inference, BioNLI, VitaminC, EQUATE, MultiNLI), general decision sets (BoolQ, ARC, CommonsenseQA) and robustness items ("none of the above", extra distractors, instructions planted in the input).
- 2,000 synthetic patient records with several questions per long note.
- 2,000 synthetic coded clinical timelines (laboratory values, medications and diagnoses over time).
Options are shuffled every time an item is used, and the loss is cross-entropy on the option-letter logits (learning rate 1e-4, 3% warm-up, cosine decay to 10%). Model selection and calibration used only calibration halves of our evaluation suite. No NLI4CT data of any split and no MIMIC, PhysioNet or LongHealth data were used in training.
Limitations
- The probabilities are calibrated on in-distribution data. Refit the temperature on a few hundred labelled local examples before using them as risks.
- Accuracy varies by record task; the weakest of the eight clinical-record benchmarks is MIMIC-III phenotypes (82.3%). The MIMIC-IV timeline and definition questions share the format of our synthetic training timelines.
- On very long multi-document records it is weaker (LongHealth 85.7%); MedDecider-27B reaches 91.3% there.
- English only. The bidirectional attention pattern needs the provided inference code.
- A research model, not a medical device; it does not replace clinical judgement.
License
The adapter is released under CC BY-NC 4.0. Use of the base model is governed by its own licence.
- Downloads last month
- 84