HateMonitors: Language Agnostic Abuse Detection in Social Media

Punyajoy Saha, Binny Mathew, Pawan Goyal, Animesh Mukherjee

Abstract

Reducing hateful and offensive content in online social media poses a dual problem for moderators. Rigid censorship cannot be imposed, yet the free flow of harmful content cannot be allowed. Efficient abusive language detection systems are required to navigate this balance. This paper presents HateMonitor, a machine learning model developed for the Hate Speech and Offensive Content Identification in Indo-European Languages (HASOC) task at FIRE 2019. By utilizing a Gradient Boosting model alongside BERT and LASER embeddings, we developed a language-agnostic system that achieved first place in the German sub-task A.

Introduction

Content moderation on social media is a complex balancing act: platforms must curb harmful content without imposing rigid censorship. This task is complicated by the sheer volume of data and the linguistic diversity of users. Most existing research focuses heavily on English, leaving a gap for "low-resource" languages or multilingual environments where users frequently switch between languages or use localized slang.

The authors address the challenge of identifying three specific types of abusive language across English, Hindi, and German:

  1. Hate Speech (HOF): Derogatory comments targeting groups based on ethnicity, gender, etc.
  2. Offensive Language (OFFN): Targeted insults toward individuals.
  3. Profanity (PRFN): Unacceptable language used without a specific target.

The core goal was to create a single, "language-agnostic" architecture capable of performing well across different languages without requiring language-specific tuning.

Methods

The researchers developed a pipeline called HateMonitors. Its architecture is built on three main pillars: context-preserving preprocessing, hybrid feature extraction, and a robust classifier.

The HateMonitors architecture combining BERT and LASER embeddings with an LGBM classifier.

Context-Preserving Preprocessing

Unlike many NLP pipelines that strip punctuation and stop-words, the authors retained them. They argued that for sentence-level embeddings, punctuation and stop-words provide vital contextual clues for identifying aggression or intent. They normalized URLs and converted text to lowercase, except for Hindi (Devanagari script).

Hybrid Feature Extraction

The team used a "best of both worlds" approach by concatenating two types of sentence embeddings:

  • Multilingual BERT: A transformer-based model trained to understand context. They extracted a 768-dimensional vector by averaging the last 11 layers.
  • LASER (Language-Agnostic SEntence Representations): Developed by Facebook, this model maps sentences from 93 different languages into a shared embedding space, providing a 1024-dimensional vector.
  • Result: A combined feature vector of length 1792 for every post.

Model Selection (LGBM)

Given that the HASOC datasets were relatively small, the authors opted for the Light Gradient Boosting Machine (LGBM) to avoid overfitting common in deep learning architectures. LGBM is an efficient gradient-boosting framework known for its high performance on tabular features like pre-extracted embeddings.

Datasets

The study utilized the HASOC 2019 dataset, covering English, Hindi, and German. The tasks were:

  • Sub-task A: Binary classification (Hateful/Offensive vs. Not).
  • Sub-task B: Multi-class classification (Hate, Offensive, or Profane).
  • Sub-task C: Identifying the type of offense (Targeted vs. Untargeted).

The authors noted significant class imbalances, particularly in the German dataset, where "Non-Hateful" posts vastly outnumbered "Hateful" ones.

Key Results

The HateMonitors model proved highly effective, particularly in cross-lingual applications. The model's performance on the primary binary classification task (Sub-task A) is summarized below.

Macro F1 scores for Sub-task A across English, German, and Hindi.
  • First Place: The model ranked #1 in the German Sub-task A with a macro F1 score of 0.62.
  • Hindi Performance: The model achieved its highest macro F1 score on the Hindi dataset (0.78), likely due to more balanced training data.
  • English Performance: The model achieved a macro F1 of 0.69 for Sub-task A.

Discussion and Insights

The success of HateMonitors highlights several key principles:

  • Simplicity over Complexity: In scenarios with limited data, a well-tuned "traditional" machine learning model (LGBM) fed with high-quality embeddings can outperform complex, end-to-end deep learning architectures.
  • The Power of Concatenation: Combining BERT (contextual excellence) with LASER (cross-lingual excellence) captured a more holistic representation of the text.
  • Context is King: Retaining punctuation and stop-words suggests that as models become more sophisticated, the old practice of stripping "noise" may remove vital signals of abuse.

Limitations and Future Work

The model's performance dropped significantly on the German dataset compared to Hindi, attributed to the extreme scarcity of "Hateful" examples in the German training set. Additionally, in Sub-task B, the model struggled to distinguish between "Hate Speech" and "Offensive Language," which are often linguistically similar. Future work may explore better handling of imbalanced data and incorporating social-media-specific features like emoji analysis.

Summary updated

Abstract

Reducing hateful and offensive content in online social media pose a dual problem for the moderators. On the one hand, rigid censorship on social media cannot be imposed. On the other, the free flow of such content cannot be allowed. Hence, we require efficient abusive language detection system to detect such harmful content in social media. In this paper, we present our machine learning model, HateMonitor, developed for Hate Speech and Offensive Content Identification in Indo-European Languages (HASOC), a shared task at FIRE 2019. We have used a Gradient Boosting model, along with BERT and LASER embeddings, to make the system language agnostic. Our model came at First position for the German sub-task A. We have also made our model public at https://github.com/punyajoy/HateMonitors-HASOC .
BibTeX
@inproceedings{saha2019hatemonitors,
  author = {Punyajoy Saha and Binny Mathew and Pawan Goyal and Animesh Mukherjee},
  title = {{HateMonitors: Language Agnostic Abuse Detection in Social Media}},
  booktitle = {FIRE (Working Notes)},
  year = {2019},
  url = {https://openreview.net/forum?id=21m64NFNff},
}
Figure