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 dialoguestyle 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.

heading: 1 Introduction
text: Disclaimer: Figures and examples in this work may feature offensive language.
Timely moderation helps curb the spread of hateful content on social-media platforms and prevents the harmful effects it has on a user’s psychological well-being (Waldron, 2012; Ye et al., 2023). Unfortunately, the sheer volume of content generated
Approved for public release: Distribution unlimited.
on these platforms makes it infeasible to enforce a scalable human moderation process (Hassan et al., 2022; Dosono and Semaan, 2019). AI-based moderation systems can help with this problem. However, current systems often remove or flag offensive content, which can reduce user participation and diversity in online discussions (Xiang et al., 2012; Warner and Hirschberg, 2012; Kwok and Wang, 2013; Wang et al., 2014; Burnap and Williams, 2015; Nobata et al., 2016; Davidson et al., 2017; Founta et al., 2019; Jhaver et al., 2019; Ye et al., 2023). A better alternative is to paraphrase offensive content to make it less offensive. Paraphrasing offensive content; however, is nontrivial since the paraphrased output should not only be inoffensive but also retain the original meaning and intent.
12612
Prior works (Atwell et al., 2022; Logacheva et al., 2022) have proposed using supervised generative models (Vaswani et al., 2017) like BART (Lewis et al., 2019), to paraphrase offensive content. However, these methods require sufficient labelled training data, which makes it harder to adapt them to novel settings. Moreover, these models are optimized to perform well on certain automated metrics (Papineni et al., 2002; Zhang et al., 2019; Lin, 2004; Vedantam et al., 2015) at the expense of possibly retaining a portion of the original toxicity, thereby making us question their overall usability for the targeted task (see Figure 1).
The emergence of few-shot In-Context Learning (ICL) has revolutionized the field by complementing the generalization capabilities of Large Language Models (LLMs) to quickly and accurately adapt to new tasks. It does this by using a small amount of labeled data, known as demonstrations or demos or examples (Brown et al., 2020). As shown in Figure 1, ICL approaches show BLEU score performance that is comparable to BART, but significantly reduces the measured toxicity (Hanu and Unitary team, 2020). Through detailed, principled experiments we explore the viability of ICL for paraphrasing offensive content, which to the best of our knowledge has not been done before. Our key contributions and findings in this paper are summarized below.
1. Influence of the following factors on generation quality, as briefly shown in Figure 1. (a) Number of Demonstrations: Performance improves by increasing number of demos but eventually saturates. (b) Selection and Order of Demonstrations: Systematically selecting and ordering demos is better than its random counterpart. It is more effective to select demos that are semantically similar to the query and curate them in a decreasing/increasing order of similarity. (c) Exclusion of Prompt Instruction in Prompt: ICL without the main instruction only slightly affects performance but at the expense of toxicity. Thus we need both demonstrations and instructions to simultaneously preserve performance and lower toxicity. (d) Robustness to Training Data Size: Carefully ordering demos shows robustness to available training data size, with only small decrease in generation performance even when 10% of training data is only made available.
2. We tested the capabilities of OpenAI’s textdavinci-003, gpt-3.5-turbo-0613, gpt-3.5turbo-instruct, gpt-3.5-turbo-1106 models and the open-source Vicuna-13b model (Chiang et al., 2023). ICL generated paraphrases are comparable to SOTA supervised approaches in performance, but on average show 76% less toxicity and are 25% better using a manual qualitative assessment, and thus have superior overall usability. We also show that our demonstration curation approach is simpler and faster than other more sophisticated methods that offer only marginal performance improvements at the expense of significant time delays.
3. Current paraphrasers are less effective at mitigating offensiveness like rudeness in conversations. They are trained using datasets that focus on social-media content, and hence aren’t directly applicable to dialogue-based environments. To this end we release a new ContextAware Polite Paraphrase (CAPP) dataset1, a dialogue-style corpus of rude utterances and corresponding polite paraphrases, with samples accompanied by additional context in the form of prior turns from the dialogue. We conduct experiments to show the importance and benefit of incorporating context to improve paraphraser performance.
Paper Outline: Section 2 describes ICL in our experimental setting; details about selecting and ordering the demos; and finally our proposed CAPP dataset in detail. Section 3 contains detailed experimental results. Section 4 discusses related work. Section 5 concludes the paper.

heading: 2 Method

