Instructions to use naazimsnh02/Shifa-4B-SFT-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use naazimsnh02/Shifa-4B-SFT-LoRA with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3.5-4B") model = PeftModel.from_pretrained(base_model, "naazimsnh02/Shifa-4B-SFT-LoRA") - Notebooks
- Google Colab
- Kaggle
Shifa-4B-SFT-LoRA
Shifa-4B is a medical reasoning model built on Qwen3.5-4B. This repository contains the Stage-1 QLoRA adapters from supervised fine-tuning on medical chain-of-thought data.
The model learns to reason step-by-step inside <think>...</think> blocks before producing a final answer — leveraging Qwen3.5's native hybrid-thinking architecture.
This is the LoRA adapter only. For the ready-to-use merged model, see naazimsnh02/Shifa-4B-SFT.
Benchmark Results (Stage-1 SFT)
| Benchmark | Shifa-4B | MedGemma-4B-IT | Delta |
|---|---|---|---|
| MedQA (USMLE, 4-opt) | 0.702 | 0.691 | +0.011 |
| MedMCQA | 0.508 | 0.598 | -0.090 |
| PubMedQA | 0.374 | 0.682 | -0.308 |
MedGemma targets are from the google/medgemma-4b-it model card. Evaluated on 500 samples per benchmark using greedy decoding.
Training Details
Data
~395K examples blended from three medical reasoning datasets plus a general-instruction mix to prevent catastrophic forgetting:
| Source | Samples | Description |
|---|---|---|
| FreedomIntelligence/medical-o1-reasoning-SFT | ~20K | HuatuoGPT-o1 gold chain-of-thought traces |
| OpenMed/Medical-Reasoning-SFT-GPT-OSS-120B | 200K | High-effort reasoning from GPT-OSS-120B |
| Intelligent-Internet/II-Medical-Reasoning-SFT | 150K | Sampled for scale and diversity |
| HuggingFaceH4/ultrachat_200k | ~28K (7%) | General instruction mix |
Hyperparameters
| Parameter | Value |
|---|---|
| Method | QLoRA (4-bit NF4) |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| Target modules | All attention + MLP (language layers only) |
| Vision tower | Frozen |
| Batch size | 4 × 4 gradient accumulation (effective 16) |
| Learning rate | 1e-4 (cosine schedule) |
| Max sequence length | 4096 |
| Training steps | 10,000 |
| Optimizer | AdamW 8-bit |
| Warmup | 3% of steps |
| Training time | ~21.7 hours on 1× A100-SXM4-80GB |
| Loss masking | Response-only (assistant turns) |
Framework
Usage
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="naazimsnh02/Shifa-4B-SFT-LoRA",
max_seq_length=4096,
load_in_4bit=True,
)
FastModel.for_inference(model)
messages = [
{"role": "user", "content": "A 45-year-old male presents with sudden chest pain radiating to the left arm. What is the most likely diagnosis and initial workup?"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to("cuda")
output = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Roadmap
- Stage-2 (GRPO): Reinforcement learning with verifiable MCQ rewards on MedQA + MedMCQA to strengthen overall medical reasoning accuracy.
Limitations
- This is a research model. Not intended for clinical use or medical decision-making.
- Performance on PubMedQA is limited; literature-based reasoning requires further tuning.
- The model inherits biases and limitations from its base model and training data.
License
Apache 2.0 — same as the base model (Qwen3.5-4B).
- Downloads last month
- 2
Model tree for naazimsnh02/Shifa-4B-SFT-LoRA
Datasets used to train naazimsnh02/Shifa-4B-SFT-LoRA
FreedomIntelligence/medical-o1-reasoning-SFT
Intelligent-Internet/II-Medical-Reasoning-SFT
Collection including naazimsnh02/Shifa-4B-SFT-LoRA
Evaluation results
- Accuracy on MedQA (USMLE, 4-opt)test set self-reported0.702
- Accuracy on MedMCQAvalidation set self-reported0.508
- Accuracy on PubMedQAtest set self-reported0.374