Model Card for Phi-4-mini-reasoning โ€” Primary Healthcare Fine-tune

Fine-tuned version of unsloth/Phi-4-mini-reasoning on a large medical QA dataset for primary healthcare, developed as part of the CSCI 566 (Deep Learning) course project at USC.

Model Details

Model Description

This model is a LoRA fine-tune of Phi-4-mini-reasoning, trained on ~146K medical multiple-choice QA examples to improve performance on clinical reasoning tasks relevant to primary healthcare. Phi-4-mini-reasoning's chain-of-thought reasoning capabilities make it well-suited for step-by-step medical QA. Both LoRA adapter weights and quantized GGUF files are provided.

  • Model type: Causal Language Model (LoRA fine-tune)
  • Language(s) (NLP): English
  • License: MIT
  • Finetuned from model: unsloth/Phi-4-mini-reasoning

Uses

Direct Use

Answer medical multiple-choice questions and provide evidence-based clinical reasoning for primary healthcare queries.

Downstream Use

Can be further fine-tuned or used as a backbone for medical decision-support tools, clinical education assistants, or healthcare chatbots.

Out-of-Scope Use

This model is not intended for direct clinical diagnosis or as a replacement for qualified medical professionals. It should not be used for emergency medical advice or high-stakes clinical decisions without human oversight.

Bias, Risks, and Limitations

  • The model may produce plausible-sounding but incorrect medical information.
  • Performance may degrade on rare conditions, non-English queries, or highly specialized subspecialties.

Recommendations

Always consult a qualified healthcare professional for personal medical advice. Outputs from this model should be treated as informational only and verified against authoritative clinical sources.

How to Get Started with the Model

With LoRA adapter (Transformers + PEFT)

from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_model = AutoModelForCausalLM.from_pretrained("unsloth/Phi-4-mini-reasoning")
tokenizer = AutoTokenizer.from_pretrained("reyanshgupta/phi-4-mini-reasoning-primaryhealthcare-csci566", subfolder="adapter")
model = PeftModel.from_pretrained(base_model, "reyanshgupta/phi-4-mini-reasoning-primaryhealthcare-csci566", subfolder="adapter")

With GGUF (llama.cpp / Ollama)

huggingface-cli download reyanshgupta/phi-4-mini-reasoning-primaryhealthcare-csci566 gguf/Phi-4-mini-reasoning.Q4_K_M.gguf

Training Details

Training Data

~146,354 medical multiple-choice QA examples in ShareGPT chat format, covering a broad range of primary care topics including internal medicine, pharmacology, and clinical reasoning. A validation split of ~5,548 examples was held out during training.

The system prompt used during training:

"You are a knowledgeable medical AI assistant. Provide accurate, evidence-based medical information. Always recommend consulting a qualified healthcare professional for personal medical advice."

Training Procedure

Training Hyperparameters

  • Training regime: bf16 mixed precision
  • Fine-tuning method: LoRA via Unsloth + TRL SFTTrainer
  • LoRA rank (r): 32
  • LoRA alpha: 64
  • LoRA dropout: 0.0
  • RSLoRA: Yes
  • Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
  • Max sequence length: 1024
  • Per-device batch size: 4
  • Gradient accumulation steps: 8 (effective batch size: 32)
  • Learning rate: 2e-4
  • Warmup steps: 400
  • Weight decay: 0.01
  • Epochs: 1
  • Optimizer: AdamW

Evaluation

Testing Data, Factors & Metrics

Testing Data

Held-out validation split (~5,548 examples) from the same medical QA distribution as training data, plus standard medical benchmarks (MedQA, MedMCQA).

Metrics

  • Accuracy on multiple-choice medical QA benchmarks

Results

Benchmark Base Model Fine-tuned
CareQA 43.23% 56.77%
HEADQA 45.92% 60.69%
MedQA 41.63% 50.51%
MMLU (Medical) 50.10% 63.63%
MMLU-Pro (Medical) 31.42% 34.47%
PubMedQA 53.50% 69.70%

Summary

Phi-4-mini-reasoning shows the most consistent and significant improvements from fine-tuning across all models in this comparison. Every benchmark improved substantially, with HEADQA gaining +14.77%, MMLU +13.53%, CareQA +13.54%, and PubMedQA +16.20%. This suggests the base model's reasoning capabilities were well-suited to adapting to the medical domain, and the fine-tuning successfully transferred domain-specific knowledge without degrading general reasoning ability.

Technical Specifications

Model Architecture and Objective

Decoder-only transformer (Phi-4-mini-reasoning) with LoRA adapters applied to attention and MLP projection layers. Trained with next-token prediction (SFT) on chat-formatted medical QA data.

Compute Infrastructure

Hardware

NVIDIA RTX 5090 GPU: 24GB (CUDA 12.8)

Software

  • Python 3.13
  • Unsloth
  • TRL (SFTTrainer)
  • PEFT
  • Transformers

Model Card Authors

Reyansh Gupta โ€” USC CSCI 566

Model Card Contact

reyanshg@usc.edu

Downloads last month
29
GGUF
Model size
4B params
Architecture
phi3
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for reyanshgupta/phi-4-mini-reasoning-primaryhealthcare-csci566

Adapter
(1)
this model

Evaluation results