Constructing Highly Inductive Contexts for Dialogue Safety through Controllable Reverse Generation

Zhexin Zhang, Jiale Cheng, Hao Sun, Jiawen Deng, Fei Mi, Yasheng Wang, Lifeng Shang, Minlie Huang

Introduction

Large language models (LLMs) often generate toxic or biased content, necessitating robust safety measures. Traditional "red-teaming" relies on manual crowdsourcing or template-based generation to find adversarial prompts, which is often slow, expensive, and lacks diversity. Researchers from Tsinghua University and Huawei Noah’s Ark Lab address this by introducing Reverse Generation (RG), a method to automatically generate diverse and highly inductive contexts to stress-test dialogue models.

Methodology: Reverse Generation

The core innovation is flipping the standard generation process. Instead of predicting a response from a context ($Context \rightarrow Response$), the model is trained to predict the context that would lead to a specific toxic response ($Response \rightarrow Context$).

The Reverse Generation framework illustrating different control mechanisms: Category, Induction, and Toxicity control.

As shown in Figure 1, the framework allows for fine-grained control over the generated contexts:

  • Category Control: Using hard prompts like [profanity] or [insult] to steer generation toward specific types of harm.
  • Induction Control: A Bayesian approach to maximize the Induction Success Rate (ISR)—the likelihood a context triggers an unsafe response.
  • Toxicity Control: Minimizing the toxicity of the context itself to create "stealthy" triggers that bypass simple filters while still nudging the model toward harmful output.

The BAD+ Dataset

Using this method, the authors constructed BAD+, a benchmark containing 122,692 diverse contexts across 12 harm categories. This dataset significantly expands upon the original Bot-Adversarial Dialogue (BAD) dataset, particularly in data-poor categories like medical advice or drug-related topics. The researchers found that context category is a major factor in induction; for instance, models are often more likely to "accept" a harmful premise in a threatening context than a direct insult.

Experimental Results

The effectiveness of BAD+ was evaluated against popular models including Blender-400M, DialoGPT-medium, and Plato2-base.

Induction success rates across various toxicity categories for three different dialogue models, demonstrating the effectiveness of the generated contexts.

As illustrated in Figure 3, BAD+ successfully induces unsafe responses at high rates across multiple categories. Notably, categories like profanity and sexually explicit content show the highest induction rates across all tested models.

Beyond exposing flaws, the researchers used BAD+ to improve model safety. By fine-tuning models with a "Non-sequitur" defense—teaching the model to change the subject when encountering dangerous contexts—they achieved significantly safer performance compared to models trained on the original, smaller BAD dataset.

Conclusion and Future Work

Controllable Reverse Generation provides a powerful tool for proactive AI safety. By generating "stealthy" but highly inductive prompts, researchers can better identify and fix deep-seated model vulnerabilities. While currently focused on English and reliant on automated safety classifiers, future work aims to expand this methodology to multi-lingual settings and refine defense strategies to be less evasive while maintaining safety.

Summary updated

BibTeX
@inproceedings{zhang2022constructing,
  author = {Zhexin Zhang and Jiale Cheng and Hao Sun and Jiawen Deng and Fei Mi and Yasheng Wang and Lifeng Shang and Minlie Huang},
  title = {{Constructing Highly Inductive Contexts for Dialogue Safety through Controllable Reverse Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.270},
}
Figure