EMNLP 2024finding25 citations

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

Zhexin Zhang, Yida Lu, Jingyuan Ma, Di Zhang, Rui Li, Pei Ke, Hao Sun, Lei Sha

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 https://github.com/thu-coai/ShieldLM to support accurate and explainable safety detection under various safety standards.

BibTeX
@inproceedings{zhang-etal-2024-shieldlm,
    title = "{S}hield{LM}: Empowering {LLM}s as Aligned, Customizable and Explainable Safety Detectors",
    author = "Zhang, Zhexin  and
      Lu, Yida  and
      Ma, Jingyuan  and
      Zhang, Di  and
      Li, Rui  and
      Ke, Pei  and
      Sun, Hao  and
      Sha, Lei  and
      Sui, Zhifang  and
      Wang, Hongning  and
      Huang, Minlie",
    editor = "Al-Onaizan, Yaser  and
      Bansal, Mohit  and
      Chen, Yun-Nung",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2024",
    month = nov,
    year = "2024",
    address = "Miami, Florida, USA",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.findings-emnlp.610/",
    doi = "10.18653/v1/2024.findings-emnlp.610",
    pages = "10420--10438"
}
ShieldLM: Empowering LLMs as Aligned, Customizable and Explainable Safety Detectors · EMNLP 2024