Fine-tuning Qwen3-8B on medical domain data using QLoRA, with a Retrieval-Augmented Generation (RAG) system built on top for knowledge-grounded medical question answering.
QLoRA Fine-tuning — Qwen3-8B is fine-tuned on medical Q&A data using 4-bit NF4 quantization and LoRA adapters, reducing GPU memory requirements while preserving model quality.
RAG Pipeline — A FAISS-based retrieval system indexes 125,847 chunks from 18 classic medical textbooks (MedRAG/textbooks). At inference time, relevant passages are retrieved and injected into the prompt before generation.
1# Interactive mode2python scripts/rag_inference.py --interactive
34# Single query5python scripts/rag_inference.py --query "What are the symptoms of appendicitis?"67# Batch inference (50 samples, saves to data/ragas_input.json)8python scripts/run_rag_inference.py
Knowledge base:MedRAG/textbooks — 18 medical textbooks including Harrison's Internal Medicine, Schwartz's Surgery, Adams' Neurology, Katzung Pharmacology, Robbins Pathology, and more.