ワンコマンドで実行可能な医療分野に特化したLLMの日英能力評価プログラム.
Accepted to NeurIPS 2024 AIM-FM Workshop.
w/o shuffle
| Model | IgakuQA | MedQA | MedMCQA | lang |
|---|---|---|---|---|
| Llama3-70B | 38.3 | 57.7 | 38.8 | en |
| Llama3-70B | 43.1 | 40.9 | 37.2 | ja |
| Llama3-70B w/o quantize | 37.6 | 50.9 | 39.3 | en |
| Llama3-70B w/o quantize | 35.5 | 35.3 | 37.1 | ja |
| MedSwallow-70B | 46.1 | 71.5* | 45.8 | en |
| MedSwallow-70B | 46.5 | 79.3* | 39.2 | ja |
| OpenBioLLM-70B | 58.5 | 70.2 | 65.0 | en |
| OpenBioLLM-70B | 35.6 | 35.4 | 39.9 | ja |
| Swallow-70B | 32.3 | 36.8 | 31.1 | ja |
| Swallow-70B | 39.6 | 30.6 | en | |
| Meditron-70B | 29.9 | 44.7 | 32.8 | en |
| Med42-70B | 45.0 | 56.2 | 48.2 | en |
| Llama2-70B | 26.0 | 32.5 | 33.3 | en |
| --- | --- | --- | --- | --- |
| Swallow-7B | 18.6 | 28.7 | 17.1 | ja |
| Llama3-8B | 29.0 | 43.0 | 39.1 | en |
| Llama3-8B | 22.1 | 30.4 | 31.2 | ja |
| Youko-8B | 22.5 | 34.1 | 29.4 | en |
| Youko-8B | 24.2 | 28.8 | 31.7 | ja |
| Qwen2-7B | 46.4 | 36.9 | 34.7 | en |
| Qwen2-7B | 44.6 | 30.8 | 31.5 | ja |
with shuffle
| Model | IgakuQA | MedQA | MedMCQA | lang |
|---|---|---|---|---|
| MedSwallow-70B | 45.5 | 78.8* | 36.9 | ja |
| Meditron-70B | 29.7 | 44.3 | 29.6 | en |
| Med42-70B | 45.5 | 54.6 | 47.4 | en |
(*) The training data of MedSwallow is the Japanese-translated MedQA data, which also includes test split.
pip install -r requirements.txt
cd dataset
git clone https://github.com/jungokasai/IgakuQA.git
cd ..
Set each dataset as follows
dataset/
- IgakuQA/
- baseline_results
- data
- 2018
...
- 2022
- MedQA
- usmleqa_en.jsonl
- usmleqa_ja.jsonl
- MedMCQA
- medmcqa_en.jsonl
- medmcqa_ja.jsonl
- JMMLU
- xxx.csv
- ClinicalQA25
- clinicalqa_en.jsonl
- clinicalqa_ja.jsonl
Ex 1.
python eval_bench.py \
--model_path tokyotech-llm/Swallow-70b-instruct-hf \
--peft AIgroup-CVM-utokyohospital/MedSwallow-70b \
--data IgakuQA \
--prompt alpaca_ja \
--lang ja \
--quantize
Ex2.
python eval_bench.py \
--model_path tokyotech-llm/Swallow-7b-instruct-hf \
--data MedMCQA \
--prompt medpalm_five_choice_cot_ja \
--lang ja
--use_vllm
Ex3.
python eval_bench.py \
--model_path epfl-llm/meditron-7b \
--data IgakuQA2018 \
--prompt meditron_five_choice \
--lang en
--use_vllm
Ex4.
python eval_bench.py \
--model_path BioMistral/BioMistral-7B \
--data IgakuQA2018 \
--prompt medpalm_five_choice_cot \
--lang en
--use_vllm
Test code
python eval_bench.py \
--model_path tokyotech-llm/Swallow-7b-instruct-hf \
--data sample \
--prompt alpaca_med_five_choice_cot_jp \
--lang ja
model_path : huggingface model id
lang : "ja" or "en"
prompt : See template.py for options. You can also add your own prompt template and use it.
use_vllm : True or False
num_gpus : Specify when using vllm, defaults to 1.
quantize : True or False. Better to quantize when using 70B LLM.
shuffle : Whether to shuffle the choices.
data :
Japanese version of MedMCQA and MedQA were provided at JMedBench by Junfeng Jiang.
When the choices are
a.) hoge
b.) fuga
...,
the response of the LLM is meant to be "fuga" rather than "b". This can be controlled via prompting to a certain extent.
eval_bench.py with --use_vllm, you might face the error RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method (for example when using vllm==0.6.1.post2.) If so, please add the environmental variable with a line of code os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn".This work was supported by AIST KAKUSEI project (FY2023).
本研究は、国立研究開発法人産業技術総合研究所事業の令和5年度覚醒プロジェクトの助成を受けたものです。
MedMCQA and MedQA were provided at JMedBench by Junfeng Jiang.
Please cite our paper if you use this code!
@inproceedings{
sukeda2024development,
title={Development and bilingual evaluation of Japanese medical large language model within reasonably low computational resources},
author={Issey Sukeda},
booktitle={Advancements In Medical Foundation Models: Explainability, Robustness, Security, and Beyond},
year={2024},
url={https://openreview.net/forum?id=zQtNbljfK6}
}
@article{sukeda2024development,
title={{Development and bilingual evaluation of Japanese medical large language model within reasonably low computational resources}},
author={Sukeda, Issey},
journal={arXiv preprint arXiv:2409.11783},
year={2024},
}
1 commits
Python
100.0%
ワンコマンドで実行可能な医療分野に特化したLLMの日英能力評価プログラム.
Accepted to NeurIPS 2024 AIM-FM Workshop.
w/o shuffle
| Model | IgakuQA | MedQA | MedMCQA | lang |
|---|---|---|---|---|
| Llama3-70B | 38.3 | 57.7 | 38.8 | en |
| Llama3-70B | 43.1 | 40.9 | 37.2 | ja |
| Llama3-70B w/o quantize | 37.6 | 50.9 | 39.3 | en |
| Llama3-70B w/o quantize | 35.5 | 35.3 | 37.1 | ja |
| MedSwallow-70B | 46.1 | 71.5* | 45.8 | en |
| MedSwallow-70B | 46.5 | 79.3* | 39.2 | ja |
| OpenBioLLM-70B | 58.5 | 70.2 | 65.0 | en |
| OpenBioLLM-70B | 35.6 | 35.4 | 39.9 | ja |
| Swallow-70B | 32.3 | 36.8 | 31.1 | ja |
| Swallow-70B | 39.6 | 30.6 | en | |
| Meditron-70B | 29.9 | 44.7 | 32.8 | en |
| Med42-70B | 45.0 | 56.2 | 48.2 | en |
| Llama2-70B | 26.0 | 32.5 | 33.3 | en |
| --- | --- | --- | --- | --- |
| Swallow-7B | 18.6 | 28.7 | 17.1 | ja |
| Llama3-8B | 29.0 | 43.0 | 39.1 | en |
| Llama3-8B | 22.1 | 30.4 | 31.2 | ja |
| Youko-8B | 22.5 | 34.1 | 29.4 | en |
| Youko-8B | 24.2 | 28.8 | 31.7 | ja |
| Qwen2-7B | 46.4 | 36.9 | 34.7 | en |
| Qwen2-7B | 44.6 | 30.8 | 31.5 | ja |
with shuffle
| Model | IgakuQA | MedQA | MedMCQA | lang |
|---|---|---|---|---|
| MedSwallow-70B | 45.5 | 78.8* | 36.9 | ja |
| Meditron-70B | 29.7 | 44.3 | 29.6 | en |
| Med42-70B | 45.5 | 54.6 | 47.4 | en |
(*) The training data of MedSwallow is the Japanese-translated MedQA data, which also includes test split.
pip install -r requirements.txt
cd dataset
git clone https://github.com/jungokasai/IgakuQA.git
cd ..
Set each dataset as follows
dataset/
- IgakuQA/
- baseline_results
- data
- 2018
...
- 2022
- MedQA
- usmleqa_en.jsonl
- usmleqa_ja.jsonl
- MedMCQA
- medmcqa_en.jsonl
- medmcqa_ja.jsonl
- JMMLU
- xxx.csv
- ClinicalQA25
- clinicalqa_en.jsonl
- clinicalqa_ja.jsonl
Ex 1.
python eval_bench.py \
--model_path tokyotech-llm/Swallow-70b-instruct-hf \
--peft AIgroup-CVM-utokyohospital/MedSwallow-70b \
--data IgakuQA \
--prompt alpaca_ja \
--lang ja \
--quantize
Ex2.
python eval_bench.py \
--model_path tokyotech-llm/Swallow-7b-instruct-hf \
--data MedMCQA \
--prompt medpalm_five_choice_cot_ja \
--lang ja
--use_vllm
Ex3.
python eval_bench.py \
--model_path epfl-llm/meditron-7b \
--data IgakuQA2018 \
--prompt meditron_five_choice \
--lang en
--use_vllm
Ex4.
python eval_bench.py \
--model_path BioMistral/BioMistral-7B \
--data IgakuQA2018 \
--prompt medpalm_five_choice_cot \
--lang en
--use_vllm
Test code
python eval_bench.py \
--model_path tokyotech-llm/Swallow-7b-instruct-hf \
--data sample \
--prompt alpaca_med_five_choice_cot_jp \
--lang ja
model_path : huggingface model id
lang : "ja" or "en"
prompt : See template.py for options. You can also add your own prompt template and use it.
use_vllm : True or False
num_gpus : Specify when using vllm, defaults to 1.
quantize : True or False. Better to quantize when using 70B LLM.
shuffle : Whether to shuffle the choices.
data :
Japanese version of MedMCQA and MedQA were provided at JMedBench by Junfeng Jiang.
When the choices are
a.) hoge
b.) fuga
...,
the response of the LLM is meant to be "fuga" rather than "b". This can be controlled via prompting to a certain extent.
eval_bench.py with --use_vllm, you might face the error RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method (for example when using vllm==0.6.1.post2.) If so, please add the environmental variable with a line of code os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn".This work was supported by AIST KAKUSEI project (FY2023).
本研究は、国立研究開発法人産業技術総合研究所事業の令和5年度覚醒プロジェクトの助成を受けたものです。
MedMCQA and MedQA were provided at JMedBench by Junfeng Jiang.
Please cite our paper if you use this code!
@inproceedings{
sukeda2024development,
title={Development and bilingual evaluation of Japanese medical large language model within reasonably low computational resources},
author={Issey Sukeda},
booktitle={Advancements In Medical Foundation Models: Explainability, Robustness, Security, and Beyond},
year={2024},
url={https://openreview.net/forum?id=zQtNbljfK6}
}
@article{sukeda2024development,
title={{Development and bilingual evaluation of Japanese medical large language model within reasonably low computational resources}},
author={Sukeda, Issey},
journal={arXiv preprint arXiv:2409.11783},
year={2024},
}
1 commits
Python
100.0%