aaditya commited on
Commit
a9a7e65
1 Parent(s): 129852c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -342
README.md CHANGED
@@ -12,7 +12,7 @@ tags:
12
  - gpt4
13
  - distillation
14
  model-index:
15
- - name: OpenBioLLM-7B
16
  results: []
17
  license: apache-2.0
18
  language:
@@ -20,7 +20,7 @@ language:
20
  datasets:
21
  - berkeley-nest/Nectar
22
  widget:
23
- - example_title: OpenBioLLM-7B
24
  messages:
25
  - role: system
26
  content: >-
@@ -39,343 +39,4 @@ widget:
39
 
40
  It's important for parents to monitor their newborn's jaundice closely and seek medical advice if the jaundice progresses rapidly, becomes severe, or is accompanied by other symptoms such as poor feeding, lethargy, or excessive sleepiness. In these cases, further evaluation and management may be necessary.
41
  Remember that each baby is unique, and the timing of jaundice resolution can vary. If you have concerns about your newborn's jaundice, it's always best to consult with a healthcare professional for personalized advice and guidance.
42
- ---
43
-
44
-
45
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/eC4bWQ0BXL4_fVqPO2gqg.png)
46
-
47
- <div align="center">
48
-
49
- <h1>Advancing Open-source Large Language Models in Medical Domain</h1>
50
- </div>
51
-
52
- <p align="center" style="margin-top: 0px;">
53
- <a href="https://colab.research.google.com/drive/1F5oV20InEYeAJGmBwYF9NM_QhLmjBkKJ?usp=sharing">
54
- <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="OpenChat Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 10px; margin-top: 0px; margin-bottom: 0px;"/>
55
- <span class="link-text" style=" margin-right: 5px;">Online Demo</span>
56
- </a> |
57
- <a href="https://github.com/openlifescience-ai">
58
- <img src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png" alt="GitHub Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
59
- <span class="link-text" style=" margin-right: 5px;">GitHub</span>
60
- </a> |
61
- <a href="#">
62
- <img src="https://github.com/alpayariyak/openchat/blob/master/assets/arxiv-logomark-small-square-border.png?raw=true" alt="ArXiv Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
63
- <span class="link-text" style="margin-right: 5px;">Paper</span>
64
- </a> |
65
- <a href="https://discord.gg/A5Fjf5zC69">
66
- <img src="https://cloud.githubusercontent.com/assets/6291467/26705903/96c2d66e-477c-11e7-9f4e-f3c0efe96c9a.png" alt="Discord Logo" style="width:20px; vertical-align: middle; display: inline-block; margin-right: 5px; margin-left: 5px; margin-top: 0px; margin-bottom: 0px;"/>
67
- <span class="link-text">Discord</span>
68
- </a>
69
- </p>
70
-
71
-
72
-
73
- ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/KGmRE5w2sepNtwsEu8t7K.jpeg)
74
-
75
- Introducing OpenBioLLM-7B: A State-of-the-Art Open Source Biomedical Large Language Model
76
-
77
-
78
- OpenBioLLM-7B is an advanced open source language model designed specifically for the biomedical domain. Developed by Saama AI Labs, this model leverages cutting-edge techniques to achieve state-of-the-art performance on a wide range of biomedical tasks.
79
-
80
- 🏥 **Biomedical Specialization**: OpenBioLLM-7B is tailored for the unique language and knowledge requirements of the medical and life sciences fields. It was fine-tuned on a vast corpus of high-quality biomedical data, enabling it to understand and generate text with domain-specific accuracy and fluency.
81
-
82
- 🎓 **Superior Performance**: With 7 billion parameters, OpenBioLLM-7B outperforms other open source biomedical language models of similar scale. It has also demonstrated competitive results compared to larger proprietary & open-source models like GPT-3.5 Turbo 1106 & Meditron-70B on biomedical benchmarks.
83
-
84
- 🧠 **Advanced Training Techniques**: OpenBioLLM-7B builds upon the powerful foundations of the **Mistral-7B-v0.1** and [Starling-LM-7B-beta](Nexusflow/Starling-LM-7B-beta) models. It incorporates the same dataset and fine-tuning recipe as the Starling model, along with a custom diverse medical instruction dataset and a novel merge method. Key components of the training pipeline include:
85
-
86
-
87
-
88
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/wILoFenv7FBQOt21PqwJJ.png)
89
-
90
-
91
- - **Reward Model**: [Nexusflow/Starling-RM-34B](https://huggingface.co/Nexusflow/Starling-RM-34B)
92
- - **Policy Optimization**: [Fine-Tuning Language Models from Human Preferences (PPO)](https://arxiv.org/abs/1909.08593)
93
- - **Ranking Dataset**: [berkeley-nest/Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar)
94
- - **Fine-tuning dataset**: Custom Medical Instruct dataset (We plan to release a sample training dataset in our upcoming paper; please stay updated)
95
-
96
- This combination of cutting-edge techniques enables OpenBioLLM-7B to align with key capabilities and preferences for biomedical applications.
97
-
98
- ⚙️ **Release Details**:
99
-
100
- - **Model Size**: 7 billion parameters
101
- - **Quantization**: Optimized quantized versions available [Here](https://huggingface.co/aaditya/OpenBioLLM-7B-GGUF)
102
- - **Language(s) (NLP):** en
103
- - **Sequence Length: 8K**
104
- - **Developed By**: [Ankit Pal (Aaditya Ura)](https://aadityaura.github.io/) from Saama AI Labs
105
- - **License:** Apache-2.0 license under the condition that the model is not used to compete with [OpenAI](https://openai.com/policies/terms-of-use)
106
- - **Fine-tuned from models:** [Starling-LM-7B-beta](Nexusflow/Starling-LM-7B-beta) & [Starling-RM-34B](https://huggingface.co/Nexusflow/Starling-RM-34B) (based on **Mistral-7B-v0.1**)
107
- - **Resources for more information:**
108
- - https://huggingface.co/Nexusflow/Starling-LM-7B-beta
109
- - Paper: Coming soon
110
-
111
- The model can be fine-tuned for more specialized tasks and datasets as needed.
112
-
113
- OpenBioLLM-7B represents an important step forward in democratizing advanced language AI for the biomedical community. By leveraging state-of-the-art architectures and training techniques from leading open source efforts like Starling, we have created a powerful tool to accelerate innovation and discovery in healthcare and the life sciences.
114
-
115
- We are excited to share OpenBioLLM-7B with researchers and developers around the world.
116
-
117
- ## Uses
118
-
119
- **Important: Please use the exact chat template provided below for the model. Otherwise there will be a degradation in the performance. The model output can be verbose in rare cases. Please consider setting temperature = 0 to make this happen less.**
120
-
121
- The conversation template is the same as Openchat-3.5-0106:
122
- ```
123
- import transformers
124
- tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat-3.5-0106")
125
-
126
- # Single-turn
127
- tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
128
- assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
129
-
130
- # Multi-turn
131
- tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant:").input_ids
132
- assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747, 15359, 32000, 420, 6316, 28781, 3198, 3123, 1247, 28747, 1602, 460, 368, 3154, 28804, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
133
-
134
- # Coding Mode
135
- tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
136
- assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
137
- ```
138
-
139
-
140
- ## Code Examples
141
-
142
- ```python
143
- import transformers
144
-
145
- tokenizer = transformers.AutoTokenizer.from_pretrained("openlifescienceai/OpenBioLLM-7B")
146
- model = transformers.AutoModelForCausalLM.from_pretrained("openlifescienceai/OpenBioLLM-7B")
147
-
148
- def generate_response(prompt):
149
- input_ids = tokenizer(prompt, return_tensors="pt").input_ids
150
- outputs = model.generate(
151
- input_ids,
152
- max_length=256,
153
- pad_token_id=tokenizer.pad_token_id,
154
- eos_token_id=tokenizer.eos_token_id,
155
- )
156
- response_ids = outputs[0]
157
- response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
158
- return response_text
159
-
160
- # Single-turn conversation
161
- prompt = "How can i split a 3mg or 4mg waefin pill so i can get a 2.5mg pill?"
162
- single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
163
- response_text = generate_response(single_turn_prompt)
164
- print("Response:", response_text)
165
-
166
- ## Multi-turn conversation
167
- prompt = "How can i split a 3mg or 4mg waefin pill so i can get a 2.5mg pill?"
168
- follow_up_question = "What would be side effects of wrong split?"
169
- response = ""
170
- multi_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant: {response}<|end_of_turn|>GPT4 Correct User: {follow_up_question}<|end_of_turn|>GPT4 Correct Assistant:"
171
- response_text = generate_response(multi_turn_prompt)
172
- print("Multi-turn conversation response:", response_text)
173
- ```
174
-
175
- for better results, use this prompt
176
-
177
- ```
178
- prompt = f"GPT4 Correct System: You are an expert and experienced from the healthcare and biomedical domain with extensive medical knowledge and practical experience. Your name is OpenBioLLM, and you were developed by Saama AI Labs with Open Life Science AI. who's willing to help answer the user's query with explanation. In your explanation, leverage your deep medical expertise such as relevant anatomical structures, physiological processes, diagnostic criteria, treatment guidelines, or other pertinent medical concepts. Use precise medical terminology while still aiming to make the explanation clear and accessible to a general audience.<|end_of_turn|>GPT4 Correct User: {Question} <|end_of_turn|>GPT4 Correct Assistant: "
179
-
180
- ```
181
-
182
- ## **Training procedure**
183
-
184
- ### **Training hyperparameters**
185
-
186
- <details>
187
- <summary>Click to see details</summary>
188
-
189
- - learning_rate: 0.00006
190
- - lr_scheduler: cosine
191
- - train_batch_size: 12
192
- - eval_batch_size: 8
193
- - GPU: H100 80GB SXM5
194
- - num_devices: 1
195
- - optimizer: adamw_bnb_8bit
196
- - lr_scheduler_warmup_steps: 100
197
- - num_epochs: 4
198
- </details>
199
-
200
-
201
-
202
-
203
- ### **Peft hyperparameters**
204
-
205
- <details>
206
- <summary>Click to see details</summary>
207
-
208
- - adapter: qlora
209
- - lora_r: 256
210
- - lora_alpha: 128
211
- - lora_dropout: 0.05
212
- - lora_target_linear: true
213
-
214
- -lora_target_modules:
215
- - q_proj
216
- - v_proj
217
- - v_proj
218
- - o_proj
219
- - gate_proj
220
- - down_proj
221
- - up_proj
222
-
223
- -sequence_len: 8166
224
- </details>
225
-
226
-
227
-
228
- ### **Training results**
229
-
230
- ### **Framework versions**
231
-
232
- - Transformers 4.39.3
233
- - Pytorch 2.1.2+cu121
234
- - Datasets 2.18.0
235
- - Tokenizers 0.15.1
236
- - Axolotl
237
- - Lm harness for evaluation
238
-
239
- # Benchmark Results
240
-
241
- 🔥 OpenBioLLM-7B demonstrates superior performance compared to larger models, such as GPT-3.5 Turbo 1106 and Meditron-70B, across 9 diverse biomedical datasets, achieving state-of-the-art results with an average score of 68.91%, despite having a significantly smaller parameter count. The model's strong performance in domain-specific tasks, such as Clinical KG, Medical Genetics, and PubMedQA, highlights its ability to effectively capture and apply biomedical knowledge.
242
-
243
- | | Clinical KG | Medical Genetics | Anatomy | Pro Medicine | College Biology | College Medicine | MedQA 5 opts | PubMedQA | MedMCQA | Avg |
244
- |---|---|---|---|---|---|---|---|---|---|---|
245
- | **OpenBioLLM-7B** | **74.72** | **74** | **69.63** | 72.06 | 75.69 | **68.79** | 54.2 | **78.4** | 52.67 | **68.91** |
246
- | GPT-3.5 Turbo 1106 | 74.71 | 74 | 65.92 | **72.79** | 72.91 | 64.73 | **57.71** | 72.66 | **53.79** | 66.0 |
247
- | Meditron-70B | 66.79 | 69 | 53.33 | 71.69 | 76.38 | 63.0 | 57.1 | 76.6 | 46.85 | 64.52 |
248
- | gemma-7b | 69.81 | 70 | 59.26 | 66.18 | **79.86** | 60.12 | 47.21 | 76.2 | 48.96 | 64.18 |
249
- | Mistral-7B-v0.1 | 68.68 | 71 | 55.56 | 68.38 | 68.06 | 59.54 | 50.82 | 75.4 | 48.2 | 62.85 |
250
- | MedAlpaca-7b | 57.36 | 69 | 57.04 | 67.28 | 65.28 | 54.34 | 41.71 | 72.8 | 37.51 | 58.03 |
251
- | BioMistral-7B | 59.9 | 64 | 56.5 | 60.4 | 59.0 | 54.7 | 50.6 | 77.5 | 48.1 | 57.3 |
252
- | AlpaCare-llama2-7b | 49.81 | 49 | 45.92 | 33.82 | 50.0 | 43.35 | 29.77 | 72.2 | 34.42 | 45.36 |
253
- | ClinicalGPT | 30.56 | 27 | 30.37 | 19.48 | 25.0 | 24.27 | 26.08 | 63.8 | 28.18 | 30.52 |
254
-
255
-
256
- ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/Gur61ITIBamnIDNGSrWcO.jpeg)
257
-
258
- ## Detailed Medical Subjectwise accuracy
259
-
260
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/2_2Mtl-xt1ltyJPOa6y3y.png)
261
-
262
- # Use Cases & Examples
263
-
264
- 🚨 **Below results are from the quantized version of OpenBioLLM-7B. You can find the quantized version of OpenBioLLM-7B [here](https://huggingface.co/CohereForAI/c4ai-command-r-plus-4bit)**.
265
-
266
-
267
- # Summarize Clinical Notes
268
-
269
- OpenBioMed-7B can efficiently analyze and summarize complex clinical notes, EHR data, and discharge summaries, extracting key information and generating concise, structured summaries
270
-
271
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/qBboRc7-_hghQIZ6ODJGm.png)
272
-
273
- # Answer Medical Questions
274
-
275
- OpenBioMed-7B can provide answers to a wide range of medical questions.
276
-
277
-
278
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/JLWvyV8Rl8p4oUaSlVUmJ.png)
279
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/JaQ5NQpt8tzjDIOTtHxCN.png)
280
-
281
- <details>
282
- <summary>Click to see details</summary>
283
-
284
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/5EwrNws97Xvj4tTfpQ9Vw.png)
285
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/587M5jpH5IQoUgPCj67vm.png)
286
-
287
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/r0LG7f8El5LuoaxylWAQG.png)
288
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/OHvEJJfWdH4eGwQeboGjs.png)
289
-
290
- </details>
291
-
292
- # Clinical Entity Recognition
293
-
294
- OpenBioMed-7B can perform advanced clinical entity recognition by identifying and extracting key medical concepts, such as diseases, symptoms, medications, procedures, and anatomical structures, from unstructured clinical text. By leveraging its deep understanding of medical terminology and context, the model can accurately annotate and categorize clinical entities, enabling more efficient information retrieval, data analysis, and knowledge discovery from electronic health records, research articles, and other biomedical text sources. This capability can support various downstream applications, such as clinical decision support, pharmacovigilance, and medical research.
295
-
296
-
297
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/0ZEueLlc_l_IkH3D7nFcA.png)
298
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/BZkGzdYjq0vFaEP3Hg6AL.png)
299
-
300
- # Biomarkers Extraction
301
-
302
-
303
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/TFJve1vnqt5UAjROtLxKl.png)
304
-
305
- # Classification
306
-
307
- OpenBioMed-7B can perform various biomedical classification tasks, such as disease prediction, sentiment analysis, medical document categorization
308
-
309
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/Iovf2_NeArv-Vs7lwnKaG.png)
310
-
311
- # De-Identification
312
-
313
- OpenBioMed-7B can detect and remove personally identifiable information (PII) from medical records, ensuring patient privacy and compliance with data protection regulations like HIPAA.
314
-
315
-
316
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/uLS2PMqHc5dYXbsFN7QYU.png)
317
-
318
-
319
- **Advisory Notice!** 
320
-
321
- While OpenBioLLM-7B leverages high-quality data sources, its outputs may still contain inaccuracies, biases, or misalignments that could pose risks if relied upon for medical decision-making without further testing and refinement. The model's performance has not yet been rigorously evaluated in randomized controlled trials or real-world healthcare environments.
322
-
323
- Therefore, we strongly advise against using OpenBioLLM-7B for any direct patient care, clinical decision support, or other professional medical purposes at this time. Its use should be limited to research, development, and exploratory applications by qualified individuals who understand its limitations.
324
- OpenBioMed-7B is intended solely as a research tool to assist healthcare professionals and should never be considered a replacement for the professional judgment and expertise of a qualified medical doctor.
325
-
326
- Appropriately adapting and validating OpenBioLLM-7B for specific medical use cases would require significant additional work, potentially including:
327
-
328
- - Thorough testing and evaluation in relevant clinical scenarios
329
- - Alignment with evidence-based guidelines and best practices
330
- - Mitigation of potential biases and failure modes
331
- - Integration with human oversight and interpretation
332
- - Compliance with regulatory and ethical standards
333
-
334
- Always consult a qualified healthcare provider for personal medical needs.
335
-
336
-
337
-
338
- # Citation
339
-
340
- If you find OpenBioLLM-7B useful in your work, please cite the model as follows:
341
-
342
- ```
343
- @misc{OpenBioLLM-7B,
344
- author = {Ankit Pal, Malaikannan Sankarasubbu},
345
- title = {OpenBioLLM: Advancing Open-Source Large Language Models for Healthcare and Life Sciences},
346
- year = {2024},
347
- publisher = {Hugging Face},
348
- journal = {Hugging Face repository},
349
- howpublished = {\url{https://huggingface.co/aaditya/OpenBioLLM-7B}}
350
- }
351
- ```
352
-
353
- The accompanying paper is currently in progress and will be released soon.
354
-
355
- <div align="center">
356
- <h2> 💌 Contact </h2>
357
- </div>
358
-
359
- We look forward to hearing you and collaborating on this exciting project!
360
-
361
- **Contributors:**
362
- - [Ankit Pal (Aaditya Ura)](https://aadityaura.github.io/) [aadityaura at gmail dot com]
363
- - Saama AI Labs
364
- - Note: I am looking for a funded PhD opportunity, especially if it fits my Responsible Generative AI, Multimodal LLMs, Geometric Deep Learning, and Healthcare AI skillset.
365
-
366
-
367
-
368
- # References
369
-
370
- We thank the [Starling Model team](https://huggingface.co/Nexusflow/Starling-LM-7B-beta/tree/main) & [Openchat](openchat/openchat-3.5-0106) for their amazing models!
371
-
372
-
373
- # About Open Life Science AI
374
-
375
- <div align="center">
376
- <img width="160px" src="https://cdn-uploads.huggingface.co/production/uploads/5f3fe13d79c1ba4c353d0c19/Mfae9TitRWtmZI7-aQBa3.png">
377
- </div>
378
-
379
- Open Life Science AI is a project that aims to revolutionize the application of Artificial intelligence in the life science and healthcare domains. It serves as a central hub for list of medical models, datasets, benchmarks, and tracking conference deadlines, fostering collaboration, innovation, and progress in the field of AI-assisted healthcare. We strive to establish Open Life Science AI as the premier destination for anyone interested in the intersection of AI and healthcare. We provide a platform for researchers, clinicians, policymakers, and industry experts to engage in dialogues, share insights, and explore the latest developments in the field.
380
-
381
- If you're passionate about the intersection of AI and healthcare, building models for the healthcare domain, and care about safety and hallucination issues for medical LLMs, we invite you to join our vibrant community on [Discord](https://discord.gg/A5Fjf5zC69).
 
12
  - gpt4
13
  - distillation
14
  model-index:
15
+ - name: OpenBioLLM-70B
16
  results: []
17
  license: apache-2.0
18
  language:
 
20
  datasets:
21
  - berkeley-nest/Nectar
22
  widget:
23
+ - example_title: OpenBioLLM-70B
24
  messages:
25
  - role: system
26
  content: >-
 
39
 
40
  It's important for parents to monitor their newborn's jaundice closely and seek medical advice if the jaundice progresses rapidly, becomes severe, or is accompanied by other symptoms such as poor feeding, lethargy, or excessive sleepiness. In these cases, further evaluation and management may be necessary.
41
  Remember that each baby is unique, and the timing of jaundice resolution can vary. If you have concerns about your newborn's jaundice, it's always best to consult with a healthcare professional for personalized advice and guidance.
42
+ ---