heading: 2.1 In-Context Learning
text: Prompts used for ICL contain three parts – (1) an instruction I that defines the task to be performed; (2) a set of n demonstrations from the training corpus, D = (xi, yi)ni=1, where (xi, yi) denotes the offensive, inoffensive sentence pair; and (3) the offensive test query sample xq. Consider the following prompt example with n = 2 demonstrations, where the final sentence represents the query for which we want to generate the paraphrase.
1The CAPP dataset and generated paraphrases are available online at https://github.com/anirudhsom/CAPP-Dataset.
Instruction: Paraphrase the following sentence to be more polite. Sentence: What’s wrong with you? Paraphrase: Are you feeling alright? Sentence: Get out of the way. Paraphrase: Can you please step aside? Sentence: What’s the matter with you? Paraphrase:
The impact of each part on the BLEU score and toxicity is briefly illustrated in Figure 1. For instance, prompts with only instruction show the lowest BLEU scores, followed by prompts with only demos, while prompts that include both have the best BLEU scores. In terms of Toxicity, prompts with just instruction show the least Toxicity, followed by prompts that include both demos and instruction, while prompts that only include demos exhibit a higher toxicity. The order of demos is also crucial, and we discuss this next.

heading: 2.2 Selection and Ordering of Demonstrations
text: Here we describe our approach to select and order the demonstrations. We first compute normalized vector embeddings for each training sample xi and the query xq, denoted as ei and eq respectively. Next, the cosine similarity score between eq and each ei is used to select n demonstrations. We explored the following two variations for selecting the demonstrations – (1) Least Similar, (2) Most Similar, i.e., select n demos with the lowest and highest cosine similarity scores, respectively. These are compared to randomly selecting n demos, that are arranged in no particular order. We further investigated if arranging the n selected demos in either ascending or descending order based on their measured cosine similarity, had any impact on the overall performance. Using BLEU and toxicity, Figure 1 compares Random selection to the Most Similar (Descending order) approach, with the latter being better on both fronts. Our findings for other selection and ordering approaches are described in detail in Section 3.2.

heading: 2.3 Context-Aware Polite Paraphrase (CAPP) Dataset
text: Existing datasets (Atwell et al., 2022; Logacheva et al., 2022) contain comments flagged for toxicity and provide non-toxic paraphrases that maintain the core meaning in a neutral manner. However, they are not directly suitable to address rudeness in speech, as speech is often directed at specific par-
ticipants, while social media posts have a broader audience, resulting in different styles and tones. Additionally, most social media posts can be remedied by removing explicit insults, but rude speech requires additional modifications to make it more polite. For instance, we should not just eliminate offensive language and direct insults in a rude utterance, but also transform an accusation of ignorance into an inquiry about knowledge.
To address the aforementioned differences, we constructed a dialogue-style rude speech dataset by leveraging the OpenSubtitles corpus (Lison and Tiedemann, 2016). Our approach involved a threestep process to extract target rude utterances. First, we fine-tuned a DistilBERT-base model (Sanh et al., 2019) using both the Stanford Politeness corpus (Danescu-Niculescu-Mizil et al., 2013) and a subset of manually labeled OpenSubtitles samples to train a three-class model capable of predicting polite, neutral, or rude sentences. Next, we use the fine-tuned model to annotate a larger, different portion of the OpenSubtitles corpus, bootstrapping additional training data for our final rudeness detection model. Finally, a separate portion of the OpenSubtitles dataset was selected and labeled as rude, polite, or neutral using the updated rudeness detection model, resulting in an intermediate set containing rude samples without polite paraphrases. Detailed information about the training/evaluation of the rudeness detector is provided in Appendix A. When available, context in the form of prior turns from the dialogue that precede the rude utterance was also collected for the selected rude samples.
The gpt-3.5-turbo-0613 model was used to gen-
erate the Gold-Standard or Groundtruth polite paraphrases. To do this we first explored three different prompts for generating three versions of polite paraphrases before finally deciding on one – (1) Context-Free: No prior dialogue context was included in the prompt, ensuring that the generated paraphrase is solely based on the rude utterance; (2) Context-Infused: Prompt includes context which can significantly influence the generated paraphrase; (3) Context-Aware: Prompt includes context, with the generated paraphrase being less impacted by it. For each version, 500 rude utterances and their corresponding polite paraphrases were randomly selected for qualitative evaluation. An in-house annotator assessed the quality of the paraphrases using the scoring guidelines in Table 1 and was not informed about the type of prompt used to generate the polite paraphrases. The annotator identifies as a 28 year old cis female (pronouns she/her) and was compensated monetarily. Table 2 shows the final evaluation scores. The Context-Aware prompt achieves a score comparable to the Context-Free prompt while still incorporating context like the Context-Infused prompt. Context-Aware combines the benefits of both, and was hence used in the CAPP dataset.

