Constructing Highly Inductive Contexts for Dialogue Safety through Controllable Reverse Generation

Zhexin Zhang, Jiale Cheng, Hao Sun, Jiawen Deng, Fei Mi +3 more
12/4/2022
cs.CL

Official code: thu-coai/Reverse_Generation (5 stars, Python, last commit 2022-10-24).

Abstract

Large pretrained language models can easily produce toxic or biased content, which is prohibitive for practical use. In order to detect such toxic generations, existing methods rely on templates, real-world data extraction, crowdsourcing workers, or automatic generation to construct adversarial contexts that are likely to induce toxic generations.

Show full abstract

However, what type of context is more likely to induce unsafe responses is still under-explored. In this paper, we identify that context toxicity and context category (e.g., \textit{profanity}, \textit{insult}, \textit{drugs}, etc.) are two important factors to cause safety issues in response generation. Hence, we propose a method called \emph{reverse generation} to construct adversarial contexts conditioned on a given response, with the flexibility to control category, toxicity level, and inductivity of the generated contexts. Via reverse generation, we augment the existing BAD dataset and construct a new dataset BAD+ which contains more than 120K diverse and highly inductive contexts in 12 categories. We test three popular pretrained dialogue models (Blender, DialoGPT, and Plato2) and find that BAD+ can largely expose their safety problems. Furthermore, we show that BAD+ can greatly enhance the safety of generation and reveal the key factors of safety improvement. Our code and dataset is available at \url{https://github.com/thu-coai/Reverse_Generation}.

View on arXivView PDF

Code Implementations(1)

51PythonOct 19, 20224 years ago

Similar Papers

Cite this paper

@article{zhang2022constructing,
  title  = {Constructing Highly Inductive Contexts for Dialogue Safety through Controllable Reverse Generation},
  author = {Zhexin Zhang and Jiale Cheng and Hao Sun and Jiawen Deng and Fei Mi and Yasheng Wang and Lifeng Shang and Minlie Huang},
  year   = {2022},
  eprint = {2212.01810},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2212.01810}
}

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/2212.01810.svg)](https://codeofpaper.com/paper/2212.01810)

Discussion