Downloads · 30 days
0
rreinold/medgemma-4b-decision
medgemma-4b-decision is a text classification model from rreinold. Use it when you need a label for a piece of text. The card lists the license as other.
Downloads · 30 days
0
Access
Public
Updated Sep 21, 2026
Repo size
12.2 KB
Likes
0
Public
Click a slice to open those files.
.py34.5 KB · 63%
From the Hugging Face model README
⚠️ Experimental
Non-autoregressive clinical decision encoder built on google/medgemma-4b-it.
Instead of generating text, the model runs one forward pass and reads hidden states at
[DECISION] marker token positions. Lightweight classification heads (ChoiceHead, ScoreHead,
NoulHead) decode structured answers directly — no sampling, no generation loop.
State: {state}
Q[q1] {instructions} Options: {opt1} | {opt2} [DECISION]
Q[q2] {instructions} [DECISION]
↓ single forward pass
↓ hidden state at each [DECISION]
↓ per-question head
→ choice (softmax over options)
→ score (expected value over ordinal levels)
→ noul (sigmoid probability)
Decision primitives (compatible with OpenRouter /api/alpha/decisions schema):
| Type | Head | Output |
|---|---|---|
choice | ChoiceHead (linear → softmax) | top option + probabilities dict |
score | ScoreHead (linear → ordinal EV) | float in [0, n_levels) |
noul | NoulHead (linear → sigmoid) | probability float in [0, 1] |
Latency on Apple M-series MPS: ~74ms per call (all questions in one pass).
Requires access to google/medgemma-4b-it (accept Google HAI-DEF terms at that page first).
from medgemma_decision import MedGemmaDecision
model = MedGemmaDecision(device="mps") # or "cuda" / "cpu"
result = model.predict(
state="54yo male. Chest tightness x2h. BP 158/96. ECG: ST elevation II/III/aVF.",
questions={
"triage": {
"type": "choice",
"instructions": "Triage priority?",
"criteria": {
"emergent": "life-threatening, immediate intervention required",
"urgent": "serious but stable, seen within 30 min",
"semi": "non-urgent, can wait",
},
},
"admit": {
"type": "noul",
"instructions": "Does this patient require hospital admission?",
},
},
)
# result["answers"]["triage"]["choice"] → "emergent"
# result["answers"]["admit"]["noul"] → 0.73
noul_head.pt is a trained checkpoint (60-epoch Brier-loss fine-tune on the prior auth benchmark set, head-only — backbone frozen). Choice and score heads remain randomly initialized.
| Model | Accuracy (83 Qs) | Notes |
|---|---|---|
| laya (ModernBERT-large, zero-shot) | 75% | noul biased toward 0 |
| medgemma-4b-decision (untrained) | 75% | noul stuck at 0.5 |
medgemma-4b-decision (noul_head.pt) | 90% | 60 epochs, Brier loss; in-sample |
Synthetic prior auth charts (rheumatology + dermatology), criterion-level and overall approval questions (tests/eval_2_prior_auth.py). 83 questions across 16 cases.
Training: head-only, backbone frozen, Adam lr=1e-3, loss 0.21 → 0.10.
Research and development tooling for clinical decision-support systems. Not intended for clinical deployment or use in diagnosis, treatment decisions, or patient care without appropriate validation, regulatory review, and Health Regulatory Authorization.
This is a modified architecture (not a fine-tune or weights release). Users must load
google/medgemma-4b-it weights themselves under the HAI-DEF Terms of Use.
This repository is distributed under the Health AI Developer Foundations (HAI-DEF) Terms of Use: https://developers.google.com/health-ai-developer-foundations/tos
By using this repository, you agree to the HAI-DEF Terms of Use, which are incorporated by reference and apply to all downstream uses. Key requirements for downstream users:
NOTICE fileYou may not use this model in a way that would cause a Health Regulatory Authority to classify Google as the medical device manufacturer.
See the NOTICE file for the full attribution notice and list of modified files.
If you use this architecture in research, please cite the base model:
@misc{medgemma2025,
title={MedGemma},
author={Google},
year={2025},
url={https://huggingface.co/google/medgemma-4b-it}
}