heading: 3 Experiments and Discussion
text: 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 (Atwell et al., 2022), ParaDetox (Logacheva et al., 2022), 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 (Wieting and Gimpel, 2017). 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-basev2) (Reimers and Gurevych, 2019) to generate the
B L
E U
normalized embeddings described in Section 2.2. We evaluated generation quality using automated evaluation metrics such as BLEU (Papineni et al., 2002), BERT-F1 (Zhang et al., 2019), ROUGE (Lin, 2004) and CIDEr (Vedantam et al., 2015). 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.

heading: 3.1 Number of Demonstrations
text: Figure 2 shows the relation between number of demonstrations and BLEU (refer to Appendix C.1, Figure 8 for other metrics). We set the number of demonstrations to [0, 1, 10, 20, 30, 40] for text-davinci-003, gpt-3.5-turbo-0613, and [0, 1, 2, 4, 6, 8, 10] for Vicuna-13b. We used the proposed Most Similar (Descending Order) approach to select and order the demos. We observe that BLEU improves rapidly until 10 demos for the OpenAI models and 4 demos for the Vicuna-
te x
td
a v
in ci
-0 0 3 g p t3 .5 -t u rb o -0 6 1 3
V ic
u n
a -1
3 b
13b model across all datasets. Further increasing the demos only results in slight improvement, as each additional demo is semantically less similar to the query and thereby less important than the demonstrations selected before (Liu et al., 2021).
We notice in the case of the gpt-3.5-turbo-0613 model on CAPP dataset that BLEU without any demos is better than with 40 demos. It’s possible that the main instruction used here was less effective in the ICL paradigm, and that a different instruction could have increased the BLEU score, as seen later in Section 3.3. However, we believe this happens because the Gold-Standard for CAPP was also generated using gpt-3.5-turbo-0613. This hints at the possibility of ICL not necessarily improving paraphrasing performance of LLMs, which in turn were used to generate the dataset. We see similar observations in the following sections as well.

heading: 3.2 Selection and Order of Demonstrations
text: We now discuss the effect of selection and ordering the demos in the prompt on BLEU. Note, in Figures 3 and 4, the number of demonstrations was set to 10 and explore the different ordering mechanisms described in Section 2.2. In Figure 3, we observe that the Random strategy sometimes achieves better BLEU than the Least Similar strategy. While in
most cases the Most Similar shows better performance than both Random and Least Similar. This intuitively makes sense since Most Similar represents samples from the training corpus that are most semantically similar to the query (Liu et al., 2021). This enables the LLM to generate a paraphrase that is also similar to the Gold-Standard paraphrase of the query. Next, the order in which the demos are arranged also has an impact on BLEU score. We find that curating the demos in decreasing order of similarity often results in better BLEU than arranging them in increasing order of similarity. We also observe similar trends with other automated evaluation metrics. Note, the above observations do not apply to the gpt-3.5-turbo-0613 model on the CAPP dataset.
While the approaches described in Section 2.2 are simple and effective, they might not bring out the best possible performance. Sophisticated methods to select and order demonstrations have been proposed and have shown better performance in other applications (Ye et al., 2022; Zhang et al., 2022; Lu et al., 2021). However, we find that they offer only marginal improvement, while taking significantly longer times to process each query sample. For example, Table 3 shows the different performance metrics and compute times for (Ye et al.,
B L
E U
T o
x ic
it y
2022)’s MMR method and the proposed ICL-based approach. Note, gpt-3.5-turbo-1106 was used as the generation model for MMR. While MMR might be marginally better quantitatively, it is several orders of magnitude slower than the proposed approach in terms of mean Similarity Compute Time and mean Demo Retrieval Compute Time. Please refer to Appendix C.2 for more details on this topic.

