good2idnan/medgemma-1.5-4b-it-leukemia-lora
๐ฉธ MedGemma Leukemia LoRA - Blood Cell Classification Model
<p align="center"> <img src="https://img.shields.io/badge/Accuracy-78.15%25-brightgreen" alt="Accuracy"/> <img src="https://img.shields.io/badge/Leukemia%20Recall-83.10%25-orange" alt="Recall"/> <img src="https://img.shields.io/badge/F1%20Score-83.24%25-blue" alt="F1"/> <img src="https://img.shields.io/badge/Training%20Images-10%2C000+-purple" alt="Training"/> </p>
๐ฏ Model Summary
medgemma-1.5-4b-it-leukemia-lora is a parameter-efficient fine-tuned vision-language model specialized for Acute Lymphoblastic Leukemia (ALL) detection from microscopic blood cell images.
Built on Google's MedGemma 1.5 4B IT foundation model and fine-tuned using LoRA (Low-Rank Adaptation), this model achieves high recall for leukemia detectionโcritical for medical screening applications where minimizing false negatives saves lives.
๐ก Key Impact: Early detection of leukemia improves 5-year survival rates from 20% to over 85%.
๐ค Collaborative project โ Originally published at chaudhrysuleman/medgemma-1.5-4b-it-leukemia-lora
โ ๏ธ CRITICAL DISCLAIMER - READ BEFORE USE
THIS MODEL IS FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY
๐ซ What This Model Is NOT:
- โ NOT FDA-approved or cleared for medical use
- โ NOT CE-marked for clinical diagnosis in EU
- โ NOT validated for real-world patient care
- โ NOT a substitute for professional medical diagnosis
- โ NOT suitable for making clinical treatment decisions
โ What This Model IS:
- โ A research demonstration of LoRA fine-tuning techniques
- โ An educational tool for understanding medical AI
- โ A proof-of-concept for the MedGemma Impact Challenge
- โ A benchmark for comparing medical vision-language models
๐ Performance Metrics
๐งฌ Model Details
Architecture & Training
Developers
- Chaudhry Muhammad Suleman - @chaudhrysuleman
- Muhammad Idnan - @good2idnan
Training Data
The model was trained on the C-NMC Leukemia Classification Dataset, containing:
- Microscopic images of blood cells
- Binary labels: Normal (healthy) vs. ALL (Acute Lymphoblastic Leukemia)
- Single-cell centered images for consistent analysis
๐ Quick Start
โ ๏ธ Before Running This Code
WARNING: This code is for educational/research demonstration only.
- Do NOT use output for medical decisions
- Do NOT apply to real patient samples without proper validation and approval
- Ensure you have appropriate research ethics approval if using real medical data
Installation
pip install transformers peft torch pillowBasic Usage
import os
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForVision2Seq
from peft import PeftModel
BASE_MODEL_ID = "google/medgemma-1.5-4b-it"
LORA_ADAPTER_ID = "chaudhrysuleman/medgemma-1.5-4b-it-leukemia-lora"
hf_token = os.getenv("HF_TOKEN", "").strip() or None
processor = AutoProcessor.from_pretrained(
BASE_MODEL_ID,
trust_remote_code=True,
token=hf_token
)
base_model = AutoModelForVision2Seq.from_pretrained(
BASE_MODEL_ID,
trust_remote_code=True,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto" if torch.cuda.is_available() else None,
token=hf_token
)
model = PeftModel.from_pretrained(base_model, LORA_ADAPTER_ID, token=hf_token)
model.eval()
image = Image.open("blood_cell.jpg").convert("RGB")
prompt = (
"Analyze this blood cell microscopy image and classify it.\n"
"Is the cell NORMAL or LEUKEMIA (blast)?\n"
"Answer with exactly one of: Normal, Leukemia."
)
messages = [{
"role": "user",
"content": [{"type": "image"}, {"type": "text", "text": prompt}]
}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(images=image, text=text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=10, do_sample=False)
print(processor.decode(outputs[0], skip_special_tokens=True))Try the Demo
๐ฎ Live Demo: LeukemiaScope on HuggingFace Spaces
๐ก Intended Uses
โ Appropriate Uses (Research & Education Only)
Required Context: All uses must be in non-clinical, research, or educational settings with proper supervision and understanding of limitations.
๐ซ Prohibited Uses
Legal Requirement: Any clinical application requires separate regulatory approval in your jurisdiction (FDA 510(k), CE-IVD marking, etc.).
โ ๏ธ Limitations & Risks
Known Limitations
- Dataset Bias: Trained on a single public dataset (C-NMC); may not generalize to:
- Different microscope types
- Alternative staining techniques
- Other leukemia subtypes (AML, CML, CLL)
- Varying image resolutions
- Population Representation: Dataset demographics may not reflect all patient populations
- False Negatives/Positives: While optimized for high recall, some cases may be misclassified
Safety Recommendations
- โ Always validate on local clinical data before any experimental use
- โ Use as screening support, not final diagnosis
- โ Combine with expert pathologist review
- โ Follow regulatory guidelines for medical AI in your jurisdiction
- โ Never deploy in clinical settings without proper approval
๐ฌ Technical Specifications
Input Requirements
- Image Format: RGB images (PNG, JPG, JPEG)
- Recommended: Single blood cell, centered, clear microscopy
- Resolution: Model handles various resolutions (224x224+ recommended)
Compute Requirements
๐ Citation
If you use this model in your research, please cite:
@misc{medgemma-leukemia-lora-2026,
author = {Suleman, Chaudhry Muhammad and Idnan, Muhammad},
title = {MedGemma Leukemia LoRA: Parameter-Efficient Fine-Tuning for Blood Cell Classification},
year = {2026},
publisher = {HuggingFace},
url = {https://huggingface.co/chaudhrysuleman/medgemma-1.5-4b-it-leukemia-lora}
}๐ Resources
๐ License
This model is released under the Apache 2.0 License, consistent with the MedGemma base model license. See the LICENSE file for details.
๐ Responsible AI Statement
We are committed to the responsible development and use of AI in healthcare:
- Transparency: All limitations and risks are openly disclosed
- Safety: Strong disclaimers against clinical misuse
- Accountability: Contact information provided for reporting concerns
- Education: Clear guidance on appropriate vs. prohibited uses
- Compliance: Encouragement to follow all applicable regulations
Version History
- v1.0 (February 2026): Initial release for MedGemma Impact Challenge
- 83.10% recall on C-NMC test set
- Research/educational use only ---
Remember: This is a research tool, not a medical device. Human expertise saves lives, not AI alone. ๐ฅ
Built with โค๏ธ for the MedGemma Impact Challenge 2026
