π§ͺ Qwen2.5-0.5B-Instruct + LoRA Fine-Tuned on PubMedQA (pqa_labeled)
This model is a LoRA-adapted version of Qwen2.5-0.5B-Instruct, fine-tuned using Unsloth on the pqa_labeled
subset of the PubMedQA dataset.
β Summary
This work demonstrates that even a compact instruction-tuned model like Qwen2.5 0.5B Instruct can achieve near state-of-the-art performance on biomedical QA tasks. With LoRA fine-tuning using just 1,000 examples, this model achieves 98.99% accuracy on the PubMedQA test set.
It reframes the classification task as a text generation problem β prompting the model to generate "yes", "no", or "maybe" responses. This results in highly interpretable and efficient predictions with excellent generalization.
π₯ Key Highlights
- β Model: Qwen2.5-0.5B-Instruct (general-purpose, open)
- β Fine-tuning: LoRA with Unsloth
- β Accuracy: 98.99%
- β Macro F1: 0.977
- β Very high performance on all 3 classes: yes, no, maybe
- β Fully generative: no classification head
- β Lightweight and deployment-friendly
π Evaluation Metrics
Label | Precision | Recall | F1 Score | Support |
---|---|---|---|---|
yes | 0.981 | 1.000 | 0.990 | 52 |
no | 1.000 | 1.000 | 1.000 | 38 |
maybe | 1.000 | 0.889 | 0.941 | 9 |
- Accuracy: 98.99%
- Macro F1: 0.977
- Weighted F1: 0.989
ποΈ Training Configuration
- Base Model: Qwen2.5-0.5B-Instruct
- Framework: PyTorch + PEFT + Unsloth
- LoRA Config:
r
: 16alpha
: 16target_modules
: ["q_proj", "v_proj"]
- Epochs: 100
- Batch Size: 16
- Learning Rate: 2e-4
πΎ Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
model = PeftModel.from_pretrained(model, "ShahzebKhoso/qwen2.5-instruct-0.5B-pubmedqa-lora")
tokenizer = AutoTokenizer.from_pretrained("ShahzebKhoso/qwen2.5-instruct-0.5B-pubmedqa-lora")
β οΈ Limitations
- Trained on limited size PubMedQA subset (~1k examples)
- May still show uncertainty in "maybe" class generation
- Not suitable for medical decision-making in clinical settings
π Citation
@misc{shahzebkhoso2025qwenpubmedqa,
title={Fine-tuning Qwen2.5-0.5B on PubMedQA with LoRA},
author={Shahzeb Khoso},
year={2025},
howpublished={\\url{https://huggingface.co/ShahzebKhoso/qwen2.5-instruct-0.5B-pubmedqa-lora}},
}
β¨ Acknowledgements
- Downloads last month
- 6
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support