heading: 3.3 Significance of Instruction
text: We now investigate the effect of removing the instruction in the prompt. The left-most set of bars within each bar plot in Figures 3 and 4, which show prompts with No Instruction, display BLEU scores that are on par with prompts that include both instructions and demonstrations. This is interesting since it is a common practice to always include the instruction in the prompt even if no demonstrations are provided. Our results suggest that when it is difficult to determine effective instructions for the target paraphrasing task, with ICL one can simply use a few systematically selected demonstrations to get high quality generated paraphrases.
In Figure 4, for text-davinci-003 on APPDIA, we observe that the No Instruction setting retains a significant amount of the original content’s toxicity, thereby making its usability questionable. Similar
observations were made with other models (refer to Appendix C.3, Figure 9). Order of demos also plays an important role in the No Instruction setting, with the Most Similar showing much lower toxicity than both Random and Least Similar strategies. For cases that include both instruction and demos, the measured toxicity is less impacted by the order of demos, indicating that the main instruction serves as a toxicity regularizer.
We want to also highlight that creating a good instruction for paraphrasing tasks is non-trivial. Despite using good demos, a bad instruction can negatively impact the quality of the generated paraphrase. For instance, in Figure 3, the Vicuna-13b model shows better BLEU with just the curated demonstrations on the APPDIA and ParaDetox datasets. Similarly, in Figure 4, we see that certain instructions can result in lower BLEU than prompts that have No Instruction.

heading: 3.4 Comparison with Supervised Approaches
text: We compare our ICL-based approach to prior state-of-the-art supervised baselines. For APPDIA we use BART, T5, DialoGPT, and PDTB+RST methods as done in (Atwell et al., 2022); for ParaDetox we use BART as done in (Logacheva et al., 2022); and for CAPP we fine-tuned BART-base and T5-base on the training set. We used the default hyperparameters defined in the Transformers Seq2SeqTrainer for fine-tuning on CAPP. The comparison between our ICL-based approaches (including the newer OpenAI models, gpt-3.5-turboinstruct and gpt-3.5-turbo-1106) and prior baselines is shown in Table 3.
Note, the objective of any paraphraser should be to score high on generation quality and have a low Toxicity in the generated paraphrases. For APPDIA and ParaDetox, the BART and T5 models perform better than the ICL-based approach on the different standard evaluation metrics. However, the paraphrases generated by these baselines seem to retain a significant amount of the original toxicity. To better understand this issue, we use the Toxicity for the Inoffensive Gold-Standard in each dataset as a point of reference. Ideally, a paraphraser should generate paraphrases whose average Toxicity is no greater than this reference. We observe that all baseline methods except DialoGPT show a higher Toxicity, while the ICL-based methods exhibit Toxicity that is lower or on par with that of the Gold-Standard. Our approach offers a better trade-off between generation quality and Toxicity.
Figure 5 illustrates the Toxicity measured for the different ICL-based methods by varying the number of demonstrations. The Most Similar (Descending Order) strategy was used to select and organize the demos. It also displays the measured Toxicity of the Offensive Test Set, the Gold-Standard and the different baselines. Note that, B1, B2, B3, B4 refer to BART, T5, DialoGPT and PDTB+RST models respectively. For APPDIA and ParaDetox we observe that LLMs without any demonstrations show much lower Toxicity than when any demonstration is used. The reverse, however, is observed for the CAPP dataset. The absence of demos causes LLMs to fallback on their own task definition which results in paraphrases with Toxicity significantly different from that of the Gold-
Standard. However, the absence of demos also causes the generated paraphrases to exhibit a lower BLEU score as seen earlier in Figure 2. A balance between the main instruction and demos can ensure generation of paraphrases that reduce offensiveness and score high using different automated metrics.

heading: 3.5 Additional Dialogue Context Helps
text: We show preliminary results of using the prior utterances leading up to the rude utterance as additional context in the our ICL-based method. Similar to the example in Section 2.1, we prepend the context for both the demo and the query. Figure 6 shows BLEU score as we add/remove context and vary the number of demonstrations. We clearly see performance improvement by incorporating dialogue context us-
ing the text-davinci-003 and gpt-3.5-turbo-0613 models. We were unable to create a prompt for Vicuna-13b that successfully uses additional context in the ICL framework. We will develop such prompts for Vicuna-13b in future work.

heading: 3.6 Robustness to Reduced Training Data
text: Here we study the impact of available training data on the performance of our best performing strategy i.e. Most Similar (Descending Order). We observe only a minimal fall in BLEU up to 10% of the training data as shown for text-davinci-003 in Figure 7 (refer to Appendix C.4, Figure 10 for other models). Further reducing training data results in noticeable drop in BLEU. We also find that reducing training dataset below 10% results in BLEU score that is similar to Random demo selection and arrangement strategy but with access to 100% of the training data. That result shows that our ICLbased method can work with limited training data and thus can be adapted quickly to novel settings.

