ICASSP 2025accepted0 citations

DETCP: Self-Detoxifying Language Models With Contrastive Pairs

Dianqing Liu, Yi Liu, Junbo Guo, Zhendong Mao

Abstract

Influenced by context such as tone, emotion and demographic, pre-trained language models may generate harmful text, which limits their widespread application. While detoxifying language models seeks to reduce the likelihood of generating harmful content. There are two categories of detoxification strategies: fine-tuning language models and constraining outputs during inference. Neither category of methods achieved a proper balance between detoxification efficacy, the amount of annotated data, and inference efficiency. In this paper, we introduce a lightweight detoxification approach aiming at guiding the probability distribution of generated tokens towards the opposite direction of toxification, which relies on the language model itself and the contrastive pairs of contexts in the inference phase, without training. Experiments show that our method has state-of-the-art performance in detoxification effect while it has an edge in both fluency and speed of text generation.

BibTeX
@inproceedings{icassp2025_detcpselfdetoxif,
  title = {DETCP: Self-Detoxifying Language Models With Contrastive Pairs},
  author = {Dianqing Liu and Yi Liu and Junbo Guo and Zhendong Mao},
  booktitle = {ICASSP 2025},
  year = {2025}
}