MedGate-4B

MedGate-4B is a Jev-style, non-autoregressive System 1 clinical decision and selective abstention gatekeeper.

In a single forward pass with zero output token generation, MedGate-4B scores diagnostic candidates, evaluates clinical evidence sufficiency (evidence_sufficient), and triggers human or System 2 escalation (needs_human_review) with calibrated probability estimates (ECE = 0.0098 in-domain).


Out-of-Distribution (OOD) Training and Evaluation Integrity

To ensure strict zero-shot evaluation integrity, zero rows from PubMedQA or MedQA-USMLE were included in training or calibration.

Stage 2 aligns the Stage 1 checkpoint (salihfurkaan/MedDecision-System1-3B) across three leak-free sources:

  1. Clinical Vignettes and Abstention (salihfurkaan/meddecision-clinical-case-corpus): Selective abstention (needs_human_review, evidence_sufficient), triage urgency, and differential diagnosis selection.
  2. Clinical Natural Language Inference (MedNLI): Three-way clinical premise verification (entailment, contradiction, neutral) without biomedical abstract leakage.
  3. Medical Board Exam QA (MedMCQA): Cross-specialty biomedical reasoning across 21 clinical domains, deduplicated against all held-out test sets.

Benchmark Results

Benchmark Split / Regime Stage 1 (MedDecision-System1-3B) MedGate-4B (Stage 2 OOD-Clean)
meddecision-clinical-case-corpus In-Domain Test (n=984) 94.46% (ECE: 0.0152) 93.89% (Record: 89.23%, ECE: 0.0098)
PubMedQA (Official Test) Zero-Shot OOD (n=500) 71.20% (Macro-F1: 54.27%) 75.20% (Macro-F1: 55.29%)
MedQA-USMLE (4-Options) Zero-Shot OOD (n=1,273) Not evaluated 69.91% (ECE: 0.0266)

Note: On the official 500-question PubMedQA test split, MedGate-4B surpasses GPT-6 Luna (74.40%) completely zero-shot, with 0 PubMedQA training examples.


Quickstart

from unsloth import FastDecisionModel

model, tokenizer = FastDecisionModel.from_pretrained(
    model_name="salihfurkaan/MedGate-4B",
    max_seq_length=2048,
    load_in_4bit=True,
)
FastDecisionModel.for_inference(model)

clinical_vignette = (
    "A 64-year-old man with a 40-pack-year smoking history presents with progressive dysphagia "
    "to solids over 3 months and 8 kg unintentional weight loss. Physical exam is unremarkable. "
    "Upper endoscopy is scheduled."
)

rubric = {
    "evidence_sufficient": {
        "type": "noul",
        "instructions": "Is the available clinical text sufficient to confirm a definitive diagnosis?",
    },
    "needs_human_review": {
        "type": "noul",
        "instructions": "Should this case be escalated for clinician or System 2 review before final diagnosis?",
    },
    "working_diagnosis": {
        "type": "choice",
        "instructions": "What is the primary suspected condition to rule out?",
        "criteria": {
            "esophageal_cancer": "Esophageal carcinoma",
            "gerd": "Uncomplicated gastroesophageal reflux disease",
            "achalasia": "Primary esophageal achalasia",
        },
    },
}

predictions = FastDecisionModel.predict(model, tokenizer, clinical_vignette, rubric)
for name, out in predictions.items():
    probs = {k: round(v, 3) for k, v in out["probabilities"].items()}
    print(f"{name}: answer={out['answer']} | probs={probs}")

Dual-Process Cascade with System 2 (Avicenna-8B-Base)

MedGate-4B is built to serve as the sub-100ms front-end gatekeeper in front of salihfurkaan/Avicenna-8B-Base. Cases where evidence_sufficient == True, needs_human_review == False, and decision confidence exceeds threshold (>= 0.85) resolve immediately in System 1, while uncertain or incomplete presentations escalate to Avicenna-8B-Base for multi-step System 2 clinical reasoning.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from unsloth import FastDecisionModel

