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

Anirudh Som, Karan Sikka, Helen Gent, Ajay Divakaran, Andreas Kathol, Dimitra Vergyri

Abstract

Traditional content moderation often relies on a binary "keep or delete" approach, which can stifle online discussion and reduce the diversity of discourse. This paper proposes an alternative: paraphrasing offensive content into polite language using In-Context Learning (ICL). By providing Large Language Models (LLMs) with a few well-chosen examples, the researchers demonstrate that ICL matches the quality of specialized supervised models while reducing toxicity by 76% and requiring 90% less training data.

Introduction

Existing supervised paraphrasers, such as fine-tuned BART models, face two significant hurdles. First, they are "data hungry," requiring massive labeled datasets of toxic-to-civil pairs. Second, they often suffer from toxicity retention; because they are trained to preserve original meaning, they frequently fail to remove the offensive "sting" of the source text. This study investigates whether LLMs can overcome these issues by leveraging their pre-existing knowledge through ICL.

Methodology: In-Context Learning

The core approach involves constructing a prompt that guides the LLM without updating its underlying weights. As shown in Figure 1, an ICL prompt typically consists of a task instruction, a small set of demonstrations (input-output pairs), and the target query.

Example of an ICL prompt structure for polite paraphrasing.

The researchers conducted a systematic study of demonstration selection and ordering. They found that "Most Similar (Descending Order)" selection—where examples are semantically closest to the query and arranged from most to least similar—yielded the best performance across models like GPT-3.5 and Vicuna-13b.

Datasets and Evaluation

The study utilized three key benchmarks:

  • APPDIA: Offensive Reddit comments.
  • ParaDetox: A large corpus of toxic/non-toxic pairs.
  • CAPP (Context-Aware Polite Paraphrase): A new dataset introduced in this paper that focuses on dialogue, including the prior turns of conversation to provide necessary context for the rudeness.

Key Results

As illustrated in Figure 2, ICL-based approaches significantly outperformed supervised baselines in toxicity reduction while maintaining competitive linguistic quality (BLEU scores).

Comparison of BLEU scores and Toxicity levels across datasets for baseline BART and various ICL configurations.

Major Findings:

  • Toxicity Reduction: ICL paraphrasers achieved 76% lower toxicity than state-of-the-art supervised models. This suggests that ICL acts as a natural regularizer, stripping away toxicity more effectively than models explicitly trained to mimic specific datasets.
  • Human Preference: In blind tests, humans rated ICL-generated paraphrases 25% better than those from supervised models.
  • Efficiency and Robustness: Models reached near-peak performance using only 10% of available training data for example selection. Furthermore, the "Most Similar" retrieval method proved to be orders of magnitude faster than complex selection algorithms like MMR.
  • The Power of Examples: Demonstrations were found to be the primary drivers of performance. In several instances, providing examples without any explicit instruction performed nearly as well as providing both.

Discussion and Future Work

While adding dialogue context in the CAPP dataset significantly improved relevance, the authors note that more sophisticated methods for incorporating conversational history could be explored. Additionally, while open-source models like Vicuna-13b performed well, they still lag behind closed-source models in following complex instructions. Finally, the researchers acknowledge the ethical risk of "reverse use," where these techniques could be used to toxify harmless content, highlighting the need for continued safety research.

Summary updated

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.
BibTeX
@inproceedings{som2024demonstrations,
  author = {Anirudh Som and Karan Sikka and Helen Gent and Ajay Divakaran and Andreas Kathol and Dimitra Vergyri},
  title = {{Demonstrations Are All You Need: Advancing Offensive Content Paraphrasing using In-Context Learning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.749},
}
Figure