Aggression and Misogyny Detection using BERT: A Multi-Task Approach

Niloofar Safi Samghabadi, Parth Patwa, Srinivas Pykl, Prerana Mukherjee, Amitava Das, Thamar Solorio

Abstract

This paper presents a multi-task learning (MTL) framework for the automated detection of aggression and misogyny in social media comments across English, Hindi, and Bengali. By leveraging BERT as a feature extractor combined with an attention mechanism, the proposed system simultaneously classifies levels of aggression and identifies misogynistic content. The approach highlights the strong correlation between these two forms of toxicity and achieved a 3rd place finish in the English misogyny detection task at TRAC-2.

Introduction

Online toxicity is a multifaceted challenge for Natural Language Processing (NLP). While "Overt Aggression," characterized by direct insults, is relatively straightforward to flag, "Covert Aggression"—encompassing sarcasm, indirectness, or "polite" hostility—remains difficult to detect. Furthermore, toxicity often intersects with specific biases, such as misogyny. Most existing systems treat aggression and hate speech as isolated problems. This research addresses the need for models that can handle the nuance of indirect aggression and the intersectionality of hate speech across multiple languages, specifically targeting the low-resource contexts of Hindi and Bengali alongside English.

Methodology

The proposed system utilizes an end-to-end neural architecture based on a Multi-Task Learning (MTL) paradigm. The core hypothesis is that the model can learn shared features beneficial for both aggression and misogyny detection simultaneously.

The proposed multi-task architecture featuring a BERT layer, attention mechanism, and task-specific classification heads.

Key components of the architecture include:

  • BERT Layer: Pre-trained BERT models (bert-base-uncased for English and bert-base-multilingual-cased for Hindi/Bengali) are used to extract contextualized word embeddings. In this setup, BERT serves as a fixed feature extractor rather than being fine-tuned.
  • Attention Mechanism: An attention layer is added to assign relative importance to specific tokens, allowing the model to focus on the most relevant words for determining toxicity rather than relying solely on the standard [CLS] token.
  • Shared and Task-Specific Layers: The attention output passes through shared fully-connected layers for dimensionality reduction before branching into two separate classification heads: a 3-way softmax for aggression (Sub-task A) and a 2-way softmax for misogyny (Sub-task B).
  • Loss Weighting: Class weights are incorporated into the Binary Cross Entropy loss function to mitigate the impact of data imbalance, where non-aggressive comments typically form the majority.

Datasets

The study utilizes the TRAC-2 Shared Task dataset, covering English, Hindi, and Bengali. Sub-task A (Aggression) labels include Not Aggressive (NAG), Covertly Aggressive (CAG), and Overtly Aggressive (OAG). Sub-task B (Misogyny) labels include Gendered (GEN) and Non-Gendered (NGEN). The datasets are notably imbalanced; for instance, nearly 80% of the English training data is labeled "Not Aggressive," complicating the detection of minority aggressive classes.

Results and Analysis

The system demonstrated strong performance, particularly in misogyny detection, securing 3rd place out of 15 teams for English Sub-task B.

Confusion matrices for misogyny detection (Sub-task B) across English, Hindi, and Bengali.

Key findings from the experimental results include:

  • Aggression-Misogyny Correlation: A clear trend was observed where the percentage of gendered (misogynistic) examples increased alongside the "directness" of aggression (from NAG to OAG). This statistical link justifies the multi-task approach.
  • The "Covert" Challenge: Across all languages, F1 scores for "Covert Aggression" (CAG) were the lowest (0.40–0.45). The model frequently misclassified these instances as "Not Aggressive" due to the lack of explicit profanity.
  • Language-Specific Performance: The model performed exceptionally well on Bengali misogyny detection (F1 of 0.9206). In Hindi, performance was impacted by a significant distribution shift between training and test sets.
  • Label Subjectivity: Error analysis revealed cases where the model's "incorrect" prediction appeared more accurate than the human-provided ground truth, highlighting the inherent subjectivity in hate speech datasets.

Conclusion

While the MTL approach with BERT and attention proved effective, identifying implicit or sarcastic aggression remains a primary limitation. Future work will explore fine-tuning the BERT layers directly to capture more subtle linguistic nuances and incorporating sentiment analysis features to provide better emotional context.

Summary updated

BibTeX
@inproceedings{samghabadi2020aggression,
  author = {Niloofar Safi Samghabadi and Parth Patwa and Srinivas PYKL and Prerana Mukherjee and Amitava Das and Thamar Solorio},
  title = {{Aggression and Misogyny Detection using BERT: A Multi-Task Approach}},
  booktitle = {Trac@lrec},
  year = {2020},
}
Figure