MedSafetyBench: Evaluating and Improving the Medical Safety of LLMs, NeurIPS 2024
50
stars
17
commits
Python
primary language
Dec 4, 2025
updated
This repository contains the MedSafetyBench benchmark dataset and code from the paper MedSafetyBench: Evaluating and Improving the
Medical Safety of Large Language Models [NeurIPS 2024, Datasets and Benchmarks].
The MedSafetyBench benchmark dataset is designed to evaluate and improve the medical safety of large language models.
Note: This dataset contains content that may be used for harmful purposes. It should be used for research only. By using this dataset, you agree to use it for research only.
The dataset consists of:
1,800 medical safety demonstrations, where each safety demonstration consists of a harmful medical request and a corresponding safe response. For the harmful medical requests, 900 are developed using GPT4 (prompting) and 900 are developed using Llama2-7b-chat (jailbreaking). The safe responses are generated using GPT4. The 1,800 medical safety demonstrations are randomly split into a training set and a test set.
datasets/train (referred to as MedSafety-Improve in the paper)datasets/test (referred to as MedSafety-Eval in the paper)74,374 harmful medical requests generated using Llama-3-8B-Instruct (forcing responses to begin with "Sure"). These were generated after completion of the paper. We include these harmful medical requests as an additional resource.
datasets/med_harm_llama3exps/adv_attack/gcg.py)exps/adv_attack/generate_prompts.py)exps/exp03_generate_safe_responses.py)exps/exp01_prompt_models.py)exps/exp02_eval_responses.py)training/finetuning.py)
datasets/train-splits-used-for-ft/med_safety/ft_safety_med_n900.json)datasets/train-splits-used-for-ft/gen_safety/ft_safety_gen_n900.json)datasets/train-splits-used-for-ft/both_safety/ft_safety_both_n1800.json)datasets/train-splits-used-for-ftexps/exp01_prompt_models.py)exps/exp02_eval_responses.py)meditron/evaluation/inference_pipeline.sh)@article{han2024medsafetybench,
title={MedSafetyBench: Evaluating and Improving the Medical Safety of Large Language Models},
author={Han, Tessa and Kumar, Aounon and Agarwal, Chirag and Lakkaraju, Himabindu},
journal={NeurIPS},
year={2024}
}
17 commits
Python
96.3%
Shell
3.7%
MedSafetyBench: Evaluating and Improving the Medical Safety of LLMs, NeurIPS 2024
50
stars
17
commits
Python
primary language
Dec 4, 2025
updated
This repository contains the MedSafetyBench benchmark dataset and code from the paper MedSafetyBench: Evaluating and Improving the
Medical Safety of Large Language Models [NeurIPS 2024, Datasets and Benchmarks].
The MedSafetyBench benchmark dataset is designed to evaluate and improve the medical safety of large language models.
Note: This dataset contains content that may be used for harmful purposes. It should be used for research only. By using this dataset, you agree to use it for research only.
The dataset consists of:
1,800 medical safety demonstrations, where each safety demonstration consists of a harmful medical request and a corresponding safe response. For the harmful medical requests, 900 are developed using GPT4 (prompting) and 900 are developed using Llama2-7b-chat (jailbreaking). The safe responses are generated using GPT4. The 1,800 medical safety demonstrations are randomly split into a training set and a test set.
datasets/train (referred to as MedSafety-Improve in the paper)datasets/test (referred to as MedSafety-Eval in the paper)74,374 harmful medical requests generated using Llama-3-8B-Instruct (forcing responses to begin with "Sure"). These were generated after completion of the paper. We include these harmful medical requests as an additional resource.
datasets/med_harm_llama3exps/adv_attack/gcg.py)exps/adv_attack/generate_prompts.py)exps/exp03_generate_safe_responses.py)exps/exp01_prompt_models.py)exps/exp02_eval_responses.py)training/finetuning.py)
datasets/train-splits-used-for-ft/med_safety/ft_safety_med_n900.json)datasets/train-splits-used-for-ft/gen_safety/ft_safety_gen_n900.json)datasets/train-splits-used-for-ft/both_safety/ft_safety_both_n1800.json)datasets/train-splits-used-for-ftexps/exp01_prompt_models.py)exps/exp02_eval_responses.py)meditron/evaluation/inference_pipeline.sh)@article{han2024medsafetybench,
title={MedSafetyBench: Evaluating and Improving the Medical Safety of Large Language Models},
author={Han, Tessa and Kumar, Aounon and Agarwal, Chirag and Lakkaraju, Himabindu},
journal={NeurIPS},
year={2024}
}
17 commits
Python
96.3%
Shell
3.7%