CoolFace
Apppublic

mou11/medical-llm-finetune

sourceHugging Facemitupdated 4mo agoView on Hugging Face
2likes
App README

⚡ Medical LLM Fine-tuning — Mistral-7B + QLoRA

Python Mistral QLoRA HuggingFace

🎯 Live Demo

👉 Try it on Hugging Face Spaces

🔍 Overview

Fine-tuned Mistral-7B-Instruct-v0.2 on 9,160 USMLE medical QA samples using QLoRA — reducing GPU memory by 75% vs full fine-tuning. Trained on free Kaggle T4 GPU in under 3 hours.

📊 Results

MetricValue
Training Loss1.039
Validation Loss0.987
USMLE Sample Accuracy30% (beats 20% random baseline)
Trainable Parameters13.6M (0.19% of 7.2B total)
Training Time~3 hours
GPU Memory Reduction75% vs full fine-tuning

✨ Features

  • —✅ QLoRA 4-bit quantization — runs on free Kaggle GPU
  • —✅ USMLE-style clinical vignette training data
  • —✅ Weights & Biases experiment tracking
  • —✅ LoRA adapters published on HuggingFace
  • —✅ Interactive Gradio demo

🛠️ Tech Stack

ComponentTool
Base ModelMistral-7B-Instruct-v0.2
Fine-tuningQLoRA (4-bit NF4)
FrameworkHuggingFace PEFT + TRL
Datasetmedalpaca/medicalmeadowmedqa
TrackingWeights & Biases
PlatformKaggle T4 GPU (free)
UIGradio

🏗️ Training Details

HyperparameterValue
LoRA Rank (r)16
LoRA Alpha32
Target Modulesqproj, kproj, vproj, oproj
Learning Rate2e-4
Batch Size2
Gradient Accumulation8 steps
Epochs1
Optimizerpagedadamw8bit

🔗 Model

👉 mou11/medical-mistral-7b-qlora

⚠️ Medical Disclaimer

This system is for educational and research purposes only. It does not provide medical advice. Always consult a qualified healthcare professional for medical decisions.

📌 Part of Medical AI Portfolio

  1. 1.✅ Pneumonia Detection (ViT + Grad-CAM)
  2. 2.✅ Clinical Decision Support Agent (LangGraph + RAG)
  3. 3.✅ Medical LLM Fine-tuning (QLoRA) — this project
  4. 4.✅ Medical Report Generator (Hallucination Detection + FHIR)