--- license: apache-2.0 base_model: - google/medgemma-1.5-4b-it - AlphaRaven/medgemma-4b-antihallu tags: - medical - dermatology - adverse-event-detection - medgemma --- # MedGemma AE Detection MedGemma 1.5-4B fine-tuned for **visual adverse event detection** from clinical photographs using paired image comparison. - **Base model**: `AlphaRaven/medgemma-4b-antihallu` - **Method**: LoRA fine-tuning (r=8, alpha=16, target: q_proj/v_proj) - **Training**: 100 epochs - **Task**: - 1. Paired comparison of baseline vs. current patient photos. 2. Classify skin AEs from patient photos into 21 categories (normal + 7 AE types × 3 CTCAE grades; alopecia G1-G2 only) - **AE types**: maculopapular rash, acneiform rash, periorbital edema, SJS, stomatitis, pruritus, alopecia ## Performance (test set, 42 paired images): - Accuracy: 95.2% - Weighted F1: 0.951 - ## Dataset**: Synthetic clinical photographs (Gemini-generated) - 147 train / 21 val / 42 test paired images ## Usage ```python from transformers import AutoModelForImageTextToText, AutoProcessor model = AutoModelForImageTextToText.from_pretrained("AlphaRaven/medgemma-ae-detection") processor = AutoProcessor.from_pretrained("google/medgemma-1.5-4b-it") ``` Input: Two images (baseline photo + current photo) with a clinical reasoning prompt using CTCAE grading criteria. Output: JSON array of detected AEs with ae_term, grade, and reasoning. Part of the [Clinical Trial Simulation Engine](https://github.com/AlphaRaven/ClinicalTrialEngine) pipeline.