Downloads · 30 days
11
24% of all-time downloads
naazimsnh02/Shifa-4B-SFT-LoRA
Shifa-4B-SFT-LoRA is a text generation model from naazimsnh02. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
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.
Downloads · 30 days
11
24% of all-time downloads
All-time downloads
46
Public
Repo size
280 MB
Likes
0
Public
Click a slice to open those files.
.safetensors260 MB · 93%
From the Hugging Face model README
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 | 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.
~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 |
| 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) |
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))
Apache 2.0 — same as the base model (Qwen3.5-4B).