Vaidya — Mistral-7B fine-tuned on MedMCQA
Vaidya (वैद्य) is a Mistral-7B-Instruct-v0.3 model fine-tuned for Indian medical licensing–exam multiple-choice questions (MedMCQA). It was trained with QLoRA supervised fine-tuning followed by DPO preference tuning, raising MedMCQA accuracy from 44.8% → 59.8% (+15.0 pp over the base model).
This is a research / portfolio model for exam-style question answering. It is not a medical device and must not be used for clinical decision-making. See Limitations.
Model Details
- Developed by: Anand Kumar Sahu (SneakySpidy)
- Model type: Decoder-only causal LM (merged QLoRA + DPO adapter)
- Base model:
mistralai/Mistral-7B-Instruct-v0.3 - Language: English
- Finetuned for: Medical multiple-choice QA (A/B/C/D selection)
- License: Apache-2.0 (inherited from base model)
- Training data: MedMCQA (~187k questions)
Training pipeline
Mistral-7B-Instruct-v0.3
└── QLoRA SFT (187k MedMCQA) → 44.8% → 59.3%
└── DPO preference tuning → 59.3% → 59.8%
└── merge + quantize → GPTQ / AWQ / GGUF (3.5× smaller)
How to Get Started
The model is trained on a ChatML prompt format and outputs a single option letter (A/B/C/D).
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "SneakySpidy/vaidya-mistral-7b-medmcqa"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
SYSTEM = ("You are Vaidya, an expert in Indian medical licensing exams "
"(AIIMS, PGI, USMLE-equivalent). Answer the question by selecting the single best option.")
question = "Which vitamin deficiency causes night blindness?"
options = {"A": "Vitamin A", "B": "Vitamin B12", "C": "Vitamin C", "D": "Vitamin D"}
opts = "\n".join(f"{k}. {v}" for k, v in options.items())
prompt = (
f"<|im_start|>system\n{SYSTEM}\n<|im_end|>\n"
f"<|im_start|>user\nQuestion: {question}\n\nOptions:\n{opts}\n<|im_end|>\n"
f"<|im_start|>assistant\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=8, do_sample=False,
pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
# → "A"
Training Details
Data
- Source: MedMCQA — ~187k real Indian medical-entrance (AIIMS/NEET-PG) questions across 21 subjects.
- Format: Converted to ChatML; the assistant target is the correct option letter.
- Splits: Train used for SFT and DPO pairs; a held-out test split used only for evaluation.
Supervised fine-tuning (QLoRA)
| Hyperparameter | Value |
|---|---|
| Method | QLoRA (4-bit NF4, double quant) |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Max sequence length | 640 |
| Epochs | 1 |
| Learning rate | 2e-4 (cosine, 5% warmup) |
| Precision | bf16 (A100) |
| Packing | Enabled (TRL ConstantLengthDataset) |
Preference tuning (DPO)
| Hyperparameter | Value |
|---|---|
| Method | DPO (on top of SFT adapter) |
| Preference pairs | 2,000 (format-matched single-letter chosen/rejected) |
| Beta | 0.1 |
| Learning rate | 5e-6 (cosine, 10% warmup) |
| Epochs | 1 |
Note on DPO: an initial DPO run with verbose preference pairs and a 5e-5 LR caused catastrophic forgetting (−16 pp, parse errors ↑). Matching the pair format to the SFT output style and lowering the LR 10× recovered the model and added a clean +0.5 pp.
Infrastructure
- Training: Lightning.ai (A100 80 GB) / Modal (A10G)
- Tracking: MLflow (artifacts in S3)
Evaluation
Evaluated on 1,000 stratified MedMCQA test questions across 21 subjects (greedy decoding, exact letter match).
| Model | Accuracy | Δ vs previous | Parse errors |
|---|---|---|---|
| Mistral-7B-Instruct-v0.3 (base) | 44.8% | — | 147 |
| + QLoRA SFT | 59.3% | +14.5 pp | 0 |
| + DPO (this model) | 59.8% | +0.5 pp | 0 |
Strongest subjects: Orthopaedics (70.6%), Pediatrics (68.2%), Pharmacology (67.9%), Pathology (64.6%). Weakest subjects: Skin (45.5%), Physiology (50.0%), Gynaecology & Obstetrics (50.9%).
Quantized variants
The merged model was quantized to 4-bit for low-VRAM deployment (3.5× smaller, fits 8 GB GPUs):
| Format | Size | Use case |
|---|---|---|
| BF16 (this repo) | 14.5 GB | Full-precision reference |
| GPTQ 4-bit | 4.2 GB | GPU serving (vLLM) |
| AWQ 4-bit | 4.2 GB | GPU serving (vLLM) |
| GGUF Q4_K_M | 4.4 GB | CPU / edge (Ollama, llama.cpp) |
Uses
Direct use: answering MedMCQA-style single-best-answer medical exam questions (A/B/C/D).
Out-of-scope / misuse:
- Clinical diagnosis, treatment planning, or any real patient-care decision.
- Open-ended medical advice or free-form generation (trained for letter selection, not explanations).
- Non-English or non-Indian-curriculum medical content (training distribution is MedMCQA).
Limitations
- Not for clinical use. Exam accuracy (~60%) is far below any safe clinical bar.
- Reflects MedMCQA biases — Indian curriculum emphasis, dataset label noise, uneven subject coverage.
- Can be confidently wrong; it outputs a letter with no calibrated uncertainty.
- Inherits all limitations and biases of the Mistral-7B base model.
Citation
@misc{sahu2026vaidya,
title = {Vaidya: QLoRA + DPO Fine-Tuning of Mistral-7B for MedMCQA},
author = {Anand Kumar Sahu},
year = {2026},
howpublished = {\url{https://huggingface.co/SneakySpidy/vaidya-mistral-7b-medmcqa}}
}
Dataset:
@inproceedings{pal2022medmcqa,
title = {MedMCQA: A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answering},
author = {Pal, Ankit and Umapathi, Logesh Kumar and Sankarasubbu, Malaikannan},
booktitle = {Proceedings of the Conference on Health, Inference, and Learning},
year = {2022}
}