LLM s to Replace Crowdsourcing For Parallel Data Creation? The Case of Text Detoxification (2024)

Abstract: The lack of high-quality training data remains a significant challenge in NLP. Manual annotation methods, such as crowdsourcing, are costly, require intricate task design skills, and, if used incorrectly, may result in poor data quality. From the other hand, LLMs have demonstrated proficiency in many NLP tasks, including zero-shot and few-shot data annotation. However, they often struggle with text detoxification due to alignment constraints and fail to generate the required detoxified text. This work explores the potential of modern open source LLMs to annotate parallel data for text detoxification. Using the recent technique of activation patching, we generate a pseudo-parallel detoxification dataset based on ParaDetox. The detoxification model trained on our generated data shows comparable performance to the original dataset in automatic detoxification evaluation metrics and superior quality in manual evaluation and side-by-side comparisons.

## introduction the main challenge in solving many natural language problems has been and continues to be the lack of high-quality training data. each year, researchers and large corporations invest hundreds of thousands of dollars and countless hours of work collecting, evaluating, and manually labeling data in order to train machine learning models @xcite . while crowdsourcing remains one of the most popular methods for data collection, it presents several major drawbacks: (1) variability in data quality due to the diverse skill levels of contributors, (2) the total cost and time required for largescale projects, and (3) potential biases due to crowd workers differences in background. meanwhile, llms have shown the ability to solve numerous nlp tasks with zero or few examples (kojima * equal contribution. et @xcite . moreover, llms have also been tested as a replacement of crowdsourcing for many nlp data annotation tasks, including sentiment analysis, named entity recognition (ner) @xcite , machine translation @xcite , and many other text annotation tasks @xcite . despite their impressive capabilities, llms still struggle with text detoxification, a task of rewriting original toxic (e.g. rude) text in a polite (neutral) way that preserves the original meaning and does not degrade its fluency @xcite . llmbased annotation of pseudo-parallel data for detoxification is still a challenge due to strict alignment. both open-source and proprietary llms may at some point refuse to generate such detoxifications. in this work, we test the hypothesis that modern open-source llms, such as llama 3 (ai@meta, 2024), can serve as plausible parallel data annotators for the task of text detoxification. to bypass detoxification refusals, we apply the recently introduced activation patching technique @xcite and generate a pseudo-parallel detoxification dataset based on the toxic part of paradetox @xcite , a parallel detoxification corpus for english. following the training pipeline of @xcite , we train bart on both the original paradetox data and the pseudopa-radetox data generated by llms (cf. figure 1 ). our contributions are the following: (1) we adopt activation patching to use llms as detoxification data annotators. (2) we create several pseudo-parallel detoxification datasets based on the paradetox. (3) through comprehensive experimental evaluation we show that fine-tuning with the llm-generated pseudo-parallel data yields comparable or better detoxification performance to the original paradetox data according to automatic metrics, side-by-side comparisons and manual human evaluations. we openly release code, pretrained models, and the generated datasets. 1 2 related work the fundamental challenge of solving almost any nlp task is finding sufficient amount of labeled data. most models rely on thousands of pairs of labeled data to solve a given task with plausible performance. collecting and annotating such data is a costly and slow process @xcite . therefore, researchers propose different techniques to augment @xcite , generate @xcite @xcite or pseudolabel @xcite @xcite training data. pseudolabeling with llms, in particular, has been widely explored for a variety of nlp tasks such as classification @xcite , question answering (qa) @xcite , and named entity recognition (ner) @xcite . llms can handle effectively generating a label or relatively short spans of text given their pre-training on diverse and extensive amounts of data @xcite . being prompted with a few annotation examples, llms can easily generalize from limited labeled examples, enabling the generation of additional labeled data that can enhance model performance @xcite . however, the application of data labeling or augmentation with llms to sequence-to-sequence tasks remains relatively unexplored @xcite . sequence-to-sequence tasks, such as machine translation, text summarization, and text generation, involve generating entire sequences of text from input sequences. the complexity of maintaining coherence and contextual relevance across longer text spans presents unique challenges for llm utilization in this domain. ## evaluation automatic metrics in detoxification evaluation we follow the pipeline presented by @xcite . we calculate style transfer accuracy (sta), similarity (sim), fluency (fl) and their sentence-level average -joint score (j): side-by-side comparison automatic metrics may not fully reflect the differences in quality of the detoxification. the results require additional manual evaluation round @xcite . therefore, we further make side-by-side comparisons between our baseline and proposed methods using gpt-4o (openai, 2024) as a judge. the judgement is a single choice from three options: method a is better, method b is better, or they are comparable (tie). we provide the judgement prompt and other details in appendix a.4. ## conclusion in this work, we explored the usefulness of recent open-source llms as labeling systems for a sequence-to-sequence task of text detoxification (i.e., paraphrasing from rude to neutral text style). in order to avoid alignment limitations of llms, we have employed activation patching technique @xcite . following @xcite we fine-tune bart on paradetox parallel detoxification corpus and pseudoparadetox variants -pseudo-parallel detoxification data generated with llms in 0-shot and 10-shot setups. according to automatic evaluation metrics bart trained on pseudoparadetox is on par or better than bart trained on crowdsourced paradetox data. side-by-side and human evaluations show that patched llms provide higher quality data and training on this llm-annotated data is more preferrable than training on original paradetox.