Text Generation
Transformers
Safetensors
English
medical
q&a
pubmedqa
diffusiongemma
lora
unsloth
conversational
Instructions to use kingabzpro/diffusiongemma_pubmedqa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kingabzpro/diffusiongemma_pubmedqa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kingabzpro/diffusiongemma_pubmedqa") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("kingabzpro/diffusiongemma_pubmedqa", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kingabzpro/diffusiongemma_pubmedqa with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kingabzpro/diffusiongemma_pubmedqa" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kingabzpro/diffusiongemma_pubmedqa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kingabzpro/diffusiongemma_pubmedqa
- SGLang
How to use kingabzpro/diffusiongemma_pubmedqa with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kingabzpro/diffusiongemma_pubmedqa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kingabzpro/diffusiongemma_pubmedqa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kingabzpro/diffusiongemma_pubmedqa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kingabzpro/diffusiongemma_pubmedqa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use kingabzpro/diffusiongemma_pubmedqa with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kingabzpro/diffusiongemma_pubmedqa to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kingabzpro/diffusiongemma_pubmedqa to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kingabzpro/diffusiongemma_pubmedqa to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="kingabzpro/diffusiongemma_pubmedqa", max_seq_length=2048, ) - Docker Model Runner
How to use kingabzpro/diffusiongemma_pubmedqa with Docker Model Runner:
docker model run hf.co/kingabzpro/diffusiongemma_pubmedqa
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,436 @@
|
|
| 1 |
-
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
| 4 |
-
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
-
### Downstream Use
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
### Out-of-Scope Use
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
## Bias, Risks, and Limitations
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
### Recommendations
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
## How to Get Started with the Model
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
### Training Procedure
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
|
|
|
| 92 |
|
| 93 |
-
|
|
|
|
| 94 |
|
| 95 |
-
|
|
|
|
| 96 |
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
-
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
### Testing Data, Factors & Metrics
|
| 108 |
|
| 109 |
#### Testing Data
|
| 110 |
|
| 111 |
-
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
|
|
|
|
|
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
|
| 120 |
|
| 121 |
#### Metrics
|
| 122 |
|
| 123 |
-
|
| 124 |
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
### Results
|
| 128 |
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
#### Summary
|
| 132 |
|
|
|
|
| 133 |
|
|
|
|
| 134 |
|
| 135 |
-
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
|
| 140 |
|
| 141 |
## Environmental Impact
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
|
| 147 |
-
- **Hardware Type:**
|
| 148 |
-
- **Hours used:**
|
| 149 |
-
- **Cloud Provider:**
|
| 150 |
-
- **Compute Region:**
|
| 151 |
-
- **Carbon Emitted:**
|
| 152 |
|
| 153 |
-
## Technical Specifications
|
| 154 |
|
| 155 |
### Model Architecture and Objective
|
| 156 |
|
| 157 |
-
|
| 158 |
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
#### Hardware
|
| 164 |
|
| 165 |
-
|
|
|
|
| 166 |
|
| 167 |
#### Software
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
|
| 172 |
|
| 173 |
-
|
| 174 |
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
-
|
|
|
|
|
|
|
| 188 |
|
| 189 |
-
|
| 190 |
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
-
## Model Card Authors
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
+
```
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- medical
|
| 5 |
+
- q&a
|
| 6 |
+
- pubmedqa
|
| 7 |
+
- diffusiongemma
|
| 8 |
+
- lora
|
| 9 |
+
- unsloth
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
datasets:
|
| 12 |
+
- qiaojin/PubMedQA
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
metrics:
|
| 16 |
+
- accuracy
|
| 17 |
+
base_model:
|
| 18 |
+
- google/diffusiongemma-26B-A4B-it
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
# DiffusionGemma PubMedQA
|
| 23 |
+
|
| 24 |
+
This model is a LoRA fine-tuned version of **DiffusionGemma 26B-A4B IT** for biomedical question answering on **PubMedQA**.
|
| 25 |
+
|
| 26 |
+
The model was fine-tuned to answer biomedical research questions using PubMed abstract context and return one of three labels:
|
| 27 |
+
|
| 28 |
+
```text
|
| 29 |
+
yes / no / maybe
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
> This model is intended for experimentation, benchmarking, and educational use. It is **not** intended for clinical decision-making or medical advice.
|
| 33 |
|
| 34 |
## Model Details
|
| 35 |
|
| 36 |
### Model Description
|
| 37 |
|
| 38 |
+
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`.
|
| 39 |
|
| 40 |
+
- **Developed by:** kingabzpro
|
| 41 |
+
- **Shared by:** kingabzpro
|
| 42 |
+
- **Model type:** Diffusion language model with LoRA adapter
|
| 43 |
+
- **Language(s):** English
|
| 44 |
+
- **License:** Apache 2.0
|
| 45 |
+
- **Fine-tuned from:** `google/diffusiongemma-26B-A4B-it`
|
| 46 |
+
- **Training framework:** Unsloth + Transformers
|
| 47 |
+
- **Task:** Biomedical question answering / text generation
|
| 48 |
+
- **Dataset:** `qiaojin/PubMedQA`
|
| 49 |
|
| 50 |
+
### Model Sources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
- **Repository:** `kingabzpro/diffusiongemma_pubmedqa`
|
| 53 |
+
- **Base model:** `google/diffusiongemma-26B-A4B-it`
|
| 54 |
+
- **Dataset:** `qiaojin/PubMedQA`
|
| 55 |
|
| 56 |
+
## Uses
|
| 57 |
|
| 58 |
+
### Direct Use
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
This model can be used to answer PubMedQA-style biomedical research questions where the input includes:
|
| 61 |
|
| 62 |
+
1. A biomedical research question
|
| 63 |
+
2. Relevant abstract/context text
|
| 64 |
+
3. A request to answer with `yes`, `no`, or `maybe`
|
| 65 |
|
| 66 |
+
Example task format:
|
| 67 |
+
|
| 68 |
+
```text
|
| 69 |
+
Answer the biomedical research question using only the context.
|
| 70 |
+
|
| 71 |
+
Context:
|
| 72 |
+
[PubMed abstract context]
|
| 73 |
|
| 74 |
+
Question:
|
| 75 |
+
[Biomedical research question]
|
| 76 |
|
| 77 |
+
Answer with only one word: yes, no, or maybe.
|
| 78 |
+
```
|
| 79 |
|
| 80 |
+
### Downstream Use
|
| 81 |
|
| 82 |
+
This model may be useful for:
|
| 83 |
|
| 84 |
+
- Biomedical QA experiments
|
| 85 |
+
- PubMedQA-style benchmark testing
|
| 86 |
+
- Fine-tuning tutorials
|
| 87 |
+
- LoRA adapter experiments with DiffusionGemma
|
| 88 |
+
- Educational demos for medical-domain model adaptation
|
| 89 |
|
| 90 |
### Out-of-Scope Use
|
| 91 |
|
| 92 |
+
This model should **not** be used for:
|
| 93 |
|
| 94 |
+
- Medical diagnosis
|
| 95 |
+
- Treatment recommendations
|
| 96 |
+
- Emergency medical advice
|
| 97 |
+
- Replacing a doctor, pharmacist, or clinical expert
|
| 98 |
+
- Patient-specific medical decisions
|
| 99 |
+
- High-stakes biomedical or healthcare deployment without further validation
|
| 100 |
+
|
| 101 |
+
The model is trained on a narrow benchmark-style task and may produce incorrect answers.
|
| 102 |
|
| 103 |
## Bias, Risks, and Limitations
|
| 104 |
|
| 105 |
+
This model has several important limitations:
|
| 106 |
|
| 107 |
+
- It was fine-tuned on PubMedQA-style examples, not general medical conversations.
|
| 108 |
+
- The model predicts only `yes`, `no`, or `maybe`, so it may oversimplify complex biomedical findings.
|
| 109 |
+
- The evaluation set used in this experiment was small: 50 examples.
|
| 110 |
+
- The model may be sensitive to prompt format.
|
| 111 |
+
- The model may answer incorrectly if the context is incomplete, misleading, or unrelated.
|
| 112 |
+
- The training target was short, so the loss dropped quickly and may not reflect deep medical reasoning.
|
| 113 |
+
- The model should not be treated as medically reliable.
|
| 114 |
|
| 115 |
### Recommendations
|
| 116 |
|
| 117 |
+
Users should:
|
| 118 |
|
| 119 |
+
- Use this model only for research and educational experiments.
|
| 120 |
+
- Always verify outputs against trusted biomedical sources.
|
| 121 |
+
- Avoid using the model for real clinical or patient-facing decisions.
|
| 122 |
+
- Run larger evaluations before drawing strong conclusions.
|
| 123 |
+
- Consider training on explanations, not only one-word labels, for a more meaningful medical QA setup.
|
| 124 |
|
| 125 |
## How to Get Started with the Model
|
| 126 |
|
| 127 |
+
### Install dependencies
|
| 128 |
+
|
| 129 |
+
```bash
|
| 130 |
+
pip install unsloth
|
| 131 |
+
pip install transformers datasets peft accelerate sentencepiece protobuf
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
### Load the model
|
| 135 |
+
|
| 136 |
+
If this repository contains the LoRA adapter, load the base model first and then attach the adapter:
|
| 137 |
+
|
| 138 |
+
```python
|
| 139 |
+
import copy
|
| 140 |
+
import torch
|
| 141 |
+
from peft import PeftModel
|
| 142 |
+
from unsloth import FastModel
|
| 143 |
+
|
| 144 |
+
base_model_name = "unsloth/diffusiongemma-26B-A4B-it"
|
| 145 |
+
adapter_name = "kingabzpro/diffusiongemma_pubmedqa"
|
| 146 |
+
|
| 147 |
+
model, tokenizer = FastModel.from_pretrained(
|
| 148 |
+
model_name=base_model_name,
|
| 149 |
+
dtype=torch.bfloat16,
|
| 150 |
+
load_in_4bit=False,
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
model = PeftModel.from_pretrained(model, adapter_name)
|
| 154 |
+
|
| 155 |
+
processor = tokenizer
|
| 156 |
+
tok = processor.tokenizer if hasattr(processor, "tokenizer") else processor
|
| 157 |
+
|
| 158 |
+
dev = next(
|
| 159 |
+
(p.device for p in model.parameters() if p.device.type != "meta"),
|
| 160 |
+
torch.device("cuda"),
|
| 161 |
+
)
|
| 162 |
+
|
| 163 |
+
canvas_len = model.config.canvas_length
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
### Run inference
|
| 167 |
+
|
| 168 |
+
```python
|
| 169 |
+
def answer_question(prompt, steps=16):
|
| 170 |
+
input_ids = processor.apply_chat_template(
|
| 171 |
+
[{"role": "user", "content": prompt}],
|
| 172 |
+
tokenize=True,
|
| 173 |
+
add_generation_prompt=True,
|
| 174 |
+
return_tensors="pt",
|
| 175 |
+
).to(dev)
|
| 176 |
+
|
| 177 |
+
gen_config = copy.deepcopy(model.generation_config)
|
| 178 |
+
gen_config.max_denoising_steps = steps
|
| 179 |
+
gen_config.max_new_tokens = canvas_len
|
| 180 |
+
|
| 181 |
+
model.eval()
|
| 182 |
+
|
| 183 |
+
with torch.no_grad():
|
| 184 |
+
output = model.generate(
|
| 185 |
+
input_ids=input_ids,
|
| 186 |
+
generation_config=gen_config,
|
| 187 |
+
)
|
| 188 |
|
| 189 |
+
generated = output.sequences[0, input_ids.shape[1]:]
|
| 190 |
+
text = tok.decode(generated.tolist(), skip_special_tokens=True)
|
| 191 |
+
|
| 192 |
+
return text.strip().lower()
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
prompt = """Answer the biomedical research question using only the context.
|
| 196 |
+
|
| 197 |
+
Context:
|
| 198 |
+
[Paste PubMed abstract context here]
|
| 199 |
+
|
| 200 |
+
Question:
|
| 201 |
+
[Paste biomedical question here]
|
| 202 |
+
|
| 203 |
+
Answer with only one word: yes, no, or maybe."""
|
| 204 |
+
|
| 205 |
+
print(answer_question(prompt, steps=16))
|
| 206 |
+
```
|
| 207 |
|
| 208 |
## Training Details
|
| 209 |
|
| 210 |
### Training Data
|
| 211 |
|
| 212 |
+
The model was fine-tuned on `qiaojin/PubMedQA`.
|
| 213 |
|
| 214 |
+
The notebook used:
|
| 215 |
+
|
| 216 |
+
- **Training split:** `pqa_artificial`
|
| 217 |
+
- **Evaluation split:** `pqa_labeled`
|
| 218 |
+
- **Training examples used:** 3,000
|
| 219 |
+
- **Evaluation examples prepared:** 200
|
| 220 |
+
- **Evaluation examples used for reported result:** 50
|
| 221 |
+
|
| 222 |
+
Each training example was converted into a prompt-answer pair:
|
| 223 |
+
|
| 224 |
+
```text
|
| 225 |
+
Input:
|
| 226 |
+
Biomedical question + PubMed abstract context
|
| 227 |
+
|
| 228 |
+
Target:
|
| 229 |
+
yes / no / maybe
|
| 230 |
+
```
|
| 231 |
|
| 232 |
### Training Procedure
|
| 233 |
|
| 234 |
+
#### Preprocessing
|
| 235 |
|
| 236 |
+
For each PubMedQA row:
|
| 237 |
|
| 238 |
+
1. The abstract contexts were joined into one context block.
|
| 239 |
+
2. The context was truncated to 2,500 characters.
|
| 240 |
+
3. The question was inserted below the context.
|
| 241 |
+
4. The target answer was the `final_decision` field.
|
| 242 |
+
5. Only examples with `yes`, `no`, or `maybe` labels were used.
|
| 243 |
|
| 244 |
+
Prompt format:
|
| 245 |
|
| 246 |
+
```text
|
| 247 |
+
Answer the biomedical research question using only the context.
|
| 248 |
|
| 249 |
+
Context:
|
| 250 |
+
{context}
|
| 251 |
|
| 252 |
+
Question:
|
| 253 |
+
{question}
|
| 254 |
|
| 255 |
+
Answer with only one word: yes, no, or maybe.
|
| 256 |
+
```
|
| 257 |
|
| 258 |
+
Target format:
|
| 259 |
|
| 260 |
+
```text
|
| 261 |
+
{final_decision}
|
| 262 |
+
```
|
| 263 |
|
| 264 |
+
#### Training Hyperparameters
|
| 265 |
+
|
| 266 |
+
- **Training regime:** bf16
|
| 267 |
+
- **LoRA rank:** 64
|
| 268 |
+
- **LoRA alpha:** 128
|
| 269 |
+
- **Trainable parameters:** 149,630,976
|
| 270 |
+
- **Total parameters:** 25,973,409,840
|
| 271 |
+
- **Trainable percentage:** 0.5761%
|
| 272 |
+
- **Training examples:** 3,000
|
| 273 |
+
- **Training steps:** 60
|
| 274 |
+
- **Gradient accumulation:** 4
|
| 275 |
+
- **Learning rate:** 1e-4
|
| 276 |
+
- **Optimizer:** AdamW
|
| 277 |
+
- **Scheduler:** OneCycleLR
|
| 278 |
+
- **Weight decay:** 0.0
|
| 279 |
+
- **Max context characters:** 2,500
|
| 280 |
+
- **Canvas length:** 256
|
| 281 |
+
- **Dataset:** `qiaojin/PubMedQA`
|
| 282 |
+
|
| 283 |
+
#### Speeds, Sizes, Times
|
| 284 |
+
|
| 285 |
+
Training was run on a RunPod H100 notebook.
|
| 286 |
+
|
| 287 |
+
Training logs from the saved notebook:
|
| 288 |
+
|
| 289 |
+
```text
|
| 290 |
+
step 20/60 | loss 0.0019 | 43s
|
| 291 |
+
step 40/60 | loss 0.0003 | 85s
|
| 292 |
+
step 60/60 | loss 0.0001 | 126s
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
Approximate training time:
|
| 296 |
+
|
| 297 |
+
```text
|
| 298 |
+
126 seconds for 60 steps
|
| 299 |
+
```
|
| 300 |
+
|
| 301 |
+
## Evaluation
|
| 302 |
|
| 303 |
### Testing Data, Factors & Metrics
|
| 304 |
|
| 305 |
#### Testing Data
|
| 306 |
|
| 307 |
+
Evaluation used the `pqa_labeled` subset of `qiaojin/PubMedQA`.
|
| 308 |
|
| 309 |
+
The reported run used:
|
| 310 |
|
| 311 |
+
- **Evaluation examples:** 50
|
| 312 |
+
- **Denoising steps:** 16
|
| 313 |
+
- **Metric:** Accuracy
|
| 314 |
|
| 315 |
+
#### Factors
|
| 316 |
|
| 317 |
+
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.
|
| 318 |
|
| 319 |
#### Metrics
|
| 320 |
|
| 321 |
+
Accuracy was used because PubMedQA final decisions are discrete labels:
|
| 322 |
|
| 323 |
+
```text
|
| 324 |
+
yes / no / maybe
|
| 325 |
+
```
|
| 326 |
+
|
| 327 |
+
A prediction was counted as correct if the cleaned model output matched the gold `final_decision`.
|
| 328 |
|
| 329 |
### Results
|
| 330 |
|
| 331 |
+
| Setting | Accuracy | Correct / Total |
|
| 332 |
+
| --- | --- | --- |
|
| 333 |
+
| Before fine-tuning | 0.60 | 30 / 50 |
|
| 334 |
+
| After fine-tuning | 0.80 | 40 / 50 |
|
| 335 |
+
| Improvement | +0.20 | +10 / 50 |
|
| 336 |
|
| 337 |
#### Summary
|
| 338 |
|
| 339 |
+
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.
|
| 340 |
|
| 341 |
+
This is a **+20 percentage point improvement**.
|
| 342 |
|
| 343 |
+
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.
|
| 344 |
|
| 345 |
+
## Model Examination
|
| 346 |
|
| 347 |
+
No detailed interpretability or model examination was performed.
|
| 348 |
|
| 349 |
## Environmental Impact
|
| 350 |
|
| 351 |
+
Carbon emissions were not measured for this run.
|
|
|
|
|
|
|
| 352 |
|
| 353 |
+
- **Hardware Type:** NVIDIA H100 80GB HBM3
|
| 354 |
+
- **Hours used:** Approximately 0.04 hours for the 60-step training loop, excluding setup, model loading, and evaluation
|
| 355 |
+
- **Cloud Provider:** RunPod
|
| 356 |
+
- **Compute Region:** Not recorded
|
| 357 |
+
- **Carbon Emitted:** Not measured
|
| 358 |
|
| 359 |
+
## Technical Specifications
|
| 360 |
|
| 361 |
### Model Architecture and Objective
|
| 362 |
|
| 363 |
+
The base model is DiffusionGemma 26B-A4B IT, a diffusion-style language model. The fine-tuning used LoRA adapters.
|
| 364 |
|
| 365 |
+
The training objective followed a block-diffusion setup:
|
| 366 |
|
| 367 |
+
1. Encode the target answer into the model canvas.
|
| 368 |
+
2. Randomly corrupt answer tokens.
|
| 369 |
+
3. Train the model to reconstruct the clean answer.
|
| 370 |
+
4. Apply loss only over the target answer tokens.
|
| 371 |
+
|
| 372 |
+
### Compute Infrastructure
|
| 373 |
|
| 374 |
#### Hardware
|
| 375 |
|
| 376 |
+
- NVIDIA H100 80GB HBM3
|
| 377 |
+
- Reported GPU memory: approximately 85 GB total
|
| 378 |
|
| 379 |
#### Software
|
| 380 |
|
| 381 |
+
- Python
|
| 382 |
+
- PyTorch 2.10.0+cu128
|
| 383 |
+
- Transformers
|
| 384 |
+
- Unsloth
|
| 385 |
+
- Unsloth Zoo
|
| 386 |
+
- PEFT
|
| 387 |
+
- Datasets
|
| 388 |
+
- RunPod Jupyter Notebook
|
| 389 |
+
|
| 390 |
+
## Citation
|
| 391 |
|
| 392 |
+
If you use this model, please cite the original PubMedQA dataset and DiffusionGemma base model.
|
| 393 |
|
| 394 |
+
**PubMedQA:**
|
| 395 |
|
| 396 |
+
```bibtex
|
| 397 |
+
@inproceedings{jin2019pubmedqa,
|
| 398 |
+
title={PubMedQA: A Dataset for Biomedical Research Question Answering},
|
| 399 |
+
author={Jin, Qiao and Dhingra, Bhuwan and Liu, Zhengping and Cohen, William W. and Lu, Xinghua},
|
| 400 |
+
booktitle={Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing},
|
| 401 |
+
year={2019}
|
| 402 |
+
}
|
| 403 |
+
```
|
| 404 |
|
| 405 |
+
## Glossary
|
| 406 |
|
| 407 |
+
- **PubMedQA:** A biomedical question-answering dataset based on PubMed abstracts.
|
| 408 |
+
- **LoRA:** Low-Rank Adaptation, a parameter-efficient fine-tuning method.
|
| 409 |
+
- **DiffusionGemma:** A diffusion-style language model.
|
| 410 |
+
- **Denoising steps:** Iterative generation steps used by diffusion models.
|
| 411 |
+
- **Accuracy:** Percentage of predictions matching the gold label.
|
| 412 |
|
| 413 |
+
## More Information
|
| 414 |
|
| 415 |
+
This model was created as a simple fine-tuning experiment for adapting DiffusionGemma to a medical QA dataset.
|
| 416 |
|
| 417 |
+
The task is intentionally simple:
|
| 418 |
|
| 419 |
+
```text
|
| 420 |
+
Biomedical context + question → yes / no / maybe
|
| 421 |
+
```
|
| 422 |
|
| 423 |
+
For a stronger medical QA model, future versions should train on both:
|
| 424 |
|
| 425 |
+
```text
|
| 426 |
+
Decision: yes/no/maybe
|
| 427 |
+
Explanation: short evidence-based explanation
|
| 428 |
+
```
|
| 429 |
|
| 430 |
+
## Model Card Authors
|
| 431 |
|
| 432 |
+
- kingabzpro
|
| 433 |
|
| 434 |
## Model Card Contact
|
| 435 |
|
| 436 |
+
For questions, contact the model repository owner on Hugging Face.
|