Instructions to use salihfurkaan/MedGate-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use salihfurkaan/MedGate-9B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "salihfurkaan/MedGate-9B") - jev-style
How to use salihfurkaan/MedGate-9B with jev-style:
pip install "jev-style[torch]"
from jev_style import JevStyle, noul, choice js = JevStyle.from_pretrained("salihfurkaan/MedGate-9B") out = js.decide("I was charged twice for one order.", { "billing": noul("This message is about billing."), "team": choice("Which team should handle it?", ["billing", "shipping", "tech"]), }) print(out["answers"]["team"]["choice"]) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
MedGate-9B
MedGate-9B is a 9-billion-parameter, Jev-style non-autoregressive System 1 clinical decision and selective abstention gatekeeper built on unsloth/Qwen3.5-9B using Unsloth's FastDecisionModel architecture (choice, noul, and score primitives).
In a single forward pass with zero generated output tokens (total_output_tokens = 0), MedGate-9B evaluates diagnostic hypotheses, verifies biomedical claims, checks clinical evidence sufficiency (evidence_sufficient), and flags uncertain cases for clinician or System 2 escalation (needs_human_review).
Key Highlights & Scaling Findings
- Strongest Zero-Shot MedQA-USMLE Generalization (
71.80%): Scaling fromsalihfurkaan/MedGate-4B(69.91%) to MedGate-9B (71.80%) yields a +1.89% zero-shot gain on the 1,273-question 4-option USMLE test split without any USMLE training rows. - Improved Minority-Class & Calibration Balance on PubMedQA (
57.93%Macro-F1,0.0918ECE): Incorporating biomedical abstract claim verification (SciFact) alongside context-first causal prompt ordering doublesmaybeF1 (0.085to0.170), liftsnoF1 to0.752, and cuts zero-shot PubMedQA Expected Calibration Error by 30.2% (0.1316to0.0918). - Strict Out-of-Distribution (OOD) Integrity: Zero rows from
PubMedQAorMedQA-USMLEwere included in training, validation, or temperature calibration. All training questions were MD5-deduplicated against held-out test sets.
Training Mixture & Alignment Architecture
MedGate-9B was trained across two progressive convergence epochs in native context-first, question-last causal layout (Biomedical Study Abstract followed by Research Question) using 4-bit QLoRA (r=16, lora_alpha=16) and temperature-scaled decision head calibration:
- Clinical Vignettes & Selective Abstention (
salihfurkaan/meddecision-clinical-case-corpus): Diagnostic selection, triage urgency, evidence sufficiency (noul), and human-review gating. - Biomedical Abstract Claim Verification (
allenai/scifact): Scientific claim verification (SUPPORT,CONTRADICT,NOINFO) across real biomedical paper abstracts, teaching the decision head to recognize inconclusive (maybe) statistical findings without touching PubMedQA. - Medical Board Exam QA (
openlifescienceai/medmcqa): Multi-specialty biomedical recall across 21 clinical subjects, deduplicated against all held-out evaluation splits.
Benchmark Results
Cross-Model Comparison (4B vs. 9B OOD-Clean Scaling)
| Benchmark | Evaluation Regime | MedGate-4B |
MedGate-9B |
|---|---|---|---|
meddecision-clinical-case-corpus |
In-Domain Test (n=984) |
93.89% (ECE: 0.0098) |
93.46% (Record: 89.02%, ECE: 0.0216) |
MedQA-USMLE (4-Options) |
Zero-Shot OOD (n=1,273) |
69.91% |
71.80% (+1.89%) |
PubMedQA (Official Test) |
Zero-Shot OOD (n=500) |
75.20% (Macro-F1: 55.29%) |
72.80% (Macro-F1: 57.93%, ECE: 0.0918) |
Detailed Zero-Shot PubMedQA Per-Class Breakdown (n=500)
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
yes |
0.765 |
0.873 |
0.816 |
276 |
no |
0.851 |
0.675 |
0.752 |
169 |
maybe |
0.176 |
0.164 |
0.170 |
55 |
| Macro Avg | 0.597 |
0.570 |
0.579 |
500 |
| Weighted Avg / Accuracy | 0.729 |
0.728 |
0.723 |
500 |
Quickstart
Always format inputs in context-first, question-last order so causal attention processes the full clinical vignette or abstract before scoring the final decision tokens:
from unsloth import FastDecisionModel
model, tokenizer = FastDecisionModel.from_pretrained(
model_name="salihfurkaan/MedGate-9B",
max_seq_length=2048,
load_in_4bit=True,
)
FastDecisionModel.for_inference(model)
abstract_and_question = (
"Biomedical Study Abstract:\n"
"[OBJECTIVE] To evaluate whether adjunctive low-dose colchicine reduces recurrent cardiovascular events "
"within 30 days of acute myocardial infarction.\n"
"[RESULTS] Among 1,240 randomized patients, the primary composite endpoint occurred in 6.1% of the "
"colchicine group versus 6.4% of the placebo group (HR 0.95; 95% CI 0.62-1.46; p=0.81).\n"
"[CONCLUSIONS] Short-term low-dose colchicine did not significantly reduce 30-day recurrent ischemic events.\n\n"
"Research Question: Does early low-dose colchicine significantly reduce 30-day recurrent cardiovascular events after acute MI?"
)
rubric = {
"decision": {
"type": "choice",
"instructions": "Evaluate the statistical findings in [RESULTS] and [CONCLUSIONS] to answer the research question.",
"criteria": {
"yes": "Yes — statistically significant findings or primary outcomes directly support an affirmative answer.",
"no": "No — findings show no significant effect, negative outcomes, or directly refute the hypothesis.",
"maybe": "Maybe — results are inconclusive, mixed, non-significant, or authors state further studies are required.",
},
}
}
result = FastDecisionModel.predict(model, tokenizer, abstract_and_question, rubric)["decision"]
probs = {k: round(v, 3) for k, v in result["probabilities"].items()}
print(f"Answer: {result['answer']} | Probabilities: {probs}")
Dual-Process Integration with System 2 (Avicenna-8B-Base)
MedGate-9B is designed to operate as a single-pass System 1 front-end gatekeeper paired with salihfurkaan/Avicenna-8B-Base for deliberate System 2 clinical reasoning:
Fast Path (System 1): High-confidence, evidence-sufficient cases (needs_human_review == False and max_prob >= 0.75) resolve immediately in a single forward pass with calibrated probabilities.
Escalation Path (System 2): Borderline, underpowered, or incomplete cases route to Avicenna-8B-Base for step-by-step chain-of-thought differential diagnosis and evidence synthesis.
Citation
@misc{erik2026medgate9b,
author = {Salih Furkan Erik},
title = {MedGate-9B: Calibrated 9B Jev-Style Discriminative System 1 Gatekeeper for Biomedical and Clinical Decision Support},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{[https://huggingface.co/salihfurkaan/MedGate-9B](https://huggingface.co/salihfurkaan/MedGate-9B)}}
}
- Downloads last month
- 17
Model tree for salihfurkaan/MedGate-9B
Datasets used to train salihfurkaan/MedGate-9B
allenai/scifact
salihfurkaan/meddecision-clinical-case-corpus
Collection including salihfurkaan/MedGate-9B
Evaluation results
- Per-Decision Accuracy on salihfurkaan/meddecision-clinical-case-corpus (typed_decisions, test)test set self-reported0.935
- Full-Record Exact Match Accuracy on salihfurkaan/meddecision-clinical-case-corpus (typed_decisions, test)test set self-reported0.890
- Expected Calibration Error (ECE) on salihfurkaan/meddecision-clinical-case-corpus (typed_decisions, test)test set self-reported0.022
- Top-1 Accuracy (Zero-Shot OOD) on PubMedQA Official Test Split (n=500)test set self-reported0.728
- Macro-F1 on PubMedQA Official Test Split (n=500)test set self-reported0.579
- Expected Calibration Error (ECE) on PubMedQA Official Test Split (n=500)test set self-reported0.092
- Top-1 Accuracy (Zero-Shot OOD) on MedQA-USMLE 4-Options Test Split (n=1,273)test set self-reported0.718