Neural Word Decomposition Models for Abusive Language Detection

Sravan Babu Bodapati, Spandana Gella, Kasturi Bhattacharjee, Yaser Al-Onaizan

Abstract

User generated text on social media often suffers from a lot of undesired characteristics including hatespeech, abusive language, insults etc. that are targeted to attack or abuse a specific group of people. Often such text is written differently compared to traditional text such as news involving either explicit mention of abusive words, obfuscated words and typological errors or implicit abuse i.e., indicating or targeting negative stereotypes. Thus, processing this text poses several robustness challenges when we apply natural language processing techniques developed for traditional text. For example, using word or token based models to process such text can treat two spelling variants of a word as two different words. Following recent work, we analyze how character, subword and byte pair encoding (BPE) models can be aid some of the challenges posed by user generated text. In our work, we analyze the effectiveness of each of the above techniques, compare and contrast various word decomposition techniques when used in combination with others. We experiment with finetuning large pretrained language models, and demonstrate their robustness to domain shift by studying Wikipedia attack, toxicity and Twitter hatespeech datasets.

Introduction

Detecting hate speech and abuse on social media is a persistent "cat-and-mouse" game. Users frequently employ typos, "leetspeak" (e.g., replacing 'e' with '3'), and intentional obfuscation (e.g., "h@te") to evade automated filters. Standard Natural Language Processing (NLP) models typically operate at the word level. If a model is trained on "hate" but encounters "h@te" in production, it treats the latter as an "out-of-vocabulary" (OOV) token, leading to a failure in recognition. This research addresses this robustness gap by investigating word decomposition strategies that allow models to understand the underlying meaning of a word even when its surface form is manipulated.

Methodology

The study compares several word decomposition strategies to evaluate their resilience to noise in user-generated text:

  1. Word-based (Baseline): Utilizing fastText, which represents documents by averaging word embeddings.
  2. Subword-based: A fastText variant that decomposes words into character n-grams.
  3. Joint Word and Character Embeddings: A TextCNN model combining standard word embeddings with features from a character-level CNN.
  4. End-to-End Character Models: VDCNN (Very Deep Convolutional Neural Network), operating entirely on character sequences.
  5. Byte Pair Encoding (BPE) / Wordpiece: Leveraging the BERT tokenizer to split words into frequent sub-units (e.g., "unhappy" into "un" and "##happy").
  6. Pre-trained Language Models: Fine-tuning a full BERT model.
Overview of model architectures and the WordPiece tokenization pipeline.

A key finding in the methodology is the "Tokenizer Transfer" effect: using BERT’s Wordpiece tokenizer to preprocess text for simpler models like fastText yields significant performance improvements. This suggests that the subword units learned by BERT capture universal linguistic patterns that aid simpler architectures in handling noise.

Experimental Results

The models were evaluated on three benchmarks: Twitter Hatespeech (~11k tweets), Wikipedia Personal Attacks (W-ATT, ~115k comments), and Wikipedia Toxicity (W-TOX, ~159k comments).

Performance comparison (Weighted F1) across Hatespeech and Wikipedia datasets.

As shown in the results table, fine-tuned BERT models achieved state-of-the-art performance on the Wikipedia datasets, reaching a 95.7 Weighted F1 on W-ATT and 96.8 on W-TOX. Notably, on the Twitter dataset, a fastText model utilizing bigrams and BERT’s Wordpiece tokenization outperformed the full fine-tuned BERT model in certain splits. This highlights a significant efficiency gain, as fastText is considerably faster to train and deploy.

Discussion and Conclusion

The research highlights several critical insights:

  • Word Boundaries Matter: Purely character-based models (VDCNN) underperformed compared to hybrid models, suggesting that maintaining the concept of a "word" provides necessary structural context.
  • Pre-trained vs. Custom BPE: Training a custom BPE tokenizer on small, task-specific datasets often leads to performance degradation. Subword units are most effective when learned from massive, diverse corpora like Wikipedia.
  • Robustness to Obfuscation: Qualitative analysis confirmed that BPE-based models successfully identify abusive terms even when obfuscated by punctuation or symbols.

Despite these gains, the models still struggle with implicit abuse, such as sarcasm or negative stereotypes that do not rely on "bad" words. Future work should focus on pre-training language models specifically on large-scale social media data to better capture the nuances of internet slang and implicit toxicity.

Summary updated

Abstract

User generated text on social media often suffers from a lot of undesired characteristics including hatespeech, abusive language, insults etc. that are targeted to attack or abuse a specific group of people. Often such text is written differently compared to traditional text such as news involving either explicit mention of abusive words, obfuscated words and typological errors or implicit abuse i.e., indicating or targeting negative stereotypes. Thus, processing this text poses several robustness challenges when we apply natural language processing techniques developed for traditional text. For example, using word or token based models to process such text can treat two spelling variants of a word as two different words. Following recent work, we analyze how character, subword and byte pair encoding (BPE) models can be aid some of the challenges posed by user generated text. In our work, we analyze the effectiveness of each of the above techniques, compare and contrast various word decomposition techniques when used in combination with others. We experiment with finetuning large pretrained language models, and demonstrate their robustness to domain shift by studying Wikipedia attack, toxicity and Twitter hatespeech datasets
BibTeX
@misc{bodapati2019neural,
  author = {Sravan Babu Bodapati and Spandana Gella and Kasturi Bhattacharjee and Yaser Al-Onaizan},
  title = {{Neural Word Decomposition Models for Abusive Language Detection}},
  year = {2019},
  eprint = {1910.01043},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.01043},
}
Figure