A Study of the Class Imbalance Problem in Abusive Language Detection

Yaqi Zhang, Viktor Hangya, Alexander FraserNAACL 2024

TL;DR

This paper tackles the significant challenge of class imbalance in abusive language detection, where abusive content is vastly outnumbered by benign text. The authors conduct a comprehensive empirical study of various methods to mitigate this imbalance, proposing two novel augmentation techniques and offering practical guidance for practitioners.

What Problem Does This Paper Address?

The proliferation of social media has led to an explosion of user-generated content, much of which can be abusive, offensive, or hateful. Automatically detecting such content is crucial, but a major hurdle is the inherent class imbalance in available datasets. Typically, non-abusive text vastly outnumbers abusive text, leading machine learning models to favor the majority class and perform poorly on minority (abusive) classes. While various methods exist to address this, there's a lack of systematic comparison specifically within the context of abusive language detection. This paper aims to fill that gap by evaluating existing techniques and introducing new ones to improve the effectiveness of abusive language detection systems.

Methods

The study categorizes methods for addressing class imbalance into three groups: data-level, model-level, and hybrid.

  • Data-Level Methods: These involve manipulating the training data. The paper explores:
  • Random Oversampling (ROS): Duplicating minority class samples.
  • Random Undersampling (RUS): Removing majority class samples.
  • Hybrid Sampling (Combi RS): Combining ROS and RUS.
  • BERTAug: A novel text augmentation technique that uses contextual embeddings to replace words in minority class samples with synonyms.
  • AbusiveLexiconAug: Another novel method that augments minority class samples by replacing abusive terms with synonyms found in a curated lexicon of abusive words. This method leverages FastText embeddings for synonym similarity.
  • ExternalDataAug: Augmenting minority class samples with texts from similar abusive datasets.
  • Model-Level Methods: These adjust the classification model itself. The paper investigates:
  • Threshold-Moving (TM): Adjusting the decision threshold at inference time to favor minority classes.
  • Weighted Cross-Entropy (Weighted CE): Assigning different weights to classes in the loss function.
  • Focal Loss (FL): A modification of cross-entropy that down-weights easy-to-classify examples, focusing more on hard-to-classify (often minority) samples.
  • Weighted Focal Loss (Weighted FL): Combines Focal Loss with class weights.
  • Hybrid Methods: The paper also experiments with combining over- and undersampling.

Datasets

The study utilizes a diverse set of 8 English datasets, covering various aspects of abusive language and imbalance ratios:

  • Binary Datasets:
    • Twitter-Hate-Speech
    • Civil-Comments (a subset of 5,000 samples)
    • Gibert-2018 (Stormfront Hate Speech Dataset)
    • US-Election-2020
  • Multi-Class Datasets:
    • Founta-2018 (Hate and Abusive Speech on Twitter)
    • Davidson-2017 (Hate Speech and Offensive Language on Twitter)
    • AMI-2018 (Evalita 2018 Task on Automatic Misogyny Identification)
    • CMSB (Sexism Detection)

The paper also mentions using external datasets for the ExternalDataAug method, categorized by label type (Hate, Sexism, Toxic).

Key Insights and Ideas

  • No Silver Bullet: The study confirms that no single method universally outperforms others across all datasets and imbalance scenarios.
  • AbusiveLexiconAug Shows Promise: The novel AbusiveLexiconAug method consistently shows strong improvements, particularly in enriching abusive information for minority classes.
  • Focal Loss is a Strong Contender: Focal Loss emerges as a highly effective model-level approach, often yielding peak performance.
  • Data Size Matters for RUS: Random Undersampling is effective but requires a large training dataset to avoid losing too much information.
  • Small Datasets are Tricky: Datasets with fewer than 5,000 samples are highly sensitive to method choices and require rigorous hyperparameter tuning and multiple runs with different seeds.
  • ROS Overfitting: Random Oversampling can lead to overfitting, especially on larger datasets, necessitating careful selection of the sampling ratio.
  • External Data Challenges: While ExternalDataAug aims to leverage external data, it can introduce out-of-domain text, potentially hindering performance unless data sources are closely aligned.

Key Results

  • Top Performers: Random oversampling, Focal Loss, and AbusiveLexiconAug were found to be versatile and effective across most datasets.
  • Model-Level vs. Data-Level: For binary datasets, model-level methods generally performed better. For multi-class datasets, both approaches showed comparable performance.
  • AbusiveLexiconAug vs. BERTAug: AbusiveLexiconAug significantly outperformed BERTAug, demonstrating the benefit of targeted augmentation of abusive terms.
  • Focal Loss Tuning: Smaller values of gamma (γ) in Focal Loss (around 0.2) generally yielded the best results, with sensitivity observed on smaller datasets.
  • Weighted CE Tuning: For Weighted CE, while training set distributions can provide a decent starting point for class weights, fine-tuning these weights is crucial for optimal performance.
  • Civil-Comments Challenge: The Civil-Comments dataset proved particularly challenging, with many methods failing to outperform the baseline, highlighting the need for careful analysis on difficult datasets.

Limitations and Future Work

  • Language Limitation: The study was limited to English corpora. Future work could explore the validity of these findings for other languages.
  • Method Scope: Only a selection of popular data-level, model-level, and hybrid methods were tested. Future research could investigate other proposed methods.
  • Classifier Scope: The experiments primarily used BERT with a classification head. Exploring other classifier architectures would be valuable.
  • Task-Specific Approaches: The authors express interest in developing approaches specifically tailored for abusive language detection.
  • External Data Alignment: For ExternalDataAug, future work could focus on utilizing external data from the same platform or domain to mitigate domain shift issues.
  • Hyperparameter Sensitivity: Most methods are sensitive to hyperparameters, and while the paper provides starting points, further tuning is often required.

Summary updated

BibTeX
@inproceedings{zhang2024study,
  author = {Yaqi Zhang and Viktor Hangya and Alexander Fraser},
  title = {{A Study of the Class Imbalance Problem in Abusive Language Detection}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
}
Figure