Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- medical
|
7 |
+
- llama
|
8 |
+
- finetuned
|
9 |
+
- health
|
10 |
+
model_type: llama
|
11 |
+
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
12 |
+
---
|
13 |
+
|
14 |
+
# Model Card for HealthGPT-TinyLlama
|
15 |
+
|
16 |
+
This model is a fine-tuned version of TinyLlama-1.1B-Chat-v1.0 on a custom medical dataset. It was developed to serve as a lightweight, domain-specific assistant capable of answering medical questions fluently and coherently.
|
17 |
+
|
18 |
+
## Model Details
|
19 |
+
|
20 |
+
### Model Description
|
21 |
+
|
22 |
+
HealthGPT-TinyLlama is a 1.1B parameter model fine-tuned using LoRA adapters for the task of medical question answering. The base model is TinyLlama, a compact transformer architecture optimized for performance and efficiency.
|
23 |
+
|
24 |
+
* **Developed by:** Selina Zarzour
|
25 |
+
* **Shared by:** selinazarzour
|
26 |
+
* **Model type:** Causal Language Model
|
27 |
+
* **Language(s):** English
|
28 |
+
* **License:** apache-2.0
|
29 |
+
* **Finetuned from model:** TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
30 |
+
|
31 |
+
### Model Sources
|
32 |
+
|
33 |
+
* **Repository:** [https://huggingface.co/selinazarzour/healthgpt-tinyllama](https://huggingface.co/selinazarzour/healthgpt-tinyllama)
|
34 |
+
* **Demo (local only):** Gradio app tested locally with GPU (not deployed to Spaces due to lack of CPU compatibility)
|
35 |
+
|
36 |
+
## Uses
|
37 |
+
|
38 |
+
### Direct Use
|
39 |
+
|
40 |
+
* Designed to answer general medical questions.
|
41 |
+
* Intended for educational and experimental use.
|
42 |
+
|
43 |
+
### Out-of-Scope Use
|
44 |
+
|
45 |
+
* Not suitable for clinical decision-making or professional diagnosis.
|
46 |
+
* Should not be relied on for life-critical use cases.
|
47 |
+
|
48 |
+
## Bias, Risks, and Limitations
|
49 |
+
|
50 |
+
* The model may hallucinate or provide medically inaccurate information.
|
51 |
+
* It has not been validated against real-world clinical data.
|
52 |
+
* Biases present in the training dataset may persist.
|
53 |
+
|
54 |
+
### Recommendations
|
55 |
+
|
56 |
+
* Always verify model outputs with qualified professionals.
|
57 |
+
* Do not use in scenarios where safety is critical.
|
58 |
+
|
59 |
+
## How to Get Started with the Model
|
60 |
+
|
61 |
+
```python
|
62 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
63 |
+
|
64 |
+
model = AutoModelForCausalLM.from_pretrained("selinazarzour/healthgpt-tinyllama")
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
|
66 |
+
|
67 |
+
prompt = "### Question:\nWhat are the symptoms of diabetes?\n\n### Answer:\n"
|
68 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
69 |
+
outputs = model.generate(**inputs, max_new_tokens=150)
|
70 |
+
print(tokenizer.decode(outputs[0]))
|
71 |
+
```
|
72 |
+
|
73 |
+
## Training Details
|
74 |
+
|
75 |
+
### Training Data
|
76 |
+
|
77 |
+
* Finetuned on a synthetic dataset composed of medical questions and answers derived from reliable medical knowledge sources.
|
78 |
+
|
79 |
+
### Training Procedure
|
80 |
+
|
81 |
+
* LoRA adapter training using HuggingFace PEFT and `transformers`
|
82 |
+
* Model merged with base weights after training
|
83 |
+
|
84 |
+
#### Training Hyperparameters
|
85 |
+
|
86 |
+
* Precision: float16 mixed precision
|
87 |
+
* Epochs: 3
|
88 |
+
* Optimizer: AdamW
|
89 |
+
* Batch size: 4
|
90 |
+
|
91 |
+
## Evaluation
|
92 |
+
|
93 |
+
### Testing Data, Factors & Metrics
|
94 |
+
|
95 |
+
* Testing done manually by querying the model with unseen questions.
|
96 |
+
* Sample outputs evaluated for relevance, grammar, and factual accuracy.
|
97 |
+
|
98 |
+
### Results
|
99 |
+
|
100 |
+
* The model produces relevant and coherent answers in most cases.
|
101 |
+
* Model performs best on short, fact-based questions.
|
102 |
+
|
103 |
+
## Model Examination
|
104 |
+
|
105 |
+
Screenshot of local Gradio app interface:
|
106 |
+
|
107 |
+
**Note:** The model was not deployed publicly due to GPU-only compatibility, but it runs successfully in local environments with GPU access.
|
108 |
+
|
109 |
+

|
110 |
+
|
111 |
+
## Environmental Impact
|
112 |
+
|
113 |
+
* **Hardware Type:** Google Colab GPU (T4/A100)
|
114 |
+
* **Hours used:** \~3 hours
|
115 |
+
* **Cloud Provider:** Google Cloud via Colab
|
116 |
+
* **Compute Region:** US (unknown exact zone)
|
117 |
+
* **Carbon Emitted:** Unknown
|
118 |
+
|
119 |
+
## Technical Specifications
|
120 |
+
|
121 |
+
### Model Architecture and Objective
|
122 |
+
|
123 |
+
* LlamaForCausalLM with 22 layers, 32 attention heads, 2048 hidden size
|
124 |
+
* LoRA finetuning applied to attention layers only
|
125 |
+
|
126 |
+
### Compute Infrastructure
|
127 |
+
|
128 |
+
* **Hardware:** Colab GPU
|
129 |
+
* **Software:**
|
130 |
+
|
131 |
+
* transformers 4.39+
|
132 |
+
* peft
|
133 |
+
* bitsandbytes (for initial quantized training)
|
134 |
+
|
135 |
+
## Citation
|
136 |
+
|
137 |
+
**APA:**
|
138 |
+
Zarzour, S. (2025). HealthGPT-TinyLlama: A fine-tuned 1.1B LLM for medical Q\&A.
|
139 |
+
|
140 |
+
## Model Card Contact
|
141 |
+
|
142 |
+
* **Contact:** Selina Zarzour via Hugging Face (@selinazarzour)
|
143 |
+
|
144 |
+
---
|
145 |
+
|
146 |
+
**Note**: This model is a prototype and not intended for clinical use.
|