MedGuard-WildGuard-7B

LoRA adapters for patient-conditioned medication guarding, trained on MedGuardBench. Given a structured patient profile and a proposed prescription, the model returns a safe/unsafe verdict and the 17 risk categories that justify it.

These are the selected checkpoints for each training arm, one per subfolder.

Subfolder Training arm Acc Rec FPR Mic Mac EM
sft/ SFT† 91.5 87.1 3.7 74.9 71.6 68.9
cu/ Patient Profile Unrolling (CU)† 90.8 95.8 14.6 72.5 65.9 65.3
grpo/ Guided GRPO† 94.0 92.9 4.9 75.3 68.5 71.9

† Not reported in the paper's main results table. Scored on the same 729 test rows with the same metric code.

Metrics (%) are on the 729-row drug-disjoint MedGuardBench test split. Acc is verdict accuracy, Rec is unsafe recall, FPR is the false-positive rate on safe prescriptions, and Mic / Mac / EM are the 17-category micro-F1, macro-F1 and exact match.

  • SFT: schema-aligned supervised fine-tuning.
  • CU: Patient Profile Unrolling. One extra epoch from the SFT checkpoint in which the model first checks each patient-chart field against the drug's safety rules, then gives its verdict.
  • Guided GRPO: GRPO with a verifiable safety reward and teacher-guided rollouts, starting from the merged SFT model.

Base model each adapter was trained on:

  • sft/: allenai/wildguard
  • cu/: allenai/wildguard
  • grpo/: merged allenai/wildguard + sft/

Usage

The SFT and CU adapters apply directly to the base model they were trained on (allenai/wildguard; the original model is allenai/wildguard).

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base = AutoModelForCausalLM.from_pretrained("allenai/wildguard", device_map="auto")
tok = AutoTokenizer.from_pretrained("sarakhosravi/MedGuard-WildGuard-7B", subfolder="cu")
model = PeftModel.from_pretrained(base, "sarakhosravi/MedGuard-WildGuard-7B", subfolder="cu")

Guided GRPO

The grpo/ adapter was trained on top of the merged SFT model, so apply sft/ first:

base = AutoModelForCausalLM.from_pretrained("allenai/wildguard", device_map="auto")
model = PeftModel.from_pretrained(base, "sarakhosravi/MedGuard-WildGuard-7B", subfolder="sft").merge_and_unload()
model = PeftModel.from_pretrained(model, "sarakhosravi/MedGuard-WildGuard-7B", subfolder="grpo")

Decode greedily (temperature 0). The CU arm writes a verification trace before its verdict, so allow at least 2,048 new tokens.

Intended use

Research on medication-safety guardrails only. These models are not medical devices and must not be used for clinical decisions.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sarakhosravi/MedGuard-WildGuard-7B

Adapter
(2)
this model

Dataset used to train sarakhosravi/MedGuard-WildGuard-7B

Collection including sarakhosravi/MedGuard-WildGuard-7B