Detoxifying Text with M a RC o: Controllable Revision with Experts and Anti-Experts (2023)

Abstract: Text detoxification has the potential to mitigate the harms of toxicity by rephrasing text to remove offensive meaning, but subtle toxicity remains challenging to tackle. We introduce MaRCo, a detoxification algorithm that combines controllable generation and text rewriting methods using a Product of Experts with autoencoder language models (LMs). MaRCo uses likelihoods under a non-toxic LM (expert) and a toxic LM (anti-expert) to find candidate words to mask and potentially replace. We evaluate our method on several subtle toxicity and microaggressions datasets, and show that it not only outperforms baselines on automatic metrics, but MaRCo’s rewrites are preferred 2.1 times more in human evaluation. Its applicability to instances of subtle toxicity is especially promising, demonstrating a path forward for addressing increasingly elusive online hate.

## introduction toxic, offensive, hateful, or biased language is increasingly prevalent and can cause online and offline harms, especially to minority groups @xcite . this is challenging for nlp systems to detect and account for when biases are subtle or without explicit toxic keywords @xcite @xcite . for example, the statement "you'll be fine! just talk like a white person" conveys the biased implication that non-white dialects are not conducive to success (figure 1 ), which is a harmful racial stereotype @xcite . text detoxification, i.e., rewriting text to be less toxic while preserving non-toxic meaning, provides a promising solution by suggesting alternative ways of expressing similar ideas with less biased implications (nogueira dos @xcite . for example, the rewrite "you'll be fine! just talk like a good person" eliminates the racial bias from the original statement while preserving the non-toxic meaning. such methods have the potential to improve 2) identify where the toxic and non-toxic lms disagree the most you'll be fine! just talk like a white person. ## text detoxification with marco marco is an unsupervised approach to text detoxification, consisting of two discrete steps: masking and then replacing tokens, assisted by the context of the entire sequence. though inspired by dex-perts @xcite , our novelty is two-fold: first, we tackle a more challenging task, unsupervised revision, instead of style-controlled generation, and second, we propose a detect and rewrite pipeline, in contrast to simple word-distribution steering during autoregressive generation. expert and anti-expert lms our method for unsupervised controlled revision is based on denoising autoencoder lms (ae-lms), which are trained to mask and reconstruct sequences of text. our setup consists of a base pretrained ae-lm g, an expert ae-lm g + finetuned on data with desirable attributes, and an anti-expert ae-lm g - finetuned on data with undesirable attributes. we use bart-base @xcite as our base autoencoder. we finetune the expert and antiexpert using 1m non-toxic and 100k overtly toxic comments from the jigsaw corpus (do, 2019), as done in @xcite and @xcite . bart can infill multiple or no tokens even if only one token is masked, allowing for more flexible mask infilling. see appendix a for training details. ## detoxification experiments & results in our experiments, we focus on rewriting sentences from three toxicity datasets, and use both automatic and human evaluations to measure marco's performance at detoxifying text. ## conclusion we present marco, a novel method for text detoxification, which utilizes auto-encoder language model experts in a mask and reconstruct process. our method outperforms strong baselines in automatic and human evaluations, showing strong ability to detoxify even subtle biases. marco's success demonstrates the effectiveness of controllable generation mixed with text rewriting methods 6 appendix c contains more example generations.