UoB at SemEval-2021 Task 5: Extending Pre-Trained Language Models to Include Task and Domain-Specific Information for Toxic Span Prediction

Erik Yan, Harish Tayyar MadabushiACL 2021

TL;DR

This paper explores how to improve pre-trained language models (PLMs) for identifying toxic spans in text. The authors found that while adding domain-specific word lists and count-based features (TF-IDF) offered marginal improvements, they helped reduce overprediction of toxic tokens. Their best model achieved a competitive score, ranking 25th out of 91 teams in the SemEval-2021 task.

What Problem Does This Paper Address?

Online toxicity is a significant issue, and effectively moderating it is crucial for healthy digital communities. While pre-trained language models (PLMs) like BERT have revolutionized NLP, they often struggle to capture nuances specific to a particular task or domain without extensive fine-tuning. This paper focuses on the Toxic Spans Detection task, which aims to pinpoint the exact words or phrases contributing to toxicity, rather than just classifying an entire post. The challenge lies in equipping PLMs with the necessary task-specific statistical information and domain knowledge to accurately identify these toxic spans.

Methods

The researchers experimented with several modifications to a baseline DistilBERT model:

  • TF-IDF Integration: They incorporated Term Frequency-Inverse Document Frequency (TF-IDF) scores for each token. TF-IDF is a statistical measure that captures word importance within a document relative to a corpus, helping to identify key terms.
  • Domain-Specific Word List: They integrated a feature indicating whether a token was present in a curated list of known toxic words. This directly injects domain-specific knowledge about offensive language.
  • Conditional Random Field (CRF): They added a CRF layer on top of the PLM. CRFs are known for their ability to model dependencies between sequential predictions, which is beneficial for tasks like token classification where the label of one token can influence the labels of its neighbors.

These features were appended to the token's hidden state output from DistilBERT before being fed into a fully connected classification layer. The CRF layer, when used, took the output scores from this classification layer to compute the probability of the entire tag sequence.

Datasets

The primary dataset used in this work is from the SemEval-2021 Task 5: Toxic Spans Detection. The paper mentions using this dataset for training, validation, and testing. No new benchmarks were introduced; the focus was on improving performance on the existing task.

Key Insights and Ideas

  • Marginal Gains, Meaningful Impact: While the overall F1 score improvements from adding TF-IDF and word lists were small, they were significant enough to improve the model's ranking. This suggests that even subtle enhancements can matter in competitive NLP tasks.
  • Reducing Overprediction: A key finding was that the TF-IDF feature, despite its small impact on the overall F1 score, significantly reduced the baseline DistilBERT model's tendency to overpredict toxic labels. This is crucial for practical moderation systems where false positives can be as problematic as false negatives.
  • The Challenge of Context: The authors highlight the inherent difficulty in token classification, noting inconsistencies in human annotations and the struggle of both models and humans to correctly identify toxicity when non-toxic words are used in a toxic context (e.g., "Trump troll").

Key Results

  • Validation Set: On the validation set, the DistilBERT+Word List model achieved the highest F1 score (0.59296), but the improvements over the baseline DistilBERT (0.58896) were marginal. Interestingly, combining TF-IDF and word lists, or adding a CRF, slightly worsened performance on the validation set.
  • Test Set: On the test dataset, the DistilBERT+TF-IDF model showed the most improvement over the baseline, achieving an F1 score of 0.67609 compared to the baseline's 0.66937. This difference, though small (0.00672), would have improved their ranking by 6 places.
  • Ranking: The best performing model (DistilBERT+TF-IDF) achieved an F1 score of 0.67609, ranking 25th out of 91 participating teams.
  • Confusion Matrix Analysis: The DistilBERT+TF-IDF model demonstrated a 2.5% improvement on a subset of the test set by correctly identifying over 100 false positives from the baseline DistilBERT as true negatives.

Limitations and Future Work

  • Limited Training Runs: Due to time and resource constraints, each model was trained only five times with different random seeds, instead of the more rigorous ten. This might have limited the ability to fully capture the performance variations.
  • Feature Vector Size: The authors hypothesize that the relatively large size of DistilBERT's token vectors (768 dimensions) might dilute the impact of the smaller, added features (TF-IDF and word list indicators).
  • Future Directions: The authors plan to further explore how these and other features interact with pre-trained models for token classification tasks, suggesting an avenue for continued research into enhancing PLMs for nuanced NLP challenges.

Summary updated

BibTeX
@inproceedings{yan2021uob,
  author = {Erik Yan and Harish Tayyar Madabushi},
  title = {{UoB at SemEval-2021 Task 5: Extending Pre-Trained Language Models to Include Task and Domain-Specific Information for Toxic Span Prediction}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
}
Figure