Downloads · 30 days
4
10% of all-time downloads
dliebovi/medgemma-stage2-report
medgemma-stage2-report is a text generation model from dliebovi. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as other.
A LoRA adapter fine-tuned on google/medgemma-4b-it for generating patient-friendly health reports that communicate diabetic retinopathy screening results using probabilistic framing and health-literate language.
Downloads · 30 days
4
10% of all-time downloads
All-time downloads
42
Public
Repo size
165 MB
Likes
0
Public
Click a slice to open those files.
.safetensors131 MB · 79%
From the Hugging Face model README
A LoRA adapter fine-tuned on google/medgemma-4b-it for generating patient-friendly health reports that communicate diabetic retinopathy screening results using probabilistic framing and health-literate language.
This adapter was trained as Model 2 in a dual-adapter pipeline for the MedGemma Impact Challenge:
Given structured clinical context (DR probability, labs, CGM metrics, demographics), this adapter generates a ~5,000-character patient report that:
| Parameter | Value |
|---|---|
| Base model | google/medgemma-4b-it |
| PEFT method | LoRA |
| Rank | 16 |
| Alpha | 32 |
| Dropout | 0.1 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Trainable params | 0.76% of base model |
| Training data | 43 participants from AI-READI dataset |
| Training targets | GPT-5.2 generated reports with probabilistic framing |
| Hardware | Apple Silicon M4 (MPS backend), float32 |
| Epochs | ~55 steps with gradient accumulation=4 |
Evaluated on 7 held-out test participants using GPT-5.2 as automated judge (1-5 scale):
| Criterion | Fine-tuned (this) | Base MedGemma | Improvement |
|---|---|---|---|
| Probability communication | 4.3 | 3.3 | +1.0 |
| Actionability | 3.7 | 2.6 | +1.1 |
| Clinical accuracy | 3.0 | 3.0 | 0 |
| Readability | 4.1 | 4.1 | 0 |
| Completeness | 5.0 | 4.9 | +0.1 |
| Overall quality | 3.4 | 3.1 | +0.3 |
| Overall mean | 3.9/5 | 3.5/5 | +0.4 |
from transformers import AutoModelForCausalLM, AutoProcessor
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained("google/medgemma-4b-it")
model = PeftModel.from_pretrained(base_model, "drdavidl/medgemma-stage2-report")
processor = AutoProcessor.from_pretrained("google/medgemma-4b-it")
prompt = """You are a health communication specialist...
SCREENING RESULTS:
- Probability of diabetic retinopathy: 42.0% (about 4 out of 10)
...
"""
messages = [{"role": "user", "content": prompt}]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True,
tokenize=True, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.3)
report = processor.decode(outputs[0], skip_special_tokens=True)
Multimodal Health Risk Communicator — GitHub Repository
MedGemma Impact Challenge submission by David Liebovitz, MD
This adapter follows the Health AI Developer Foundations Terms of Service, consistent with the base MedGemma model license.