đ QwenMedic-v1
QwenMedic-v1 is a specialized medical model fine - tuned from Qwen3 - 1.7B, designed for clinical reasoning and instruction - following tasks, enhancing diagnostic Q&A and clinical summarization.
đ Quick Start
The following is a quick overview of the QwenMedic-v1 model. For more detailed information, please refer to the subsequent sections.
⨠Features
- Medical Specialization: Adapted from the Qwen3 - 1.7B causal language model, specifically fine - tuned for medical tasks such as clinical reasoning, diagnostic Q&A, and clinical summarization.
- Data - Driven: Trained on two curated medical datasets to improve performance in medical scenarios.
- Flexible Quantization: Supports float16 and int4 quantization.
đĻ Installation
The README does not provide installation steps, so this section is skipped.
đģ Usage Examples
Basic Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/QwenMedic-v1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
prompt = "A 55-year-old male with Type 2 diabetes presents with sudden chest pain "
"and diaphoresis. What are the top differential diagnoses?"
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
try:
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("thinking content:", thinking_content)
print("content:", content)
đ Documentation
Overview
QwenMedic-v1 is a medical - specialty adaptation of the Qwen3 - 1.7B causal language model, fine - tuned for clinical reasoning and instruction - following tasks. It was trained for 1 epoch on two curated medical datasets to improve diagnostic Q&A and clinical summarization.
Base Model
Property |
Details |
Model Type |
Qwen3 - 1.7B (28 layers, 16 Q / 8 KV attention heads, 32 768 - token context) |
Parameters |
1.7 billion |
Quantization |
float16 and int4 supported |
Fine - Tuning Data
-
Medical Reasoning SFT (FreedomIntelligence/medical - o1 - reasoning - SFT
)
- Chain - of - thought reasoning examples on verifiable medical problems
- Language: English
- Split used:
train
-
General Medical Instruction (jtatman/medical - sci - instruct - 1m - sharegpt
)
- Conversational Q&A prompts across medical topics
- Sampled first 100 000 examples via
train[:100000]
Training Configuration
- Framework: PyTorch + Hugging Face Transformers
- Optimizer: AdamW
- Learning Rate: 2 Ã 10âģâĩ
- Batch Size: 16 (with gradient accumulation)
- Precision: bfloat16 mixed precision
- Hardware: NVIDIA RTX 3090 (24 GB)
Intended Uses
- Clinical question answering & differential diagnosis
- Summarization of patient notes
- Medical education & decision support
Limitations & Risks
â ī¸ Important Note
- The model may produce hallucinations or plausible - sounding but incorrect advice.
- There may be biases due to training - data coverage.
- The model is Not FDA - approved and should not replace professional medical judgment.
- Avoid feeding patient - identifiable data without proper de - identification.
Summary of Final Training Metrics
Metric |
Step |
Smoothed |
Raw Value |
Epoch |
1539 |
0.9979 |
0.9997 |
Gradient Norm |
1539 |
0.3882 |
0.3974 |
Learning Rate |
1539 |
â |
0 |
Training Loss |
1539 |
1.5216 |
1.4703 |
Contact
- Creator: Andre Ross
- Company: Ross Technologies
- Email: devops.ross@gmail.com
đ License
The model is released under the apache - 2.0 license.