Introduction
Detecting hate speech online is a critical yet complex challenge. While explicit toxicity—characterized by slurs and profanity—is relatively straightforward for automated systems to flag, implicit toxicity remains elusive. Implicit harm often relies on humor, sarcasm, microaggressions, or "dog whistles" that require deep social context to decode. This "nuance gap" is compounded by the "black-box" nature of state-of-the-art deep learning models, which typically provide a binary classification without explaining the underlying reasoning.
ToxVis is an interactive visualization tool designed to bridge this gap. By leveraging interpretability techniques, it allows users to examine which specific words lead a model to classify a post as explicit, implicit, or neutral, fostering transparency in automated content moderation.
Methods and System Architecture
The researchers developed ToxVis by combining high-performing Transformer-based language models with an interactive user interface. The system architecture supports several models, including fine-tuned versions of BERT, RoBERTa, and XLNet, as well as few-shot classification using GPT-3 (davinci).
To provide transparency, ToxVis utilizes Integrated Gradients (IG) to calculate attribution scores for each word in an input sentence. These scores indicate a word's contribution to the predicted label:
- Positive scores (Green): Indicate tokens that contributed to the model's decision for a specific label.
- Negative scores (Blue): Indicate tokens that pushed the model away from that label.
The interface, built with Python Flask, provides a step-by-step workflow where users can input text, trigger the detector, and compare results across different models as shown in the visualization above.
Datasets
The study utilized a consolidated dataset of 14,473 posts, merged from three primary sources to capture a wide range of toxic behavior:
- ETHOS: An online hate speech detection dataset.
- AbuseEval: Focused on offensive language.
- Tumblr Microaggressions Dataset: Specifically selected to provide examples of subtle, implicit harm.
The data underwent manual verification to correct mislabeled instances and remove noise such as URLs and special characters, ensuring a high-quality benchmark for evaluating implicit toxicity.
Experimental Results
The models were evaluated using standard metrics: F1 score, Precision, Recall, and Accuracy. The results demonstrate that while fine-tuned Transformer models perform well, the massive scale of GPT-3 provides a significant advantage in understanding social nuance.
As detailed in the performance table, GPT-3 (davinci) emerged as the top performer with an F1 score of 0.976 and an accuracy of 0.977. Qualitatively, the ToxVis interface successfully highlighted how words like "royalty" or "everything" in specific contexts—such as microaggressions against marginalized groups—contributed to an "Implicit Hate" classification, even in the absence of profanity.
Discussion and Future Work
ToxVis represents a significant step toward interpretable AI in content moderation. By moving from simple prediction to explanation, it provides moderators with the context needed to trust and verify automated decisions.
However, several challenges remain. The computational cost of running Integrated Gradients on large-scale models like GPT-3 in real-time environments is substantial. Furthermore, because hate speech is inherently subjective, future iterations of ToxVis could incorporate "human-in-the-loop" feedback, allowing users to provide direct feedback on attribution scores to iteratively refine the model's understanding of social context.
Summary updated