Demonstrations Are All You Need: Advancing Offensive Content Paraphrasing using In-Context Learning (2024)

Abstract: Paraphrasing of offensive content is a better alternative to content removal and helps improve civility in a communication environment. Supervised paraphrasers; however, rely heavily on large quantities of labelled data to help preserve meaning and intent. They also often retain a large portion of the offensiveness of the original content, which raises questions on their overall usability. In this paper we aim to assist practitioners in developing usable paraphrasers by exploring In-Context Learning (ICL) with large language models (LLMs), i.e., using a limited number of input-label demonstration pairs to guide the model in generating desired outputs for specific queries. Our study focuses on key factors such as - number and order of demonstrations, exclusion of prompt instruction, and reduction in measured toxicity. We perform principled evaluation on three datasets, including our proposed Context-Aware Polite Paraphrase (CAPP) dataset, comprising of dialogue-style rude utterances, polite paraphrases, and additional dialogue context. We evaluate our approach using four closed source and one open source LLM. Our results reveal that ICL is comparable to supervised methods in generation quality, while being qualitatively better by 25% on human evaluation and attaining lower toxicity by 76%. Also, ICL-based paraphrasers only show a slight reduction in performance even with just 10% training data.

## experiments and discussion we realized icl using openai's text-davinci-003, gpt-3.5-turbo-0613 models and their latest standins, and the open-source vicuna-13b model. we performed evaluation on the appdia @xcite , paradetox @xcite , capp datasets, with the corresponding (#training, #test) samples being (1584, 199), (11927, 670), (7939, 1120) respectively. appdia contains offensive reddit comments and their inoffensive paraphrases. the paradetox corpus consists of toxic and non-toxic sentence pairs, obtained by filtering the paranmt corpus @xcite . in capp, 55% of the training set and 53% of the test set contains prior dialogue context information. we used the sentence transformer (all-mpnet-base-v2) @xcite to generate the normalized embeddings described in section 2.2. we evaluated generation quality using automated evaluation metrics such as bleu @xcite , bert-f1 @xcite , rouge @xcite and cider @xcite . for toxicity we used the implementation by (hanu and unitary team, 2020). the exact prompt instruction used in all experiments is provided in appendix b. ## related work our paper explores the potential use of llms with icl for paraphrasing systems. there has been sigscore description 5 perfect meaning-preserving inoffensive paraphrase. paraphrase that is inoffensive but somewhat distinct in meaning. ## conclusion in this paper, we focus on developing usable offensive content paraphrasing systems by leveraging generalization capabilities of llms and quickly adapting them to new tasks using icl. a paraphraser should generate qualitatively good paraphrases that preserve the original content's meaning, while also minimizing toxicity. focusing only on one of these aspects compromises overall usability. compared to supervised approaches that require lot of training data and often produce undesired yet coherent paraphrases, our icl-based framework is generally comparable on various evaluation metrics like bleu, but is qualitatively better and helps significantly reduce toxicity in the generated paraphrases. through systematic experiments we tested the capabilities and limitations of icl-based offensive paraphrasers. other key highlights of using our icl framework include: (1) selection and arrangement of demos significantly impacts quality of paraphrases; (2) measured toxicity is lowest when only the instruction is used and highest when only demos are used. combining both instruction and demos helps ensure quality and usability of generated paraphrases; (3) robust to limited data, i.e., with just 10% training data we only see a slight decrease in overall performance, thereby enabling us to easily scale and deploy.