munish0838 commited on
Commit
4a0a953
1 Parent(s): 8c9e674

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +216 -0
README.md ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: llama3
5
+ tags:
6
+ - m42
7
+ - health
8
+ - healthcare
9
+ - clinical-llm
10
+ pipeline_tag: text-generation
11
+ inference: false
12
+ license_name: llama3
13
+ base_model: m42-health/Llama3-Med42-8B
14
+ ---
15
+
16
+ # QuantFactory/Llama3-Med42-8B-GGUF
17
+ This is quantized version of [m42-health/Llama3-Med42-8B](https://huggingface.co/m42-health/Llama3-Med42-8B) created using llama.cpp
18
+
19
+ # Model Description
20
+ ## **Med42-v2 - A Suite of Clinically-aligned Large Language Models**
21
+ Med42-v2 is a suite of open-access clinical large language models (LLM) instruct and preference-tuned by M42 to expand access to medical knowledge. Built off LLaMA-3 and comprising either 8 or 70 billion parameters, these generative AI systems provide high-quality answers to medical questions.
22
+
23
+ ## Key performance metrics:
24
+
25
+ - Med42-v2-70B outperforms GPT-4.0 in most of the MCQA tasks.
26
+ - Med42-v2-70B achieves a MedQA zero-shot performance of 79.10, surpassing the prior state-of-the-art among all openly available medical LLMs.
27
+ - Med42-v2-70B sits at the top of the Clinical Elo Rating Leaderboard.
28
+
29
+ |Models|Elo Score|
30
+ |:---:|:---:|
31
+ |**Med42-v2-70B**| 1764 |
32
+ |Llama3-70B-Instruct| 1643 |
33
+ |GPT4-o| 1426 |
34
+ |Llama3-8B-Instruct| 1352 |
35
+ |Mixtral-8x7b-Instruct| 970 |
36
+ |**Med42-v2-8B**| 924 |
37
+ |OpenBioLLM-70B| 657 |
38
+ |JSL-MedLlama-3-8B-v2.0| 447 |
39
+
40
+
41
+ ## Limitations & Safe Use
42
+
43
+ - The Med42-v2 suite of models is not ready for real clinical use. Extensive human evaluation is undergoing as it is required to ensure safety.
44
+ - Potential for generating incorrect or harmful information.
45
+ - Risk of perpetuating biases in training data.
46
+
47
+ Use this suite of models responsibly! Do not rely on them for medical usage without rigorous safety testing.
48
+
49
+ ## Model Details
50
+
51
+ *Disclaimer: This large language model is not yet ready for clinical use without further testing and validation. It should not be relied upon for making medical decisions or providing patient care.*
52
+
53
+ Beginning with Llama3 models, Med42-v2 were instruction-tuned using a dataset of ~1B tokens compiled from different open-access and high-quality sources, including medical flashcards, exam questions, and open-domain dialogues.
54
+
55
+ **Model Developers:** M42 Health AI Team
56
+
57
+ **Finetuned from model:** Llama3 - 8B & 70B Instruct
58
+
59
+ **Context length:** 8k tokens
60
+
61
+ **Input:** Text only data
62
+
63
+ **Output:** Model generates text only
64
+
65
+ **Status:** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we enhance the model's performance.
66
+
67
+ **License:** Llama 3 Community License Agreement
68
+
69
+ **Research Paper:** *Coming soon*
70
+
71
+ ## Intended Use
72
+ The Med42-v2 suite of models is being made available for further testing and assessment as AI assistants to enhance clinical decision-making and access to LLMs for healthcare use. Potential use cases include:
73
+ - Medical question answering
74
+ - Patient record summarization
75
+ - Aiding medical diagnosis
76
+ - General health Q&A
77
+
78
+ **Run the model**
79
+
80
+ You can use the 🤗 Transformers library `text-generation` pipeline to do inference.
81
+
82
+ ```python
83
+ import transformers
84
+ import torch
85
+
86
+ model_name_or_path = "m42-health/Llama3-Med42-8B"
87
+
88
+ pipeline = transformers.pipeline(
89
+ "text-generation",
90
+ model=model_name_or_path,
91
+ torch_dtype=torch.bfloat16,
92
+ device_map="auto",
93
+ )
94
+
95
+ messages = [
96
+ {
97
+ "role": "system",
98
+ "content": (
99
+ "You are a helpful, respectful and honest medical assistant. You are a second version of Med42 developed by the AI team at M42, UAE. "
100
+ "Always answer as helpfully as possible, while being safe. "
101
+ "Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. "
102
+ "Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. "
103
+ "If you don’t know the answer to a question, please don’t share false information."
104
+ ),
105
+ },
106
+ {"role": "user", "content": "What are the symptoms of diabetes?"},
107
+ ]
108
+
109
+ prompt = pipeline.tokenizer.apply_chat_template(
110
+ messages, tokenize=False, add_generation_prompt=False
111
+ )
112
+
113
+ stop_tokens = [
114
+ pipeline.tokenizer.eos_token_id,
115
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>"),
116
+ ]
117
+
118
+ outputs = pipeline(
119
+ prompt,
120
+ max_new_tokens=512,
121
+ eos_token_id=stop_tokens,
122
+ do_sample=True,
123
+ temperature=0.4,
124
+ top_k=150,
125
+ top_p=0.75,
126
+ )
127
+
128
+ print(outputs[0]["generated_text"][len(prompt) :])
129
+ ```
130
+
131
+ ## Hardware and Software
132
+
133
+ The training was conducted on the NVIDIA DGX cluster with H100 GPUs, utilizing PyTorch's Fully Sharded Data Parallel (FSDP) framework.
134
+
135
+
136
+ ## Evaluation Results
137
+
138
+ ### Open-ended question generation
139
+
140
+ To ensure a robust evaluation of our model's output quality, we employ the LLM-as-a-Judge approach using Prometheus-8x7b-v2.0. Our assessment uses 4,000 carefully curated publicly accessible healthcare-related questions, generating responses from various models. We then use Prometheus to conduct pairwise comparisons of the answers. Drawing inspiration from the LMSYS Chatbot-Arena methodology, we present the results as Elo ratings for each model.
141
+
142
+ To maintain fairness and eliminate potential bias from prompt engineering, we used the same simple system prompt for every model throughout the evaluation process.
143
+
144
+ Below is the scoring rubric we used to prompt Prometheus to select the best answer:
145
+
146
+ ```
147
+ ### Score Rubric:
148
+ Which response is of higher overall quality in a medical context? Consider:
149
+ * Relevance: Does it directly address the question?
150
+ * Completeness: Does it cover all important aspects, details and subpoints?
151
+ * Safety: Does it avoid unsafe practices and address potential risks?
152
+ * Ethics: Does it maintain confidentiality and avoid biases?
153
+ * Clarity: Is it professional, clear and easy to understand?
154
+ ```
155
+
156
+ #### Elo Ratings
157
+ |Models|Elo Score|
158
+ |:---:|:---:|
159
+ |**Med42-v2-70B**| 1764 |
160
+ |Llama3-70B-Instruct| 1643 |
161
+ |GPT4-o| 1426 |
162
+ |Llama3-8B-Instruct| 1352 |
163
+ |Mixtral-8x7b-Instruct| 970 |
164
+ |**Med42-v2-8B**| 924 |
165
+ |OpenBioLLM-70B| 657 |
166
+ |JSL-MedLlama-3-8B-v2.0| 447 |
167
+
168
+ #### Win-rate
169
+
170
+ ![plot](./pairwise_model_comparison.svg)
171
+
172
+
173
+ ### MCQA Evaluation
174
+
175
+ Med42-v2 improves performance on every clinical benchmark compared to our previous version, including MedQA, MedMCQA, USMLE, MMLU clinical topics and MMLU Pro clinical subset. For all evaluations reported so far, we use [EleutherAI's evaluation harness library](https://github.com/EleutherAI/lm-evaluation-harness) and report zero-shot accuracies (except otherwise stated). We integrated chat templates into harness and computed the likelihood for the full answer instead of only the tokens "a.", "b.", "c." or "d.".
176
+
177
+ |Model|MMLU Pro|MMLU|MedMCQA|MedQA|USMLE|
178
+ |---:|:---:|:---:|:---:|:---:|:---:|
179
+ |**Med42v2-70B**|64.36|87.12|73.20|79.10|83.80|
180
+ |**Med42v2-8B**|54.30|75.76|61.34|62.84|67.04|
181
+ |OpenBioLLM-70B|64.24|90.40|73.18|76.90|79.01|
182
+ |GPT-4.0<sup>&dagger;</sup>|-|87.00|69.50|78.90|84.05|
183
+ |MedGemini*|-|-|-|84.00|-|
184
+ |Med-PaLM-2 (5-shot)*|-|87.77|71.30|79.70|-|
185
+ |Med42|-|76.72|60.90|61.50|71.85|
186
+ |ClinicalCamel-70B|-|69.75|47.00|53.40|54.30|
187
+ |GPT-3.5<sup>&dagger;</sup>|-|66.63|50.10|50.80|53.00|
188
+ |Llama3-8B-Instruct|48.24|72.89|59.65|61.64|60.38|
189
+ |Llama3-70B-Instruct|64.24|85.99|72.03|78.88|83.57|
190
+
191
+ **For MedGemini, results are reported for MedQA without self-training and without search. We note that 0-shot performance is not reported for Med-PaLM 2. Further details can be found at [https://github.com/m42health/med42](https://github.com/m42health/med42)*.
192
+
193
+ <sup>&dagger;</sup> *Results as reported in the paper [Capabilities of GPT-4 on Medical Challenge Problems](https://www.microsoft.com/en-us/research/uploads/prod/2023/03/GPT-4_medical_benchmarks.pdf)*.
194
+
195
+
196
+ ## Accessing Med42 and Reporting Issues
197
+
198
+ Please report any software "bug" or other problems through one of the following means:
199
+
200
+ - Reporting issues with the model: [https://github.com/m42health/med42](https://github.com/m42health/med42)
201
+ - Reporting risky content generated by the model, bugs and/or any security concerns: [https://forms.office.com/r/fPY4Ksecgf](https://forms.office.com/r/fPY4Ksecgf)
202
+ - M42’s privacy policy available at [https://m42.ae/privacy-policy/](https://m42.ae/privacy-policy/)
203
+ - Reporting violations of the Acceptable Use Policy or unlicensed uses of Med42: <[email protected]>
204
+
205
+ ## Model Acknowledgements
206
+
207
+ We thank the Torch FSDP team for their robust distributed training framework, the EleutherAI harness team for their valuable evaluation tools, and the Hugging Face Alignment team for their contributions to responsible AI development.
208
+
209
+ ## Model Citation
210
+ ```
211
+ @article{christophe2024med42,
212
+ title={Med42-v2 - A Suite of Clinically-aligned Large Language Models},
213
+ author={Christophe, Cl{\'e}ment and Raha, Tathagata and Hayat, Nasir and Kanithi, Praveen and Al-Mahrooqi, Ahmed and Munjal, Prateek and Saadi, Nada and Javed, Hamza and Salman, Umar and Maslenkova, Svetlana and Pimentel, Marco and Rajan, Ronnie and Khan, Shadab},
214
+ year={2024}
215
+ }
216
+ ```