
MedQA is a medical question-answering AI built entirely on AMD hardware for the lablab.ai AMD Hackathon. We fine-tuned Qwen3-1.7B using LoRA on the MedMCQA dataset — 193,000 clinical multiple-choice questions from Indian medical entrance exams. Given a clinical MCQ with four options, the model selects the correct answer and provides a clinical explanation. This has real applications in medical education, exam prep, and clinical decision support. The entire pipeline runs on AMD Instinct MI300X via AMD Developer Cloud using ROCm 7.2 — no CUDA or NVIDIA hardware required. We used PyTorch with ROCm backend, HuggingFace Transformers, PEFT for LoRA, and TRL for training. Inference runs in bfloat16, natively supported on AMD GPUs. Key decisions: LoRA over full fine-tuning means only 0.15% of parameters are updated — fast and memory efficient. We switched from fp16 to bfloat16 after fp16 caused gradient norm explosion (nan values) on ROCm. bfloat16 trained stably throughout. The project has four components: train.py for LoRA fine-tuning, infer.py for CLI inference, eval.py for accuracy evaluation with per-subject breakdown, and app.py — a Gradio web app with a custom dark clinical UI. The LoRA adapter is open-sourced on HuggingFace Hub and the live demo runs on HuggingFace Spaces. Built by Harikrishna Sivanand Iyer and Srijan Sivaram A.
10 May 2026