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
Model card: model summary, evaluation, quickstart, details
Browse files
README.md
CHANGED
|
@@ -7,22 +7,62 @@ tags:
|
|
| 7 |
- medical
|
| 8 |
- clinical
|
| 9 |
- decision-model
|
| 10 |
-
-
|
| 11 |
- systemone
|
| 12 |
-
- lora
|
| 13 |
language:
|
| 14 |
- en
|
| 15 |
---
|
| 16 |
|
| 17 |
# MedDecider-9B
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
| --- | --- | --- | --- | --- |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
Install with `pip install "transformers>=5.18" peft torch flash-linear-attention`. Each call returns a probability for every option. The numbers below are this model's own outputs from our evaluation run (both option orders averaged, temperatures from `meddecider_config.json`), rounded to three decimals. The clinical notes are synthetic test notes from our suite; the last question is from MMLU-Pro (MIT licence).
|
| 28 |
|
|
@@ -122,93 +162,57 @@ mj.decide(None, "Most surveillance systems use which of the following study desi
|
|
| 122 |
# correct: Serial cross-sectional
|
| 123 |
```
|
| 124 |
|
| 125 |
-
##
|
| 126 |
-
|
| 127 |
-
A medical decision model in the Jev style. It reads a state (clinical note, trial record, any JSON) and a question with
|
| 128 |
-
2–10 options, and returns a calibrated probability for every option from the logits of the option letters. There is no
|
| 129 |
-
text generation: two forward passes, one per option order, averaged.
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
| Memory (bf16) | about 63 GB | about 56 GB |
|
| 136 |
-
|
| 137 |
-
MedDecider Duo averages the two models' probabilities. It needs both in memory (about 120 GB, e.g. one H200) and twice the compute.
|
| 138 |
-
|
| 139 |
-
## Use
|
| 140 |
-
|
| 141 |
-
```
|
| 142 |
-
pip install "transformers>=5.18" peft torch flash-linear-attention
|
| 143 |
-
python meddecider_infer.py --adapter ./meddecider-31b-adapter
|
| 144 |
-
python meddecider_infer.py --adapter ./meddecider-31b-adapter --adapter2 ./meddecider-27b-adapter # Duo
|
| 145 |
-
```
|
| 146 |
-
|
| 147 |
-
```python
|
| 148 |
-
from meddecider_infer import MedDecider
|
| 149 |
-
mj = MedDecider("./meddecider-31b-adapter") # base model is read from meddecider_config.json
|
| 150 |
-
mj.decide(note_text, "Is the patient on an anticoagulant?", ["Yes", "No"], qtype="noul")
|
| 151 |
-
mj.decide({"primary_trial": {...}}, "Classify the statement ...", ["Entailment: ...", "Contradiction: ..."])
|
| 152 |
-
```
|
| 153 |
-
|
| 154 |
-
`qtype` selects the temperature: `choice` (pick one option), `noul` (yes/no), `score` (ordered levels).
|
| 155 |
-
|
| 156 |
-
## Results (test halves; nothing here was used for training or model selection)
|
| 157 |
-
|
| 158 |
-
| Model | In-distribution | TrialGPT criteria | Unseen exam datasets | Unseen problem types | Robustness | Follows injected instruction | NLI4CT macro-F1 |
|
| 159 |
-
| --- | --- | --- | --- | --- | --- | --- | --- |
|
| 160 |
-
| **MedDecider-31B** | 0.892 | 0.869 | **0.702** | 0.884 | 0.888 | 2.7% | **0.843** |
|
| 161 |
-
| MedDecider Duo (31B + 27B) | **0.896** | **0.876** | 0.696 | **0.895** | **0.898** | 3.0% | **0.845** |
|
| 162 |
-
| MedDecider-27B | 0.881 | 0.854 | 0.644 | 0.897 | 0.883 | 3.0% | 0.827 |
|
| 163 |
-
| MedDecider-9B | 0.861 | 0.857 | 0.575 | 0.893 | 0.829 | 2.0% | 0.799 |
|
| 164 |
-
| MedDecider-4B | 0.847 | 0.854 | 0.547 | 0.878 | 0.797 | 5.4% | 0.776 |
|
| 165 |
-
| Qwen3.8-27B, untrained | 0.814 | 0.734 | 0.604 | 0.892 | 0.681 | 35% | 0.792 |
|
| 166 |
-
| Gemma 4 31B, untrained | 0.833 | 0.612 | 0.680 | 0.882 | 0.539 | 63% | 0.830 |
|
| 167 |
-
| Jev 1.13 (published) | | | | | | | 0.841 |
|
| 168 |
-
|
| 169 |
-
- **Unseen exam datasets:** MedXpertQA, MMLU-Pro health, MedBullets, MedExQA, MedConcepts, and the Polish PES exam.
|
| 170 |
-
- **Unseen problem types:** adverse drug events, PubMed RCT sentence roles, Symptom2Disease, medical question pairs, health advice and MedQuAD intent.
|
| 171 |
-
- **Robustness:**
|
| 172 |
-
- "none of the above" substitution;
|
| 173 |
-
- 8-option MedQA;
|
| 174 |
-
- instructions injected into notes and trial records.
|
| 175 |
-
- **NLI4CT:** the Jev Decision Index clinical benchmark, 5,500 test statements. The rows are rebuilt byte-identical to the index's file. The state is passed as `json.dumps` of the request. Score is macro-F1 over Entailment and Contradiction.
|
| 176 |
-
- MedDecider-31B: 95% CI 0.833–0.853.
|
| 177 |
-
- Duo: 95% CI 0.836–0.855.
|
| 178 |
-
- Jev's row-level answers are not public, so the comparison with Jev has no paired test.
|
| 179 |
-
|
| 180 |
-
**Calibration:** with the shipped temperatures, MedDecider-31B has an expected calibration error of 0.029 on the 12 unseen datasets. It is at least 90% confident on 55% of those items and right on 94% of them.
|
| 181 |
|
| 182 |
## Training
|
| 183 |
|
| 184 |
-
One epoch over 35,800
|
|
|
|
| 185 |
- **Medical exams:** MedQA and MedMCQA.
|
| 186 |
-
- **
|
| 187 |
-
- **
|
| 188 |
-
- **
|
| 189 |
-
- **Evidence and
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
##
|
| 211 |
-
|
| 212 |
-
-
|
| 213 |
-
-
|
| 214 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
- medical
|
| 8 |
- clinical
|
| 9 |
- decision-model
|
| 10 |
+
- calibrated
|
| 11 |
- systemone
|
|
|
|
| 12 |
language:
|
| 13 |
- en
|
| 14 |
---
|
| 15 |
|
| 16 |
# MedDecider-9B
|
| 17 |
|
| 18 |
+
MedDecider-9B brings the family's training to a model that runs on a single mid-range GPU. Given a clinical state (a note, 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 built for high-volume clinical decision steps: medication and diagnosis checks in notes, trial eligibility screening, evidence classification and medical knowledge questions.
|
| 19 |
|
| 20 |
+
## Model summary
|
| 21 |
+
|
| 22 |
+
| | |
|
| 23 |
+
| --- | --- |
|
| 24 |
+
| Developer | thelion.ai |
|
| 25 |
+
| Model type | Medical decision model: choice, yes/no and ordered-scale questions |
|
| 26 |
+
| Parameters | 9.7B |
|
| 27 |
+
| Fine-tuning data | 35,800 decisions, 7.5M tokens, one epoch |
|
| 28 |
+
| Fine-tuning compute | 35 minutes on one NVIDIA H100 |
|
| 29 |
+
| Output | A probability for every answer option, calibrated per question type |
|
| 30 |
+
| Languages | English (training); also evaluated on Polish medical exams |
|
| 31 |
+
| Release | October 2026 |
|
| 32 |
+
| License | CC BY-NC 4.0 |
|
| 33 |
+
|
| 34 |
+
## Highlights
|
| 35 |
+
|
| 36 |
+
- **Passes every session of the Polish final medical exam (LEK), 2008–2026:** 77.9% over 4,722 questions, and 78.7% on the 286 new questions of the 2025–2026 sessions, 7.4 points above the average examinee (71.3%).
|
| 37 |
+
- **More robust than Jev 1.13:** 82.9% vs 79.5% on robustness tests, and it follows an instruction hidden in a note 2.0% of the time (Jev 1.13: 13.7%).
|
| 38 |
+
- **Ahead of Clef-flash 9B** on robustness (82.9% vs 70.3%) and NLI4CT (0.799 vs 0.786), and level on unseen exams (57.5% vs 56.5%).
|
| 39 |
+
|
| 40 |
+
## Evaluation
|
| 41 |
+
|
| 42 |
+
All models answer the same 9,849 held-out test items in the same request format. Each competitor runs through its authors' own inference code and Jev through TypeSafe's API; on NLI4CT this setup reproduces their published scores to within 0.003. Unseen medical exams: MedXpertQA, MMLU-Pro health, Medbullets, MedExQA, MedConceptsQA and Polish specialty exams (PES). Unseen clinical problem types: adverse drug effects, PubMed RCT sentence roles, symptom to diagnosis, medical question pairs, health-advice strength and MedQuAD question types. Robustness: "none of the above" substitution, 8-option MedQA and instructions planted in notes and trial records. None of these datasets was used in training.
|
| 43 |
+
|
| 44 |
+
| Benchmark | MedDecider-9B | Jev 1.13 | Clef-flash 9B | JPT-9B |
|
| 45 |
| --- | --- | --- | --- | --- |
|
| 46 |
+
| Unseen medical exams (6 datasets) | 57.5% | **65.4%** | 56.5% | 55.1% |
|
| 47 |
+
| Unseen clinical problem types (6 datasets) | **89.3%** | 87.7% | 88.1% | 88.3% |
|
| 48 |
+
| Robustness (4 tests) | **82.9%** | 79.5% | 70.3% | 74.2% |
|
| 49 |
+
| Follows a planted instruction (lower is better) | **2.0%** | 13.7% | 12.0% | 10.9% |
|
| 50 |
+
| NLI4CT macro-F1 | 0.799 | **0.841** | 0.786 | 0.790 |
|
| 51 |
+
| TrialGPT trial criteria ¹ | **85.7%** | 68.3% | 67.5% | 67.7% |
|
| 52 |
+
| In-distribution test halves ¹ | **86.1%** | 84.8% | 80.1% | 79.5% |
|
| 53 |
+
|
| 54 |
+
¹ Test halves of datasets whose training halves are in MedDecider's training data, so these rows favour MedDecider. NLI4CT for the other models is their published score; for MedDecider it is our run in the Decision Index format. No NLI4CT data of any split was used in training. Best result in each row in bold.
|
| 55 |
|
| 56 |
+
**Polish final medical exam (LEK).** 26 sessions from 2008 to 2026, pass mark 56%:
|
| 57 |
+
|
| 58 |
+
| | MedDecider-9B | Average examinee |
|
| 59 |
+
| --- | --- | --- |
|
| 60 |
+
| All 26 sessions (4,722 questions) | 77.9%, every session passed | |
|
| 61 |
+
| 286 new questions from the 2025–2026 sessions ² | 78.7% | 71.3% |
|
| 62 |
+
|
| 63 |
+
² Questions that do not appear in the public question bank of earlier sessions,. Examinee figures are from the exam board's per-question statistics; questions with images were excluded.
|
| 64 |
+
|
| 65 |
+
## Quickstart
|
| 66 |
|
| 67 |
Install with `pip install "transformers>=5.18" peft torch flash-linear-attention`. Each call returns a probability for every option. The numbers below are this model's own outputs from our evaluation run (both option orders averaged, temperatures from `meddecider_config.json`), rounded to three decimals. The clinical notes are synthetic test notes from our suite; the last question is from MMLU-Pro (MIT licence).
|
| 68 |
|
|
|
|
| 162 |
# correct: Serial cross-sectional
|
| 163 |
```
|
| 164 |
|
| 165 |
+
## Model details
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
+
- **Architecture:** a LoRA adapter (rank 32, all linear layers, 173 MB) on `Qwen/Qwen3.5-9B`, merged at load time. `meddecider_infer.py` downloads the base model named in `meddecider_config.json`.
|
| 168 |
+
- **Readout:** next-token logits of the option letters after a chat prompt with reasoning turned off. Each question is scored in both option orders and the two probability vectors are averaged.
|
| 169 |
+
- **Calibration:** one temperature per question type (choice 1.43, yes/no 1.0, score 1.0), fitted on in-distribution calibration data only. Refit on a few hundred labelled local examples before using the probabilities as risks.
|
| 170 |
+
- **Input:** any string or JSON state; JSON is serialised with `json.dumps(state, ensure_ascii=False)`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
## Training
|
| 173 |
|
| 174 |
+
One epoch over 35,800 decisions:
|
| 175 |
+
|
| 176 |
- **Medical exams:** MedQA and MedMCQA.
|
| 177 |
+
- **Differential diagnosis:** DDXPlus.
|
| 178 |
+
- **Clinical notes generated by code**, with minimal-pair twins: medication status, negated and historical diagnoses, laboratory values, family history, timing.
|
| 179 |
+
- **Clinical-trial eligibility criteria**, including "not enough information" cases.
|
| 180 |
+
- **Evidence and inference:** Evidence Inference 2.0, BioNLI, VitaminC, EQUATE, MultiNLI.
|
| 181 |
+
- **6,000 synthetic minimal pairs about invented clinical trials:** results, adverse events, eligibility and dosing, with labels computed by code.
|
| 182 |
+
- **Robustness items:** "none of the above" options, extra distractors, instructions planted in the input.
|
| 183 |
+
- **General decision replay**, so that non-medical decisions are not forgotten.
|
| 184 |
+
|
| 185 |
+
A share of states is rendered as JSON, so the model reads structured records as well as free text.
|
| 186 |
+
|
| 187 |
+
Every item is shown with its options shuffled, and the loss is cross-entropy on the option-letter logits (learning rate 1e-4, 3% warm-up, cosine decay to 10%). Model selection used only calibration halves of our own evaluation suite. No NLI4CT data of any split was used.
|
| 188 |
+
|
| 189 |
+
## The MedDecider family
|
| 190 |
+
|
| 191 |
+
| Model | Parameters | Unseen medical exams | Unseen clinical problem types | Robustness | NLI4CT macro-F1 | LEK, 4,722 questions |
|
| 192 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 193 |
+
| MedDecider Duo (31B + 27B) | 59.1B | 69.6% | 89.5% | 89.8% | 0.845 | 89.2% |
|
| 194 |
+
| MedDecider-31B | 31.3B | 70.2% | 88.4% | 88.8% | 0.843 | 87.7% |
|
| 195 |
+
| MedDecider-27B | 27.8B | 64.4% | 89.7% | 88.3% | 0.827 | 87.1% |
|
| 196 |
+
| MedDecider-9B | 9.7B | 57.5% | 89.3% | 82.9% | 0.799 | 77.9% |
|
| 197 |
+
| MedDecider-4B | 4.7B | 54.7% | 87.8% | 79.7% | 0.776 | not tested |
|
| 198 |
+
|
| 199 |
+
MedDecider Duo averages the probabilities of MedDecider-31B and MedDecider-27B (load both with `MedDeciderDuo`).
|
| 200 |
+
|
| 201 |
+
## Intended use and limitations
|
| 202 |
+
|
| 203 |
+
- MedDecider is a research model, not a medical device. Its outputs must not drive patient care without validation on local data and clinical oversight.
|
| 204 |
+
- It was trained on English data. Polish results come from evaluation only.
|
| 205 |
+
- Knowledge-heavy questions remain the hardest case: accuracy on unseen exam datasets ranges from 55% to 70% across the family.
|
| 206 |
+
- The clinical notes used for training and for the quickstart are synthetic. Performance on real records must be measured before deployment.
|
| 207 |
+
- Licence: CC BY-NC 4.0 (non-commercial). The base model keeps its own licence.
|
| 208 |
+
|
| 209 |
+
## Citation
|
| 210 |
+
|
| 211 |
+
```bibtex
|
| 212 |
+
@misc{meddecider2026,
|
| 213 |
+
title = {MedDecider: calibrated medical decision models},
|
| 214 |
+
author = {{thelion.ai}},
|
| 215 |
+
year = {2026},
|
| 216 |
+
url = {https://huggingface.co/lion-ai/MedDecider-9B}
|
| 217 |
+
}
|
| 218 |
+
```
|