Model details
Intended use
This adapter is shared for:
- studying a small supervised fine-tuning experiment;
- comparing a base model with a fine-tuned adapter;
- reproducing evaluation and failure analysis;
- exploring how fine-tuning and RAG play different roles in a medical-information assistant.
It is not intended for clinical deployment or unsupervised end-user use. Any research use should preserve the warnings and independently validate the outputs.
Training data
The source is MedQuAD, a medical question-answer collection created from NIH websites and published under CC BY 4.0. Please cite the original dataset authors:
Asma Ben Abacha and Dina Demner-Fushman. "A Question-Entailment Approach to Question Answering." BMC Bioinformatics, 2019.
The project produced document-aware train, validation, and test splits. The candidate-v3 smoke run selected records deterministically and balanced them across nine answer-bearing MedQuAD source groups:
- 1,000 training examples selected from 12,444 available records;
- 200 validation examples selected from 1,457 available records;
- the test split was not used for this candidate decision.
The system instruction used during SFT was:
You are a medical information assistant. Answer only the question asked with concise educational information grounded in reliable medical sources. If reliable information is unavailable, say that it is unknown instead of inventing details. Do not prescribe medication, diagnose a patient, or replace a qualified healthcare professional.
Training procedure
Table with columns: Setting, Value| Setting | Value |
|---|
| Method | Supervised fine-tuning with LoRA |
| LoRA rank / alpha | 16 / 16 |
| LoRA dropout | 0.0 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Maximum sequence length | 2,048 tokens |
The run used one NVIDIA GeForce RTX 5060 Ti with approximately 16 GiB VRAM. Training runtime was about 513 seconds. Carbon emissions were not measured.
Evaluation
The base model and adapter were compared on the same 20 validation questions. Generation used temperature 0.7, top-p 0.8, top-k 20, repetition penalty 1.1, and deterministic per-record seeds.
Automatic metrics
Table with columns: Metric, Base, Fine-tuned| Metric | Base | Fine-tuned |
|---|
| Empty answers | 0 | 0 |
| Mean reference token F1 | 0.2741 | 0.3066 |
| Mean latency in seconds | 14.2588 | 13.7565 |
| Per-record token-F1 wins | 7 | 13 |
Token overlap was treated only as an auxiliary metric. It did not predict the human preference outcome.
Manual review
The review was non-blinded, non-clinical, AI-assisted, and limited to 20 validation examples. Scores ranged from 0 to 2.
Table with columns: Criterion, Base, Fine-tuned| Criterion | Base | Fine-tuned |
|---|
| Mean correctness | 1.25 | 1.05 |
| Mean completeness | 1.50 | 1.60 |
| Mean safety | 1.30 | 1.05 |
| Preferred answers | 10 | 7 |
There were three ties, eight safety regressions, and one severe safety regression. The project quality gate rejected this candidate because the fine-tuned model was not preferred more often and showed a severe safety regression.
Known limitations
- The adapter sometimes invents prevalence estimates, causes, genes, symptoms, or treatments not supported by the reference.
- Rare-disease questions were particularly vulnerable to unsupported details.
- Some generations reached the configured 256-new-token limit and ended mid-sentence.
- Repetition was reduced compared with an earlier candidate, but structured repetition still occurred.
- This was a 50-step smoke experiment using 1,000 selected training examples, not a full training run.
- The evaluation sample was small and was not reviewed by a qualified healthcare professional.
- MedQuAD reference answers can contain source-specific wording, duplicated passages, and information that may become outdated.
- The adapter has no retrieval mechanism and cannot verify facts against current sources. A separate RAG layer is required for grounded answers and citations.
Loading the adapter
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "Qwen/Qwen3-4B-Instruct-2507"
adapter_id = "mikaelkanzaki/tech3-v3"
base_revision = "f5d253c7173262c9fbfd68aee1eda21bdc375fb5"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_id,
revision=base_revision,
torch_dtype="auto",
device_map="auto",
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
messages = [
{
"role": "system",
"content": (
"You are a medical information assistant. Answer only the question "
"asked with concise educational information grounded in reliable medical "
"sources. If reliable information is unavailable, say that it is unknown "
"instead of inventing details. Do not prescribe medication, diagnose a "
"patient, or replace a qualified healthcare professional."
),
},
{"role": "user", "content": "What is heart failure?"},
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.8,
top_k=20,
repetition_penalty=1.1,
)
answer = tokenizer.decode(
output[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(answer)
Outputs can be factually wrong even when they sound confident. Do not present them as medical advice.
Reproducibility files
The Hub repository includes the training and model manifests plus the summarized validation decision. The complete project pipeline and tests are maintained in the tech-fine-tuning repository.