heading: 3.7 Manual Qualitative Assessment
text: We also perform quality assessment of the Goldstandard and generated paraphrases using a human annotator. We select a subset of 150, 200, and 200
samples from the test-set of APPDIA, ParaDetox and CAPP respectively. For ParaDetox and CAPP, we use all the supervised baseline methods listed in Table 3. For APPDIA we only use BART and DialoGPT models for comparison. Our in-house annotator (mentioned earlier in Section 2.3) used the scoring guidelines described in Tables 1 and 4. Information about the type of model used to generate each paraphrase was not made available to the annotator. Table 3 shows that the three ICL-based LLM models received a higher average score that is significantly different (i.e., p-value < 0.05) than the corresponding baseline methods. We also note that Vicuna-13b’s qualitative score was comparable to and in some cases better than the OpenAI models, despite having scored lower on metrics that are traditionally used to measure generation quality. This shows that open-source LLM paraphrasers are comparable to closed-source LLMs as per human assessment and might be a viable alternative. Refer to Appendix C.5 for additional analysis between manual evaluation score and toxicity metric.

heading: 4 Related Work
text: Our paper explores the potential use of LLMs with ICL for paraphrasing systems. There has been sig-
B L
E U
nificant interest in better understanding the capabilities of ICL, but for other applications (Min et al., 2021a; Zhao et al., 2021; Razeghi et al., 2022; Xie et al., 2021; Lampinen et al., 2022; Mishra et al., 2021; Chen et al., 2021; Min et al., 2021b; Chen et al., 2023). For instance, (Lu et al., 2021) showed that order of demos has a significant impact on model performance. (Liu et al., 2021) showed that retrieving demonstrations that are semantically similar to the query can be a more effective approach to control the variability in performance. (Rubin et al., 2021) learned an encoding scheme to retrieve better demos for ICL. Other works also explored the influence of number of demos in different settings (Garg et al., 2022; Min et al., 2022; Wei et al., 2023). (Zhou et al., 2022) evaluated the importance of each part in the prompt has towards the final performance. In this paper we study the impact of various components on the final performance, while ensuring that the toxicity of the outputs is within tolerable levels. This enables us to propose a few-shot solution to offensive content paraphrasing. Most prior works (Atwell et al., 2022; Lo-
B L
E U
gacheva et al., 2022) have modeled paraphrasing as a sequence-to-sequence problem and trained models such as T5, BART on human annotated data. Despite good generation results, these models tend towards higher toxicity and are difficult to adapt to new applications without collecting more data. Our solution addresses those challenges successfully, with only a fraction of the original training set.

heading: 5 Conclusion
text: 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.

heading: Acknowledgments
text: This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Contract No. HR001122C0032. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views or policies of DARPA, the Department of Defense or the U.S. Government.
Limitations
Here, we list the limitations identified in this paper:
1. We found that ICL fails on datasets that were prepared using the same LLMs used in the ICL framework. Since we used the gpt-3.5turbo-0613 model to create polite paraphrases for our CAPP dataset, we were unable to see the same observations in our results when using other models and datasets. This could have been avoided by creating manually annotated polite paraphrases. However, manual annotation is a laborious process and isn’t scalable. Hence, a manual qualitative assessment was done on a small subset of the final CAPP dataset to ensure usability of the generated paraphrases.
2. Prompt engineering for the Vicuna-13b model with the ICL framework is nontrivial. We found it difficult to create main instructions in the prompt that result in the Vicuna-13b model to behave in a desired way. Also, unlike the two OpenAI models, the number of demonstrations that can be effectively passed into Vicuna-13b is quite limited. In some cases we were able to concatenate more than 10 demos to the prompt but it often resulted in generating incomprehensible or empty outputs.
3. The No Instruction prompt explored in the paper resulted in paraphrases that are comparable to prompts that include both instruction and demos, on several automated evaluation metrics. However, we notice that the No Instruction setting also retains a significant amount of toxicity from the original content. We propose that in situations where it is difficult to decide on a good main instruction, one could simply use a few carefully curated and ordered demos like the “Most Similar (Descending Order)” approach to generate para-
phrases and check if it is within the desired toxicity levels.
4. Our experimental results indicate that there is no single prompt that works in all situations. One must carefully balance the main instruction and the set of demos from the training corpus to get desired paraphrase outputs.
5. We showed preliminary results showcasing the benefit of incorporating additional context in the form of prior two utterances in the ICL framework. We believe there can be better ways to incorporate this contextual information and further improve performance of LLMs.
6. The closed-source OpenAI models are more powerful, faster and expensive to use. Despite open-source models like Vicuna-13b coming close to OpenAI models on other tasks, they still have a long way to go for offensive content paraphrasing.
Ethics Statement
We have to take great care with our collection of offensive content to protect privacy. We have to ensure judicious use of the collected data to protect the vulnerable against such speech. We recognize that our models cannot entirely eliminate offensive content from a given text. Additionally, we acknowledge that utilizing pretrained models may introduce biases in specific situations, as studies have revealed that pretrained models can be influenced by biases present in the data used for their initial training. We have to continue research on making sure that the LLMs do not hallucinate and end up injecting toxicity since we don’t know what they have been trained on. There is a danger of this kind of technology being used in reverse, i.e., take harmless content and paraphrase to inject toxicity. We realize that ethics is an ongoing challenge. We are engaged with the Fairness, Accountability and Transparency community and are learning to address key ethics issues on an ongoing basis.

