Learning from Response not Preference: A Stackelberg Approach for LLM Detoxification using Non-parallel Data

Xinhong Xie, Tao Li, Quanyan ZhuarXiv 2024 · DOI

Introduction

Detoxifying Large Language Models (LLMs)—the process of training them to rephrase toxic inputs into neutral, safe outputs—is a critical challenge in AI safety. Traditional approaches typically rely on two types of data: parallel corpora (pairs of toxic and clean sentences) or human preference labels (rankings of model outputs). However, both are resource-intensive to produce. Parallel datasets are often small and domain-specific, while preference-based alignment methods like Direct Preference Optimization (DPO) struggle with the "incomplete preference" problem: if a model generates two equally toxic outputs, there is no clear "winner" to guide the learning process.

To address these limitations, this research introduces Stackelberg Response Optimization (SRO), a fine-tuning framework that enables detoxification using only non-parallel data and a simple binary toxicity classifier.

Methodology: The Stackelberg Game

The researchers frame the interaction between an LLM and a toxicity screener as a Stackelberg game. In this strategic model, the LLM acts as the "leader," generating a response first, while a toxicity screener (the "follower") evaluates that response.

The SRO framework utilizes a feedback loop where an LLM's output is screened for style, and the resulting pass/fail signal guides optimization.

The core innovation of SRO lies in how it handles the feedback from the screener. Unlike standard alignment techniques that require a preference pair, SRO utilizes a hybrid loss function based on two scenarios:

  1. The "Pass" Case: When the LLM successfully generates a non-toxic paraphrase, SRO treats this as a preferred outcome. It optimizes the model to favor this clean output over the original toxic input, similar to the mechanics of DPO.
  2. The "Fail" Case: If the LLM produces a response that is still toxic, SRO applies a partial loss. Instead of discarding this data or requiring a better alternative, the model is penalized for generating that specific failed response. This "negative reinforcement" allows the model to learn even when it fails to find a correct solution immediately.

By using an SVM-based style screening mechanism, the system can provide automated, binary feedback without human intervention or complex reward modeling.

Experimental Results

The SRO method was evaluated using the Jigsaw Toxic Comment Classification Challenge dataset. Performance was measured using the J-metric, a composite score of Style Accuracy (STA), Content Similarity (SIM), and Fluency (FL).

Comparative performance of SRO against various baselines and human references across multiple metrics.

As shown in the results, SRO achieved a J-score of 0.66, matching the performance of human references. It significantly outperformed existing non-parallel detoxification methods such as ParaGeDi (0.62) and CondBERT (0.62). Notably, SRO maintained high fluency (0.92), avoiding the common pitfall of word-replacement methods (like "Delete" or "Mask&Infill") which often produce disjointed or ungrammatical sentences.

Ablation studies further highlighted the importance of the "fail loss" component. When the ability to learn from unsuccessful attempts was removed, the model's J-score dropped from 0.66 to 0.51, confirming that negative reinforcement is essential when training on non-parallel data.

Discussion and Limitations

While SRO demonstrates a powerful path toward automated detoxification, it is highly dependent on the accuracy of the toxicity screener. The authors noted that even a 10% error rate in the screener's classifications leads to a significant degradation in the LLM's performance. This suggests that the "Follower" in the Stackelberg game must be robust and highly reliable.

Future work may explore moving beyond binary signals to continuous or multi-class feedback, which could provide more nuanced guidance for the model. Additionally, testing the SRO framework on other forms of undesirable content, such as misinformation or implicit bias, remains a key area for exploration.

Summary updated

Abstract

Text detoxification, a variant of style transfer tasks, finds useful applications in online social media. This work presents a fine-tuning method that only uses non-parallel data to turn large language models (LLM) into a detoxification rewritter. We model the fine-tuning process as a Stackelberg game between an LLM (leader) and a toxicity screener (follower), which is a binary style classifier (toxic or non-toxic). The LLM aims to align its preference according to the screener and generate paraphases passing the screening. The primary challenge of non-parallel data fine-tuning is incomplete preference. In the case of unsuccessful paraphrases, the classifier cannot establish a preference between the input and paraphrase, as they belong to the same toxic style. Hence, preference-alignment fine-tuning methods, such as direct preference optimization (DPO), no longer apply. To address the challenge of incomplete preference, we propose Stackelberg response optimization (SRO), adapted from DPO, to enable the LLM to learn from the follower's response. The gist is that SRO decreases the likelihood of generating the paraphrase if it fails the follower's screening while performing DPO on the pair of the toxic input and its paraphrase when the latter passes the screening. Experiments indicate that the SRO-fine-tunned LLM achieves satisfying performance comparable to state-of-the-art models regarding style accuracy, content similarity, and fluency. The overall detoxification performance surpasses other computing methods and matches the human reference. Additional empirical evidence suggests that SRO is sensitive to the screener's feedback, and a slight perturbation leads to a significant performance drop. We release the code and LLM models at \url{https://github.com/XXXinhong/Detoxification_LLM}.
BibTeX
@misc{xie2024learning,
  author = {Xinhong Xie and Tao Li and Quanyan Zhu},
  title = {{Learning from Response not Preference: A Stackelberg Approach for LLM Detoxification using Non-parallel Data}},
  year = {2024},
  eprint = {2410.20298},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.20298},
}
Figure