Downloads · 30 days
7
12% of all-time downloads
KiranUpadhyay/biomistral-qlora-clinical-research-assistant
biomistral-qlora-clinical-research-assistant is a text generation model from KiranUpadhyay. Use it when you need the model to write or continue text. It is set up for peft.
This repository contains a PEFT LoRA adapter trained for the Agentic Evidence-Based Clinical Research Assistant, developed as an M.Tech capstone project at PES University.
Downloads · 30 days
7
12% of all-time downloads
All-time downloads
60
Public
Repo size
27.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors27.3 MB · 89%
From the Hugging Face model README
This repository contains a PEFT LoRA adapter trained for the Agentic Evidence-Based Clinical Research Assistant, developed as an M.Tech capstone project at PES University.
The adapter was trained to generate structured biomedical research summaries from retrieved PubMed Central (PMC) evidence. It is intended to be used with a Retrieval-Augmented Generation (RAG) pipeline based on PubMedBERT embeddings and FAISS retrieval.
Important: This repository is not a standalone 4-bit model. It contains LoRA adapter weights only. The
BioMistral/BioMistral-7Bbase model must be downloaded separately. Four-bit NF4 quantization was used during QLoRA training.
pritamdeka/S-PubMedBert-MS-MARCOThe adapter is intended for:
It was designed for use with retrieved biomedical evidence. Supplying a question without supporting evidence may produce substantially less reliable output.
| Setting | Value |
|---|---|
| Base model | BioMistral/BioMistral-7B |
| Training method | QLoRA / PEFT |
| Quantization | 4-bit NF4 with double quantization |
| Compute precision | FP16 |
| LoRA rank | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Maximum training sequence length | 1,024 tokens |
| Epochs | 2 |
| Optimization steps | 88 |
| Per-device batch size | 1 |
| Gradient accumulation | 4 |
| Effective batch size | 4 |
| Learning rate | 2e-4 |
| Optimizer | paged_adamw_8bit |
| Hardware | NVIDIA GeForce RTX 4060 Laptop GPU |
The recorded interval training loss decreased from approximately 1.73 near the beginning of training to 0.28 near the final logged step. This is training loss, not validation loss or task accuracy. No held-out validation loss was recorded.
The project processed 152 PMC Open Access articles into 2,267 section-aware chunks. A retrieval-grounded dataset of 175 instruction examples was then generated. Up to three retrieved evidence chunks were used when constructing an example.
The data pipeline included:
The training prompt format was:
### Instruction:
{instruction}
### Input:
{retrieved evidence}
### Response:
{response}
The training corpus is small and covers selected biomedical research themes rather than the full clinical domain. The PMC source documents are not redistributed in this model repository. Users should review the reuse terms of individual PMC articles before redistributing derived data.
Install the required packages:
pip install torch transformers peft bitsandbytes accelerate
Load the base model in 4-bit precision and attach the adapter:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
base_id = "BioMistral/BioMistral-7B"
adapter_id = "KiranUpadhyay/biomistral-qlora-clinical-research-assistant"
tokenizer = AutoTokenizer.from_pretrained(base_id, use_safetensors=False)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.float16,
)
base_model = AutoModelForCausalLM.from_pretrained(
base_id,
quantization_config=quantization_config,
device_map="auto",
use_safetensors=False,
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
Use the same instruction format used during training:
question = "What are the reported benefits of remote patient monitoring?"
evidence = """Evidence 1:
Title: [source title]
PMCID: [PMCID]
Section: [section]
Text: [retrieved passage]
"""
prompt = f"""### Instruction:
Answer the biomedical research question using only the provided evidence.
Provide a structured response with Summary, Key Findings, source title,
PMCID, section name, and Limitations.
### Input:
Question:
{question}
Evidence:
{evidence}
### Response:
"""
inputs = tokenizer(
prompt,
return_tensors="pt",
truncation=True,
max_length=4096,
).to(model.device)
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=250,
temperature=0.1,
do_sample=True,
top_p=0.9,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id,
)
generated = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated[len(prompt):].strip())
Evaluation was conducted at the complete RAG-system level, not as a standardized standalone language-model benchmark. The results below are therefore illustrative and should not be interpreted as evidence of clinical validity or broad generalization.
Five representative queries were manually labeled for relevance.
| Metric | Mean result |
|---|---|
| Precision@3 | 1.00 |
| NDCG@3 | 1.00 |
| Precision@5 | 0.96 |
| NDCG@5 | 1.00 |
This is a very small, project-specific evaluation set. The high results may not generalize to other topics or query formulations.
Five representative generations were checked for response structure, lexical grounding overlap, PMCID traceability, answer length, and a composite score.
| Metric | Mean result |
|---|---|
| Structure score | 0.667 |
| Grounding overlap | 0.189 |
| PMCID traceability score | 0.000 |
| Length score | 0.900 |
| Overall generation score | 0.389 |
The observed composite scores ranged from 0.259 to 0.537. In particular, the zero PMCID traceability score shows that source identifiers were not reliably reproduced in the evaluated answers. These results identify important limitations rather than demonstrating production readiness. No controlled base-model-versus-adapter comparison was performed, so this card does not claim a measured improvement over the base model.
This adapter is for research and educational use only. It is not intended for diagnosis, treatment recommendations, emergency decisions, medication decisions, direct patient care, or any other professional medical use. Outputs must be checked against the cited primary literature and reviewed by appropriately qualified professionals.
The project repository contains the data-processing, retrieval, training, inference, and evaluation scripts used in the submitted capstone implementation:
prepare_qlora_dataset.pyqlora_train.pytest_finetuned_model.pyevaluate_retrieval.pyevaluate_generation_auto.pySee UpadhyayKiran/mtech-capstone-project for the accompanying implementation.
@mastersthesis{upadhyay2026clinicalresearchassistant,
author = {Kiran Upadhyay},
title = {Agentic Evidence-Based Clinical Research Assistant},
school = {PES University},
year = {2026},
type = {M.Tech Capstone Project}
}
This work uses BioMistral, Hugging Face Transformers and PEFT, bitsandbytes, Sentence Transformers, FAISS, and PubMed Central Open Access literature.
No additional license is asserted in this model card. Users are responsible for complying with the license and terms of the BioMistral base model and with any applicable source-data terms.