MedGuard-ShieldGemma-2B
LoRA adapters for medication prescription checks
2 min readupdated
This release provides a set of LoRA (lightweight add-ons on top of a base model) adapters trained on the MedGuardBench dataset to verify prescription safety against a patient's profile. Given structured patient data and a proposed prescription, the model outputs a safety verdict and flags potential risk categories. Built on the google/shieldgemma-2b base model, it is designed for research into medical guardrails.
Key features
- Adapters built on google/shieldgemma-2b for checking medication prescriptions.
- Trained on the MedGuardBench dataset with evaluation across 17 risk categories.
- Multiple training variants: SFT, Patient Profile Unrolling, and Guided GRPO.
- Detailed precision, recall, and F1-score metrics for each variant included in the model card.
What you can do
- Load the adapters via the peft library for AI safety research tasks.
- Switch between different training branches (sft, cu, grpo) depending on your experiments.
- Test safety verdict generation and verification tracing (available in the CU variant).
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("google/shieldgemma-2b", device_map="auto")
tok = AutoTokenizer.from_pretrained("sarakhosravi/MedGuard-ShieldGemma-2B", subfolder="cu")
model = PeftModel.from_pretrained(base, "sarakhosravi/MedGuard-ShieldGemma-2B", subfolder="cu")Read more
DetailsBenchmarks on the MedGuardBench test split (729 rows):
- SFT: Acc 90.1, Rec 95.3, FPR 15.4
- CU (Patient Profile Unrolling): Acc 90.1, Rec 96.6, FPR 16.9
- Guided GRPO: Acc 80.0, Rec 98.4, FPR 40.0
Limitations: These models are intended strictly for research on medication safety guardrails and are not medical devices.










Comments