Comprehensive Assessment of Toxicity in ChatGPT

Boyang Zhang, Xinyue Shen, Wai Man Si, Zeyang Sha, Zeyuan Chen, Ahmed Salem, Yun Shen, Michael Backes, Yang ZhangarXiv 2023

Abstract: Moderating offensive, hateful, and toxic language has always been an important but challenging topic in the domain of safe use in NLP. The emerging large language models (LLMs), such as ChatGPT, can potentially further accentuate this threat. Previous works have discovered that ChatGPT can generate toxic responses using carefully crafted inputs. However, limited research has been done to systematically examine when ChatGPT generates toxic responses. In this paper, we comprehensively evaluate the toxicity in ChatGPT by utilizing instruction-tuning datasets that closely align with real-world scenarios. Our results show that ChatGPT's toxicity varies based on different properties and settings of the prompts, including tasks, domains, length, and languages. Notably, prompts in creative writing tasks can be 2x more likely than others to elicit toxic responses. Prompting in German and Portuguese can also double the response toxicity. Additionally, we discover that certain deliberately toxic prompts, designed in earlier studies, no longer yield harmful responses. We hope our discoveries can guide model developers to better regulate these AI systems and the users to avoid undesirable outputs.

Introduction

While adversarial "jailbreaks" have demonstrated that Large Language Models (LLMs) can be manipulated into generating harmful content, there is a critical need to understand how toxicity emerges during standard, non-adversarial use. Most prior research has relied on simple text-completion benchmarks that do not reflect the complex, instruction-following nature of modern AI interactions. This study provides a systematic "stress test" of ChatGPT’s toxicity across diverse real-world usage scenarios, identifying specific "blind spots" in current safety alignment techniques.

Methodology and Data

The researchers employed a multi-dimensional analysis framework to evaluate toxicity across several axes:

  1. Content-Based Analysis: Prompts were categorized into seven task types (e.g., Information Requests, Creative Writing, Coding) and five domains (e.g., STEM, Law, Medicine).
  2. Hyperparameter-Based Analysis: The study varied settings including language (18 languages), response length, sampling temperature, and model version (GPT-3.5 vs. GPT-4).
  3. Toxicity Quantification: The Perspective API was used to assign toxicity scores to model responses.

To simulate real-world interactions, the study utilized the Alpaca-GPT4 dataset (52,002 instruction-tuning pairs), GPTeacher (3,922 pairs for system role analysis), and RealToxicPrompts for baseline comparisons.

Key Drivers of Toxicity

Task Type and Creative Freedom

A primary finding is that the nature of the task significantly influences the model's propensity for toxicity. Creative writing and content generation tasks are nearly twice as likely to produce toxic responses compared to factual information requests. The "creative liberty" inherent in these tasks appears to relax the model's internal safety constraints, leading to higher average and maximum toxicity scores.

Toxicity metrics across different task types, highlighting the elevated risk in creative writing.

The Multilingual Safety Gap

Toxicity is not language-agnostic. Safety alignment (such as RLHF) appears to be less robust in non-English languages. For example, in tests using intentional insult prompts, German and Portuguese consistently yielded higher toxicity scores. Specifically, German prompts reached a mean toxicity of 0.602, compared to 0.406 for English.

Toxicity scores across 18 languages, demonstrating significant variance between native and translated prompts.

The "Helpfulness" Paradox and Model Comparison

Surprisingly, GPT-4 was found to be more prone to generating toxic content than its predecessor, GPT-3.5-Turbo. In a test of 20 intentional insult prompts, GPT-4 had a 100% response rate with a mean toxicity of 0.478, whereas GPT-3.5-Turbo refused to answer 14% of the time and maintained a lower mean score of 0.334. This suggests that GPT-4’s superior instruction-following capabilities might make it "too compliant," fulfilling borderline toxic requests that the older model would reject.

Conclusion and Future Work

This research highlights that prompt content and language are stronger predictors of toxicity than assigned system roles. The findings suggest that developers must prioritize multilingual safety alignment and develop more nuanced filters for creative tasks where the boundary between fictional conflict and actual toxicity is often blurred. Future work should also address the Eurocentric bias in current toxicity detection tools to ensure safety across a broader range of global languages and cultural contexts.

Summary updated

BibTeX
@misc{zhang2023comprehensive,
  author = {Boyang Zhang and Xinyue Shen and Wai Man Si and Zeyang Sha and Zeyuan Chen and Ahmed Salem and Yun Shen and Michael Backes and Yang Zhang},
  title = {{Comprehensive Assessment of Toxicity in ChatGPT}},
  year = {2023},
  eprint = {2311.14685},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.14685},
}
Figure