
This publication documents the end-to-end fine-tuning of Qwen2.5-0.5B-Instruct for specialized medical dialogue using Parameter-Efficient Fine-Tuning (PEFT). By applying QLoRA with 4-bit quantization, we adapted a general-purpose Small Language Model (SLM) on the ChatDoctor-HealthCareMagic-100k dataset. The resulting model demonstrates significant improvements in medical "bedside manner," professional formatting, and structural consistency. This work highlights how lightweight architectures can be effectively aligned to high-stakes domains on consumer-grade hardware, while simultaneously providing a critical analysis of the current limitations in clinical reasoning.
This work is conducted strictly for educational and certification purposes and is not intended for real-world medical use.
The objective of this project is to develop a domain-specific assistant capable of providing empathetic and structured medical advice based on patient symptoms. The model is trained to act as a "ChatDoctor," receiving unstructured patient queries and generating professional medical responses.
General-purpose LLMs often provide medical advice that is either too verbose, improperly formatted for clinical dialogue, or lacking the specific empathetic tone required in healthcare. By fine-tuning, we aim to:
Medical Q&A is a high-impact task for personal AI health agents and initial symptom triaging. I chose this specific task to explore the boundaries of pattern mimicry in SLMs—understanding how well a small model can "sound" like a doctor before requiring more complex reasoning layers.
The ChatDoctor-HealthCareMagic-100k dataset consists of real-world medical question-and-answer pairs collected from an online medical consultation platform. Each example follows a conversational structure where a patient describes symptoms and a doctor responds professionally.
The dataset is ideal for studying linguistic and stylistic adaptation, though not for validating clinical correctness.
Using a small model ensures:
QLoRA combines low-rank adaptation with 4-bit quantization, allowing efficient fine-tuning while keeping the base model weights frozen. The overall training took around 1.5 hrs on a single L4 GPU
I evaluated the model on a test split of 100 samples using the ROUGE metric, comparing the fine-tuned version against the original base model.
| Metric | Base Model | Fine-tuned | Improvement |
|---|---|---|---|
| ROUGE-1 | 0.2246 | 0.2646 | +0.0400 |
| ROUGE-2 | 0.0187 | 0.0485 | +0.0298 |
| ROUGE-L | 0.1091 | 0.1493 | +0.0402 |
The training was monitored via Weights & Biases. Below are the training and evaluation curves.
The training loss showed a steady decline from ~3.0 to ~2.25, while the token-level accuracy increased from 0.42 to 0.53, indicating successful pattern recognition of the medical dialogue format.

The evaluation loss decreased consistently to ~2.22, suggesting the model generalizes well to unseen patient queries without significant overfitting.

Patient: Hello, I am seeking some professional help for a small white hard bump below my bottom front teeth. If anyone has any dental knowledge I would be really happy. The bump does not hurt unless I push very hard and it was noticed by my local dentist and he may refer me to a oral specialist. Does anyone know what this is??
Model Response: Hi, Welcome to Chat Doctor forum. It seems you have developed ulcer in gums due to poor oral hygiene. Visit a good dentist, get your teeth cleaned, and apply mouth wash over the affected area of gum. Maintain proper oral hygiene. You can take tab. Chlorpheniramine male, once daily at night. This will relieve inflammation. Hope this answers your query. I will be available for further clarifications. Regards.
Patient: I am having terrible pain in my middle back radiating off to the side on the left. Sharp and very painful to sit up when laying down or to turn. Also diagnosed with an abdominal aortic aneurysm which they are keeping an eye on the size is only 4 right now. could this pain be coming from that or what could this possibly be. Been to chiropractor with no relief. Now going to PT and still no relief. I am becoming very depressed and tired from lack of sleep.
Model Response: Hello, Thanks for consulting ChatDoctor. Read your query as you have sharp burning pain over back of abdomen may be due to many reasons like1. Herniated disc2. Spinal stenosis3. Muscle spasm4. Prolapsed disc5. Spinal tuberculosis etc... In my opinion you should consult physician first because if it will not respond to physical therapy then surgical procedure is needed so do warm water fomentation and apply muscle relaxant local application and take tab paracetamol 650\u00a0mg after food. Hope this will help you.
A qualitative analysis of the model's output reveals that while it has mastered the form of a medical consultation, it still lacks the substance required for production-level medical advice.
The model has successfully internalized the "bedside manner" found in the HealthCareMagic dataset:
Doctor: prefix and maintains a helpful, empathetic tone throughout the response.Despite the stylistic improvements, the model's actual advice is often medically generic or lacks deep reasoning:
For this model to be viable in a real-world healthcare setting, significant further development is required:
This project was conducted strictly for learning purposes to understand the QLoRA fine-tuning process. It successfully demonstrated that a Small Language Model (0.5B parameters) can be quickly adapted to follow complex structural and tonal requirements. However, it serves as a reminder that linguistic proficiency does not equal domain expertise.