hBERT + BiasCorp - Fighting Racism on the Web

Olawale Moses Onabola, Zhuang Ma, Xie Yang, Benjamin Akera, Ibraheem Abdulrahman, Jia Xue, Dianbo Liu, Yoshua Bengio

Abstract

Subtle and overt racism is still present both in physical and online communities today and has impacted many lives in different segments of the society. In this short piece of work, we present how we're tackling this societal issue with Natural Language Processing. We are releasing BiasCorp, a dataset containing 139,090 comments and news segment from three specific sources - Fox News, BreitbartNews and YouTube. The first batch (45,000 manually annotated) is ready for publication. We are currently in the final phase of manually labeling the remaining dataset using Amazon Mechanical Turk. BERT has been used widely in several downstream tasks. In this work, we present hBERT, where we modify certain layers of the pretrained BERT model with the new Hopfield Layer. hBert generalizes well across different distributions with the added advantage of a reduced model complexity. We are also releasing a JavaScript library and a Chrome Extension Application, to help developers make use of our trained model in web applications (say chat application) and for users to identify and report racially biased contents on the web respectively.

Problem Statement

Despite the prevalence of hate speech online, automatically detecting racial bias remains a significant challenge for Natural Language Processing (NLP). Standard models like BERT are powerful but computationally expensive, making them difficult to deploy in "edge" environments like web browsers where users need them most.

Furthermore, existing datasets for hate speech often lack the nuance required to identify subtle racial bias or are limited in scope. The authors address these gaps by providing both a massive, curated dataset from diverse online sources and a streamlined model architecture designed for better generalization and lower overhead.

Methodology

The authors introduce hBert, a modified version of the BERT architecture. The key innovation is the replacement of the self-attention mechanism in the final layers with Hopfield Layers.

  • Hopfield Layers: These layers use a modern version of Hopfield Networks (associative memory) to approximate the functionality of the attention mechanism. This allows the model to extract task-specific features from the input representation with significantly fewer parameters.
  • Hopfield Pooling: They also implemented a Hopfield Pooling layer, which acts as a form of memory to store the hidden states of the last layer, further improving performance.
  • Weighted Loss Function: To handle the inherent subjectivity in human labeling, the authors formulated a custom loss function that weights labels based on annotator confidence scores, rather than simply averaging them.

The BiasCorp Dataset

The paper introduces BiasCorp, a dataset containing 139,090 comments and news segments scraped from Fox News, BreitbartNews, and YouTube.

Distribution of bias and confidence scores (CV) in the BiasCorp dataset.

To ensure a balanced dataset, the team used sentiment analysis and a racial-related lookup table to identify potentially biased content. At the time of writing, 45,000 entries have been manually annotated. Each entry includes a bias score and a confidence score from multiple annotators. The training set focused on news outlets, while the test set consisted exclusively of YouTube comments to evaluate cross-domain generalization.

Key Results and Discussion

The hBert model was compared against a standard BERT baseline across several metrics. The results indicate that the use of associative memory via Hopfield Layers is highly effective for specialized tasks like bias detection.

  • Accuracy: hBert achieved a Top-1 Accuracy of 0.64, outperforming the baseline's 0.60.
  • Mean Average Precision (mAP): hBert showed a significant jump to 0.3501, compared to the baseline's 0.2935.
  • Complexity: The authors successfully reduced the parameter size and model complexity, confirming that hBert performs as well as or better than the baseline while being leaner.
Comparison of training and validation loss between hBert and the BERT baseline.

As shown in the loss curves, hBert maintains a lower and more stable validation loss compared to the baseline, suggesting better generalization to unseen data and different "internet dialects."

Conclusion and Future Work

While promising, the work is ongoing. The full BiasCorp dataset is still undergoing manual labeling for the remaining rows. Currently, the work is focused strictly on racial bias, but the authors plan to extend the framework to detect other forms of discrimination, such as gender bias. Future iterations may explore even more aggressive compression techniques, such as 8-bit quantization, to further optimize the Chrome extension for end-users.

Summary updated

BibTeX
@inproceedings{onabola2021hbert,
  author = {Olawale Moses Onabola and Zhuang Ma and Xie Yang and Benjamin Akera and Ibraheem Abdulrahman and Jia Xue and Dianbo Liu and Yoshua Bengio},
  title = {{hBERT + BiasCorp - Fighting Racism on the Web}},
  booktitle = {LT-EDI@EACL},
  year = {2021},
  url = {https://openreview.net/forum?id=cDbkdLGCDk},
}
Figure