heading: A Context-Aware Polite Paraphrase (CAPP) Dataset
text: This section provides additional details about the training protocol used to develop the rudeness detector described in Section 2.3. The initial rudeness detection model was trained on a randomlyselected subset of the OpenSubtitles corpus (Lison and Tiedemann, 2016) that was manually annotated by an in-house human annotator, as well as the Stanford Politeness corpus (Danescu-Niculescu-Mizil et al., 2013). Between these two data sources, this model was trained on 10997 gold-quality samples. This intermediate model achieved an overall accuracy score of 59.40 across the three classes (rude, polite, and neutral). The accuracy for specifically rude utterances in the test data was 71.84 – higher than that of other classes. The final rudeness detection model, trained on a combination of the aforementioned gold data, and a larger subset (250379 samples) of the OpenSubtitles corpus annotated using the intermediate model, achieved an overall accuracy of 57.20 across the three classes, with an accuracy score of 71.84 on rude samples – still higher than the accuracy on other classes. The disparity in rudeness detector performance between classes was deemed acceptable due to its high performance on the rude class. Accurate identification of rude utterances was prioritized in the interest of generating a sufficient number and variety of rude utterances for paraphraser training – with an acceptance of the potential for noise in the form of some non-rude utterances in the training data.
B Instructions Used in Experiments
The exact prompt instruction used for each experiment in Section 3 is shown below. Except Subsection 3.2 and 3.3, we use only Instruction-1 for the following Subsections 3.1, 3.4, 3.5, 3.6 and 3.7.
1. Instruction prompts used for text-davinci-003 and gpt-3.5-turbo models on the APPDIA dataset:
(a) Instruction-1: Instruction: Rewrite the following sentence to be inoffensive
(b) Instruction-2: Instruction: Rewrite the following sentence to be inoffensive and ensure that the paraphrased sentence is similar to the original sentence
(c) Instruction-3: Instruction: Generate a paraphrased sentence that expresses a more balanced viewpoint
(d) Instruction-4: Instruction: Rewrite the following sentence with a more objective tone
2. Instruction prompts used for text-davinci-003 and gpt-3.5-turbo models on the ParaDetox dataset:
(a) Instruction-1: Instruction: Rewrite the following sentence to be inoffensive
(b) Instruction-2: Instruction: Rewrite the following sentence to be not toxic
3. Instruction prompts used for text-davinci-003, gpt-3.5-turbo and Vicuna-13b models on the CAPP dataset:
(a) Instruction-1: The following sentence can contain rude text. Please provide one paraphrased sentence that is semantically similar to it and is polite.
4. Instruction prompts used for Vicuna-13b model on APPDIA and ParaDetox datasets:
(a) Instruction-1: The following sentence contains offensive text. Please provide one paraphrased sentence that is semantically similar to it and is inoffensive.
5. While incorporating additional context in the form of previous two turns in the dialogue, the instruction prompt used for text-davinci003 and gpt-3.5-turbo models on the CAPP dataset:
(a) Instruction-1: Paraphrase only the below Sentence to be polite and semantically similar to the Sentence. Use the context as as reference but do not include any part of it in the final paraphrase.

