UPB at SemEval-2021 Task 5: Virtual Adversarial Training for Toxic Spans Detection

Andrei Paraschiv, Dumitru-Clementin Cercel, Mihai DascaluACL 2021

TL;DR

This paper tackles the challenging task of identifying specific "toxic spans" within online text, going beyond simple classification of entire comments. The authors introduce Virtual Adversarial Training (VAT) to enhance the robustness of Transformer-based models like BERT and RoBERTa, achieving competitive results on the SemEval-2021 Task 5.

What Problem Does This Paper Address?

The proliferation of online toxicity, especially amplified during the COVID-19 pandemic, necessitates effective automated detection methods. While previous work has focused on classifying entire messages as toxic or non-toxic, SemEval-2021 Task 5 introduces a more granular challenge: pinpointing the exact character spans within a comment that contribute to its toxicity. This is crucial because not all parts of a comment are equally toxic, and identifying these specific segments allows for more nuanced understanding and intervention. The task is particularly difficult due to the subtle and evolving nature of toxic language, which often employs obfuscated or indirect expressions.

Methods

The core of the proposed approach lies in leveraging Transformer-based language models, specifically BERT and RoBERTa, for toxic span detection. To improve their robustness against adversarial attacks and subtle linguistic variations, the authors incorporate Virtual Adversarial Training (VAT). VAT is a semi-supervised technique that aims to make models more invariant to small perturbations in the input data. It achieves this by adding a regularization term to the loss function that penalizes large changes in the model's output when presented with slightly perturbed versions of the input.

The authors also explore enhancing these models with character embeddings. These embeddings, trained using a CNN-BiLSTM model on the Jigsaw dataset, aim to capture finer-grained linguistic features that might be missed by word-level embeddings alone. Finally, a Conditional Random Field (CRF) layer is used on top of the Transformer models to further refine the sequence labeling process for identifying toxic spans.

Datasets

The primary dataset used for this task is a subset of the Jigsaw Unintended Bias in Toxicity Classification dataset, specifically curated for SemEval-2021 Task 5. This dataset features annotated character spans indicating toxicity. The authors also utilized 20,000 random records from the Jigsaw dataset for unsupervised training, ensuring no overlap with the SemEval training data.

Key Insights and Ideas

  • VAT's Robustness Boost: Virtual Adversarial Training proved to be a valuable technique for enhancing the robustness of Transformer models in toxic span detection, leading to performance improvements.
  • Domain-Specific Models Shine: The experiments suggest that domain-specific models can sometimes outperform larger, more general models, especially when dealing with nuanced tasks like toxic span detection.
  • Character Embeddings: A Mixed Bag: While character embeddings improved the performance of baseline LSTM-CRF models, they did not consistently benefit the BERT-based models in this specific task. This might be due to the way they influenced span detection, potentially leading to longer, less precise toxic spans.
  • The Challenge of Obfuscation: The models successfully identified common toxic expressions but struggled with more obscured or indirectly offensive language, highlighting the ongoing challenge of detecting evolving toxicity.
  • Over-prediction Tendency: The models exhibited a tendency to over-predict toxic spans, sometimes including words that are not inherently toxic or extending the identified span beyond the truly offensive part.

Key Results

The authors achieved an F1-score of 65.73% in their official submission and 66.13% after further post-evaluation tuning. This performance was achieved using a BERT-based model with VAT and a CRF layer. The paper presents a detailed table (Table 1) comparing various model configurations, showing that BERT-toxic-CRF-VAT* (their best model) achieved the highest F1-score on the competition test set. Qualitative analysis revealed that models could identify both explicit and some implicit toxic language, but also showed examples of over-prediction and missed subtle toxicity.

Limitations and Future Work

The authors acknowledge that their models sometimes over-predict toxic spans, a tendency that can be influenced by the unsupervised training data and the distribution of toxic spans in the training set. They also note that while character embeddings helped some models, they didn't universally improve BERT performance and could lead to detecting longer, less precise spans.

For future work, the authors plan to explore self-supervised adversarial training to further improve model robustness, particularly in detecting cleverly hidden offensive and toxic expressions. They also suggest that a deeper study into the impact of adversarial training on offensive and hate speech classifiers is a promising avenue for future research.

Summary updated

BibTeX
@inproceedings{paraschiv2021upb,
  author = {Andrei Paraschiv and Dumitru-Clementin Cercel and Mihai Dascalu},
  title = {{UPB at SemEval-2021 Task 5: Virtual Adversarial Training for Toxic Spans Detection}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
}
Figure