πŸ§ͺ 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: 16
    • alpha: 16
    • target_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

Model tree for ShahzebKhoso/qwen2.5-instruct-0.5B-pubmedqa-lora

Base model

Qwen/Qwen2.5-0.5B
Adapter
(293)
this model

Dataset used to train ShahzebKhoso/qwen2.5-instruct-0.5B-pubmedqa-lora