saadxsalman/ss-medical-moe
๐ฅ Medical MoE Llama-3.2-1B
Model by [saadxsalman](https://huggingface.co/saadxsalman)
A Mixture of Experts (MoE) language model fine-tuned for medical question answering, built on Llama-3.2-1B with QLoRA adaptation and a custom 4-expert routing layer trained on 1.26M real doctor-patient conversations.
Architecture
Input Tokens โ Llama-3.2-1B (1B params, QLoRA-merged, fp16) โ MoE Layer โ 4 domain experts, top-2 routing โ LayerNorm + Residual โ LM Head โ Medical Answer
Expert Specializations
Training Details
Dataset
Trained on `Malikeh1375/medical-question-answering-datasets` โ 1.26M medical QA pairs from 12 sources including ChatDoctor (112K real doctor-patient conversations), iCliniq, MedQA, WikiDoc, PubMed, and CORD-19.
Expert Routing Results
How to Use
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from huggingface_hub import hf_hub_download
# Load tokenizer and merged backbone
tokenizer = AutoTokenizer.from_pretrained("saadxsalman/medical-moe-llama3.2-1b")
backbone = AutoModelForCausalLM.from_pretrained(
"saadxsalman/medical-moe-llama3.2-1b",
torch_dtype=torch.float16,
device_map="auto"
)
# Load MoE weights separately
moe_ckpt = torch.load(
hf_hub_download("saadxsalman/medical-moe-llama3.2-1b", "moe_components.pt"),
map_location="cuda"
)
# See moe_config.json in the repo for full architecture detailsFiles in This Repository
โ ๏ธ Disclaimer
This model is for research purposes only. It is not validated for clinical use and may produce incorrect medical information. Always consult a qualified healthcare professional for medical advice.
