RichardErkhov commited on
Commit
5f8a34b
•
1 Parent(s): bffb6a6

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +187 -0
README.md ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ meerkat-7b-v1.0 - GGUF
11
+ - Model creator: https://huggingface.co/dmis-lab/
12
+ - Original model: https://huggingface.co/dmis-lab/meerkat-7b-v1.0/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [meerkat-7b-v1.0.Q2_K.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q2_K.gguf) | Q2_K | 2.53GB |
18
+ | [meerkat-7b-v1.0.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.IQ3_XS.gguf) | IQ3_XS | 2.81GB |
19
+ | [meerkat-7b-v1.0.IQ3_S.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.IQ3_S.gguf) | IQ3_S | 2.96GB |
20
+ | [meerkat-7b-v1.0.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q3_K_S.gguf) | Q3_K_S | 2.95GB |
21
+ | [meerkat-7b-v1.0.IQ3_M.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.IQ3_M.gguf) | IQ3_M | 3.06GB |
22
+ | [meerkat-7b-v1.0.Q3_K.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q3_K.gguf) | Q3_K | 3.28GB |
23
+ | [meerkat-7b-v1.0.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q3_K_M.gguf) | Q3_K_M | 3.28GB |
24
+ | [meerkat-7b-v1.0.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q3_K_L.gguf) | Q3_K_L | 3.56GB |
25
+ | [meerkat-7b-v1.0.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.IQ4_XS.gguf) | IQ4_XS | 3.67GB |
26
+ | [meerkat-7b-v1.0.Q4_0.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q4_0.gguf) | Q4_0 | 3.83GB |
27
+ | [meerkat-7b-v1.0.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.IQ4_NL.gguf) | IQ4_NL | 3.87GB |
28
+ | [meerkat-7b-v1.0.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q4_K_S.gguf) | Q4_K_S | 3.86GB |
29
+ | [meerkat-7b-v1.0.Q4_K.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q4_K.gguf) | Q4_K | 4.07GB |
30
+ | [meerkat-7b-v1.0.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q4_K_M.gguf) | Q4_K_M | 4.07GB |
31
+ | [meerkat-7b-v1.0.Q4_1.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q4_1.gguf) | Q4_1 | 4.24GB |
32
+ | [meerkat-7b-v1.0.Q5_0.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q5_0.gguf) | Q5_0 | 4.65GB |
33
+ | [meerkat-7b-v1.0.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q5_K_S.gguf) | Q5_K_S | 4.65GB |
34
+ | [meerkat-7b-v1.0.Q5_K.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q5_K.gguf) | Q5_K | 4.78GB |
35
+ | [meerkat-7b-v1.0.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q5_K_M.gguf) | Q5_K_M | 4.78GB |
36
+ | [meerkat-7b-v1.0.Q5_1.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q5_1.gguf) | Q5_1 | 5.07GB |
37
+ | [meerkat-7b-v1.0.Q6_K.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q6_K.gguf) | Q6_K | 5.53GB |
38
+ | [meerkat-7b-v1.0.Q8_0.gguf](https://huggingface.co/RichardErkhov/dmis-lab_-_meerkat-7b-v1.0-gguf/blob/main/meerkat-7b-v1.0.Q8_0.gguf) | Q8_0 | 7.17GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ license: cc-by-nc-4.0
46
+ pipeline_tag: text-generation
47
+ tags:
48
+ - medical
49
+ - small LM
50
+ - instruction-tuned
51
+ - usmle
52
+ - chain-of-thought
53
+ - synthetic data
54
+ ---
55
+
56
+
57
+ # Meerkat-7B (Version 1.0)
58
+
59
+ <center><img src = "https://cdn-uploads.huggingface.co/production/uploads/5efbdc4ac3896117eab961a9/IH0nR9HxYwNvrJBjP2dYQ.png" width="200" height="200"></center>
60
+
61
+ 🚀 Meerkat-7B-v1.0 is an instruction-tuned medical AI system that surpasses the passing threshold of 60% for the United States Medical Licensing Examination (USMLE) for the first time among all 7B-parameter models.
62
+ The model was trained using our new synthetic dataset consisting of high-quality chain-of-thought reasoning paths sourced from 18 medical textbooks, along with diverse instruction-following datasets.
63
+ This equips the model with high-level medical reasoning capabilities required for solving complex medical problems.
64
+ For further insights into our model, please refer to our paper!
65
+
66
+ 📄 **Paper**: [Small Language Models Learn Enhanced Reasoning Skills from Medical Textbooks](https://arxiv.org/abs/2404.00376)
67
+
68
+
69
+ ## Quick Start
70
+
71
+ The input query should always end with "ASSISTANT:" as shown below.
72
+ ```
73
+ query = "USER: What should I do when I get cold? ASSISTANT:"
74
+ ```
75
+
76
+ We can use our model using the [apply_chat_template](https://huggingface.co/docs/transformers/main/chat_templating) function as follows:
77
+ ```python
78
+ from transformers import AutoModelForCausalLM, AutoTokenizer
79
+
80
+ device = "cuda" # cuda or cpu
81
+ checkpoint = "dmis-lab/meerkat-7b-v1.0"
82
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
83
+ model = AutoModelForCausalLM.from_pretrained(
84
+ checkpoint,
85
+ torch_dtype=torch.bfloat16, # You can choose to use this when there's not enough GPU memory available.
86
+ )
87
+
88
+ # Multi-turn dialogue example
89
+ messages = [
90
+ {"role": "system", "content": "You are a helpful doctor or healthcare professional. Guide the conversation to provide useful, complete, and scientifically-grounded answers to user questions. You have the option to compose a concise, single-turn conversation if the user's input is comprehensive to provide accurate answers. However, if essential details are missing, you should engage in a multi-turn dialogue, asking follow-up questions to gather a thorough medical history and records.\n\n"},
91
+ {"role": "user", "content": "Hello, doctor. I'm really concerned about my 10-year-old son. We recently discovered a painless mass in his left testicle, so we brought him to the pediatrician."},
92
+ {"role": "assistant", "content": "I understand your concern. Let's gather some more information. Has your son experienced any other symptoms along with the mass?"},
93
+ {"role": "user", "content": "Other than the mass, my son hasn't shown any symptoms. He's been his usual self, playing and eating normally."}
94
+ ]
95
+
96
+ encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
97
+
98
+ model_inputs = encodeds.to(device)
99
+ model.to(device)
100
+
101
+ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True, pad_token_id=tokenizer.eos_token_id)
102
+ decoded = tokenizer.batch_decode(generated_ids)
103
+ print(decoded[0])
104
+ ```
105
+
106
+ ## Prompt Details
107
+
108
+ To reproduce the results reported in our paper, it is advisable to utilize the identical system messages used during model training. Please refer to the guidelines detailed below.
109
+
110
+ ### USMLE or Clinical Cases
111
+
112
+ When solving USMLE-style questions such as [MedQA](https://arxiv.org/abs/2009.13081) and [MedBullets](https://arxiv.org/abs/2402.18060), or dealing with complex clinical cases like the [JAMA Clinical Challenge](https://arxiv.org/abs/2402.18060), use the following system message:
113
+ ```
114
+ messages = [
115
+ {"role": "system", "content": "The following is a multiple-choice question about medical knowledge. Solve this in a step-by-step fashion, starting by summarizing the available information. Output a single option from the given options as the final answer. You are strongly required to follow the specified output format; conclude your response with the phrase \"the answer is ([option_id]) [answer_string]\".\n\n"},
116
+ {"role": "user", "content": "Two weeks after undergoing an emergency cardiac catherization with stenting for unstable angina pectoris, a 61-year-old man has decreased urinary output and malaise. He has type 2 diabetes mellitus and osteoarthritis of the hips. Prior to admission, his medications were insulin and naproxen. He was also started on aspirin, clopidogrel, and metoprolol after the coronary intervention. His temperature is 38\u00b0C (100.4\u00b0F), pulse is 93/min, and blood pressure is 125/85 mm Hg. Examination shows mottled, reticulated purplish discoloration of the feet. Laboratory studies show:\nHemoglobin count 14 g/dL\nLeukocyte count 16,400/mm3\nSegmented neutrophils 56%\nEosinophils 11%\nLymphocytes 31%\nMonocytes 2%\nPlatelet count 260,000/mm3\nErythrocyte sedimentation rate 68 mm/h\nSerum\nUrea nitrogen 25 mg/dL\nCreatinine 4.2 mg/dL\nRenal biopsy shows intravascular spindle-shaped vacuoles. Which of the following is the most likely cause of this patient's symptoms?\" (A) Renal papillary necrosis (B) Cholesterol embolization (C) Eosinophilic granulomatosis with polyangiitis (D) Polyarteritis nodosa"},
117
+ ]
118
+ ```
119
+ The model generates reasoning paths to solve the problem and then sequentially provides the predicted answers.
120
+ Since the model ends its response with "the answer is," it is straightforward to extract the predicted answer for comparison with the actual answer.
121
+
122
+ ### Multiple-choice Exams
123
+
124
+ For other types of multiple-choice exams such as [MedMCQA](https://arxiv.org/abs/2203.14371) or [MMLU](https://arxiv.org/abs/2009.03300), use the following simple system message:
125
+ ```
126
+ messages = [
127
+ {"role": "system", "content": "Answer the multiple-choice question about medical knowledge.\n\n"},
128
+ {"role": "user", "content": "In a Robertsonian translocation fusion occurs at the: (A) telomeres. (B) centromeres. (C) histones. (D) ends of the long arms."},
129
+ ]
130
+ ```
131
+
132
+ ### Other Use Cases
133
+ Our model was trained using the [AlpaCare](https://github.com/xzhang97666/alpacare) instruction dataset comprising 52K examples, to enhance its generalization capabilities across diverse user prompts.
134
+ Feel free to design and test your prompts and to share your thoughts with us, whether the model exceeds expectations or falls short!
135
+
136
+ ## Evaluation
137
+
138
+ We tested models on seven medical benchmarks: [MedQA](https://arxiv.org/abs/2009.13081), [USMLE sample test](https://www.usmle.org/prepare-your-exam), [Medbullets-4](https://arxiv.org/abs/2402.18060), [Medbullets-5](https://arxiv.org/abs/2402.18060) , [MedMCQA](https://arxiv.org/abs/2203.14371), [MMLU-Medical](https://arxiv.org/abs/2009.03300), and [JAMA Clinical Challenge](https://arxiv.org/abs/2402.18060).
139
+
140
+ | **Model** | **Average** | **MedQA** | **USMLE** | **Medbullets-4** | **Medbullets-5** | **MedMCQA** | **MMLU-Medical** | **JAMA** |
141
+ |:--------------------------------|:-----------:|:---------:|:---------:|:----------------:|:----------------:|:-----------:|:----------------:|:--------:|
142
+ | GPT-4 | 75.2 | 81.4 | 86.6 | 68.8 | 63.3 | 72.4 | 87.1 | 67.1 |
143
+ | GPT-3.5 | 54.1 | 53.6 | 58.5 | 51.0 | 47.4 | 51.0 | 67.3 | 50.1 |
144
+ | MediTron-70B (Ensemble, 5 runs) | - | 70.2 | - | - | - | 66.0 | 78.0 | - |
145
+ |*Open-source (7B)*|
146
+ | MediTron-7B | 50.8 | 50.2 | 44.6 | 51.1 | 45.5 | 57.9 | 56.7 | 49.3 |
147
+ | BioMistral-7B | 54.4 | 54.3 | 51.4 | 52.3 | 48.7 | **61.1** | 64.6 | 48.6 |
148
+ | Meerkat-7B | 62.4 | 70.6 | 70.3 | 58.7 | 52.9 | 60.6 | 70.5 | 53.1 |
149
+ | Meerkat-7B (Ensemble, 5 runs) | **64.2** | **74.3** | **71.4** | **61.0** | **55.3** | 60.7 | **72.4** | **54.0** |
150
+
151
+ Please note that the scores in MMLU-Medical were calculated based on the average accuracies across six medical-related subjects in the original MMLU benchmark, and each result for a single subject is presented below.
152
+
153
+ | **Model** | **Average** | **Cliniq Knowledge** | **Medical Genetics** | **Anatomy** | **Professional Medicine** | **College Biology** | **College Medicine** |
154
+ |:--------------------------------|:-----------:|:--------------------:|:--------------------:|:-----------:|:-------------------------:|:-------------------:|:--------------------:|
155
+ | GPT-4 | 87.1 | 86.4 | 92.0 | 80.0 | 93.8 | 93.8 | 76.3 |
156
+ | GPT-3.5 | 67.3 | 68.7 | 68.0 | 60.7 | 69.9 | 72.9 | 63.6 |
157
+ | MediTron-70B (Ensemble, 5 runs) | 78.0 | 75.5 | 85.9 | 69.4 | 82.3 | 86.7 | 68.0 |
158
+ |*Open-source (7B)*|
159
+ | MediTron-7B | 56.7 | 57.7 | 63.8 | 56.9 | 56.0 | 57.1 | 48.9 |
160
+ | BioMistral-7B | 64.6 | 59.9 | 64.0 | 56.5 | 60.4 | 59.0 | 54.7 |
161
+ | Meerkat-7B | 70.5 | 71.6 | 74.8 | 63.2 | 77.3 | 70.8 | **65.2** |
162
+ | Meerkat-7B (Ensemble, 5 runs) | **72.4** | **74.1** | **79.4** | **64.1** | **78.8** | **75.8** | 62.4 |
163
+
164
+ ## Model Architecture
165
+
166
+ Our model was based on [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) because of its accuracy and run-time efficiency.
167
+
168
+ ## Training Data
169
+
170
+ We plan to release our training dataset publicly.
171
+
172
+ ## Reference
173
+
174
+ Please see the information below to cite our paper.
175
+ ```bibtex
176
+ @article{kim2024small,
177
+ title={Small language models learn enhanced reasoning skills from medical textbooks},
178
+ author={Kim, Hyunjae and Hwang, Hyeon and Lee, Jiwoo and Park, Sihyeon and Kim, Dain and Lee, Taewhoo and Yoon, Chanwoong and Sohn, Jiwoong and Choi, Donghee and Kang, Jaewoo},
179
+ journal={arXiv preprint arXiv:2404.00376},
180
+ year={2024}
181
+ }
182
+ ```
183
+
184
+ ## Contact
185
+
186
+ Feel free to email `hyunjae-kim@korea.ac.kr` if you have any questions.
187
+