A LoRA adapter that fine-tunes Qwen2.5-0.5B to classify transcribed clinical notes by medical specialty. Built as part of a controlled benchmark comparing TF-IDF with logistic regression, a fine-tuned clinical BERT, and this LoRA-tuned LLM. Code, data preparation, and all results: github.com/oshinmiranda26/clinical-note-classifier.
| Model | Macro-F1 | Accuracy |
|---|---|---|
| TF-IDF + logistic regression | 0.820 | 0.890 |
| Bio_ClinicalBERT, 512 tokens, class weights | 0.794 | 0.874 |
| This adapter (Qwen2.5-0.5B + LoRA) | 0.783 | 0.879 |
The simple baseline performed best: specialty labels in this dataset are largely vocabulary-driven, which keyword features capture well. The adapter was strongest on surgery (F1 0.97), orthopedic, and urology notes (0.92 each) and weakest on neurology (0.42), whose notes overlap with other specialties.
from peft import PeftModel
from transformers import AutoModelForSequenceClassification, AutoTokenizer
base = AutoModelForSequenceClassification.from_pretrained("Qwen/Qwen2.5-0.5B", num_labels=NUM_LABELS)
model = PeftModel.from_pretrained(base, "oshinmiranda26/qwen2.5-0.5b-lora-clinical-note-specialty")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B")
Set NUM_LABELS and the label order to match the training code in the repository.
Qwen/Qwen2.5-0.5B