sys1_model, sys1_tok = FastDecisionModel.from_pretrained(
    model_name="salihfurkaan/MedGate-4B",
    max_seq_length=2048,
    load_in_4bit=True,
)
FastDecisionModel.for_inference(sys1_model)

sys2_tok = AutoTokenizer.from_pretrained("salihfurkaan/Avicenna-8B-Base")
sys2_model = AutoModelForCausalLM.from_pretrained(
    "salihfurkaan/Avicenna-8B-Base",
    torch_dtype=torch.float16,
    device_map="auto",
)

def route_clinical_case(vignette: str, rubric: dict, confidence_threshold: float = 0.85):
    sys1_out = FastDecisionModel.predict(sys1_model, sys1_tok, vignette, rubric)

    needs_review = sys1_out["needs_human_review"]["answer"]
    sufficient = sys1_out["evidence_sufficient"]["answer"]
    dx_conf = max(sys1_out["working_diagnosis"]["probabilities"].values())

    if sufficient and not needs_review and dx_conf >= confidence_threshold:
        return {"route": "SYSTEM_1_MEDGATE_FAST", "decision": sys1_out}

    prompt = (
        f"Clinical Vignette:\n{vignette}\n\n"
        f"System 1 Gate Flag: Evidence Sufficient={sufficient}, "
        f"Working Diagnosis={sys1_out['working_diagnosis']['answer']} ({dx_conf:.2f}).\n"
        "Perform a step-by-step clinical differential analysis and recommend next diagnostic steps:"
    )
    inputs = sys2_tok.apply_chat_template(
        [{"role": "user", "content": prompt}],
        add_generation_prompt=True,
        tokenize=True,
        return_dict=True,
        return_tensors="pt",
    ).to(sys2_model.device)

    with torch.inference_mode():
        outputs = sys2_model.generate(**inputs, max_new_tokens=512, temperature=0.3)

    reasoning = sys2_tok.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
    return {
        "route": "SYSTEM_2_AVICENNA_ESCALATION",
        "system1_gate": sys1_out,
        "system2_reasoning": reasoning,
    }

Limitations and Safety Disclaimer

  • Research Use Only: This model is an academic research artifact for studying calibrated clinical decision routing and selective abstention. It is not a certified medical device and must never be used for autonomous clinical diagnosis or patient care.
  • Bounded Rubric Dependency: Because FastDecisionModel scores candidate options supplied at inference time, diagnostic accuracy depends on including relevant differentials in the input criteria dictionary. Always pair with human clinician oversight or a System 2 reasoning model when needs_human_review evaluates to True.

Citation

@misc{erik2026medgate4b,
  author       = {Salih Furkan Erik},
  title        = {MedGate-4B: Calibrated Jev-Style Discriminative System 1 Gatekeeper for Clinical Decision Support},
  year         = {2026},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/salihfurkaan/MedGate-4B}}
}
Downloads last month
51
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train salihfurkaan/MedGate-4B

Collection including salihfurkaan/MedGate-4B

Evaluation results

  • Per-Decision Accuracy on salihfurkaan/meddecision-clinical-case-corpus (typed_decisions, test)
    test set self-reported
    0.939
  • Full-Record Exact Match Accuracy on salihfurkaan/meddecision-clinical-case-corpus (typed_decisions, test)
    test set self-reported
    0.892
  • Expected Calibration Error (ECE) on salihfurkaan/meddecision-clinical-case-corpus (typed_decisions, test)
    test set self-reported
    0.010
  • Top-1 Accuracy (Zero-Shot OOD) on PubMedQA Official Test Split (n=500)
    test set self-reported
    0.752
  • Macro-F1 on PubMedQA Official Test Split (n=500)
    test set self-reported
    0.553
  • Top-1 Accuracy (Zero-Shot OOD) on MedQA-USMLE 4-Options Test Split (n=1,273)
    test set self-reported
    0.699
  • Expected Calibration Error (ECE) on MedQA-USMLE 4-Options Test Split (n=1,273)
    test set self-reported
    0.027