h BERT + B ias C orp - Fighting Racism on the Web (2021)

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 3 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

## introduction the internet has evolved to become one of the main sources of textual information for many people. through social media, reviews, and comment sections across the internet, people are continuously consuming information through text. with this, racially biased content has become more entrenched within the language of the internet. racially biased content in this context refers to the attitudes or stereotypes expressed against marginalized races. this is often as a result of implicit bias resulting into hate speech. in this work, we attempt to automatically detect this racially biased content from data collected from the web, including comments from online news outlets such as fox news and and comments from youtube videos. we label this dataset with pointers to racial bias and use machine learning techniques to automate this task. specifically, we implement bert as a base model to do this. we also implement a browser extension as a tool to help people identify racially biased content in the information they are consuming. we will also be releasing our curated dataset -biascorp to allow more research to be done in this direction. ## related works one of the earliest papers to investigate machine learning approaches for the automatic detection of racially-biased online content is @xcite . the paper identified the potential use of bag-of-words, n-grams, and distributions of parts-of-speech tags as features for the task. their bag-of-words features are informed by ideas from the field of information retrieval, and involve either word frequencies or counts of word occurrences. using an svm classifier, for bag-of-words features, they found that the use of frequency of words, rather than number of occurrence of words, yielded greater classification accuracies. the n-grams and parts-of-speech tags techniques were unavailable as of the time of their writing. in @xcite , authors followed the definition of (nockleby and john, 2000) by defining hate speech as "any communication that disparages a person or a group on the basis of some characteristic such as race, color, ethnicity, gender, sexual orientation, nationality, religion, or other characteristic." their work focused more on detecting anti-semitic hate speech. for their work, they created a dataset containing hate speech obtained from yahoo! and the american jewish congress. following the work of @xcite , they employed hand-crafted template-based features. apart from the fact that these features are hand-engineered, a potential drawback is their sheer size: a total of 3,537 features, which is prone to the curse of dimensionality. a counter-intuitive result reported by the paper is that the uni-gram features contributed best to classification accuracies. they used linear-kernel svms for classification. the work of @xcite dealt with the broad category of abusive language. authors of the work gave definitions for distinguishing between three categories of abusive language: hate speech which subsumes racial bias, derogatory remarks and profanity. further, they described reasons why automatic detection of abusive language, which subsumes racial bias, is difficult. reasons include: clever evasion of detection engines by users via the use of mischievous permutations of words (e.g. niggah written as ni99ah); evolution of ethnic slurs with time; role of cultural context in the perception and interpretation of slurs, as a phrase that is considered derogative in one culture might be perfectly neutral in another culture. towards building their classification model, they employed four categories of features namely, n-grams, lexical features, syntactic/parser features, and word-level as well as comment-level embeddings. they found that character-level n-grams gave the highest contribution to the model's accuracy. the authors of @xcite also developed techniques for detecting multiple hate speech categories including the racially-based category. towards creating their datasets, they harnessed hate speech event-triggers. for example, to create their racial bias dataset, they collected tweets in a two-week interval following the reelection of barrack obama as u.s president. they explored a number of potential features towards building their classification algorithm: bag of words, lexicon of hateful terms, and typed dependencies. in addition, they experimented into classification via svms versus classification via random forests, and reported that the former yielded superior performance over the latter. also, they compared the use of classifiers trained for each hate speech category against the use of a single classifier trained on data spanning all categories. as expected, the specialized classifiers outperformed their multi-category counterpart. @xcite followed the definition of @xcite , which states that hate speech is: "speech or expression which is capable of instilling or inciting hatred of, or prejudice towards, a person or group of people on a specified ground, including race, nationality, ethnicity, country of origin, ethno-religious identity, religion, sexuality, gender identity or gender." the main research thrust of their work was to apply demographic embeddings @xcite , @xcite , for the task of racial bias detection in tweets. compared to other works such as @xcite , for instance, a particularly distinguishing result of @xcite is how their data extraction procedure is able to arrive at a better balanced ratio of racially-biased to non-racially-biased comments. for example, in the work, 40.58 percent of canadian tweets were judged racially-biased by human annotators, whereas in @xcite only about 3.73 percent of the comments in the dataset are racially biased. classification results using an svm classifier revealed benefits of their proposed demographic embeddings over traditional features and embeddings. in @xcite , the authors explored the detection of hate speech in white supremacist forums. they explored bilstm, logistic regression and bert for their task. also, they compared the use of domain-agnostic pretrained word embedding (such as glove.6b.300d ) versus the use of a domain-aware 300-dimensional word2vec embedding trained on the specific dataset used in the work. results showed that bert yields better results than both logistic regression and bilstm. further, results proved the domainaware embeddings to be superior to the pre-trained embeddings. ## discussion in this work we have shown a way to detect racial bias in text. we experimented with a bert-based model as we aim to reduce model complexity without sacrificing much of the performance. we also discussed the biascorp, a manually labelled dataset containing racially biased comments from fox news, breitbartnews and youtube. to enable developers make use of our pretrained hbert model, we are releasing a javascript library, optimized for inference on the edge. a chrome extension will also be available for users to help report and identify racially bias text on the web. we also plan to extend this work to other forms of biases such as gender. in a future work, we plan to further reduce the model complexity by using gaussian kernel as described in @xcite and other quantization tricks.