This repository demonstrates the fine-tuning of Qwen-1.5B using QLoRA on the PubMedQA dataset. The project focuses on enhancing the model's reasoning capabilities and instruction-following accuracy in the specialized medical domain under constrained computational resources.
This project was designed under the following constraints:
- Single-GPU environment with limited VRAM(8GB)
- No access to full fine-tuning or large batch training
- Requirement for reproducible, leakage-free evaluation
To address these constraints, the following design choices were made:
- QLoRA (4-bit NF4 quantization) to enable fine-tuning of a 1.5B model on limited hardware
- LoRA adapters applied to attention and MLP projections to balance capacity and stability
The PubMedQA (pqa_labeled) dataset was used for supervised fine-tuning. Each example consists of a biomedical question, multiple context sentences, and a ternary decision label: yes / no / maybe.
A chat-based instruction format was adopted to align with the Qwen-Instruct model. Special care was taken to ensure that ground-truth answers were excluded during evaluation to prevent label leakage.
- Base model: Qwen2.5-1.5B-Instruct
- Quantization: 4-bit NF4 (bitsandbytes)
- LoRA rank: 16
- LoRA alpha: 32
- Batch size (effective): 16 (via gradient accumulation)
- Max sequence length: 2048
- Optimizer: AdamW
- Training steps: 400
Evaluation was performed on a held-out test split that was never observed during training.
Unlike loss-based evaluation, model performance was measured using end-to-end generation:
- The model was prompted without the ground-truth answer
- A single-token decision (yes / no / maybe) was generated
- Predictions were compared directly against gold labels
Both the base model and the fine-tuned model were evaluated under identical 4-bit quantization settings to ensure a fair comparison.
The following chart shows the training loss over steps, indicating a stable convergence.
The fine-tuned model shows a significant improvement in clinical decision accuracy compared to the base model.
This represents a +13% absolute improvement under a strict, leakage-free evaluation protocol.
- Explore logit-based evaluation for more precise uncertainty modeling
- Extend the approach to retrieval-augmented medical QA
- PubMedQA Dataset: Jin, Q., Dhingra, B., Liu, Z., Cohen, W., & Lu, X. (2019). PubMedQA: A Dataset for Biomedical Research Question Answering. In Proceedings of EMNLP-IJCNLP 2019. https://pubmedqa.github.io/
- Qwen2.5-1.5B-Instruct: Alibaba Cloud Qwen Team

