Downloads · 30 days
23
14% of all-time downloads
anshpunia8597/mistral-7b-medical-qa-finetuned
mistral-7b-medical-qa-finetuned is a text generation model from anshpunia8597. Use it when you need the model to write or continue text. It is set up for peft.
A medical-domain adaptation of Mistral-7B-Instruct-v0.2, fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with LoRA for medical question answering and healthcare AI research.
Downloads · 30 days
23
14% of all-time downloads
All-time downloads
162
Public
Repo size
3 GB
Likes
3
Public
Click a slice to open those files.
.safetensors2.7 GB · 72%
From the Hugging Face model README
A medical-domain adaptation of Mistral-7B-Instruct-v0.2, fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with LoRA for medical question answering and healthcare AI research.
Important: This model is intended for research, experimentation, and educational use only. It has not been clinically validated and must not be used as a substitute for professional medical advice, diagnosis, treatment, or clinical decision-making.
This model is a domain-adapted version of mistralai/Mistral-7B-Instruct-v0.2.
Rather than training a foundation model from scratch, this project applies Low-Rank Adaptation (LoRA) using the Hugging Face PEFT framework to specialize Mistral-7B-Instruct-v0.2 for medical question-answering tasks.
mistralai/Mistral-7B-Instruct-v0.2This model is intended primarily for:
Generated responses should be treated as machine-generated research outputs rather than medical advice.
This model should not be independently used for:
The model has not been clinically validated and may generate inaccurate, incomplete, outdated, misleading, or hallucinated information.
Potential limitations include:
Researchers should independently evaluate the model before downstream use and verify important outputs against authoritative medical sources.
This repository contains a PEFT/LoRA adapter. Load the original Mistral model and then apply the adapter.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "mistralai/Mistral-7B-Instruct-v0.2"
adapter_id = "anshpunia8597/mistral-7b-medical-qa-finetuned"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(
base_model,
adapter_id
)
messages = [
{
"role": "user",
"content": "Explain the major risk factors associated with hypertension."
}
]
inputs = tokenizer.apply_chat_template(
messages,
return_tensors="pt"
).to(model.device)
with torch.no_grad():
outputs = model.generate(
inputs,
max_new_tokens=300,
temperature=0.7,
do_sample=True
)
response = tokenizer.decode(
outputs[0][inputs.shape[-1]:],
skip_special_tokens=True
)
print(response)
The objective of this project was to explore whether a general-purpose instruction-following language model could be efficiently adapted toward medical question answering using parameter-efficient fine-tuning.
LoRA was used instead of full-parameter fine-tuning to reduce the number of trainable parameters and lower memory and compute requirements.
The model was fine-tuned using medical-domain question-answering data prepared for supervised fine-tuning.
Detailed dataset documentation will be added after verification of the original training data, provenance, licensing, preprocessing pipeline, and train/validation/test splits.
mistralai/Mistral-7B-Instruct-v0.2Exact LoRA rank, alpha, dropout, target modules, learning rate, batch size, epochs, optimizer, scheduler, and training precision should be added after verifying the original training configuration.
A comprehensive quantitative benchmark comparing this adapter against the original mistralai/Mistral-7B-Instruct-v0.2 model has not yet been published.
No claim of clinically validated performance improvement is made.
Future evaluation may include:
The underlying model is Mistral-7B-Instruct-v0.2, an instruction-tuned decoder-only transformer language model.
This repository contains PEFT/LoRA adapter weights for medical-domain question answering. The project does not claim to have trained a 7-billion-parameter foundation model from scratch.
The adapter has been publicly released through Hugging Face to make the work accessible to researchers, students, and developers.
Where permitted by applicable licenses, users can inspect, download, evaluate, and build upon the adapter.
This model is provided for research and educational purposes only.
It is not a medical device and has not been validated or approved for clinical use.
The model may produce incorrect, incomplete, misleading, outdated, or fabricated information. Generated content should not be relied upon for diagnosis, treatment, medication decisions, emergency decisions, or other medical care.
Always consult qualified healthcare professionals and authoritative medical sources for medical decisions.
Ansh Punia
Independent AI/ML developer working on large language models, medical AI, retrieval-augmented generation, and applied artificial intelligence.