Downloads · 30 days
0
kingabzpro/diffusiongemma_pubmedqa
diffusiongemma_pubmedqa is a text generation model from kingabzpro. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a LoRA fine-tuned version of DiffusionGemma 26B-A4B IT for biomedical question answering on PubMedQA.
Downloads · 30 days
0
Access
Public
Updated Jul 8, 2026
Repo size
3.6 GB
Likes
0
Public
Click a slice to open those files.
.safetensors599 MB · 95%
From the Hugging Face model README
This model is a LoRA fine-tuned version of DiffusionGemma 26B-A4B IT for biomedical question answering on PubMedQA.
The model was fine-tuned to answer biomedical research questions using PubMed abstract context and return one of three labels:
yes / no / maybe
This model is intended for experimentation, benchmarking, and educational use. It is not intended for clinical decision-making or medical advice.
This model adapts DiffusionGemma to the PubMedQA task. Given a biomedical research question and supporting PubMed abstract context, the model predicts whether the answer is yes, no, or maybe.
unsloth/diffusiongemma-26B-A4B-itqiaojin/PubMedQAkingabzpro/diffusiongemma_pubmedqaunsloth/diffusiongemma-26B-A4B-itqiaojin/PubMedQAThis model can be used to answer PubMedQA-style biomedical research questions where the input includes:
yes, no, or maybeExample task format:
Answer the biomedical research question using only the context.
Context:
[PubMed abstract context]
Question:
[Biomedical research question]
Answer with only one word: yes, no, or maybe.
This model may be useful for:
This model should not be used for:
The model is trained on a narrow benchmark-style task and may produce incorrect answers.
This model has several important limitations:
yes, no, or maybe, so it may oversimplify complex biomedical findings.Users should:
pip install unsloth
pip install transformers datasets peft accelerate sentencepiece protobuf
If this repository contains the LoRA adapter, load the base model first and then attach the adapter:
import copy
import torch
from peft import PeftModel
from unsloth import FastModel
base_model_name = "unsloth/diffusiongemma-26B-A4B-it"
adapter_name = "kingabzpro/diffusiongemma_pubmedqa"
model, tokenizer = FastModel.from_pretrained(
model_name=base_model_name,
dtype=torch.bfloat16,
load_in_4bit=False,
)
model = PeftModel.from_pretrained(model, adapter_name)
processor = tokenizer
tok = processor.tokenizer if hasattr(processor, "tokenizer") else processor
dev = next(
(p.device for p in model.parameters() if p.device.type != "meta"),
torch.device("cuda"),
)
canvas_len = model.config.canvas_length
def answer_question(prompt, steps=16):
input_ids = processor.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
).to(dev)
gen_config = copy.deepcopy(model.generation_config)
gen_config.max_denoising_steps = steps
gen_config.max_new_tokens = canvas_len
model.eval()
with torch.no_grad():
output = model.generate(
input_ids=input_ids,
generation_config=gen_config,
)
generated = output.sequences[0, input_ids.shape[1]:]
text = tok.decode(generated.tolist(), skip_special_tokens=True)
return text.strip().lower()
prompt = """Answer the biomedical research question using only the context.
Context:
[Paste PubMed abstract context here]
Question:
[Paste biomedical question here]
Answer with only one word: yes, no, or maybe."""
print(answer_question(prompt, steps=16))
The model was fine-tuned on qiaojin/PubMedQA.
The notebook used:
pqa_artificialpqa_labeledEach training example was converted into a prompt-answer pair:
Input:
Biomedical question + PubMed abstract context
Target:
yes / no / maybe
For each PubMedQA row:
final_decision field.yes, no, or maybe labels were used.Prompt format:
Answer the biomedical research question using only the context.
Context:
{context}
Question:
{question}
Answer with only one word: yes, no, or maybe.
Target format:
{final_decision}
qiaojin/PubMedQATraining was run on a RunPod H100 notebook.
Training logs from the saved notebook:
step 20/60 | loss 0.0019 | 43s
step 40/60 | loss 0.0003 | 85s
step 60/60 | loss 0.0001 | 126s
Approximate training time:
126 seconds for 60 steps
Evaluation used the pqa_labeled subset of qiaojin/PubMedQA.
The reported run used:
The evaluation was not disaggregated by biomedical topic, article type, answer class, or question type. Results should be treated as a small sanity-check evaluation, not a full benchmark.
Accuracy was used because PubMedQA final decisions are discrete labels:
yes / no / maybe
A prediction was counted as correct if the cleaned model output matched the gold final_decision.
| Setting | Accuracy | Correct / Total |
|---|---|---|
| Before fine-tuning | 0.60 | 30 / 50 |
| After fine-tuning | 0.80 | 40 / 50 |
| Improvement | +0.20 | +10 / 50 |
In the saved RunPod H100 notebook run, the model improved from 60% accuracy before fine-tuning to 80% accuracy after fine-tuning on a 50-example PubMedQA evaluation sample.
This is a +20 percentage point improvement.
The result shows that the model can quickly adapt to the PubMedQA answer format. However, this is a small evaluation and should not be interpreted as a clinically meaningful benchmark.
No detailed interpretability or model examination was performed.
Carbon emissions were not measured for this run.
The base model is DiffusionGemma 26B-A4B IT, a diffusion-style language model. The fine-tuning used LoRA adapters.
The training objective followed a block-diffusion setup:
If you use this model, please cite the original PubMedQA dataset and DiffusionGemma base model.
PubMedQA:
@inproceedings{jin2019pubmedqa,
title={PubMedQA: A Dataset for Biomedical Research Question Answering},
author={Jin, Qiao and Dhingra, Bhuwan and Liu, Zhengping and Cohen, William W. and Lu, Xinghua},
booktitle={Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing},
year={2019}
}
This model was created as a simple fine-tuning experiment for adapting DiffusionGemma to a medical QA dataset.
The task is intentionally simple:
Biomedical context + question → yes / no / maybe
For a stronger medical QA model, future versions should train on both:
Decision: yes/no/maybe
Explanation: short evidence-based explanation
For questions, contact the model repository owner on Hugging Face.