heading: C Experiments
text: C.1 Number of Demonstrations Figure 8 provides additional details, supporting the information described in Section 3.1.
C.2 Selection and Order of Demonstrations This section provides additional details, supporting the information described in Section 3.2. While the original paper (Ye et al., 2022) suggests using BERT-Score for similarity measurement, we also explore the cosine similarity measurement for the normalized embeddings extracted using the sentence transformer models. We refer to the original
implementation as MMR-BERT and name the new variant as MMR-Embedding. The parameter λ was set to 0.5 for both MMR approaches. Tables 3 and 5 compare the performance differences between the different MMR approaches and the proposed best
performing ICL-based approach, i.e., the Most Similar (Descending Order) method. Comparison is done using various quantitative evaluation metrics and compute time metrics. Note, for the proposed approach, the compute times reported correspond
to the Most Similar (Descending Order) method, however, these would also be the same for the other demonstration selection and ordering approaches described in Section 3.2. The different compute time metrics explored are defined as follows – The mean Similarity Compute Time measures the average time taken to perform similarity measurement between a query test sample and all the available reference training samples; The mean Demo Retrieval Compute Time measures the average time taken to select n demonstrations from the available training set based on the similarity measurements done previously. Here, n is defined beside each method’s name within parenthesis. The total time taken to process each query test sample would approximately be equal to the sum of the above two compute times.
Table 3 shows that the MMR methods offer marginal improvement with respect to the different quantitative metrics but at the expense of significant time delays. Note, the Similarity Compute Time for MMR-Embedding is the same as our proposed ICL-based approach since both employ the cosine similarity metric. Quantitative metrics for the two MMR approaches is only reported for 10 demonstrations in Table 3 as we observed even greater delays with respect to Demo Retrieval Compute Time when trying to retrieve 40 demonstrations. Table 5 reports the two Compute Times for the different MMR approaches and proposed ICL method, for both 10 and 40 demonstrations. Note, gpt-3.5turbo-1106 was used as the generation model for MMR. For the proposed ICL-based approach we observe negligible differences in compute times when we want to retrieve either 10 or 40 demonstrations. However, the MMR-BERT approach becomes 10 times slower when trying to retrieve 40 demonstrations instead of 10.
While there are several demonstration selection and ordering approaches (Ye et al., 2022; Zhang et al., 2022; Lu et al., 2021) that can help push the performance ceiling, one must also make sure if these approaches can be easily implemented and scaled up in a real-time, real-world application setting. For example, (Zhang et al., 2022) propose a reinforcement learning algorithm to identify generalizable policies to select demonstrations but find that this approach offers diminishing returns on larger, more sophisticated LLMs. The approach described by (Lu et al., 2021) to overcome fewshot prompt order sensitivity is better suited for multi-class classification tasks, since the entropy-
based statistics framework discussed to identify performant prompts is not directly applicable to text generation tasks like paraphrasing.
C.3 Significance of Instruction Figure 9 provides additional details, supporting the information described in Section 3.3.
C.4 Robustness to Reduced Training Data Figure 10 provides additional details, supporting the information described in Section 3.6.
C.5 Correlation between Manual Evaluation Score and Automated Toxicity Metric
The manual quality evaluation score considers not just Toxicity minimization in the generated paraphrase but also considers meaning preservation. Directly comparing it to the automated toxicity score is not possible since there is a semantic mismatch between the two metrics. Instead, we first compute the difference in the toxicity measured between the (offensive) utterance and the (inoffensive) paraphrase. Next, we compute the Pearson correlation between this difference in toxicity score to the manual quality evaluation score. This difference captures the comparisons made by the annotator while coming up with the manual scoring as shown in Tables 1 and 4. Therefore, if there is correlation between this automatically computed difference and the manual scores, then convergent validity is assured.
Tables 6, 7, 8 show the computed Pearson correlation coefficient between the manual quality evaluation score and automated toxicity score under two different settings. Type-1 represents the Pearson correlation coefficient between the manual quality score and automated toxicity score of the paraphrased output; and Type-2 represents the Pearson correlation coefficient between the manual quality score and difference in measured toxicity between original utterance and paraphrased output. Note, the dynamic range of the toxicity captured in the CAPP dataset is low because it mostly consists of rude speech that contains little or no foul language.
B L
E U
B L
E U
B L
E U

heading: Future Work
text: We will develop such prompts for Vicuna-13b in future work