macech at SemEval-2021 Task 5: Toxic Spans Detection

Maggie CechACL 2021

TL;DR

This paper tackles the challenge of identifying specific "toxic spans" within online comments, going beyond simple toxic/non-toxic classification. The authors explore recurrent neural network (RNN) architectures, specifically GRU and LSTM, and investigate the impact of data augmentation on performance, ultimately finding that simpler models and original data yield better results.

What Problem Does This Paper Address?

In today's digital landscape, online communication is ubiquitous, leading to a surge in user-generated content. While platforms strive to foster healthy discussions, toxic language can discourage participation and negatively influence user perceptions. Traditional approaches often classify entire comments as toxic or not, but this fails to pinpoint the exact phrases or words that contribute to the toxicity. This granular identification is crucial for effective moderation, allowing for targeted interventions without resorting to broad censorship. The SemEval-2021 Task 5 specifically aims to evaluate systems capable of detecting these toxic spans within text.

Methods

The core of this research lies in applying recurrent neural networks (RNNs) for sequence labeling. The authors frame the task of identifying toxic spans as assigning a label (toxic or non-toxic) to each word in a comment. They compare two popular RNN variants: Gated Recurrent Units (GRU) and Long Short-Term Memory (LSTM) units. Both are implemented within a bidirectional RNN architecture.

The methodology involves extensive pre-processing of the text data, including:

  • Lowercasing
  • Removing URLs, numbers, and punctuation
  • Expanding contractions
  • Tokenizing words
  • Lemmatizing tokens
  • Removing stop words

Crucially, the text is then converted into numerical representations using pre-trained GloVe word embeddings. The paper also explores data augmentation by replacing toxic words with synonyms to increase the dataset size.

Datasets

The primary dataset used is from SemEval-2021 Task 5, which provides comments with indices of toxic spans. The authors also created an augmented dataset by replacing single toxic words with synonyms, increasing the dataset size from approximately 7,939 comments to 21,822.

Key Insights and Ideas

  • Granularity Matters: Moving beyond whole-comment classification to identifying specific toxic spans is a more nuanced and potentially more effective approach for moderation.
  • GRU vs. LSTM: For this specific sequence labeling task, GRU models demonstrated a slight but consistent performance advantage over LSTM models.
  • Data Augmentation Backfires: Surprisingly, augmenting the dataset by replacing toxic words with synonyms did not improve performance and, in fact, led to worse results and significantly longer training times. This suggests that simple synonym replacement might not capture the complex contextual nuances of toxic language.
  • Overfitting Potential: The test set performance outperforming the development set across all methods hints at potential overfitting, possibly due to the evaluation data having fewer "guessed comments" (comments predicted by common toxic words rather than the model itself).

Key Results

  • The GRU model consistently outperformed the LSTM model across various hyperparameter settings and both original and augmented datasets, achieving the highest F1 score.
  • The original, non-augmented dataset yielded better F1 scores than the augmented dataset for both GRU and LSTM models.
  • The F1 scores for the test set were generally higher than for the development set, suggesting potential overfitting.
  • The paper notes a significant discrepancy between their calculated F1 scores (up to 0.602) and the official SemEval competition results (0.070), attributing it to submission errors or incorrect ordering of results.

Limitations and Future Work

The authors acknowledge that the method of data augmentation, by only changing one word, might not have effectively taught the model to learn deeper connections within the text, potentially leading to memorization of toxic words rather than understanding. They suggest that further experimentation with different embedding sets could be beneficial.

Future work could explore combining GRU and LSTM cells within a single model, with each focusing on different aspects of toxicity detection (e.g., GRU for true negatives, LSTM for true positives). Investigating why augmented datasets are less sensitive to learning rate changes is also an interesting avenue. The authors also mention that the evaluation data containing fewer "guessed comments" might explain the better test set performance, suggesting that the impact of these guessed comments on the F1 score is significant.

Summary updated

BibTeX
@inproceedings{cech2021macech,
  author = {Maggie Cech},
  title = {{macech at SemEval-2021 Task 5: Toxic Spans Detection}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
}
Figure