TL;DR
This paper tackles the challenging task of pinpointing toxic spans within text, going beyond simple document-level toxicity classification. The authors propose an ensemble approach combining BiLSTM-CRF, custom spaCy NER, and fine-tuned BERT models, fused with a majority voting strategy, to achieve competitive results in the SemEval-2021 toxic span detection task.
What Problem Does This Paper Address?
The proliferation of online content, especially on social media and blogs, has led to an increase in toxic language, hate speech, and personal attacks. While classifying entire posts or comments as toxic is a common approach, it often lacks the granularity needed for effective moderation. Identifying the specific segments of text that are toxic (toxic spans) is crucial for precise content moderation, allowing platforms to remove harmful content without censoring legitimate discourse. This task is particularly challenging because toxicity can be subtle, context-dependent, and spread across multiple words, making it difficult for automated systems to accurately delineate these spans.
Methods
The core of the CSECU-DSG system is an ensemble of three distinct sequence tagging models, each contributing to the final toxic span detection.
- BiLSTM-CRF: This model, a standard for sequence labeling tasks like Named Entity Recognition (NER), is adapted for toxic span detection using the BIO (Begin, Inside, Outside) tagging scheme. It leverages GloVe word embeddings, CNN-based character embeddings, and a bidirectional LSTM encoder followed by a Conditional Random Field (CRF) layer for optimized tag prediction.
- Custom spaCy NER: A spaCy NER model is trained specifically for this task. The authors create a custom "TOXIC" entity type, load a blank English model, append pre-trained word2vec embeddings, and then train the NER pipeline on the toxic span data.
- Fine-tuned BERT: The authors fine-tune a BERT-large-cased model for token classification. This approach treats each token in a sentence and assigns it a "toxic" or "non-toxic" label, with tokens within toxic spans being tagged as "toxic."
Finally, a majority voting fusion scheme is employed. Spans predicted by at least two of the three models are included in the final output. This ensemble approach aims to leverage the strengths of each individual model and mitigate their weaknesses.
Datasets
The primary dataset used for training and evaluation is the Civil Comments Dataset. This dataset contains approximately 10,000 toxic comments. For the SemEval-2021 Task 5, the dataset was split into training (7939 comments), trial (690 comments), and test (2000 comments) sets. The authors note that about 90% of the comments in their dataset contain toxic spans, while 10% have no toxic spans.
Key Insights and Ideas
- Ensembling for Granularity: The paper strongly demonstrates that combining multiple sequence tagging models (BiLSTM-CRF, spaCy NER, BERT) through majority voting significantly improves toxic span detection performance compared to individual models. This highlights the benefit of diverse model architectures for capturing different aspects of toxic language.
- Beyond Token-Level: While individual models might excel at token-level prediction, the ensemble approach, particularly majority voting, helps in identifying more accurate spans. However, the paper also points out that this ensemble can sometimes struggle with phrasal toxicity, potentially fragmenting toxic sequences or missing broader contextual toxicity.
- BIO vs. Token Classification: The use of both BIO tagging (BiLSTM-CRF) and token classification (BERT) within the ensemble provides different perspectives on span identification, which, when combined, can lead to more robust predictions.
Key Results
The CSECU-DSG system achieved a competitive F1-Score of 0.6795264755, ranking 21st among 91 valid submissions in the SemEval-2021 Task 5. This performance was a notable improvement over the individual models, with the ensemble boosting the F1-Score by approximately 3% compared to the best-performing individual model. The paper also provides an example (Table 5) where the majority voting correctly identifies a toxic span that one of the individual models missed.
Limitations and Future Work
The authors acknowledge that their system sometimes struggles with detecting phrasal toxicity and can fragment toxic sequences. They attribute this to the models primarily being trained on token-level data, with only the BiLSTM-CRF explicitly using BIO tags. The ensemble, while improving overall scores, can sometimes "shrink some important features of the discrete models."
For future work, the authors plan to explore other advanced sequence tagging models and fine-tuned language models, such as ALBERT, DistilBERT, RoBERTa, and GPT, potentially in further ensemble configurations, to improve toxic span detection.
Summary updated