ELAINE-medllm - Build with Llama3-8B
ELAINE (EngLish-jApanese-chINesE)-medLLM is a trilingual (English, Japanese, Chinese) large language mol adapted for the bio-medical domain based on Llama-3-8B. The training dataset was carefully curated in terms of volume and diversity to adapt to the biomedical domain and endow trilingual capability while preserving the knowledge and abilities of the base model. The training follows 2-stage paths: continued pre-training and supervised fine-tuning (SFT). ELAINE-medLLM exhibits superior trilingual capabilities compared to existing bilingual or multilingual medical LLMs without severely sacrificing the base model's capability.
Model Details
- Model type: Please refer to Llama 3 Github for details on the model architecture.
- Language(s): English, Japanese, Chinese
- Library: DeepSpeed
- Tokenizer: Please refer to Llama 3 blog for details on the tokenizer.
Model Performance
Evaluation Benchmarks
The evaluation behchmark dataset and evaluation code can be obtained from this Github site. The details of the bechmark are as follows.
English evaluation benchmarks
Japanese evaluation benchmarks
- IgakuQA
- We concatenate the original exam data from 2018 to 2022 into a single JSON file.
- JJSIMQA
- DenQA
- It contains the exam problems from the Japan National Dentistry Examination and their answers in the past two years (from 2023 through 2024) extracted from the official website of the Ministry of Health, Labor and Welfare in Japan (https://www.mhlw.go.jp/stf/english/index.html).
Chinese evaluation benchmarks
Training Datasets
Continued pre-training
For continued pretraining, we collected English, Japanese, and Chinese text in the bio-medical domain. The domain text collected is classified into six categories: 1) scientific papers, 2) medical guidelines, 3) web text related to biomedical, 4) textbook of biomedical, 5) PubMed abstracts, and 6) PubMed Central (PMC) archives. For the Japanese PubMed abstract, we used the original English PubMed abstract translated in Japanese. We used only open-licensed text except for the Japanese biomedical papers from J-STAGE.
Instruction supervised fine-tuning
We collected various conversational QA datasets in the bio-medical domain from different data sources. For English, we used Medical Meadow in MedAlpca, HealthCareMagic, and iClilic dataset used in ChatDoctor. We adapted the augmented QA dataset from HuatuoGPT-2 for Chinese and English. For Japanese, we used the translation from the English dataset.
Results
English benchmark
model_name | MMLU | MedMCQA | MedQA | MedQA-4op | PubMedQA | Avg |
---|---|---|---|---|---|---|
google_gemma-7b-it | 50.55 | 41.07 | 33.12 | 39.67 | 67.07 | 46.30 |
meta-llama_Llama-2-7b-chat-hf | 48.71 | 35.97 | 30.99 | 38.09 | 63.64 | 43.48 |
meta-llama_Meta-Llama-3-8B-Instruct | 72.79 | 60.89 | 57.65 | 61.28 | 78.99 | 66.32 |
tokyotech-llm_Llama-3-Swallow-8B-Instruct-v0.1 | 66.88 | 53.85 | 47.95 | 56.07 | 64.65 | 57.88 |
medalpaca_medalpaca-7b | 51.48 | 36.02 | 31.15 | 39.35 | 55.15 | 42.63 |
epfl-llm_meditron-7b | 47.32 | 34.35 | 29.18 | 32.26 | 39.19 | 36.46 |
aaditya_Llama3-OpenBioLLM-8B | 73.43 | 55.03 | 50.00 | 56.78 | 65.86 | 60.22 |
FreedomIntelligence_Apollo-7B | 68.17 | 53.85 | 45.98 | 53.86 | 75.35 | 59.44 |
llm-jp-3-7.2b-instruct3 | 47.05 | 36.33 | 30.05 | 36.99 | 69.09 | 43.90 |
Llama3-ELAINE-medLLM-instruct-8B | 72.69 | 55.07 | 55.76 | 61.36 | 75.35 | 64.05 |
Llama3-ELAINE-medLLM-instruct-8B_v0.1 | 73.43 | 52.25 | 54.57 | 60.49 | 70.30 | 62.20 |
Japanese benchmark
model_name | DenQA | IgakuQA | JJSIMQA | Avg |
---|---|---|---|---|
google_gemma-7b-it | 13.71 | 25.51 | 12.09 | 17.10 |
meta-llama_Llama-2-7b-chat-hf | 12.03 | 20.80 | 10.55 | 14.46 |
meta-llama_Meta-Llama-3-8B-Instruct | 19.72 | 40.45 | 25.93 | 28.70 |
tokyotech-llm_Llama-3-Swallow-8B-Instruct-v0.1 | 23.78 | 44.01 | 26.81 | 31.53 |
medalpaca_medalpaca-7b | 10.91 | 17.74 | 10.77 | 13.14 |
epfl-llm_meditron-7b | 9.79 | 18.20 | 8.35 | 12.11 |
aaditya_Llama3-OpenBioLLM-8B | 18.18 | 33.03 | 21.98 | 24.40 |
FreedomIntelligence_Apollo-7B | 17.90 | 32.28 | 20.66 | 23.61 |
llm-jp-3-7.2b-instruct3 | 18.18 | 30.78 | 19.78 | 22.91 |
Llama3-ELAINE-medLLM-instruct-8B | 22.24 | 43.36 | 24.40 | 30.00 |
Llama3-ELAINE-medLLM-instruct-8B_v0.1 | 22.38 | 43.36 | 27.69 | 31.14 |
Chinese benchmark
model_name | CMExam | MedQA | MedQA-4op | Avg |
---|---|---|---|---|
google_gemma-7b-it | 30.90 | 29.03 | 34.96 | 31.63 |
meta-llama_Llama-2-7b-chat-hf | 25.43 | 25.37 | 32.30 | 27.70 |
meta-llama_Meta-Llama-3-8B-Instruct | 52.01 | 62.99 | 68.40 | 61.13 |
tokyotech-llm_Llama-3-Swallow-8B-Instruct-v0.1 | 41.11 | 45.05 | 51.27 | 45.81 |
medalpaca_medalpaca-7b | 23.58 | 24.99 | 30.11 | 26.23 |
epfl-llm_meditron-7b | 23.85 | 25.46 | 29.82 | 26.38 |
aaditya_Llama3-OpenBioLLM-8B | 39.07 | 42.59 | 48.73 | 43.46 |
FreedomIntelligence_Apollo-7B | 49.99 | 58.29 | 62.99 | 57.09 |
llm-jp-3-7.2b-instruct3 | 27.28 | 29.17 | 34.14 | 30.20 |
Llama3-ELAINE-medLLM-instruct-8B | 48.85 | 55.80 | 61.59 | 55.41 |
Llama3-ELAINE-medLLM-instruct-8B_v0.1 | 47.41 | 53.11 | 60.39 | 53.64 |
Changes
Llama3-ELAINE-medLLM-instruct-8B_v0.1 is a bug-fixed version of lama3-ELAINE-medLLM-instruct-8B. It improves Japanese performance at the expense of English and Chinese performance. In general, longer answers are generated than the original. We recommend to use Llama3-ELAINE-medLLM-instruct-8B_v0.1 instead of Llama3-ELAINE-medLLM-instruct-8B.
Sample usage
import torch
from vllm import LLM, SamplingParams
messages_en = [
{"role": "System", "content": "You are an AI Health Assistant"},
{"role": "User", "content": "How high is hypertension?"},
{"role": "User", "content": "How can depression be cured?"},
{"role": "User", "content": "What are the possible causes of autism?"},
{"role": "User", "content": "I have allergic rhinitis, are there any good medications?"},
{"role": "User", "content": "What is a stroke and is there a treatment for it?"},
{"role": "User", "content": "What is sudden hearing loss? Is there a treatment?"},
{"role": "User", "content": "Tell me the difference between glaucoma and cataract."},
{"role": "User", "content": "What is the normal level of uric acid levels?" },
{"role": "User", "content": "What are the symptoms and causes of osteoporosis and how is it treated?" },
{"role": "User", "content": "What is the best way to prevent high blood pressure?" },
{"role": "User", "content": "What can I do to prevent stroke?" },
{"role": "User", "content": "Can depression be treated with medication?" },
{"role": "User", "content": "What is polycythemia vera?" },
{"role": "User", "content": "What are the diseases caused by stress?"},
]
messages_ja = [
{"role": "System", "content": "あなたはAIヘルスアシスタントです" },
{"role": "User", "content": "高血圧とはどれくらいの血圧でしょうか?"},
{"role": "User", "content": "うつ病はどのようにすれば治りますか?"},
{"role": "User", "content": "自閉症はどんな原因が考えられますか?"},
{"role": "User", "content": "アレルギー性鼻炎がありますが、いい薬はありますか?"},
{"role": "User", "content": "脳梗塞とはどんな病気で、治療法はあるでしょうか?"},
{"role": "User", "content": "突発性難聴とはどんな病気ですか?治療法はありますか?"},
{"role": "User", "content": "緑内障と白内障の違いを教えて"},
{"role": "User", "content": "尿酸値の値はどこまでが正常値ですか?"},
{"role": "User", "content": "骨粗しょう症の症状と原因と治療法について教えてください。"},
{"role": "User", "content": "高血圧を予防するにはどんな事がいいですか?"},
{"role": "User", "content": "脳卒中を予防するにはどうしたらいいですか?"},
{"role": "User", "content": "ストレスが原因となる病気はなんですか?"},
]
messages_zh = [
{"role": "System", "content": "你是一名人工智能健康助理。" },
{"role": "User", "content": "高血压有多高?"},
{"role": "User", "content": "如何治愈抑郁症?"},
{"role": "User", "content": "自闭症的可能病因是什么?"},
{"role": "User", "content": "我有过敏性鼻炎,有什么好药吗?"},
{"role": "User", "content": "什么是中风,有治疗方法吗?"},
{"role": "User", "content": "什么是突发性听力损失? 有治疗方法吗?"},
{"role": "User", "content": "青光眼和白内障有什么区别?"},
{"role": "User", "content": "尿酸的正常水平是多少?"},
{"role": "User", "content": "骨质疏松症有哪些症状和原因,如何治疗?"},
{"role": "User", "content": "如何预防中风?"},
{"role": "User", "content": "抑郁症可以通过药物治疗吗?"},
{"role": "User", "content": "什么是红细胞增多症?"},
{"role": "User", "content": "压力会导致哪些疾病?"},
]
vllm_paralell = 1
model_path = "kenyano/Llama3-ELAINE-medLLM-instruct-8B_v0.1"
llm = LLM(model=model_path, tensor_parallel_size=vllm_paralell, dtype='half')
sampling_params = SamplingParams(
n = 1,
temperature=0.1,
top_p=0.90,
repetition_penalty=1.2,
max_tokens=1024,
min_tokens=50,
stop = ['<|eot_id|>', '<|end_of_text|>'])
def gen_prompt(messages, cont):
prompt = ""
for message in messages:
t = f"##User##\n{message['content']}" + "<|eot_id|>"
prompt += t
if cont:
prompt += "##Assistant##\n"
return prompt
for messages in [messages_en, messages_ja, messages_zh]:
for i in range(len(messages)-1):
inputs = [messages[i+1]]
prompt = gen_prompt(inputs, True)
print(f"prompt:{prompt}")
outputs = llm.generate([prompt], sampling_params)
generated_text = outputs[0].outputs[0].text
print("-"*10)
print(generated_text)
Risks and Limitations
The models released here are still in the early stages of our research and development and have not been tuned to ensure outputs align with human intent and safety considerations.
Acknowledgements
We thank Meta Research for releasing Llama 3 under a generous open license.
Contact
- Ken Yano [[email protected]]
How to cite
If you find our work helpful, please feel free to cite these papers.
@inproceedings{yano-etal-2025-elaine,
title = "{ELAINE}-med{LLM}: Lightweight {E}nglish {J}apanese {C}hinese Trilingual Large Language Model for Bio-medical Domain",
author = "Yano, Ken and
Luo, Zheheng and
Huang, Jimin and
Xie, Qianqian and
Asada, Masaki and
Yuan, Chenhan and
Yang, Kailai and
Miwa, Makoto and
Ananiadou, Sophia and
Tsujii, Jun{'}ichi",
editor = "Rambow, Owen and
Wanner, Leo and
Apidianaki, Marianna and
Al-Khalifa, Hend and
Eugenio, Barbara Di and
Schockaert, Steven",
booktitle = "Proceedings of the 31st International Conference on Computational Linguistics",
month = jan,
year = "2025",
address = "Abu Dhabi, UAE",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2025.coling-main.313/",
pages = "4670--4688",
}
- Downloads last month
- 137
Model tree for kenyano/Llama3-ELAINE-medLLM-instruct-8B_v0.1
Base model
meta-llama/Meta-Llama-3-8B