vadimbelsky commited on
Commit
4d58b28
·
verified ·
1 Parent(s): 9b6aff8

Add model card

Browse files
Files changed (1) hide show
  1. README.md +105 -0
README.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/Qwen3.5-9B
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - medical
7
+ - emergency-medicine
8
+ - triage
9
+ - dpo
10
+ - rlhf
11
+ - qwen3_5
12
+ - unsloth
13
+ language:
14
+ - en
15
+ license: apache-2.0
16
+ ---
17
+
18
+ # Qwen3.5-9B — Medical Triage Stage 3 DPO
19
+
20
+ Fine-tuned **Qwen3.5-9B** for emergency department triage decision support. This is the fully merged Stage 3 checkpoint, aligned with DPO to reduce over-triage and preserve recall for high-acuity patients.
21
+
22
+ ## Model Description
23
+
24
+ | Property | Value |
25
+ |---|---|
26
+ | Base model | `unsloth/Qwen3.5-9B` |
27
+ | Architecture | Qwen 3.5 — 9B parameters |
28
+ | Precision | bfloat16 |
29
+ | Training stages | 3 (SFT stage 1 → SFT stage 2 → DPO stage 3) |
30
+ | Task | Emergency triage — ESI level assignment from SOAP notes |
31
+
32
+ ## Training — Stage 3 (this checkpoint)
33
+
34
+ Stage 3 applies Direct Preference Optimization (DPO) on top of Stage 2 SFT adapters to correct over-triage bias.
35
+
36
+ | Hyperparameter | Value |
37
+ |---|---|
38
+ | Method | DPO (sigmoid loss) |
39
+ | Beta | 0.1 |
40
+ | Learning rate | 5e-5 |
41
+ | Epochs | 1 |
42
+ | Batch size | 2 × 8 grad accum = 16 effective |
43
+ | Optimizer | AdamW 8-bit |
44
+ | LoRA rank | 16 |
45
+ | Training pairs | 3,730 |
46
+ | Validation pairs | 197 |
47
+ | Framework | Unsloth + TRL |
48
+
49
+ **Alignment objective:** reduce over-triage (assigning ESI 1/2 to ESI 3/4/5 cases) while preserving recall for truly high-acuity patients.
50
+
51
+ ## System Prompt
52
+
53
+ ```
54
+ You are an expert emergency medicine triage nurse. Given a SOAP intake note, provide a structured triage decision including ESI level with justification, key clinical findings, time-to-provider target, and any immediate interventions required.
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ ```python
60
+ from transformers import AutoModelForCausalLM, AutoTokenizer
61
+ import torch
62
+
63
+ model_id = "vadimbelsky/qwen3.5-medical-ft-stage3-dpo"
64
+
65
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
66
+ model = AutoModelForCausalLM.from_pretrained(
67
+ model_id,
68
+ dtype=torch.bfloat16,
69
+ device_map="auto",
70
+ )
71
+
72
+ system_prompt = (
73
+ "You are an expert emergency medicine triage nurse. "
74
+ "Given a SOAP intake note, provide a structured triage decision including "
75
+ "ESI level with justification, key clinical findings, time-to-provider target, "
76
+ "and any immediate interventions required."
77
+ )
78
+
79
+ soap_note = """
80
+ S: 67-year-old male, chest pain radiating to left arm x 45 minutes, diaphoretic, nausea.
81
+ O: BP 160/95, HR 102, RR 20, SpO2 96% RA, temp 37.1°C.
82
+ A: Suspected ACS / STEMI rule-out.
83
+ P: 12-lead ECG, troponin, aspirin 325mg, IV access.
84
+ """
85
+
86
+ messages = [
87
+ {"role": "system", "content": system_prompt},
88
+ {"role": "user", "content": soap_note.strip()},
89
+ ]
90
+
91
+ inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(model.device)
92
+ outputs = model.generate(inputs, max_new_tokens=512, temperature=0.1, do_sample=True)
93
+ print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
94
+ ```
95
+
96
+ ## Intended Use
97
+
98
+ - Clinical decision support tool for emergency triage education and research
99
+ - **Not validated for clinical deployment** — always defer to licensed clinical staff
100
+
101
+ ## Limitations
102
+
103
+ - Trained on a curated DPO dataset; real-world distribution may differ
104
+ - Does not replace clinical judgment or access to vital signs, lab results, or imaging
105
+ - Performance on rare ESI 1 presentations (e.g. cardiac arrest, airway emergency) should be independently validated