Skip to main content
QUICK REVIEW

[Paper Review] You Only Prompt Once: On the Capabilities of Prompt Learning on Large Language Models to Tackle Toxic Content

Xinlei He, Savvas Zannettou|arXiv (Cornell University)|Aug 10, 2023
Adversarial Robustness in Machine LearningComputer Science8 citations
TL;DR

The paper systematically evaluates prompt-tuning for toxic content tasks (toxicity classification, toxic span detection, and detoxification) using five model architectures and eight datasets, showing prompt learning can match or exceed baselines with faster adaptation and less data.

ABSTRACT

The spread of toxic content online is an important problem that has adverse effects on user experience online and in our society at large. Motivated by the importance and impact of the problem, research focuses on developing solutions to detect toxic content, usually leveraging machine learning (ML) models trained on human-annotated datasets. While these efforts are important, these models usually do not generalize well and they can not cope with new trends (e.g., the emergence of new toxic terms). Currently, we are witnessing a shift in the approach to tackling societal issues online, particularly leveraging large language models (LLMs) like GPT-3 or T5 that are trained on vast corpora and have strong generalizability. In this work, we investigate how we can use LLMs and prompt learning to tackle the problem of toxic content, particularly focusing on three tasks; 1) Toxicity Classification, 2) Toxic Span Detection, and 3) Detoxification. We perform an extensive evaluation over five model architectures and eight datasets demonstrating that LLMs with prompt learning can achieve similar or even better performance compared to models trained on these specific tasks. We find that prompt learning achieves around 10\% improvement in the toxicity classification task compared to the baselines, while for the toxic span detection task we find better performance to the best baseline (0.643 vs. 0.640 in terms of $F_1$-score). Finally, for the detoxification task, we find that prompt learning can successfully reduce the average toxicity score (from 0.775 to 0.213) while preserving semantic meaning.

Motivation & Objective

  • Motivate and evaluate prompt learning as a solution to rapidly adapting toxic content detection and mitigation without full model fine-tuning.
  • Assess prompt-tuning performance across three tasks: toxicity classification, toxic span detection, and detoxification.
  • Compare prompt-tuning with task-specific baselines and analyze data efficiency, transferability, and robustness.
  • Demonstrate potential practical benefits for online platforms in terms of performance, cost, and green AI considerations.

Proposed method

  • Frame toxicity tasks as prompt-tuning problems with frozen LLMs and learnable prompts (prefix-tuning style).
  • Evaluate two prompt-tuning variants across five model families (GPT2-M, GPT2-L, T5-S, T5-B, T5-L) and eight datasets.
  • Task 1 uses classification prompts to map labels to Yes/No and optimize a binary loss.
  • Task 2 treats span detection as a generation task by prompting the model to produce non-toxic text and then subtracting to identify spans.
  • Task 3 treats detoxification as a generation task to produce a non-toxic paraphrase while preserving meaning, optimizing toward detoxified outputs.
  • Compare against baselines (Perspective API, ToxicBERT, UnRoBERTa) and report F1-scores and other metrics.
(a) HateXplain
(a) HateXplain

Experimental results

Research questions

  • RQ1Can prompt learning with frozen LLMs achieve comparable or superior performance to task-specific baselines on toxicity-related tasks?
  • RQ2How data-efficient and transferable are prompt-tuning approaches across diverse toxicity datasets and tasks?
  • RQ3What are the practical trade-offs (speed, training steps, data requirements) between prompt-tuning and full fine-tuning for toxic content tasks?
  • RQ4How robust is prompt-tuning to misspellings and adversarial textual perturbations in toxic content?
  • RQ5What implications do prompt-tuning methods have for scalability and safety in real-world online platforms?

Key findings

  • Prompt tuning with LLMs achieves comparable or better F1 scores than baselines across several datasets for toxicity classification (e.g., HateXplain: 0.731 with GPT2-L vs. 0.703 baseline).
  • For toxic span detection, prompt tuning reaches 0.643 F1, slightly exceeding SPAN-BERT’s 0.640 with reduced training time.
  • In detoxification, prompt tuning reduces average toxicity scores significantly (e.g., from 0.775 to 0.213 on ParaDetox) while preserving meaning.
  • Prompt tuning shows data efficiency, achieving strong results with as few as 500 training samples in some cases (e.g., SBIC: 0.782 with 500 samples on T5-B).
  • Prompt transferability is dataset-dependent; prompts trained on MHS generalize better to other datasets than prompts from HateXplain, indicating that diversity in training data improves generalization.
  • Compared to fine-tuning, prompt tuning with a small prompt prefix can reach competitive accuracy faster (e.g., 0.712 accuracy in 6 minutes vs. 0.619 in 100 minutes for fine-tuning on USElectionHate20).
  • Prompt tuning demonstrates robustness to misspellings and adversarial perturbations, maintaining high accuracy in tested scenarios.
(b) USElectionHate20
(b) USElectionHate20

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.