English

ShieldLM: Empowering LLMs as Aligned, Customizable and Explainable Safety Detectors

Computation and Language 2024-11-06 v2

Abstract

The safety of Large Language Models (LLMs) has gained increasing attention in recent years, but there still lacks a comprehensive approach for detecting safety issues within LLMs' responses in an aligned, customizable and explainable manner. In this paper, we propose ShieldLM, an LLM-based safety detector, which aligns with common safety standards, supports customizable detection rules, and provides explanations for its decisions. To train ShieldLM, we compile a large bilingual dataset comprising 14,387 query-response pairs, annotating the safety of responses based on various safety standards. Through extensive experiments, we demonstrate that ShieldLM surpasses strong baselines across four test sets, showcasing remarkable customizability and explainability. Besides performing well on standard detection datasets, ShieldLM has also been shown to be effective as a safety evaluator for advanced LLMs. ShieldLM is released at \url{https://github.com/thu-coai/ShieldLM} to support accurate and explainable safety detection under various safety standards.

Keywords

Cite

@article{arxiv.2402.16444,
  title  = {ShieldLM: Empowering LLMs as Aligned, Customizable and Explainable Safety Detectors},
  author = {Zhexin Zhang and Yida Lu and Jingyuan Ma and Di Zhang and Rui Li and Pei Ke and Hao Sun and Lei Sha and Zhifang Sui and Hongning Wang and Minlie Huang},
  journal= {arXiv preprint arXiv:2402.16444},
  year   = {2024}
}

Comments

19 pages. Camera ready version of EMNLP 2024 Findings

R2 v1 2026-06-28T15:00:04.270Z