Abstract
Detecting hate speech in online environments is a critical yet challenging task due to its high dependency on social context. This paper investigates the efficacy of Large Language Models (LLMs), specifically GPT-3.5-turbo, in identifying hate speech across diverse real-world datasets. We compare LLMs against traditional fine-tuned models like BERT and RoBERTa, evaluating the impact of various prompting strategies. Our findings reveal that LLMs can outperform traditional models, particularly when guided by Chain-of-Thought (CoT) reasoning, which leverages the model's internal knowledge of social nuances. However, significant performance gaps remain in multilingual contexts.
Introduction
Hate speech detection is notoriously difficult because offensive language is often subtle and context-dependent. Traditional AI approaches typically employ supervised learning with models like BERT. While effective to a degree, these "black box" models often struggle to capture the complex reasoning and broad social knowledge required for nuanced cases. This research explores whether the extensive pre-trained knowledge within LLMs can bridge this gap and identifies optimal prompting strategies for this task.
Methodology
The study evaluates GPT-3.5-turbo alongside two state-of-the-art baselines: fine-tuned BERT and RoBERTa. To optimize LLM performance, four distinct prompting strategies were tested:
- General Prompt (GP): A direct binary classification question.
- General Prompt with Definition (GPwDef): Includes a formal definition of hate speech to provide explicit criteria.
- Few-Shot Learning (FS): Provides ten balanced examples to prime the model.
- Chain-of-Thought (CoT): Instructs the model to perform step-by-step reasoning—identifying target groups and offensive terms—before reaching a verdict.
Experimental Setup
The evaluation spanned five established datasets representing different hate speech domains:
- HateXplain: A multiclass benchmark for general hate speech.
- COVID-HATE: Focused on anti-Asian racism during the pandemic.
- CallMeSexist: Centered on sexist discourse.
- USElectionHate: Political hate speech from the 2020 U.S. election.
- SWSR: A Chinese-language dataset focusing on sexism to test multilingual capabilities.
Results and Discussion
In comparative evaluations, GPT-3.5-turbo consistently outperformed the BERT and RoBERTa baselines across most English datasets. For instance, on the HateXplain dataset, GPT-3.5 achieved an F1 score of 0.82 with a general prompt, significantly higher than BERT's 0.66.
The Power of Reasoning
A key finding is that Chain-of-Thought (CoT) reasoning often yields better results than Few-Shot learning for English datasets. This suggests that for socially complex tasks, explaining the underlying logic is more beneficial than providing isolated examples. By breaking down the problem, the LLM effectively utilizes its internal "knowledge base" of human language and social dynamics.
Multilingual Challenges
Despite their strengths, LLMs showed a marked decline in performance on the Chinese SWSR dataset. F1 scores for Chinese hate speech detection ranged between 0.34 and 0.55. This suggests that cultural nuances and the use of English-language reasoning steps in prompts may hinder performance in non-English contexts.
Conclusion
LLMs represent a significant step forward for hate speech detection, offering a reasoning-based approach that surpasses traditional supervised models. While Chain-of-Thought prompting is highly effective for English text, future research must address the "multilingual hurdle" and expand into multimodal detection (e.g., hateful memes) to keep pace with evolving online discourse.
Summary updated