376 11 months ago

A specialized medical model fine-tuned from Qwen3 using SFT and Group Relative Policy Optimization (GRPO) for advanced clinical case analysis.

ollama run lastmass/Qwen3_Medical_GRPO

Details

11 months ago

26fcde2cdfa5 · 2.5GB ·

qwen3
·
4.02B
·
Q4_K_M
{{- if .System }} {{ .System }}|endoftext| {{- end }} {{- range .Messages }} {{- if eq .Role "user"
You are given a problem. Think about the problem and provide your working out. Place it between <sta
{ "stop": [ "|endoftext|" ], "temperature": 0.7, "top_k": 20, "top_p": 0

Readme

Qwen3-Medical-GRPO

Model Description

This is a specialized medical language model fine-tuned from the powerful Qwen3 base model. It is designed to assist with clinical case analysis, differential diagnosis, and medical reasoning tasks.

The model was first trained using Supervised Fine-Tuning (SFT) on a curated medical dataset. Subsequently, it was further aligned using GRPO (Group Relative Policy Optimization) to enhance the quality, accuracy, and logical consistency of its responses.

How to Use

This model uses a specific output structure to separate its reasoning process from the final conclusion. This allows users to understand how the model arrived at an answer, providing greater transparency.

The output format is as follows:

  • <start_working_out> ... <end_working_out>: This block contains the model’s internal monologue or “Chain-of-Thought” (CoT). It details the step-by-step reasoning, analysis of symptoms, and evaluation of differential diagnoses. This is the “thinking process.”

  • <SOLUTION> ... </SOLUTION>: This block contains the final, synthesized conclusion or answer to the user’s prompt. For any application, this is the part you would typically parse and display as the definitive result.

Example

Here is an example of how to interact with the model and interpret its output.

Prompt:

A 68-year-old female with a history of Type 2 Diabetes Mellitus and Hypertension is brought to the emergency department due to a 2-day history of increasing confusion and lethargy. Vitals: Temp 38.8°C, HR 115 bpm, BP 95/60 mmHg, RR 24/min. Labs: WBC 18,500/mm³, Glucose 30.5 mmol/L, Bicarbonate 12 mmol/L. Urinalysis: Large ketones, positive nitrites. ABG: pH 7.25. Please provide a comprehensive assessment, likely diagnosis, and initial management principles.

Model Output:

<start_working_out>
The patient is an elderly female with a known history of T2DM presenting with altered mental status, fever, and hypotension. This clinical picture suggests a severe underlying process. The high WBC count points towards an infection. The combination of severe hyperglycemia (30.5 mmol/L), low bicarbonate (12 mmol/L), and an acidic pH (7.25) is classic for Diabetic Ketoacidosis (DKA). The urinalysis is key; positive ketones confirm ketosis, and positive nitrites strongly suggest a Urinary Tract Infection (UTI). Therefore, the most likely scenario is a UTI acting as a trigger for DKA, leading to dehydration, electrolyte imbalance, and altered mental status. The initial management should focus on stabilizing the patient...
<end_working_out>
<SOLUTION>
Based on the provided clinical and laboratory data, the patient's primary diagnosis is **Diabetic Ketoacidosis (DKA)**, likely precipitated by **Urosepsis** (sepsis originating from a urinary tract infection).

**Key Problems:**
1.  **Metabolic:** Diabetic Ketoacidosis (DKA) with severe hyperglycemia, ketonemia, and metabolic acidosis.
2.  **Infectious:** Sepsis secondary to a Urinary Tract Infection (UTI), evidenced by fever, tachycardia, hypotension, high WBC count, and positive urinalysis.
3.  **Renal & Electrolytes:** Acute Kidney Injury (AKI) and significant electrolyte derangements secondary to dehydration and acidosis.

**Initial Management Principles:**
1.  **Fluid Resuscitation:** Immediate and aggressive intravenous fluid administration (e.g., normal saline) to correct dehydration and improve hemodynamic stability.
2.  **Insulin Therapy:** Start an intravenous insulin infusion to lower blood glucose and resolve ketosis.
3.  **Electrolyte Correction:** Closely monitor and correct electrolytes, especially potassium.
4.  **Antibiotic Administration:** Promptly administer broad-spectrum antibiotics to treat the underlying UTI/sepsis.
</SOLUTION>

⚠️ Disclaimer

This model is intended for research, educational, and informational purposes only. It is NOT a substitute for professional medical advice, diagnosis, or treatment.

DO NOT use the information or outputs from this model to make real-world medical decisions for yourself or others. The generated content may be inaccurate, incomplete, or outdated.

Always consult with a qualified healthcare professional for any medical concerns or before making any health-related decisions.