Identifying Offensive Posts and Targeted Offense from Twitter

Haimin Zhang, Debanjan Mahata, Simra Shahid, Laiba Mehnaz, Sarthak Anand, Yaman Singla, Rajiv Ratn Shah, Karan UppalarXiv 2019

Introduction

The unrestricted use of offensive language on social media platforms like Twitter poses a significant challenge for automated moderation systems. These posts range from casual abusive slurs to targeted hate speech, and their detection is complicated by the brevity, noise, and idiosyncratic nature of microblogging. This paper presents a hybrid approach developed for the SemEval 2019 Task 6 (OffensEval) competition, which focuses on identifying offensive content and determining whether such content is targeted at specific entities.

Methodology

Sub-task A: Offensive Language Identification

To classify tweets as offensive (OFF) or not offensive (NOT), the authors implemented an ensemble of three distinct neural network architectures. The goal was to combine models with different inductive biases to achieve a more robust classification:

  1. Convolutional Neural Network (CNN): This model utilized filters of sizes 2, 3, and 4 to capture local, position-invariant features, such as specific n-grams of offensive terms.
  2. Bidirectional LSTM with Attention: This architecture processed sequences in both directions to capture global context, employing an attention mechanism to weigh the most informative words in a tweet.
  3. BiLSTM + BiGRU: A stacked recurrent architecture that leveraged both Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) layers to model the sequential nature of the text deeply.

The final predictions were generated by averaging the outputs of these three models. Preprocessing included hashtag segmentation and the normalization of censored swear words, using 200-dimensional GloVe embeddings for word representation.

Sub-task B: Categorization of Offense Types

For the second sub-task—categorizing offensive tweets as targeted (TIN) or untargeted (UNT)—the authors opted for a heuristic-based system rather than a machine learning model. This decision was primarily driven by severe class imbalance in the training data and time constraints during the competition. The rule-based system utilized SpaCy for Named Entity Recognition and a compiled list of high-frequency tokens and hashtags (e.g., #maga, #liberals, antifa, trump). Tweets containing these specific keywords, pronouns, or named entities were flagged as targeted (TIN).

Datasets and Class Imbalance

The models were trained and evaluated on the SemEval 2019 Task 6 dataset, which contains 14,100 annotated tweets. A significant challenge identified during development was the extreme class imbalance, particularly for Sub-task B.

Class balance for Sub-task B instances, illustrating the heavy skew towards targeted (TIN) offenses which motivated the heuristic approach.

The dataset also exhibited a strong political bias, as approximately 50% of the keywords used for data collection were politically charged. Furthermore, an error analysis revealed that roughly 4% of the training data was mislabeled by human annotators. The authors found that manually removing these noisy samples acted as a form of heuristic undersampling, which noticeably improved model performance.

Results and Discussion

The ensemble approach for Sub-task A was highly successful, ranking 5th out of 103 participants. The results demonstrate that architectural diversity—combining CNNs for local phrase detection with RNNs for global sequence context—is a powerful strategy for text classification.

Performance metrics for Sub-task A, comparing the ensemble (MIDAS Submission 2) against individual models and baselines.

In Sub-task B, the heuristic system ranked 8th out of 75 participants. While the performance was strong, the authors noted that the system's success was largely due to its ability to reverse-engineer the dataset's collection bias. Because the dataset was heavily populated with specific political keywords, a simple rule-based system could effectively "guess" the labels. This finding highlights the danger of collection bias, as such models may not generalize well to real-world, general-purpose offensive language.

Conclusion

This research highlights the effectiveness of ensembling diverse deep learning models for offensive language detection. It also provides a critical perspective on dataset quality, showing how inherent biases in data collection can inadvertently favor naive rule-based systems. Future work will involve developing more robust machine learning models for targeted offense detection and further investigating automated methods for cleaning noisy annotations in large-scale social media datasets.

Summary updated

BibTeX
@misc{zhang2019identifying,
  author = {Haimin Zhang and Debanjan Mahata and Simra Shahid and Laiba Mehnaz and Sarthak Anand and Yaman Singla and Rajiv Ratn Shah and Karan Uppal},
  title = {{Identifying Offensive Posts and Targeted Offense from Twitter}},
  year = {2019},
  eprint = {1904.09072},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1904.09072},
}
Figure