NayanPal commited on
Commit
2fa83c1
Β·
verified Β·
1 Parent(s): 0cfb9ae

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +95 -17
README.md CHANGED
@@ -1,32 +1,110 @@
1
- # TruthTriage – Medical Safety Fine-Tuned LLM
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- ## Base Model
4
- unsloth/llama-2-7b-bnb-4bit
5
 
6
- ## Fine-tuning Method
7
- - LoRA (rank=16)
8
- - 4-bit quantization
9
- - Trained using Unsloth + TRL SFTTrainer
10
- - GPU: Tesla T4
11
 
12
- ## Dataset
13
- FreedomIntelligence/medical-o1-reasoning-SFT
14
 
15
- ## Purpose
16
- TruthTriage is designed to:
17
  - Analyze pharmaceutical safety queries
18
- - Assign risk levels (Low / Moderate / High)
19
- - Provide medically grounded responses
20
- - Avoid hallucinated medical claims
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- ## Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ```python
25
  from unsloth import FastLanguageModel
26
 
 
27
  model, tokenizer = FastLanguageModel.from_pretrained(
28
  "unsloth/llama-2-7b-bnb-4bit",
29
  load_in_4bit=True,
30
  )
31
 
32
- model.load_adapter("NayanPal/truthtriage-llama2-7b")
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ base_model: unsloth/llama-2-7b-bnb-4bit
5
+ tags:
6
+ - medical
7
+ - safety
8
+ - lora
9
+ - peft
10
+ - transformers
11
+ - unsloth
12
+ - sft
13
+ - hackathon
14
+ ---
15
 
16
+ # TruthTriage – Safety-Tuned Medical Assistant (LoRA)
 
17
 
18
+ ## 🩺 Overview
 
 
 
 
19
 
20
+ TruthTriage is a safety-aligned medical assistant fine-tuned to:
 
21
 
 
 
22
  - Analyze pharmaceutical safety queries
23
+ - Classify risk levels (Low / Moderate / High)
24
+ - Provide structured, grounded responses
25
+ - Avoid hallucinated medical advice
26
+ - Escalate emergency scenarios appropriately
27
+
28
+ This model is a LoRA adapter built on top of:
29
+
30
+ **Base Model:** `unsloth/llama-2-7b-bnb-4bit`
31
+
32
+ ---
33
+
34
+ ## 🧠 Fine-Tuning Details
35
+
36
+ - Method: LoRA (Low-Rank Adaptation)
37
+ - Quantization: 4-bit
38
+ - Framework: Unsloth + TRL SFTTrainer
39
+ - GPU: Tesla T4
40
+ - Trainable Parameters: ~0.3% of total model
41
+ - Training Samples: 662
42
+
43
+ ---
44
+
45
+ ## πŸ“Š Dataset Overview
46
+
47
+ ### Dataset: TruthTriage Safety-Tuned Medical Dataset
48
+ **Total Examples: 662**
49
+
50
+ This dataset was designed and curated by our team specifically for safety-aligned medical AI fine-tuning.
51
+
52
+ ### πŸ”Ή Dataset Composition
53
 
54
+ | Source | Count |
55
+ |--------|-------|
56
+ | ChatDoctor (Reformatted & Structured) | 500 |
57
+ | Refusal (High-Risk Queries) | 20 |
58
+ | Clarification β€” Ask | 20 |
59
+ | Clarification β€” Answer | 20 |
60
+ | Escalation (Emergency Cases) | 20 |
61
+ | General Knowledge | 20 |
62
+ | Out of Scope | 20 |
63
+ | Identity / System Persona | 20 |
64
+ | No Source Found | 22 |
65
+ | **Total** | **662** |
66
+
67
+ ---
68
+
69
+ ## πŸ›‘οΈ Safety Design
70
+
71
+ The dataset explicitly teaches:
72
+
73
+ - Controlled refusal for unsafe requests
74
+ - Emergency escalation behavior
75
+ - Clarification when information is missing
76
+ - Identity transparency
77
+ - Handling out-of-scope questions
78
+ - Risk-level classification
79
+
80
+ ### Tone Strategy
81
+
82
+ | Situation | Emoji |
83
+ |------------|--------|
84
+ | Danger / Disclaimer | πŸ’€ |
85
+ | Out of Scope (Light Tone) | 🌚 |
86
+ | Serious Cases (Refusal / Clarification / Identity) | None |
87
+
88
+ ---
89
+
90
+ ## πŸš€ How to Use
91
 
92
  ```python
93
  from unsloth import FastLanguageModel
94
 
95
+ # Load base model
96
  model, tokenizer = FastLanguageModel.from_pretrained(
97
  "unsloth/llama-2-7b-bnb-4bit",
98
  load_in_4bit=True,
99
  )
100
 
101
+ # Load TruthTriage adapter
102
+ model.load_adapter("NayanPal/truthtriage-llama2-7b")
103
+
104
+ # Inference
105
+ FastLanguageModel.for_inference(model)
106
+
107
+ inputs = tokenizer("Can I take Ibuprofen with Warfarin?", return_tensors="pt").to("cuda")
108
+ outputs = model.generate(**inputs, max_new_tokens=200)
109
+
110
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))