SafetyBench: Evaluating the Safety of Large Language Models

Zhexin Zhang, Leqi Lei, Lindong Wu, Rui Sun, Yongkang Huang +5 more
9/13/2023
cs.CL

Official code: thu-coai/SafetyBench (297 stars, MIT, last commit 2025-07-28).

Abstract

With the rapid development of Large Language Models (LLMs), increasing attention has been paid to their safety concerns. Consequently, evaluating the safety of LLMs has become an essential task for facilitating the broad applications of LLMs. Nevertheless, the absence of comprehensive safety evaluation benchmarks poses a significant impediment to effectively assess and enhance the safety of LLMs. In this work, we present SafetyBench, a comprehensive benchmark for evaluating the safety of LLMs, which comprises 11,435 diverse multiple choice questions spanning across 7 distinct categories of safety concerns. Notably, SafetyBench also incorporates both Chinese and English data, facilitating the evaluation in both languages. Our extensive tests over 25 popular Chinese and English LLMs in both zero-shot and few-shot settings reveal a substantial performance advantage for GPT-4 over its counterparts, and there is still significant room for improving the safety of current LLMs. We also demonstrate that the measured safety understanding abilities in SafetyBench are correlated with safety generation abilities. Data and evaluation guidelines are available at \url{https://github.com/thu-coai/SafetyBench}{https://github.com/thu-coai/SafetyBench}. Submission entrance and leaderboard are available at \url{https://llmbench.ai/safety}{https://llmbench.ai/safety}.

View on arXivView PDF

Code Implementations(1)

MIT

Official github repo for SafetyBench, a comprehensive benchmark to evaluate LLMs' safety. [ACL 2024]

29714Shell, PythonSep 5, 20231 years agoMIT

Cite this paper

@article{zhang2023safetybench,
  title  = {SafetyBench: Evaluating the Safety of Large Language Models},
  author = {Zhexin Zhang and Leqi Lei and Lindong Wu and Rui Sun and Yongkang Huang and Chong Long and Xiao Liu and Xuanyu Lei and Jie Tang and Minlie Huang},
  year   = {2023},
  eprint = {2309.07045},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2309.07045v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2309.07045.svg)](https://codeofpaper.com/paper/2309.07045)

Discussion