Modeling Profanity and Hate Speech in Social Media with Semantic Subspaces

Vanessa Hahn, Dana Ruiter, Thomas Kleinbauer, Dietrich Klakow

TL;DR

This paper introduces a novel approach using "semantic subspaces" to model profanity and hate speech in social media, particularly in low-resource languages. By learning these specialized representations, the authors achieve significant improvements in zero-shot transfer learning for both similar (profane/neutral) and distant (hate/neutral) tasks, outperforming standard BERT embeddings.

What Problem Does This Paper Address?

Detecting profanity and hate speech on social media is a critical but challenging task. A major hurdle is the scarcity of labeled data, especially for languages other than English. Existing datasets often have incompatible annotation schemes due to the subjective nature of these phenomena. Furthermore, pre-trained language models like BERT, while powerful, require substantial data for fine-tuning, making them less effective in these low-resource scenarios. This paper aims to bridge this gap by developing methods that can generalize well to unseen profanity and hate speech detection tasks with minimal or no task-specific training data.

Methods

The core of this paper lies in the concept of "semantic subspaces." The authors propose learning specialized vector representations that capture the "profanity" aspect of language, distinct from general semantic meaning.

  • Word-Level Subspaces: They start by identifying "minimal pairs" of words that differ only in their profanity (e.g., "Arschloch" vs. "Mensch"). Principal Component Analysis (PCA) is then applied to the word embeddings of these pairs to extract the principal component representing the profanity dimension. They explore variations of this method, including raw (PCA-RAW) and normalized (PCA-NORM) projections.
  • Sentence-Level Subspaces: This concept is extended to sentences by creating minimal pairs where only the profanity-carrying words are altered. Similar PCA-based subspace learning is applied to sentence embeddings derived from fine-tuned BERT models.
  • Zero-Shot Transfer: The learned subspaces are then used to train classifiers on a source task (identifying profanity in minimal pairs) and evaluated on unseen target tasks (profanity/neutral and hate/neutral classification) without any further training on the target data.

Datasets

The paper utilizes several datasets:

  • Minimal Pairs: German slur lists were used to create word-level minimal pairs. For sentence-level tasks, tweets from Twitter-DE were used to construct minimal pairs by replacing swearwords with neutral alternatives.
  • Fine-tuning Data: Twitter corpora for German, English, French, and Arabic were used to fine-tune BERT models.
  • Target Task Data: Several existing benchmarks were used for evaluation, including:
  • GermEval-2019 (Subtask 1 & 2) for German.
  • HASOC (Subtask A & B) for English.
  • A hate speech portion of a corpus by Charitidis et al. (2020) for French.
  • Mubarak et al. (2017) for Arabic.

Key Insights and Ideas

  • Profanity as a Distinct Semantic Dimension: The research demonstrates that profanity can be effectively isolated as a specific semantic dimension within word and sentence representations, separate from general meaning.
  • Subspaces Outperform General Embeddings in Low-Resource Settings: Semantic subspaces, when learned from even small amounts of data, provide significantly better generalization for profanity and hate speech detection compared to standard BERT embeddings, especially when training data is scarce.
  • Normalization is Not Always Necessary: The study found that the normalization step in PCA-based subspace learning was not consistently beneficial, suggesting that raw projections can be equally or more effective.
  • Cross-Lingual Transferability: The learned German profane subspaces show remarkable ability to transfer to similar and distant tasks in closely-related (English), distantly-related (French), and even non-related (Arabic) languages, highlighting the robustness of the approach.
  • Word Substitution for Civil Rephrasing: The profane subspace can be used to automatically substitute profane words with neutral counterparts, offering potential applications in content moderation and online communication tools.

Key Results

  • Word-Level: Subspace-based representations achieved F1-Macro scores up to 96.0 (TL-1), 89.9 (TL-2), and 100 (TL-3) on unseen word classification tasks, significantly outperforming BASE representations.
  • Monolingual Sentence-Level (German): PCA-RAW representations achieved peaks in F1 of 68.9 for the similar task (ST) and 63.5 for the distant task (DT) with only 50 training pairs, showing an improvement of F1 +14.2 and +10.9 respectively over the BERT baseline in low-resource scenarios.
  • Cross-Lingual Sentence-Level: Subspace-based representations achieved significant improvements over BASE representations, with differences up to F1 +20.6 (PCA-RAW on EN-ST) and F1 +22.4 (PCA-NORM on AR-ST). For distant tasks, PCA-RAW peaked at F1 59.6 (German), 65.6 (English), 66.2 (Arabic), and 56.1 (French).
  • Human Evaluation (Word Substitution): Original profane words were rated 6.1 on a profanity scale, while their substitutions were rated significantly lower at 1.9.

Limitations and Future Work

  • Subjectivity of Labels: The authors acknowledge that the subjectivity of hate speech can lead to debatable gold labels, which can affect model performance.
  • External Comparison Limitations: Direct comparison to state-of-the-art models on target tasks is noted as vague due to differing train-test splits and task definitions.
  • Future Work: The authors plan to conduct further experiments using unaligned significant words/sentences, moving beyond the strict minimal pair definition. They also suggest exploring the code and fine-tuned models are made publicly available.

Summary updated

BibTeX
@inproceedings{hahn2021modeling,
  author = {Vanessa Hahn and Dana Ruiter and Thomas Kleinbauer and Dietrich Klakow},
  title = {{Modeling Profanity and Hate Speech in Social Media with Semantic Subspaces}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
}
Figure