Detecting Aggression and Toxicity using a Multi Dimension Capsule Network

Saurabh Srivastava, Prerna KhuranaACL 2019

TL;DR

This paper introduces a novel Multi-Dimension Capsule Network (MDCN) for detecting aggressive and toxic language in text, outperforming previous state-of-the-art methods on challenging datasets. The MDCN effectively handles code-mixed languages and transliterated comments, a significant hurdle in real-world social media analysis.

What Problem Does This Paper Address?

The proliferation of social media has unfortunately led to an increase in hate speech, trolling, and verbal abuse. This toxic behavior not only degrades online discourse but also drives users away from platforms. Manually moderating the sheer volume of content is impossible, necessitating automated solutions. While deep learning has shown promise, accurately classifying nuanced forms of aggression, especially in multilingual and code-mixed contexts, remains a significant challenge. Existing models often struggle with the complexities of language variation and subtle forms of toxicity.

Methods

The core contribution of this paper is the Multi-Dimension Capsule Network (MDCN). Unlike traditional capsule networks that use fixed-dimension capsules, the MDCN explores varying capsule dimensions to capture a richer set of "instantiation parameters" representing local word order and semantic meaning.

Here's a breakdown of their approach:

  • Word Embedding Layer: Utilizes pre-trained fastText embeddings to represent individual words.
  • Feature Extraction Layer: Employs BiLSTM units to capture contextual information from both forward and backward directions of a sentence. This is a departure from some prior works that used CNNs for feature extraction, as BiLSTMs are argued to avoid the difficulty of choosing optimal window sizes.
  • Primary Capsule Layer: This layer replaces scalar outputs of CNNs with vectors that represent instantiation parameters. The authors extend previous work by varying the dimension of these capsules, hypothesizing that different dimensions can capture different aspects of the input.
  • Convolutional Capsule Layer: Connects capsules from the primary layer, using a dynamic routing algorithm (inspired by Sabour et al., 2017) to determine coupling strengths between child and parent capsules. This routing process is described as computing soft attention between lower and higher-level capsules.
  • Classification Layer: A final softmax layer uses the extracted features to calculate class probabilities.

The dynamic routing algorithm is key here, allowing capsules to agree on their output by iteratively adjusting coupling coefficients.

Datasets

The authors evaluated their model on two primary datasets:

  • TRAC-1: This dataset contains 15,000 comments in both Hindi and English, scraped from Facebook and Twitter. It's designed for aggression identification and categorizes comments into Overtly Aggressive (OAG), Covertly Aggressive (CAG), and Non-aggressive (NAG). The paper notes the presence of code-mixed text, a common real-world scenario.
  • Kaggle's Toxic Comment Classification Challenge: This is a multi-label classification task with a large dataset of Wikipedia talk page comments, labeled with six classes: toxic, severe toxic, obscene, threat, insult, and identity hate.

Key Insights and Ideas

  • Multi-Dimensional Capsules for Richer Representation: The core idea that varying capsule dimensions can capture more nuanced semantic and syntactic features is a significant contribution. This allows the model to potentially learn more robust representations of complex linguistic phenomena.
  • Handling Code-Mixed and Transliterated Text: The MDCN demonstrates a strong capability in handling comments that mix Hindi and English or use transliterated Hindi words. This is a critical advancement for real-world applications, as such text is prevalent on social media platforms.
  • BiLSTM for Feature Extraction: The choice of BiLSTM over CNNs for feature extraction is justified by the potential noise introduced by fixed window sizes in CNNs, suggesting a more flexible approach to capturing sentence context.
  • Understanding Misclassifications: The paper's analysis of misclassifications using LIME provides valuable insights into why the model struggles, particularly with sarcastic comments or subtle forms of aggression where word-level analysis might be misleading.

Key Results

  • The proposed Multi-Dimension Capsule Network achieved state-of-the-art results on the TRAC dataset (Facebook English and Twitter English) and the Kaggle Toxic Comment Classification dataset, outperforming several established architectures.
  • Specifically, on the TRAC Twitter English dataset, their model achieved an F1-score of 63.532, and on the TRAC Facebook English dataset, it achieved 58.6. For Kaggle, the ROC-AUC was 98.464.
  • The model demonstrated competence in handling transliterated comments, a challenging aspect of multilingual text classification.
  • Qualitative analysis revealed that the model sometimes struggles with sarcastic comments where individual words are neutral, and it can confuse CAG with NAG due to hidden aggression.

Limitations and Future Work

  • Sarcasm and Subtle Aggression: The authors acknowledge that the model can misclassify sarcastic comments and struggles with subtle forms of aggression where the attack is not direct. This is highlighted through analysis of specific examples.
  • TRAC Twitter Data Performance: While generally strong, the model did not beat a previous Capsule Network on the TRAC Twitter data, suggesting room for further optimization.
  • Future Work: The authors propose exploring different methods for training capsules, investigating various loss functions (e.g., spread loss, focal loss, margin loss), and applying the MDCN to other NLP tasks using advanced investigation techniques.

Summary updated

BibTeX
@inproceedings{srivastava2019detecting,
  author = {Saurabh Srivastava and Prerna Khurana},
  title = {{Detecting Aggression and Toxicity using a Multi Dimension Capsule Network}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
}
Figure