UIT-E10dot3 at SemEval-2021 Task 5: Toxic Spans Detection with Named Entity Recognition and Question-Answering Approaches

Phu Gia Hoang, Luan Thanh Nguyen, Kiet NguyenACL 2021

TL;DR

This paper tackles the challenge of precisely identifying and extracting toxic "spans" (short phrases or words) within online comments, moving beyond simple toxicity classification. The authors propose two novel approaches, one based on Named Entity Recognition (NER) and another on Question-Answering (QA), achieving a competitive F1-score of 66.99% with their NER system.

What Problem Does This Paper Address?

The proliferation of toxic comments on social media poses a significant threat to online communities, contributing to cyberbullying and harassment. While previous research focused on classifying entire comments as toxic or non-toxic, this approach has limitations, potentially stifling free speech by censoring entire posts. The SemEval-2021 Task 5: Toxic Spans Detection aims to address this by requiring systems to pinpoint the exact toxic segments within text. This is a more nuanced and challenging task, as it requires understanding the subtle linguistic cues that indicate toxicity at a granular level, rather than just a binary judgment.

Methods

The authors propose two distinct approaches for toxic span detection:

  • Named Entity Recognition (NER) Approach: This system leverages spaCy's powerful NER library. The core idea is to treat toxic spans as "named entities." The training data is preprocessed to tag all toxic character spans with the label "TOXIC." spaCy's model, known for its efficiency and accuracy, is then trained on this annotated data to predict these "TOXIC" entities in new text. The authors specifically used the en_core_web_sm model and experimented with various parameters to optimize performance.
  • Question-Answering (QA) Approach: This method frames the problem as a QA task. The system utilizes RoBERTa, a robust pre-trained language model, in conjunction with ToxicBERT, another transfer learning model specifically designed for toxicity classification. The process involves preprocessing the text to handle multi-span toxic expressions by splitting them into individual spans. The RoBERTa model is then fine-tuned to predict the start and end of toxic spans. During testing, ToxicBERT is used to filter out non-toxic comments before RoBERTa predicts the toxic words, which are then transformed back into spans.

Datasets

The primary dataset used in this work is the SemEval-2021 Task 5: Toxic Spans Detection dataset. This dataset is derived from the publicly available Civil Comments dataset. While the original Civil Comments dataset provides post-level toxicity annotations, the Toxic Spans Detection dataset focuses on a subset of 30K toxic posts, further refined to 10K posts for span-level annotation. Three experienced crowd-raters were employed to identify and highlight toxic spans within these comments. The dataset is divided into training and testing sets, with 7,939 records in the training set and 2,000 in the test set.

Key Insights and Ideas

  • Granularity Matters: The research strongly supports the idea that focusing on specific toxic spans, rather than entire comments, is a more effective and less restrictive approach to managing online toxicity.
  • NER as a Viable Alternative: The success of the spaCy-based NER system demonstrates that traditional NER techniques can be effectively adapted for toxic span detection, offering a competitive alternative to more complex QA-based methods.
  • Data Nuances Impact Performance: The analysis highlights that issues like slang, idioms, spelling mistakes, and the lack of context in some data points can significantly impair model performance. This underscores the importance of robust data preprocessing and potentially more sophisticated context-aware models.
  • Zero Spans are Common: A notable observation is the significant proportion of comments with zero toxic spans (6.15% in training, 19.7% in testing), indicating that not all comments flagged as potentially toxic actually contain explicit toxic phrases.

Key Results

The UIT-E10dot3 team achieved a competitive F1-score of 66.99% with their spaCy-based NER system, ranking 34th out of 91 teams in SemEval-2021 Task 5. Their RoBERTa-based QA system achieved an F1-score of 52.12%. The spaCy system's performance was 3.84% lower than the top-ranked team and 49.09% higher than the baseline model. The paper also provides qualitative analysis in Table 3, showcasing examples where the spaCy system struggled with context-dependent toxicity, slang, and spelling errors.

Limitations and Future Work

The authors acknowledge several limitations:

  • Contextual Ambiguity: The system sometimes struggles with toxic spans that require significant context to be understood, or when words have multiple meanings.
  • Slang and Idioms: The use of slang and idioms can lead to misinterpretations or null outputs from the system.
  • Annotation Inconsistencies: The dataset may contain inconsistencies, such as highlighting non-toxic spans or failing to highlight toxic ones, which can affect model training.
  • Spelling Errors: Intentional or unintentional spelling mistakes in the text can also impair performance.

For future work, the authors plan to:

  • Implement various State-of-the-Art (SOTA) models: They aim to explore and integrate more advanced models for toxic spans detection.
  • Improve online conversation environments: The ultimate goal is to contribute to creating safer and more friendly online forums.

Summary updated

BibTeX
@inproceedings{hoang2021uit,
  author = {Phu Gia Hoang and Luan Thanh Nguyen and Kiet Nguyen},
  title = {{UIT-E10dot3 at SemEval-2021 Task 5: Toxic Spans Detection with Named Entity Recognition and Question-Answering Approaches}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
}
Figure