Waseem and Hovy BIBREF5, Davidson et al. BIBREF9, Waseem et al. BIBREF10
EXTRACTIVE
Waseem and Hovy BIBREF5, Davidson et al. BIBREF9, and Waseem et al. BIBREF10
EXTRACTIVE
As it is understandable from Tables TABREF16(classdistributionwaseem) and TABREF16(classdistributiondavidson), we are dealing with imbalance datasets with various classes’ distribution. Since hate speech and offensive languages are real phenomena, we did not perform oversampling or undersampling techniques to adjust the classes’ distribution and tried to supply the datasets as realistic as possible. We evaluate the effect of different fine-tuning strategies on the performance of our model. Table TABREF17 summarized the obtained results for fine-tuning strategies along with the official baselines. We use Waseem and Hovy BIBREF5, Davidson et al. BIBREF9, and Waseem et al. BIBREF10 as baselines and compare the results with our different fine-tuning strategies using pre-trained BERTbase model. The evaluation results are reported on the test dataset and on three different metrics: precision, recall, and weighted-average F1-score. We consider weighted-average F1-score as the most robust metric versus class imbalance, which gives insight into the performance of our proposed models. According to Table TABREF17, F1-scores of all BERT based fine-tuning strategies except BERT + nonlinear classifier on top of BERT are higher than the baselines. Using the pre-trained BERT model as initial embeddings and fine-tuning the model with a fully connected linear classifier (BERTbase) outperforms previous baselines yielding F1-score of 81% and 91% for datasets of Waseem and Davidson respectively. Inserting a CNN to pre-trained BERT model for fine-tuning on downstream task provides the best results as F1- score of 88% and 92% for datasets of Waseem and Davidson and it clearly exceeds the baselines. Intuitively, this makes sense that combining all pre-trained BERT layers with a CNN yields better results in which our model uses all the information included in different layers of pre-trained BERT during the fine-tuning phase. This information contains both syntactical and contextual features coming from lower layers to higher layers of BERT.
As it is understandable from Tables TABREF16(classdistributionwaseem) and TABREF16(classdistributiondavidson), we are dealing with imbalance datasets with various classes’ distribution. Since hate speech and offensive languages are real phenomena, we did not perform oversampling or undersampling techniques to adjust the classes’ distribution and tried to supply the datasets as realistic as possible. We evaluate the effect of different fine-tuning strategies on the performance of our model. Table TABREF17 summarized the obtained results for fine-tuning strategies along with the official baselines. We use Waseem and Hovy BIBREF5, Davidson et al. BIBREF9, and Waseem et al. BIBREF10 as baselines and compare the results with our different fine-tuning strategies using pre-trained BERTbase model. The evaluation results are reported on the test dataset and on three different metrics: precision, recall, and weighted-average F1-score. We consider weighted-average F1-score as the most robust metric versus class imbalance, which gives insight into the performance of our proposed models. According to Table TABREF17, F1-scores of all BERT based fine-tuning strategies except BERT + nonlinear classifier on top of BERT are higher than the baselines. Using the pre-trained BERT model as initial embeddings and fine-tuning the model with a fully connected linear classifier (BERTbase) outperforms previous baselines yielding F1-score of 81% and 91% for datasets of Waseem and Davidson respectively. Inserting a CNN to pre-trained BERT model for fine-tuning on downstream task provides the best results as F1- score of 88% and 92% for datasets of Waseem and Davidson and it clearly exceeds the baselines. Intuitively, this makes sense that combining all pre-trained BERT layers with a CNN yields better results in which our model uses all the information included in different layers of pre-trained BERT during the fine-tuning phase. This information contains both syntactical and contextual features coming from lower layers to higher layers of BERT.
1910.12574
Introduction </s> People Ġare Ġincreasingly Ġusing Ġsocial Ġnetworking Ġplatforms Ġsuch Ġas ĠTwitter , ĠFacebook , ĠYouTube , Ġetc . Ġto Ġcommunicate Ġtheir Ġopinions Ġand Ġshare Ġinformation . ĠAlthough Ġthe Ġinteractions Ġamong Ġusers Ġon Ġthese Ġplatforms Ġcan Ġlead Ġto Ġconstructive Ġconversations , Ġthey Ġhave Ġbeen Ġincreasingly Ġexploited Ġfor Ġthe Ġpropagation Ġof Ġabusive Ġlanguage Ġand Ġthe Ġorganization Ġof Ġhate - based Ġactivities ĠB IB REF 0 , ĠB IB REF 1 , Ġespecially Ġdue Ġto Ġthe Ġmobility Ġand Ġanonymous Ġenvironment Ġof Ġthese Ġonline Ġplatforms . ĠViolence Ġattributed Ġto Ġonline Ġhate Ġspeech Ġhas Ġincreased Ġworldwide . ĠFor Ġexample , Ġin Ġthe ĠUK , Ġthere Ġhas Ġbeen Ġa Ġsignificant Ġincrease Ġin Ġhate Ġspeech Ġtowards Ġthe Ġimmigrant Ġand ĠMuslim Ġcommunities Ġfollowing Ġthe ĠUK 's Ġleaving Ġthe ĠEU Ġand Ġthe ĠManchester Ġand ĠLondon Ġattacks . ĠThe ĠUS Ġalso Ġhas Ġbeen Ġa Ġmarked Ġincrease Ġin Ġhate Ġspeech Ġand Ġrelated Ġcrime Ġfollowing Ġthe ĠTrump Ġelection . ĠTherefore , Ġgovernments Ġand Ġsocial Ġnetwork Ġplatforms Ġconfronting Ġthe Ġtrend Ġmust Ġhave Ġtools Ġto Ġdetect Ġaggressive Ġbehavior Ġin Ġgeneral , Ġand Ġhate Ġspeech Ġin Ġparticular , Ġas Ġthese Ġforms Ġof Ġonline Ġaggression Ġnot Ġonly Ġpoison Ġthe Ġsocial Ġclimate Ġof Ġthe Ġonline Ġcommunities Ġthat Ġexperience Ġit , Ġbut Ġcan Ġalso Ġprovoke Ġphysical Ġviolence Ġand Ġserious Ġharm ĠB IB REF 1 . </s> Recently , Ġthe Ġproblem Ġof Ġonline Ġabusive Ġdetection Ġhas Ġattracted Ġscientific Ġattention . ĠProof Ġof Ġthis Ġis Ġthe Ġcreation Ġof Ġthe Ġthird ĠWorkshop Ġon ĠAb usive ĠLanguage ĠOnline Ġor ĠK agg le âĢ Ļ s ĠToxic ĠComment ĠClassification ĠChallenge Ġthat Ġgathered Ġ4 , 551 Ġteams Ġin Ġ2018 Ġto Ġdetect Ġdifferent Ġtypes Ġof Ġtoxic ities Ġ( threat s , Ġobsc en ity , Ġetc .). ĠIn Ġthe Ġscope Ġof Ġthis Ġwork , Ġwe Ġmainly Ġfocus Ġon Ġthe Ġterm Ġhate Ġspeech Ġas Ġabusive Ġcontent Ġin Ġsocial Ġmedia , Ġsince Ġit Ġcan Ġbe Ġconsidered Ġa Ġbroad Ġumbrella Ġterm Ġfor Ġnumerous Ġkinds Ġof Ġinsulting Ġuser - generated Ġcontent . ĠHate Ġspeech Ġis Ġcommonly Ġdefined Ġas Ġany Ġcommunication Ġcriticizing Ġa Ġperson Ġor Ġa Ġgroup Ġbased Ġon Ġsome Ġcharacteristics Ġsuch Ġas Ġgender , Ġsexual Ġorientation , Ġnationality , Ġreligion , Ġrace , Ġetc . ĠHate Ġspeech Ġdetection Ġis Ġnot Ġa Ġstable Ġor Ġsimple Ġtarget Ġbecause Ġmis class ification Ġof Ġregular Ġconversation Ġas Ġhate Ġspeech Ġcan Ġseverely Ġaffect Ġusers âĢ Ļ Ġfreedom Ġof Ġexpression Ġand Ġreputation , Ġwhile Ġmis class ification Ġof Ġhateful Ġconversations Ġas Ġun problem atic Ġwould Ġmaintain Ġthe Ġstatus Ġof Ġonline Ġcommunities Ġas Ġunsafe Ġenvironments ĠB IB REF 2 . </s> To Ġdetect Ġonline Ġhate Ġspeech , Ġa Ġlarge Ġnumber Ġof Ġscientific Ġstudies Ġhave Ġbeen Ġdedicated Ġby Ġusing ĠNatural ĠLanguage ĠProcessing Ġ( N LP ) Ġin Ġcombination Ġwith ĠMachine ĠLearning Ġ( ML ) Ġand ĠDeep ĠLearning Ġ( DL ) Ġmethods ĠB IB REF 3 , ĠB IB REF 4 , ĠB IB REF 5 , ĠB IB REF 6 , ĠB IB REF 7 , ĠB IB REF 0 . ĠAlthough Ġsupervised Ġmachine Ġlearning - based Ġapproaches Ġhave Ġused Ġdifferent Ġtext Ġmining - based Ġfeatures Ġsuch Ġas Ġsurface Ġfeatures , Ġsentiment Ġanalysis , Ġlex ical Ġresources , Ġlinguistic Ġfeatures , Ġknowledge - based Ġfeatures Ġor Ġuser - based Ġand Ġplatform - based Ġmetadata ĠB IB REF 8 , ĠB IB REF 9 , ĠB IB REF 10 , Ġthey Ġnecess itate Ġa Ġwell - defined Ġfeature Ġextraction Ġapproach . ĠThe Ġtrend Ġnow Ġseems Ġto Ġbe Ġchanging Ġdirection , Ġwith Ġdeep Ġlearning Ġmodels Ġbeing Ġused Ġfor Ġboth Ġfeature Ġextraction Ġand Ġthe Ġtraining Ġof Ġclass ifiers . ĠThese Ġnewer Ġmodels Ġare Ġapplying Ġdeep Ġlearning Ġapproaches Ġsuch Ġas ĠConv olution al ĠNeural ĠNetworks Ġ( CNN s ), ĠLong ĠShort - Term ĠMemory ĠNetworks Ġ( L ST Ms ), Ġetc . BI B REF 6 , ĠB IB REF 0 Ġto Ġenhance Ġthe Ġperformance Ġof Ġhate Ġspeech Ġdetection Ġmodels , Ġhowever , Ġthey Ġstill Ġsuffer Ġfrom Ġlack Ġof Ġlabelled Ġdata Ġor Ġinability Ġto Ġimprove Ġgeneral ization Ġproperty . </s> Here , Ġwe Ġpropose Ġa Ġtransfer Ġlearning Ġapproach Ġfor Ġhate Ġspeech Ġunderstanding Ġusing Ġa Ġcombination Ġof Ġthe Ġun super vised Ġpre - trained Ġmodel ĠB ERT ĠB IB REF 11 Ġand Ġsome Ġnew Ġsupervised Ġfine - tun ing Ġstrategies . ĠAs Ġfar Ġas Ġwe Ġknow , Ġit Ġis Ġthe Ġfirst Ġtime Ġthat Ġsuch Ġexhaustive Ġfine - tun ing Ġstrategies Ġare Ġproposed Ġalong Ġwith Ġa Ġgener ative Ġpre - trained Ġlanguage Ġmodel Ġto Ġtransfer Ġlearning Ġto Ġlow - resource Ġhate Ġspeech Ġlanguages Ġand Ġimprove Ġperformance Ġof Ġthe Ġtask . ĠIn Ġsummary : </s> We Ġpropose Ġa Ġtransfer Ġlearning Ġapproach Ġusing Ġthe Ġpre - trained Ġlanguage Ġmodel ĠB ERT Ġlearned Ġon ĠEnglish ĠWikipedia Ġand ĠBook Corp us Ġto Ġenhance Ġhate Ġspeech Ġdetection Ġon Ġpublicly Ġavailable Ġbenchmark Ġdatasets . ĠTow ard Ġthat Ġend , Ġfor Ġthe Ġfirst Ġtime , Ġwe Ġintroduce Ġnew Ġfine - tun ing Ġstrategies Ġto Ġexamine Ġthe Ġeffect Ġof Ġdifferent Ġembed ding Ġlayers Ġof ĠB ERT Ġin Ġhate Ġspeech Ġdetection . </s> Our Ġexperiment Ġresults Ġshow Ġthat Ġusing Ġthe Ġpre - trained ĠB ERT Ġmodel Ġand Ġfine - tun ing Ġit Ġon Ġthe Ġdownstream Ġtask Ġby Ġleveraging Ġsynt act ical Ġand Ġcontextual Ġinformation Ġof Ġall ĠB ERT 's Ġtransform ers Ġoutper forms Ġprevious Ġworks Ġin Ġterms Ġof Ġprecision , Ġrecall , Ġand ĠF 1 - score . ĠFurthermore , Ġexamining Ġthe Ġresults Ġshows Ġthe Ġability Ġof Ġour Ġmodel Ġto Ġdetect Ġsome Ġbiases Ġin Ġthe Ġprocess Ġof Ġcollecting Ġor Ġannot ating Ġdatasets . ĠIt Ġcan Ġbe Ġa Ġvaluable Ġclue Ġin Ġusing Ġpre - trained ĠB ERT Ġmodel Ġfor Ġdeb i asing Ġhate Ġspeech Ġdatasets Ġin Ġfuture Ġstudies . </s> Previous ĠWorks </s> Here , Ġthe Ġexisting Ġbody Ġof Ġknowledge Ġon Ġonline Ġhate Ġspeech Ġand Ġoffensive Ġlanguage Ġand Ġtransfer Ġlearning Ġis Ġpresented . </s> Online ĠHate ĠSpeech Ġand ĠOffensive ĠLanguage : ĠResearchers Ġhave Ġbeen Ġstudying Ġhate Ġspeech Ġon Ġsocial Ġmedia Ġplatforms Ġsuch Ġas ĠTwitter ĠB IB REF 9 , ĠReddit ĠB IB REF 12 , ĠB IB REF 13 , Ġand ĠYouTube ĠB IB REF 14 Ġin Ġthe Ġpast Ġfew Ġyears . ĠThe Ġfeatures Ġused Ġin Ġtraditional Ġmachine Ġlearning Ġapproaches Ġare Ġthe Ġmain Ġaspects Ġdistinguishing Ġdifferent Ġmethods , Ġand Ġsurface - level Ġfeatures Ġsuch Ġas Ġbag Ġof Ġwords , Ġword - level Ġand Ġcharacter - level Ġ$ n $ - gram s , Ġetc . Ġhave Ġproven Ġto Ġbe Ġthe Ġmost Ġpredictive Ġfeatures ĠB IB REF 3 , ĠB IB REF 4 , ĠB IB REF 5 . ĠApart Ġfrom Ġfeatures , Ġdifferent Ġalgorithms Ġsuch Ġas ĠSupport ĠVector ĠMachines ĠB IB REF 15 , ĠNa ive ĠBay e ĠB IB REF 1 , Ġand ĠLog istic ĠReg ression ĠB IB REF 5 , ĠB IB REF 9 , Ġetc . Ġhave Ġbeen Ġapplied Ġfor Ġclassification Ġpurposes . ĠW ase em Ġet Ġal . ĠB IB REF 5 Ġprovided Ġa Ġtest Ġwith Ġa Ġlist Ġof Ġcriteria Ġbased Ġon Ġthe Ġwork Ġin ĠGender ĠStudies Ġand ĠCritical ĠRace ĠTheory Ġ( CR T ) Ġthat Ġcan Ġannot ate Ġa Ġcorpus Ġof Ġmore Ġthan Ġ$ 16 k $ Ġtweets Ġas Ġracism , Ġsexism , Ġor Ġneither . ĠTo Ġclassify Ġtweets , Ġthey Ġused Ġa Ġlog istic Ġregression Ġmodel Ġwith Ġdifferent Ġsets Ġof Ġfeatures , Ġsuch Ġas Ġword Ġand Ġcharacter Ġ$ n $ - gram s Ġup Ġto Ġ4 , Ġgender , Ġlength , Ġand Ġlocation . ĠThey Ġfound Ġthat Ġtheir Ġbest Ġmodel Ġproduces Ġcharacter Ġ$ n $ - gram Ġas Ġthe Ġmost Ġindicative Ġfeatures , Ġand Ġusing Ġlocation Ġor Ġlength Ġis Ġdetrimental . ĠDavidson Ġet Ġal . ĠB IB REF 9 Ġcollected Ġa Ġ$ 24 K $ Ġcorpus Ġof Ġtweets Ġcontaining Ġhate Ġspeech Ġkeywords Ġand Ġlabelled Ġthe Ġcorpus Ġas Ġhate Ġspeech , Ġoffensive Ġlanguage , Ġor Ġneither Ġby Ġusing Ġcrowd - s ourcing Ġand Ġextracted Ġdifferent Ġfeatures Ġsuch Ġas Ġ$ n $ - gram s , Ġsome Ġtweet - level Ġmetadata Ġsuch Ġas Ġthe Ġnumber Ġof Ġhasht ags , Ġmentions , Ġret we ets , Ġand ĠURLs , ĠPart ĠOf ĠSpeech Ġ( POS ) Ġtagging , Ġetc . ĠTheir Ġexperiments Ġon Ġdifferent Ġmulti - class Ġclass ifiers Ġshowed Ġthat Ġthe ĠLog istic ĠReg ression Ġwith ĠL 2 Ġregular ization Ġperforms Ġthe Ġbest Ġat Ġthis Ġtask . ĠMal mas i Ġet Ġal . ĠB IB REF 15 Ġproposed Ġan Ġensemble - based Ġsystem Ġthat Ġuses Ġsome Ġlinear ĠS VM Ġclass ifiers Ġin Ġparallel Ġto Ġdistinguish Ġhate Ġspeech Ġfrom Ġgeneral Ġprof anity Ġin Ġsocial Ġmedia . </s> As Ġone Ġof Ġthe Ġfirst Ġattempts Ġin Ġneural Ġnetwork Ġmodels , ĠDj ur ic Ġet Ġal . ĠB IB REF 16 Ġproposed Ġa Ġtwo - step Ġmethod Ġincluding Ġa Ġcontinuous Ġbag Ġof Ġwords Ġmodel Ġto Ġextract Ġparagraph 2 vec Ġembed d ings Ġand Ġa Ġbinary Ġclass ifier Ġtrained Ġalong Ġwith Ġthe Ġembed d ings Ġto Ġdistinguish Ġbetween Ġhate Ġspeech Ġand Ġclean Ġcontent . ĠBad j ati ya Ġet Ġal . ĠB IB REF 0 Ġinvestigated Ġthree Ġdeep Ġlearning Ġarchitectures , ĠFast Text , ĠCNN , Ġand ĠL ST M , Ġin Ġwhich Ġthey Ġinitialized Ġthe Ġword Ġembed d ings Ġwith Ġeither Ġrandom Ġor ĠGl o Ve Ġembed d ings . ĠGamb Ã¤ ck Ġet Ġal . ĠB IB REF 6 Ġproposed Ġa Ġhate Ġspeech Ġclass ifier Ġbased Ġon ĠCNN Ġmodel Ġtrained Ġon Ġdifferent Ġfeature Ġembed d ings Ġsuch Ġas Ġword Ġembed d ings Ġand Ġcharacter Ġ$ n $ - gram s . ĠZhang Ġet Ġal . ĠB IB REF 7 Ġused Ġa ĠCNN + GR U Ġ( G ated ĠRec urrent ĠUnit Ġnetwork ) Ġneural Ġnetwork Ġmodel Ġinitialized Ġwith Ġpre - trained Ġword 2 vec Ġembed d ings Ġto Ġcapture Ġboth Ġword / character Ġcombinations Ġ( e . Ġg ., Ġ$ n $ - gram s , Ġphrases ) Ġand Ġword / character Ġdependencies Ġ( order Ġinformation ). ĠW ase em Ġet Ġal . ĠB IB REF 10 Ġbrought Ġa Ġnew Ġinsight Ġto Ġhate Ġspeech Ġand Ġabusive Ġlanguage Ġdetection Ġtasks Ġby Ġproposing Ġa Ġmulti - task Ġlearning Ġframework Ġto Ġdeal Ġwith Ġdatasets Ġacross Ġdifferent Ġannotation Ġschemes , Ġlabels , Ġor Ġgeographic Ġand Ġcultural Ġinfluences Ġfrom Ġdata Ġsampling . ĠF ount a Ġet Ġal . ĠB IB REF 17 Ġbuilt Ġa Ġunified Ġclassification Ġmodel Ġthat Ġcan Ġefficiently Ġhandle Ġdifferent Ġtypes Ġof Ġabusive Ġlanguage Ġsuch Ġas Ġcyber bull ying , Ġhate , Ġsarc asm , Ġetc . Ġusing Ġraw Ġtext Ġand Ġdomain - specific Ġmetadata Ġfrom ĠTwitter . ĠFurthermore , Ġresearchers Ġhave Ġrecently Ġfocused Ġon Ġthe Ġbias Ġderived Ġfrom Ġthe Ġhate Ġspeech Ġtraining Ġdatasets ĠB IB REF 18 , ĠB IB REF 2 , ĠB IB REF 19 . ĠDavidson Ġet Ġal . ĠB IB REF 2 Ġshowed Ġthat Ġthere Ġwere Ġsystematic Ġand Ġsubstantial Ġracial Ġbiases Ġin Ġfive Ġbenchmark ĠTwitter Ġdatasets Ġannot ated Ġfor Ġoffensive Ġlanguage Ġdetection . ĠW ieg and Ġet Ġal . ĠB IB REF 19 Ġalso Ġfound Ġthat Ġclass ifiers Ġtrained Ġon Ġdatasets Ġcontaining Ġmore Ġimplicit Ġabuse Ġ( t we ets Ġwith Ġsome Ġabusive Ġwords ) Ġare Ġmore Ġaffected Ġby Ġbiases Ġrather Ġthan Ġonce Ġtrained Ġon Ġdatasets Ġwith Ġa Ġhigh Ġproportion Ġof Ġexplicit Ġabuse Ġsamples Ġ( t we ets Ġcontaining Ġsarc asm , Ġjokes , Ġetc .). </s> Transfer ĠLearning : ĠPre - trained Ġvector Ġrepresentations Ġof Ġwords , Ġembed d ings , Ġextracted Ġfrom Ġvast Ġamounts Ġof Ġtext Ġdata Ġhave Ġbeen Ġencountered Ġin Ġalmost Ġevery Ġlanguage - based Ġtasks Ġwith Ġpromising Ġresults . ĠTwo Ġof Ġthe Ġmost Ġfrequently Ġused Ġcontext - independent Ġneural Ġembed d ings Ġare Ġword 2 vec Ġand ĠGl ove Ġextracted Ġfrom Ġshallow Ġneural Ġnetworks . ĠThe Ġyear Ġ2018 Ġhas Ġbeen Ġan Ġinf lection Ġpoint Ġfor Ġdifferent ĠN LP Ġtasks Ġthanks Ġto Ġremarkable Ġbreakthrough s : ĠUniversal ĠLanguage ĠModel ĠFine - T uning Ġ( UL M Fi T ) ĠB IB REF 20 , ĠEmb edd ing Ġfrom ĠLanguage ĠModels Ġ( EL MO ) ĠB IB REF 21 , ĠOpen AI âĢ Ļ Ġs ĠGener ative ĠPre - trained ĠTrans former Ġ( G PT ) ĠB IB REF 22 , Ġand ĠGoogle âĢ Ļ s ĠB ERT Ġmodel ĠB IB REF 11 . ĠHoward Ġet Ġal . ĠB IB REF 20 Ġproposed ĠU LM Fi T Ġwhich Ġcan Ġbe Ġapplied Ġto Ġany ĠN LP Ġtask Ġby Ġpre - training Ġa Ġuniversal Ġlanguage Ġmodel Ġon Ġa Ġgeneral - domain Ġcorpus Ġand Ġthen Ġfine - tun ing Ġthe Ġmodel Ġon Ġtarget Ġtask Ġdata Ġusing Ġdiscrim in ative Ġfine - tun ing . ĠPeters Ġet Ġal . ĠB IB REF 21 Ġused Ġa Ġbi - direction al ĠL ST M Ġtrained Ġon Ġa Ġspecific Ġtask Ġto Ġpresent Ġcontext - sensitive Ġrepresentations Ġof Ġwords Ġin Ġword Ġembed d ings Ġby Ġlooking Ġat Ġthe Ġentire Ġsentence . ĠRad ford Ġet Ġal . ĠB IB REF 22 Ġand ĠDev lin Ġet Ġal . ĠB IB REF 11 Ġgenerated Ġtwo Ġtransformer - based Ġlanguage Ġmodels , ĠOpen AI ĠG PT Ġand ĠB ERT Ġrespectively . ĠOpen AI ĠG PT ĠB IB REF 22 Ġis Ġan Ġun id irection al Ġlanguage Ġmodel Ġwhile ĠB ERT ĠB IB REF 11 Ġis Ġthe Ġfirst Ġdeeply Ġbid irection al , Ġun super vised Ġlanguage Ġrepresentation , Ġpre - trained Ġusing Ġonly Ġa Ġplain Ġtext Ġcorpus . ĠB ERT Ġhas Ġtwo Ġnovel Ġprediction Ġtasks : ĠMask ed ĠLM Ġand ĠNext ĠSent ence ĠPrediction . ĠThe Ġpre - trained ĠB ERT Ġmodel Ġsignificantly Ġoutper formed ĠEL Mo Ġand ĠOpen AI ĠG PT Ġin Ġa Ġseries Ġof Ġdownstream Ġtasks Ġin ĠN LP ĠB IB REF 11 . ĠIdent ifying Ġhate Ġspeech Ġand Ġoffensive Ġlanguage Ġis Ġa Ġcomplicated Ġtask Ġdue Ġto Ġthe Ġlack Ġof Ġundis puted Ġlabelled Ġdata ĠB IB REF 15 Ġand Ġthe Ġinability Ġof Ġsurface Ġfeatures Ġto Ġcapture Ġthe Ġsubtle Ġsemantics Ġin Ġtext . ĠTo Ġaddress Ġthis Ġissue , Ġwe Ġuse Ġthe Ġpre - trained Ġlanguage Ġmodel ĠB ERT Ġfor Ġhate Ġspeech Ġclassification Ġand Ġtry Ġto Ġfine - t une Ġspecific Ġtask Ġby Ġleveraging Ġinformation Ġfrom Ġdifferent Ġtransformer Ġenc od ers . </s> Method ology </s> Here , Ġwe Ġanalyze Ġthe ĠB ERT Ġtransformer Ġmodel Ġon Ġthe Ġhate Ġspeech Ġdetection Ġtask . ĠB ERT Ġis Ġa Ġmulti - layer Ġbid irection al Ġtransformer Ġenc oder Ġtrained Ġon Ġthe ĠEnglish ĠWikipedia Ġand Ġthe ĠBook ĠCorpus Ġcontaining Ġ2 , 500 M Ġand Ġ800 M Ġtokens , Ġrespectively , Ġand Ġhas Ġtwo Ġmodels Ġnamed ĠB ERT base Ġand ĠB ERT large . ĠB ERT base Ġcontains Ġan Ġenc oder Ġwith Ġ12 Ġlayers Ġ( trans former Ġblocks ), Ġ12 Ġself - att ention Ġheads , Ġand Ġ110 Ġmillion Ġparameters Ġwhereas ĠB ERT large Ġhas Ġ24 Ġlayers , Ġ16 Ġattention Ġheads , Ġand Ġ340 Ġmillion Ġparameters . ĠExt racted Ġembed d ings Ġfrom ĠB ERT base Ġhave Ġ768 Ġhidden Ġdimensions ĠB IB REF 11 . ĠAs Ġthe ĠB ERT Ġmodel Ġis Ġpre - trained Ġon Ġgeneral Ġcorpor a , Ġand Ġfor Ġour Ġhate Ġspeech Ġdetection Ġtask Ġwe Ġare Ġdealing Ġwith Ġsocial Ġmedia Ġcontent , Ġtherefore Ġas Ġa Ġcrucial Ġstep , Ġwe Ġhave Ġto Ġanalyze Ġthe Ġcontextual Ġinformation Ġextracted Ġfrom ĠB ERT ' Ġs Ġpre - trained Ġlayers Ġand Ġthen Ġfine - t une Ġit Ġusing Ġannot ated Ġdatasets . ĠBy Ġfine - tun ing Ġwe Ġupdate Ġweights Ġusing Ġa Ġlabelled Ġdataset Ġthat Ġis Ġnew Ġto Ġan Ġalready Ġtrained Ġmodel . ĠAs Ġan Ġinput Ġand Ġoutput , ĠB ERT Ġtakes Ġa Ġsequence Ġof Ġtokens Ġin Ġmaximum Ġlength Ġ512 Ġand Ġproduces Ġa Ġrepresentation Ġof Ġthe Ġsequence Ġin Ġa Ġ768 - dimensional Ġvector . ĠB ERT Ġinserts Ġat Ġmost Ġtwo Ġsegments Ġto Ġeach Ġinput Ġsequence , Ġ[ CL S ] Ġand Ġ[ SE P ]. Ġ[ CL S ] Ġembed ding Ġis Ġthe Ġfirst Ġtoken Ġof Ġthe Ġinput Ġsequence Ġand Ġcontains Ġthe Ġspecial Ġclassification Ġembed ding Ġwhich Ġwe Ġtake Ġthe Ġfirst Ġtoken Ġ[ CL S ] Ġin Ġthe Ġfinal Ġhidden Ġlayer Ġas Ġthe Ġrepresentation Ġof Ġthe Ġwhole Ġsequence Ġin Ġhate Ġspeech Ġclassification Ġtask . ĠThe Ġ[ SE P ] Ġseparates Ġsegments Ġand Ġwe Ġwill Ġnot Ġuse Ġit Ġin Ġour Ġclassification Ġtask . ĠTo Ġperform Ġthe Ġhate Ġspeech Ġdetection Ġtask , Ġwe Ġuse ĠB ERT base Ġmodel Ġto Ġclassify Ġeach Ġtweet Ġas ĠRac ism , ĠSex ism , ĠNeither Ġor ĠHate , ĠOffensive , ĠNeither Ġin Ġour Ġdatasets . ĠIn Ġorder Ġto Ġdo Ġthat , Ġwe Ġfocus Ġon Ġfine - tun ing Ġthe Ġpre - trained ĠB ERT base Ġparameters . ĠBy Ġfine - tun ing , Ġwe Ġmean Ġtraining Ġa Ġclass ifier Ġwith Ġdifferent Ġlayers Ġof Ġ768 Ġdimensions Ġon Ġtop Ġof Ġthe Ġpre - trained ĠB ERT base Ġtransformer Ġto Ġminimize Ġtask - specific Ġparameters . </s> Method ology Ġ: :: ĠFine - T uning ĠStrategies </s> Different Ġlayers Ġof Ġa Ġneural Ġnetwork Ġcan Ġcapture Ġdifferent Ġlevels Ġof Ġsynt actic Ġand Ġsemantic Ġinformation . ĠThe Ġlower Ġlayer Ġof Ġthe ĠB ERT Ġmodel Ġmay Ġcontain Ġmore Ġgeneral Ġinformation Ġwhereas Ġthe Ġhigher Ġlayers Ġcontain Ġtask - specific Ġinformation ĠB IB REF 11 , Ġand Ġwe Ġcan Ġfine - t une Ġthem Ġwith Ġdifferent Ġlearning Ġrates . ĠHere , Ġfour Ġdifferent Ġfine - tun ing Ġapproaches Ġare Ġimplemented Ġthat Ġexploit Ġpre - trained ĠB ERT base Ġtransformer Ġenc od ers Ġfor Ġour Ġclassification Ġtask . ĠMore Ġinformation Ġabout Ġthese Ġtransformer Ġenc od ers ' Ġarchitectures Ġare Ġpresented Ġin ĠB IB REF 11 . ĠIn Ġthe Ġfine - tun ing Ġphase , Ġthe Ġmodel Ġis Ġinitialized Ġwith Ġthe Ġpre - trained Ġparameters Ġand Ġthen Ġare Ġfine - tun ed Ġusing Ġthe Ġlabelled Ġdatasets . ĠDifferent Ġfine - tun ing Ġapproaches Ġon Ġthe Ġhate Ġspeech Ġdetection Ġtask Ġare Ġdepicted Ġin ĠFigure ĠFIG REF 8 , Ġin Ġwhich Ġ$ X _{ i } $ Ġis Ġthe Ġvector Ġrepresentation Ġof Ġtoken Ġ$ i $ Ġin Ġa Ġtweet Ġsample , Ġand Ġare Ġexplained Ġin Ġmore Ġdetail Ġas Ġfollows : </s> 1 . ĠB ERT Ġbased Ġfine - tun ing : ĠIn Ġthe Ġfirst Ġapproach , Ġwhich Ġis Ġshown Ġin ĠFigure ĠFIG REF 8 , Ġvery Ġfew Ġchanges Ġare Ġapplied Ġto Ġthe ĠB ERT base . ĠIn Ġthis Ġarchitecture , Ġonly Ġthe Ġ[ CL S ] Ġtoken Ġoutput Ġprovided Ġby ĠB ERT Ġis Ġused . ĠThe Ġ[ CL S ] Ġoutput , Ġwhich Ġis Ġequivalent Ġto Ġthe Ġ[ CL S ] Ġtoken Ġoutput Ġof Ġthe Ġ12 th Ġtransformer Ġenc oder , Ġa Ġvector Ġof Ġsize Ġ768 , Ġis Ġgiven Ġas Ġinput Ġto Ġa Ġfully Ġconnected Ġnetwork Ġwithout Ġhidden Ġlayer . ĠThe Ġsoft max Ġactivation Ġfunction Ġis Ġapplied Ġto Ġthe Ġhidden Ġlayer Ġto Ġclassify . </s> 2 . ĠInsert Ġnon linear Ġlayers : ĠHere , Ġthe Ġfirst Ġarchitecture Ġis Ġupgraded Ġand Ġan Ġarchitecture Ġwith Ġa Ġmore Ġrobust Ġclass ifier Ġis Ġprovided Ġin Ġwhich Ġinstead Ġof Ġusing Ġa Ġfully Ġconnected Ġnetwork Ġwithout Ġhidden Ġlayer , Ġa Ġfully Ġconnected Ġnetwork Ġwith Ġtwo Ġhidden Ġlayers Ġin Ġsize Ġ768 Ġis Ġused . ĠThe Ġfirst Ġtwo Ġlayers Ġuse Ġthe ĠLe aky ĠRel u Ġactivation Ġfunction Ġwith Ġnegative Ġslope Ġ= Ġ0 . 01 , Ġbut Ġthe Ġfinal Ġlayer , Ġas Ġthe Ġfirst Ġarchitecture , Ġuses Ġsoft max Ġactivation Ġfunction Ġas Ġshown Ġin ĠFigure ĠFIG REF 8 . </s> 3 . ĠInsert ĠBi - L ST M Ġlayer : ĠUnlike Ġprevious Ġarchitectures Ġthat Ġonly Ġuse Ġ[ CL S ] Ġas Ġthe Ġinput Ġfor Ġthe Ġclass ifier , Ġin Ġthis Ġarchitecture Ġall Ġoutputs Ġof Ġthe Ġlatest Ġtransformer Ġenc oder Ġare Ġused Ġin Ġsuch Ġa Ġway Ġthat Ġthey Ġare Ġgiven Ġas Ġinputs Ġto Ġa Ġbid irection al Ġrecurrent Ġneural Ġnetwork Ġ( Bi - L ST M ) Ġas Ġshown Ġin ĠFigure ĠFIG REF 8 . ĠAfter Ġprocessing Ġthe Ġinput , Ġthe Ġnetwork Ġsends Ġthe Ġfinal Ġhidden Ġstate Ġto Ġa Ġfully Ġconnected Ġnetwork Ġthat Ġperforms Ġclassification Ġusing Ġthe Ġsoft max Ġactivation Ġfunction . </s> 4 . ĠInsert ĠCNN Ġlayer : ĠIn Ġthis Ġarchitecture Ġshown Ġin ĠFigure ĠFIG REF 8 , Ġthe Ġoutputs Ġof Ġall Ġtransformer Ġenc od ers Ġare Ġused Ġinstead Ġof Ġusing Ġthe Ġoutput Ġof Ġthe Ġlatest Ġtransformer Ġenc oder . ĠSo Ġthat Ġthe Ġoutput Ġvectors Ġof Ġeach Ġtransformer Ġenc oder Ġare Ġconc aten ated , Ġand Ġa Ġmatrix Ġis Ġproduced . ĠThe Ġconv olution al Ġoperation Ġis Ġperformed Ġwith Ġa Ġwindow Ġof Ġsize Ġ( 3 , Ġhidden Ġsize Ġof ĠB ERT Ġwhich Ġis Ġ768 Ġin ĠB ERT base Ġmodel ) Ġand Ġthe Ġmaximum Ġvalue Ġis Ġgenerated Ġfor Ġeach Ġtransformer Ġenc oder Ġby Ġapplying Ġmax Ġpool ing Ġon Ġthe Ġconv olution Ġoutput . ĠBy Ġconc aten ating Ġthese Ġvalues , Ġa Ġvector Ġis Ġgenerated Ġwhich Ġis Ġgiven Ġas Ġinput Ġto Ġa Ġfully Ġconnected Ġnetwork . ĠBy Ġapplying Ġsoft max Ġon Ġthe Ġinput , Ġthe Ġclassification Ġoperation Ġis Ġperformed . </s> Exper iments Ġand ĠResults </s> We Ġfirst Ġintroduce Ġdatasets Ġused Ġin Ġour Ġstudy Ġand Ġthen Ġinvestigate Ġthe Ġdifferent Ġfine - tun ing Ġstrategies Ġfor Ġhate Ġspeech Ġdetection Ġtask . ĠWe Ġalso Ġinclude Ġthe Ġdetails Ġof Ġour Ġimplementation Ġand Ġerror Ġanalysis Ġin Ġthe Ġrespective Ġsubsections . </s> Exper iments Ġand ĠResults Ġ: :: ĠDat as et ĠDescription </s> We Ġevaluate Ġour Ġmethod Ġon Ġtwo Ġwidely - stud ied Ġdatasets Ġprovided Ġby ĠW ase em Ġand ĠH ove y ĠB IB REF 5 Ġand ĠDavidson Ġet Ġal . ĠB IB REF 9 . ĠW ase em Ġand ĠH ovy ĠB IB REF 5 Ġcollected Ġ$ 16 k $ Ġof Ġtweets Ġbased Ġon Ġan Ġinitial Ġad - h oc Ġapproach Ġthat Ġsearched Ġcommon Ġslurs Ġand Ġterms Ġrelated Ġto Ġreligious , Ġsexual , Ġgender , Ġand Ġethnic Ġminorities . ĠThey Ġannot ated Ġtheir Ġdataset Ġmanually Ġas Ġracism , Ġsexism , Ġor Ġneither . ĠTo Ġextend Ġthis Ġdataset , ĠW ase em ĠB IB REF 23 Ġalso Ġprovided Ġanother Ġdataset Ġcontaining Ġ$ 6 . 9 k $ Ġof Ġtweets Ġannot ated Ġwith Ġboth Ġexpert Ġand Ġcrowds ourcing Ġusers Ġas Ġracism , Ġsexism , Ġneither , Ġor Ġboth . ĠSince Ġboth Ġdatasets Ġare Ġoverl apped Ġpartially Ġand Ġthey Ġused Ġthe Ġsame Ġstrategy Ġin Ġdefinition Ġof Ġhateful Ġcontent , Ġwe Ġmerged Ġthese Ġtwo Ġdatasets Ġfollowing ĠW ase em Ġet Ġal . ĠB IB REF 10 Ġto Ġmake Ġour Ġimbalance Ġdata Ġa Ġbit Ġlarger . ĠDavidson Ġet Ġal . ĠB IB REF 9 Ġused Ġthe ĠTwitter ĠAPI Ġto Ġaccumulate Ġ84 . 4 Ġmillion Ġtweets Ġfrom Ġ33 , 458 Ġtwitter Ġusers Ġcontaining Ġparticular Ġterms Ġfrom Ġa Ġpre - defined Ġlex icon Ġof Ġhate Ġspeech Ġwords Ġand Ġphrases , Ġcalled ĠHate based . org . ĠTo Ġannot ate Ġcollected Ġtweets Ġas ĠHate , ĠOffensive , Ġor ĠNeither , Ġthey Ġrandomly Ġsampled Ġ$ 25 k $ Ġtweets Ġand Ġasked Ġusers Ġof ĠCrowd Fl ower Ġcrowds ourcing Ġplatform Ġto Ġlabel Ġthem . ĠIn Ġdetail , Ġthe Ġdistribution Ġof Ġdifferent Ġclasses Ġin Ġboth Ġdatasets Ġwill Ġbe Ġprovided Ġin ĠSub section ĠSEC REF 15 . </s> Exper iments Ġand ĠResults Ġ: :: ĠPre - Process ing </s> We Ġfind Ġmentions Ġof Ġusers , Ġnumbers , Ġhasht ags , ĠURLs Ġand Ġcommon Ġemot icons Ġand Ġreplace Ġthem Ġwith Ġthe Ġtokens Ġ< user >, < number >, < hash tag >, < url >, < em ot icon >. ĠWe Ġalso Ġfind Ġelong ated Ġwords Ġand Ġconvert Ġthem Ġinto Ġshort Ġand Ġstandard Ġformat ; Ġfor Ġexample , Ġconverting Ġy ee e ess ss Ġto Ġyes . ĠWith Ġhasht ags Ġthat Ġinclude Ġsome Ġtokens Ġwithout Ġany Ġwith Ġspace Ġbetween Ġthem , Ġwe Ġreplace Ġthem Ġby Ġtheir Ġtextual Ġcounterparts ; Ġfor Ġexample , Ġwe Ġconvert Ġhashtag ĠâĢ ľ # not sex ist " Ġto ĠâĢ ľ not Ġsexist ". ĠAll Ġpunct uation Ġmarks , Ġunknown Ġun i - codes Ġand Ġextra Ġdelim iting Ġcharacters Ġare Ġremoved , Ġbut Ġwe Ġkeep Ġall Ġstop Ġwords Ġbecause Ġour Ġmodel Ġtrains Ġthe Ġsequence Ġof Ġwords Ġin Ġa Ġtext Ġdirectly . ĠWe Ġalso Ġconvert Ġall Ġtweets Ġto Ġlower Ġcase . </s> Exper iments Ġand ĠResults Ġ: :: ĠImplementation Ġand ĠResults ĠAnalysis </s> For Ġthe Ġimplementation Ġof Ġour Ġneural Ġnetwork , Ġwe Ġused Ġpy tor ch - pret rained - bert Ġlibrary Ġcontaining Ġthe Ġpre - trained ĠB ERT Ġmodel , Ġtext Ġtoken izer , Ġand Ġpre - trained ĠWord P iece . ĠAs Ġthe Ġimplementation Ġenvironment , Ġwe Ġuse ĠGoogle ĠCol abor atory Ġtool Ġwhich Ġis Ġa Ġfree Ġresearch Ġtool Ġwith Ġa ĠTesla ĠK 80 ĠGPU Ġand Ġ12 G ĠRAM . ĠBased Ġon Ġour Ġexperiments , Ġwe Ġtrained Ġour Ġclass ifier Ġwith Ġa Ġbatch Ġsize Ġof Ġ32 Ġfor Ġ3 Ġepoch s . ĠThe Ġdrop out Ġprobability Ġis Ġset Ġto Ġ0 . 1 Ġfor Ġall Ġlayers . ĠAdam Ġoptim izer Ġis Ġused Ġwith Ġa Ġlearning Ġrate Ġof Ġ2 e - 5 . ĠAs Ġan Ġinput , Ġwe Ġtoken ized Ġeach Ġtweet Ġwith Ġthe ĠB ERT Ġtoken izer . ĠIt Ġcontains Ġinvalid Ġcharacters Ġremoval , Ġpunct uation Ġsplitting , Ġand Ġlower c asing Ġthe Ġwords . ĠBased Ġon Ġthe Ġoriginal ĠB ERT ĠB IB REF 11 , Ġwe Ġsplit Ġwords Ġto Ġsub word Ġunits Ġusing ĠWord P iece Ġtoken ization . ĠAs Ġtweets Ġare Ġshort Ġtexts , Ġwe Ġset Ġthe Ġmaximum Ġsequence Ġlength Ġto Ġ64 Ġand Ġin Ġany Ġshorter Ġor Ġlonger Ġlength Ġcase Ġit Ġwill Ġbe Ġpadded Ġwith Ġzero Ġvalues Ġor Ġtrunc ated Ġto Ġthe Ġmaximum Ġlength . </s> We Ġconsider Ġ80 % Ġof Ġeach Ġdataset Ġas Ġtraining Ġdata Ġto Ġupdate Ġthe Ġweights Ġin Ġthe Ġfine - tun ing Ġphase , Ġ10 % Ġas Ġvalidation Ġdata Ġto Ġmeasure Ġthe Ġout - of - sample Ġperformance Ġof Ġthe Ġmodel Ġduring Ġtraining , Ġand Ġ10 % Ġas Ġtest Ġdata Ġto Ġmeasure Ġthe Ġout - of - sample Ġperformance Ġafter Ġtraining . ĠTo Ġprevent Ġover fitting , Ġwe Ġuse Ġstrat ified Ġsampling Ġto Ġselect Ġ0 . 8 , Ġ0 . 1 , Ġand Ġ0 . 1 Ġportions Ġof Ġtweets Ġfrom Ġeach Ġclass Ġ( rac ism / sex ism / ne ither Ġor Ġhate / offensive / ne ither ) Ġfor Ġtrain , Ġvalidation , Ġand Ġtest . ĠClasses ' Ġdistribution Ġof Ġtrain , Ġvalidation , Ġand Ġtest Ġdatasets Ġare Ġshown Ġin ĠTable ĠT AB REF 16 . </s> As Ġit Ġis Ġunderstandable Ġfrom ĠTables ĠT AB REF 16 ( class dist ribution w ase em ) Ġand ĠT AB REF 16 ( class dist ribution d avid son ), Ġwe Ġare Ġdealing Ġwith Ġimbalance Ġdatasets Ġwith Ġvarious Ġclasses âĢ Ļ Ġdistribution . ĠSince Ġhate Ġspeech Ġand Ġoffensive Ġlanguages Ġare Ġreal Ġphenomena , Ġwe Ġdid Ġnot Ġperform Ġovers am pling Ġor Ġunders am pling Ġtechniques Ġto Ġadjust Ġthe Ġclasses âĢ Ļ Ġdistribution Ġand Ġtried Ġto Ġsupply Ġthe Ġdatasets Ġas Ġrealistic Ġas Ġpossible . ĠWe Ġevaluate Ġthe Ġeffect Ġof Ġdifferent Ġfine - tun ing Ġstrategies Ġon Ġthe Ġperformance Ġof Ġour Ġmodel . ĠTable ĠT AB REF 17 Ġsummarized Ġthe Ġobtained Ġresults Ġfor Ġfine - tun ing Ġstrategies Ġalong Ġwith Ġthe Ġofficial Ġbas elines . ĠWe Ġuse ĠW ase em Ġand ĠH ovy ĠB IB REF 5 , ĠDavidson Ġet Ġal . ĠB IB REF 9 , Ġand ĠW ase em Ġet Ġal . ĠB IB REF 10 Ġas Ġbas elines Ġand Ġcompare Ġthe Ġresults Ġwith Ġour Ġdifferent Ġfine - tun ing Ġstrategies Ġusing Ġpre - trained ĠB ERT base Ġmodel . ĠThe Ġevaluation Ġresults Ġare Ġreported Ġon Ġthe Ġtest Ġdataset Ġand Ġon Ġthree Ġdifferent Ġmetrics : Ġprecision , Ġrecall , Ġand Ġweighted - average ĠF 1 - score . ĠWe Ġconsider Ġweighted - average ĠF 1 - score Ġas Ġthe Ġmost Ġrobust Ġmetric Ġversus Ġclass Ġimbalance , Ġwhich Ġgives Ġinsight Ġinto Ġthe Ġperformance Ġof Ġour Ġproposed Ġmodels . ĠAccording Ġto ĠTable ĠT AB REF 17 , ĠF 1 - sc ores Ġof Ġall ĠB ERT Ġbased Ġfine - tun ing Ġstrategies Ġexcept ĠB ERT Ġ+ Ġnon linear Ġclass ifier Ġon Ġtop Ġof ĠB ERT Ġare Ġhigher Ġthan Ġthe Ġbas elines . ĠUsing Ġthe Ġpre - trained ĠB ERT Ġmodel Ġas Ġinitial Ġembed d ings Ġand Ġfine - tun ing Ġthe Ġmodel Ġwith Ġa Ġfully Ġconnected Ġlinear Ġclass ifier Ġ( BER T base ) Ġoutper forms Ġprevious Ġbas elines Ġyielding ĠF 1 - score Ġof Ġ81 % Ġand Ġ91 % Ġfor Ġdatasets Ġof ĠW ase em Ġand ĠDavidson Ġrespectively . ĠInsert ing Ġa ĠCNN Ġto Ġpre - trained ĠB ERT Ġmodel Ġfor Ġfine - tun ing Ġon Ġdownstream Ġtask Ġprovides Ġthe Ġbest Ġresults Ġas ĠF 1 - Ġscore Ġof Ġ88 % Ġand Ġ92 % Ġfor Ġdatasets Ġof ĠW ase em Ġand ĠDavidson Ġand Ġit Ġclearly Ġexceeds Ġthe Ġbas elines . ĠInt uitive ly , Ġthis Ġmakes Ġsense Ġthat Ġcombining Ġall Ġpre - trained ĠB ERT Ġlayers Ġwith Ġa ĠCNN Ġyields Ġbetter Ġresults Ġin Ġwhich Ġour Ġmodel Ġuses Ġall Ġthe Ġinformation Ġincluded Ġin Ġdifferent Ġlayers Ġof Ġpre - trained ĠB ERT Ġduring Ġthe Ġfine - tun ing Ġphase . ĠThis Ġinformation Ġcontains Ġboth Ġsynt act ical Ġand Ġcontextual Ġfeatures Ġcoming Ġfrom Ġlower Ġlayers Ġto Ġhigher Ġlayers Ġof ĠB ERT . </s> Exper iments Ġand ĠResults Ġ: :: ĠError ĠAnalysis </s> Although Ġwe Ġhave Ġvery Ġinteresting Ġresults Ġin Ġterm Ġof Ġrecall , Ġthe Ġprecision Ġof Ġthe Ġmodel Ġshows Ġthe Ġportion Ġof Ġfalse Ġdetection Ġwe Ġhave . ĠTo Ġunderstand Ġbetter Ġthis Ġphenomenon , Ġin Ġthis Ġsection Ġwe Ġperform Ġa Ġdeep Ġanalysis Ġon Ġthe Ġerror Ġof Ġthe Ġmodel . ĠWe Ġinvestigate Ġthe Ġtest Ġdatasets Ġand Ġtheir Ġconfusion Ġmat rices Ġresulted Ġfrom Ġthe ĠB ERT base Ġ+ ĠCNN Ġmodel Ġas Ġthe Ġbest Ġfine - tun ing Ġapproach ; Ġdepicted Ġin ĠFigures ĠFIG REF 19 Ġand ĠFIG REF 19 . ĠAccording Ġto ĠFigure ĠFIG REF 19 Ġfor ĠW ase em - dat as et , Ġit Ġis Ġobvious Ġthat Ġthe Ġmodel Ġcan Ġseparate Ġsexism Ġfrom Ġracism Ġcontent Ġproperly . ĠOnly Ġtwo Ġsamples Ġbelonging Ġto Ġracism Ġclass Ġare Ġmis classified Ġas Ġsexism Ġand Ġnone Ġof Ġthe Ġsexism Ġsamples Ġare Ġmis classified Ġas Ġracism . ĠA Ġlarge Ġmajority Ġof Ġthe Ġerrors Ġcome Ġfrom Ġmis class ifying Ġhateful Ġcategories Ġ( rac ism Ġand Ġsexism ) Ġas Ġhat less Ġ( ne ither ) Ġand Ġvice Ġversa . Ġ0 . 9 % Ġand Ġ18 . 5 % Ġof Ġall Ġracism Ġsamples Ġare Ġmis classified Ġas Ġsexism Ġand Ġneither Ġrespectively Ġwhereas Ġit Ġis Ġ0 % Ġand Ġ12 . 7 % Ġfor Ġsexism Ġsamples . ĠAlmost Ġ12 % Ġof Ġneither Ġsamples Ġare Ġmis classified Ġas Ġracism Ġor Ġsexism . ĠAs ĠFigure ĠFIG REF 19 Ġmakes Ġclear Ġfor ĠDavidson - dat as et , Ġthe Ġmajority Ġof Ġerrors Ġare Ġrelated Ġto Ġhate Ġclass Ġwhere Ġthe Ġmodel Ġmis classified Ġhate Ġcontent Ġas Ġoffensive Ġin Ġ63 % Ġof Ġthe Ġcases . ĠHowever , Ġ2 . 6 % Ġand Ġ7 . 9 % Ġof Ġoffensive Ġand Ġneither Ġsamples Ġare Ġmis classified Ġrespectively . </s> To Ġunderstand Ġbetter Ġthe Ġmis label ed Ġitems Ġby Ġour Ġmodel , Ġwe Ġdid Ġa Ġmanual Ġinspection Ġon Ġa Ġsubset Ġof Ġthe Ġdata Ġand Ġrecord Ġsome Ġof Ġthem Ġin ĠTables ĠT AB REF 20 Ġand ĠT AB REF 21 . ĠConsidering Ġthe Ġwords Ġsuch Ġas ĠâĢ ľ d aughters ", ĠâĢ ľ women ", Ġand ĠâĢ ľ bur ka " Ġin Ġtweets Ġwith ĠIDs Ġ1 Ġand Ġ2 Ġin ĠTable ĠT AB REF 20 , Ġit Ġcan Ġbe Ġunderstood Ġthat Ġour ĠB ERT Ġbased Ġclass ifier Ġis Ġconfused Ġwith Ġthe Ġcontextual Ġsemantic Ġbetween Ġthese Ġwords Ġin Ġthe Ġsamples Ġand Ġmis classified Ġthem Ġas Ġsexism Ġbecause Ġthey Ġare Ġmainly Ġassociated Ġto Ġfemin inity . ĠIn Ġsome Ġcases Ġcontaining Ġimplicit Ġabuse Ġ( like Ġsubtle Ġinsults ) Ġsuch Ġas Ġtweets Ġwith ĠIDs Ġ5 Ġand Ġ7 , Ġour Ġmodel Ġcannot Ġcapture Ġthe Ġhateful / offensive Ġcontent Ġand Ġtherefore Ġmis class ifies . ĠIt Ġshould Ġbe Ġnoticed Ġthat Ġeven Ġfor Ġa Ġhuman Ġit Ġis Ġdifficult Ġto Ġdiscriminate Ġagainst Ġthis Ġkind Ġof Ġimplicit Ġabuses . </s> By Ġexamining Ġmore Ġsamples Ġand Ġwith Ġrespect Ġto Ġrecently Ġstudies ĠB IB REF 2 , ĠB IB REF 24 , ĠB IB REF 19 , Ġit Ġis Ġclear Ġthat Ġmany Ġerrors Ġare Ġdue Ġto Ġbiases Ġfrom Ġdata Ġcollection ĠB IB REF 19 Ġand Ġrules Ġof Ġannotation ĠB IB REF 24 Ġand Ġnot Ġthe Ġclass ifier Ġitself . ĠSince ĠW ase em Ġet Ġal . BI B REF 5 Ġcreated Ġa Ġsmall Ġad - h oc Ġset Ġof Ġkeywords Ġand ĠDavidson Ġet Ġal . BI B REF 9 Ġused Ġa Ġlarge Ġcrowds ourced Ġdictionary Ġof Ġkeywords Ġ( H ate base Ġlex icon ) Ġto Ġsample Ġtweets Ġfor Ġtraining , Ġthey Ġincluded Ġsome Ġbiases Ġin Ġthe Ġcollected Ġdata . ĠEspecially Ġfor ĠDavidson - dat as et , Ġsome Ġtweets Ġwith Ġspecific Ġlanguage Ġ( written Ġwithin Ġthe ĠAfrican ĠAmerican ĠVern acular ĠEnglish ) Ġand Ġgeographic Ġrestriction Ġ( United ĠStates Ġof ĠAmerica ) Ġare Ġovers am pled Ġsuch Ġas Ġtweets Ġcontaining Ġdispar age Ġwords ĠâĢ ľ n ig ga ", ĠâĢ ľ f agg ot ", ĠâĢ ľ coon ", Ġor ĠâĢ ľ que er ", Ġresult Ġin Ġhigh Ġrates Ġof Ġmis class ification . ĠHowever , Ġthese Ġmis class ifications Ġdo Ġnot Ġconfirm Ġthe Ġlow Ġperformance Ġof Ġour Ġclass ifier Ġbecause Ġannot ators Ġtended Ġto Ġannot ate Ġmany Ġsamples Ġcontaining Ġdisrespectful Ġwords Ġas Ġhate Ġor Ġoffensive Ġwithout Ġany Ġpresumption Ġabout Ġthe Ġsocial Ġcontext Ġof Ġtweet ers Ġsuch Ġas Ġthe Ġspeaker âĢ Ļ s Ġidentity Ġor Ġdialect , Ġwhereas Ġthey Ġwere Ġjust Ġoffensive Ġor Ġeven Ġneither Ġtweets . ĠTwe ets ĠIDs Ġ6 , Ġ8 , Ġand Ġ10 Ġare Ġsome Ġsamples Ġcontaining Ġoffensive Ġwords Ġand Ġslurs Ġwhich Ġare not Ġhate Ġor Ġoffensive Ġin Ġall Ġcases Ġand Ġwriters Ġof Ġthem Ġused Ġthis Ġtype Ġof Ġlanguage Ġin Ġtheir Ġdaily Ġcommunications . ĠGiven Ġthese Ġpieces Ġof Ġevidence , Ġby Ġconsidering Ġthe Ġcontent Ġof Ġtweets , Ġwe Ġcan Ġsee Ġin Ġtweets ĠIDs Ġ3 , Ġ4 , Ġand Ġ9 Ġthat Ġour ĠB ERT - based Ġclass ifier Ġcan Ġdiscriminate Ġtweets Ġin Ġwhich Ġneither Ġand Ġimplicit Ġhatred Ġcontent Ġexist . ĠOne Ġexplanation Ġof Ġthis Ġobservation Ġmay Ġbe Ġthe Ġpre - trained Ġgeneral Ġknowledge Ġthat Ġexists Ġin Ġour Ġmodel . ĠSince Ġthe Ġpre - trained ĠB ERT Ġmodel Ġis Ġtrained Ġon Ġgeneral Ġcorpor a , Ġit Ġhas Ġlearned Ġgeneral Ġknowledge Ġfrom Ġnormal Ġtextual Ġdata Ġwithout Ġany Ġpurposely Ġhateful Ġor Ġoffensive Ġlanguage . ĠTherefore , Ġdespite Ġthe Ġbias Ġin Ġthe Ġdata , Ġour Ġmodel Ġcan Ġdifferentiate Ġhate Ġand Ġoffensive Ġsamples Ġaccurately Ġby Ġleveraging Ġknowledge - aware Ġlanguage Ġunderstanding Ġthat Ġit Ġhas Ġand Ġit Ġcan Ġbe Ġthe Ġmain Ġreason Ġfor Ġhigh Ġmis class ifications Ġof Ġhate Ġsamples Ġas Ġoffensive Ġ( in Ġreality Ġthey Ġare Ġmore Ġsimilar Ġto Ġoffensive Ġrather Ġthan Ġhate Ġby Ġconsidering Ġsocial Ġcontext , Ġge ol ocation , Ġand Ġdialect Ġof Ġtweet ers ). </s> Conclusion </s> Con fl ating Ġhatred Ġcontent Ġwith Ġoffensive Ġor Ġharmless Ġlanguage Ġcauses Ġonline Ġautomatic Ġhate Ġspeech Ġdetection Ġtools Ġto Ġflag Ġuser - generated Ġcontent Ġincorrectly . ĠNot Ġaddressing Ġthis Ġproblem Ġmay Ġbring Ġabout Ġsevere Ġnegative Ġconsequences Ġfor Ġboth Ġplatforms Ġand Ġusers Ġsuch Ġas Ġdecre as ement Ġof Ġplatforms ' Ġreputation Ġor Ġusers Ġabandonment . ĠHere , Ġwe Ġpropose Ġa Ġtransfer Ġlearning Ġapproach Ġadvant aging Ġthe Ġpre - trained Ġlanguage Ġmodel ĠB ERT Ġto Ġenhance Ġthe Ġperformance Ġof Ġa Ġhate Ġspeech Ġdetection Ġsystem Ġand Ġto Ġgeneral ize Ġit Ġto Ġnew Ġdatasets . ĠTo Ġthat Ġend , Ġwe Ġintroduce Ġnew Ġfine - tun ing Ġstrategies Ġto Ġexamine Ġthe Ġeffect Ġof Ġdifferent Ġlayers Ġof ĠB ERT Ġin Ġhate Ġspeech Ġdetection Ġtask . ĠThe Ġevaluation Ġresults Ġindicate Ġthat Ġour Ġmodel Ġoutper forms Ġprevious Ġworks Ġby Ġprof iting Ġthe Ġsynt act ical Ġand Ġcontextual Ġinformation Ġembedded Ġin Ġdifferent Ġtransformer Ġenc oder Ġlayers Ġof Ġthe ĠB ERT Ġmodel Ġusing Ġa ĠCNN - based Ġfine - tun ing Ġstrategy . ĠFurthermore , Ġexamining Ġthe Ġresults Ġshows Ġthe Ġability Ġof Ġour Ġmodel Ġto Ġdetect Ġsome Ġbiases Ġin Ġthe Ġprocess Ġof Ġcollecting Ġor Ġannot ating Ġdatasets . ĠIt Ġcan Ġbe Ġa Ġvaluable Ġclue Ġin Ġusing Ġthe Ġpre - trained ĠB ERT Ġmodel Ġto Ġalleviate Ġbias Ġin Ġhate Ġspeech Ġdatasets Ġin Ġfuture Ġstudies , Ġby Ġinvestigating Ġa Ġmixture Ġof Ġcontextual Ġinformation Ġembedded Ġin Ġthe ĠB ERT âĢ Ļ s Ġlayers Ġand Ġa Ġset Ġof Ġfeatures Ġassociated Ġto Ġthe Ġdifferent Ġtype Ġof Ġbiases Ġin Ġdata .
Introduction People are increasingly using social networking platforms such as Twitter, Facebook, YouTube, etc. to communicate their opinions and share information. Although the interactions among users on these platforms can lead to constructive conversations, they have been increasingly exploited for the propagation of abusive language and the organization of hate-based activities BIBREF0, BIBREF1, especially due to the mobility and anonymous environment of these online platforms. Violence attributed to online hate speech has increased worldwide. For example, in the UK, there has been a significant increase in hate speech towards the immigrant and Muslim communities following the UK's leaving the EU and the Manchester and London attacks. The US also has been a marked increase in hate speech and related crime following the Trump election. Therefore, governments and social network platforms confronting the trend must have tools to detect aggressive behavior in general, and hate speech in particular, as these forms of online aggression not only poison the social climate of the online communities that experience it, but can also provoke physical violence and serious harm BIBREF1. Recently, the problem of online abusive detection has attracted scientific attention. Proof of this is the creation of the third Workshop on Abusive Language Online or Kaggle’s Toxic Comment Classification Challenge that gathered 4,551 teams in 2018 to detect different types of toxicities (threats, obscenity, etc.). In the scope of this work, we mainly focus on the term hate speech as abusive content in social media, since it can be considered a broad umbrella term for numerous kinds of insulting user-generated content. Hate speech is commonly defined as any communication criticizing a person or a group based on some characteristics such as gender, sexual orientation, nationality, religion, race, etc. Hate speech detection is not a stable or simple target because misclassification of regular conversation as hate speech can severely affect users’ freedom of expression and reputation, while misclassification of hateful conversations as unproblematic would maintain the status of online communities as unsafe environments BIBREF2. To detect online hate speech, a large number of scientific studies have been dedicated by using Natural Language Processing (NLP) in combination with Machine Learning (ML) and Deep Learning (DL) methods BIBREF3, BIBREF4, BIBREF5, BIBREF6, BIBREF7, BIBREF0. Although supervised machine learning-based approaches have used different text mining-based features such as surface features, sentiment analysis, lexical resources, linguistic features, knowledge-based features or user-based and platform-based metadata BIBREF8, BIBREF9, BIBREF10, they necessitate a well-defined feature extraction approach. The trend now seems to be changing direction, with deep learning models being used for both feature extraction and the training of classifiers. These newer models are applying deep learning approaches such as Convolutional Neural Networks (CNNs), Long Short-Term Memory Networks (LSTMs), etc.BIBREF6, BIBREF0 to enhance the performance of hate speech detection models, however, they still suffer from lack of labelled data or inability to improve generalization property. Here, we propose a transfer learning approach for hate speech understanding using a combination of the unsupervised pre-trained model BERT BIBREF11 and some new supervised fine-tuning strategies. As far as we know, it is the first time that such exhaustive fine-tuning strategies are proposed along with a generative pre-trained language model to transfer learning to low-resource hate speech languages and improve performance of the task. In summary: We propose a transfer learning approach using the pre-trained language model BERT learned on English Wikipedia and BookCorpus to enhance hate speech detection on publicly available benchmark datasets. Toward that end, for the first time, we introduce new fine-tuning strategies to examine the effect of different embedding layers of BERT in hate speech detection. Our experiment results show that using the pre-trained BERT model and fine-tuning it on the downstream task by leveraging syntactical and contextual information of all BERT's transformers outperforms previous works in terms of precision, recall, and F1-score. Furthermore, examining the results shows the ability of our model to detect some biases in the process of collecting or annotating datasets. It can be a valuable clue in using pre-trained BERT model for debiasing hate speech datasets in future studies. Previous Works Here, the existing body of knowledge on online hate speech and offensive language and transfer learning is presented. Online Hate Speech and Offensive Language: Researchers have been studying hate speech on social media platforms such as Twitter BIBREF9, Reddit BIBREF12, BIBREF13, and YouTube BIBREF14 in the past few years. The features used in traditional machine learning approaches are the main aspects distinguishing different methods, and surface-level features such as bag of words, word-level and character-level $n$-grams, etc. have proven to be the most predictive features BIBREF3, BIBREF4, BIBREF5. Apart from features, different algorithms such as Support Vector Machines BIBREF15, Naive Baye BIBREF1, and Logistic Regression BIBREF5, BIBREF9, etc. have been applied for classification purposes. Waseem et al. BIBREF5 provided a test with a list of criteria based on the work in Gender Studies and Critical Race Theory (CRT) that can annotate a corpus of more than $16k$ tweets as racism, sexism, or neither. To classify tweets, they used a logistic regression model with different sets of features, such as word and character $n$-grams up to 4, gender, length, and location. They found that their best model produces character $n$-gram as the most indicative features, and using location or length is detrimental. Davidson et al. BIBREF9 collected a $24K$ corpus of tweets containing hate speech keywords and labelled the corpus as hate speech, offensive language, or neither by using crowd-sourcing and extracted different features such as $n$-grams, some tweet-level metadata such as the number of hashtags, mentions, retweets, and URLs, Part Of Speech (POS) tagging, etc. Their experiments on different multi-class classifiers showed that the Logistic Regression with L2 regularization performs the best at this task. Malmasi et al. BIBREF15 proposed an ensemble-based system that uses some linear SVM classifiers in parallel to distinguish hate speech from general profanity in social media. As one of the first attempts in neural network models, Djuric et al. BIBREF16 proposed a two-step method including a continuous bag of words model to extract paragraph2vec embeddings and a binary classifier trained along with the embeddings to distinguish between hate speech and clean content. Badjatiya et al. BIBREF0 investigated three deep learning architectures, FastText, CNN, and LSTM, in which they initialized the word embeddings with either random or GloVe embeddings. Gambäck et al. BIBREF6 proposed a hate speech classifier based on CNN model trained on different feature embeddings such as word embeddings and character $n$-grams. Zhang et al. BIBREF7 used a CNN+GRU (Gated Recurrent Unit network) neural network model initialized with pre-trained word2vec embeddings to capture both word/character combinations (e. g., $n$-grams, phrases) and word/character dependencies (order information). Waseem et al. BIBREF10 brought a new insight to hate speech and abusive language detection tasks by proposing a multi-task learning framework to deal with datasets across different annotation schemes, labels, or geographic and cultural influences from data sampling. Founta et al. BIBREF17 built a unified classification model that can efficiently handle different types of abusive language such as cyberbullying, hate, sarcasm, etc. using raw text and domain-specific metadata from Twitter. Furthermore, researchers have recently focused on the bias derived from the hate speech training datasets BIBREF18, BIBREF2, BIBREF19. Davidson et al. BIBREF2 showed that there were systematic and substantial racial biases in five benchmark Twitter datasets annotated for offensive language detection. Wiegand et al. BIBREF19 also found that classifiers trained on datasets containing more implicit abuse (tweets with some abusive words) are more affected by biases rather than once trained on datasets with a high proportion of explicit abuse samples (tweets containing sarcasm, jokes, etc.). Transfer Learning: Pre-trained vector representations of words, embeddings, extracted from vast amounts of text data have been encountered in almost every language-based tasks with promising results. Two of the most frequently used context-independent neural embeddings are word2vec and Glove extracted from shallow neural networks. The year 2018 has been an inflection point for different NLP tasks thanks to remarkable breakthroughs: Universal Language Model Fine-Tuning (ULMFiT) BIBREF20, Embedding from Language Models (ELMO) BIBREF21, OpenAI’ s Generative Pre-trained Transformer (GPT) BIBREF22, and Google’s BERT model BIBREF11. Howard et al. BIBREF20 proposed ULMFiT which can be applied to any NLP task by pre-training a universal language model on a general-domain corpus and then fine-tuning the model on target task data using discriminative fine-tuning. Peters et al. BIBREF21 used a bi-directional LSTM trained on a specific task to present context-sensitive representations of words in word embeddings by looking at the entire sentence. Radford et al. BIBREF22 and Devlin et al. BIBREF11 generated two transformer-based language models, OpenAI GPT and BERT respectively. OpenAI GPT BIBREF22 is an unidirectional language model while BERT BIBREF11 is the first deeply bidirectional, unsupervised language representation, pre-trained using only a plain text corpus. BERT has two novel prediction tasks: Masked LM and Next Sentence Prediction. The pre-trained BERT model significantly outperformed ELMo and OpenAI GPT in a series of downstream tasks in NLP BIBREF11. Identifying hate speech and offensive language is a complicated task due to the lack of undisputed labelled data BIBREF15 and the inability of surface features to capture the subtle semantics in text. To address this issue, we use the pre-trained language model BERT for hate speech classification and try to fine-tune specific task by leveraging information from different transformer encoders. Methodology Here, we analyze the BERT transformer model on the hate speech detection task. BERT is a multi-layer bidirectional transformer encoder trained on the English Wikipedia and the Book Corpus containing 2,500M and 800M tokens, respectively, and has two models named BERTbase and BERTlarge. BERTbase contains an encoder with 12 layers (transformer blocks), 12 self-attention heads, and 110 million parameters whereas BERTlarge has 24 layers, 16 attention heads, and 340 million parameters. Extracted embeddings from BERTbase have 768 hidden dimensions BIBREF11. As the BERT model is pre-trained on general corpora, and for our hate speech detection task we are dealing with social media content, therefore as a crucial step, we have to analyze the contextual information extracted from BERT' s pre-trained layers and then fine-tune it using annotated datasets. By fine-tuning we update weights using a labelled dataset that is new to an already trained model. As an input and output, BERT takes a sequence of tokens in maximum length 512 and produces a representation of the sequence in a 768-dimensional vector. BERT inserts at most two segments to each input sequence, [CLS] and [SEP]. [CLS] embedding is the first token of the input sequence and contains the special classification embedding which we take the first token [CLS] in the final hidden layer as the representation of the whole sequence in hate speech classification task. The [SEP] separates segments and we will not use it in our classification task. To perform the hate speech detection task, we use BERTbase model to classify each tweet as Racism, Sexism, Neither or Hate, Offensive, Neither in our datasets. In order to do that, we focus on fine-tuning the pre-trained BERTbase parameters. By fine-tuning, we mean training a classifier with different layers of 768 dimensions on top of the pre-trained BERTbase transformer to minimize task-specific parameters. Methodology ::: Fine-Tuning Strategies Different layers of a neural network can capture different levels of syntactic and semantic information. The lower layer of the BERT model may contain more general information whereas the higher layers contain task-specific information BIBREF11, and we can fine-tune them with different learning rates. Here, four different fine-tuning approaches are implemented that exploit pre-trained BERTbase transformer encoders for our classification task. More information about these transformer encoders' architectures are presented in BIBREF11. In the fine-tuning phase, the model is initialized with the pre-trained parameters and then are fine-tuned using the labelled datasets. Different fine-tuning approaches on the hate speech detection task are depicted in Figure FIGREF8, in which $X_{i}$ is the vector representation of token $i$ in a tweet sample, and are explained in more detail as follows: 1. BERT based fine-tuning: In the first approach, which is shown in Figure FIGREF8, very few changes are applied to the BERTbase. In this architecture, only the [CLS] token output provided by BERT is used. The [CLS] output, which is equivalent to the [CLS] token output of the 12th transformer encoder, a vector of size 768, is given as input to a fully connected network without hidden layer. The softmax activation function is applied to the hidden layer to classify. 2. Insert nonlinear layers: Here, the first architecture is upgraded and an architecture with a more robust classifier is provided in which instead of using a fully connected network without hidden layer, a fully connected network with two hidden layers in size 768 is used. The first two layers use the Leaky Relu activation function with negative slope = 0.01, but the final layer, as the first architecture, uses softmax activation function as shown in Figure FIGREF8. 3. Insert Bi-LSTM layer: Unlike previous architectures that only use [CLS] as the input for the classifier, in this architecture all outputs of the latest transformer encoder are used in such a way that they are given as inputs to a bidirectional recurrent neural network (Bi-LSTM) as shown in Figure FIGREF8. After processing the input, the network sends the final hidden state to a fully connected network that performs classification using the softmax activation function. 4. Insert CNN layer: In this architecture shown in Figure FIGREF8, the outputs of all transformer encoders are used instead of using the output of the latest transformer encoder. So that the output vectors of each transformer encoder are concatenated, and a matrix is produced. The convolutional operation is performed with a window of size (3, hidden size of BERT which is 768 in BERTbase model) and the maximum value is generated for each transformer encoder by applying max pooling on the convolution output. By concatenating these values, a vector is generated which is given as input to a fully connected network. By applying softmax on the input, the classification operation is performed. Experiments and Results We first introduce datasets used in our study and then investigate the different fine-tuning strategies for hate speech detection task. We also include the details of our implementation and error analysis in the respective subsections. Experiments and Results ::: Dataset Description We evaluate our method on two widely-studied datasets provided by Waseem and Hovey BIBREF5 and Davidson et al. BIBREF9. Waseem and Hovy BIBREF5 collected $16k$ of tweets based on an initial ad-hoc approach that searched common slurs and terms related to religious, sexual, gender, and ethnic minorities. They annotated their dataset manually as racism, sexism, or neither. To extend this dataset, Waseem BIBREF23 also provided another dataset containing $6.9k$ of tweets annotated with both expert and crowdsourcing users as racism, sexism, neither, or both. Since both datasets are overlapped partially and they used the same strategy in definition of hateful content, we merged these two datasets following Waseem et al. BIBREF10 to make our imbalance data a bit larger. Davidson et al. BIBREF9 used the Twitter API to accumulate 84.4 million tweets from 33,458 twitter users containing particular terms from a pre-defined lexicon of hate speech words and phrases, called Hatebased.org. To annotate collected tweets as Hate, Offensive, or Neither, they randomly sampled $25k$ tweets and asked users of CrowdFlower crowdsourcing platform to label them. In detail, the distribution of different classes in both datasets will be provided in Subsection SECREF15. Experiments and Results ::: Pre-Processing We find mentions of users, numbers, hashtags, URLs and common emoticons and replace them with the tokens <user>,<number>,<hashtag>,<url>,<emoticon>. We also find elongated words and convert them into short and standard format; for example, converting yeeeessss to yes. With hashtags that include some tokens without any with space between them, we replace them by their textual counterparts; for example, we convert hashtag “#notsexist" to “not sexist". All punctuation marks, unknown uni-codes and extra delimiting characters are removed, but we keep all stop words because our model trains the sequence of words in a text directly. We also convert all tweets to lower case. Experiments and Results ::: Implementation and Results Analysis For the implementation of our neural network, we used pytorch-pretrained-bert library containing the pre-trained BERT model, text tokenizer, and pre-trained WordPiece. As the implementation environment, we use Google Colaboratory tool which is a free research tool with a Tesla K80 GPU and 12G RAM. Based on our experiments, we trained our classifier with a batch size of 32 for 3 epochs. The dropout probability is set to 0.1 for all layers. Adam optimizer is used with a learning rate of 2e-5. As an input, we tokenized each tweet with the BERT tokenizer. It contains invalid characters removal, punctuation splitting, and lowercasing the words. Based on the original BERT BIBREF11, we split words to subword units using WordPiece tokenization. As tweets are short texts, we set the maximum sequence length to 64 and in any shorter or longer length case it will be padded with zero values or truncated to the maximum length. We consider 80% of each dataset as training data to update the weights in the fine-tuning phase, 10% as validation data to measure the out-of-sample performance of the model during training, and 10% as test data to measure the out-of-sample performance after training. To prevent overfitting, we use stratified sampling to select 0.8, 0.1, and 0.1 portions of tweets from each class (racism/sexism/neither or hate/offensive/neither) for train, validation, and test. Classes' distribution of train, validation, and test datasets are shown in Table TABREF16. As it is understandable from Tables TABREF16(classdistributionwaseem) and TABREF16(classdistributiondavidson), we are dealing with imbalance datasets with various classes’ distribution. Since hate speech and offensive languages are real phenomena, we did not perform oversampling or undersampling techniques to adjust the classes’ distribution and tried to supply the datasets as realistic as possible. We evaluate the effect of different fine-tuning strategies on the performance of our model. Table TABREF17 summarized the obtained results for fine-tuning strategies along with the official baselines. We use Waseem and Hovy BIBREF5, Davidson et al. BIBREF9, and Waseem et al. BIBREF10 as baselines and compare the results with our different fine-tuning strategies using pre-trained BERTbase model. The evaluation results are reported on the test dataset and on three different metrics: precision, recall, and weighted-average F1-score. We consider weighted-average F1-score as the most robust metric versus class imbalance, which gives insight into the performance of our proposed models. According to Table TABREF17, F1-scores of all BERT based fine-tuning strategies except BERT + nonlinear classifier on top of BERT are higher than the baselines. Using the pre-trained BERT model as initial embeddings and fine-tuning the model with a fully connected linear classifier (BERTbase) outperforms previous baselines yielding F1-score of 81% and 91% for datasets of Waseem and Davidson respectively. Inserting a CNN to pre-trained BERT model for fine-tuning on downstream task provides the best results as F1- score of 88% and 92% for datasets of Waseem and Davidson and it clearly exceeds the baselines. Intuitively, this makes sense that combining all pre-trained BERT layers with a CNN yields better results in which our model uses all the information included in different layers of pre-trained BERT during the fine-tuning phase. This information contains both syntactical and contextual features coming from lower layers to higher layers of BERT. Experiments and Results ::: Error Analysis Although we have very interesting results in term of recall, the precision of the model shows the portion of false detection we have. To understand better this phenomenon, in this section we perform a deep analysis on the error of the model. We investigate the test datasets and their confusion matrices resulted from the BERTbase + CNN model as the best fine-tuning approach; depicted in Figures FIGREF19 and FIGREF19. According to Figure FIGREF19 for Waseem-dataset, it is obvious that the model can separate sexism from racism content properly. Only two samples belonging to racism class are misclassified as sexism and none of the sexism samples are misclassified as racism. A large majority of the errors come from misclassifying hateful categories (racism and sexism) as hatless (neither) and vice versa. 0.9% and 18.5% of all racism samples are misclassified as sexism and neither respectively whereas it is 0% and 12.7% for sexism samples. Almost 12% of neither samples are misclassified as racism or sexism. As Figure FIGREF19 makes clear for Davidson-dataset, the majority of errors are related to hate class where the model misclassified hate content as offensive in 63% of the cases. However, 2.6% and 7.9% of offensive and neither samples are misclassified respectively. To understand better the mislabeled items by our model, we did a manual inspection on a subset of the data and record some of them in Tables TABREF20 and TABREF21. Considering the words such as “daughters", “women", and “burka" in tweets with IDs 1 and 2 in Table TABREF20, it can be understood that our BERT based classifier is confused with the contextual semantic between these words in the samples and misclassified them as sexism because they are mainly associated to femininity. In some cases containing implicit abuse (like subtle insults) such as tweets with IDs 5 and 7, our model cannot capture the hateful/offensive content and therefore misclassifies. It should be noticed that even for a human it is difficult to discriminate against this kind of implicit abuses. By examining more samples and with respect to recently studies BIBREF2, BIBREF24, BIBREF19, it is clear that many errors are due to biases from data collection BIBREF19 and rules of annotation BIBREF24 and not the classifier itself. Since Waseem et al.BIBREF5 created a small ad-hoc set of keywords and Davidson et al.BIBREF9 used a large crowdsourced dictionary of keywords (Hatebase lexicon) to sample tweets for training, they included some biases in the collected data. Especially for Davidson-dataset, some tweets with specific language (written within the African American Vernacular English) and geographic restriction (United States of America) are oversampled such as tweets containing disparage words “nigga", “faggot", “coon", or “queer", result in high rates of misclassification. However, these misclassifications do not confirm the low performance of our classifier because annotators tended to annotate many samples containing disrespectful words as hate or offensive without any presumption about the social context of tweeters such as the speaker’s identity or dialect, whereas they were just offensive or even neither tweets. Tweets IDs 6, 8, and 10 are some samples containing offensive words and slurs which arenot hate or offensive in all cases and writers of them used this type of language in their daily communications. Given these pieces of evidence, by considering the content of tweets, we can see in tweets IDs 3, 4, and 9 that our BERT-based classifier can discriminate tweets in which neither and implicit hatred content exist. One explanation of this observation may be the pre-trained general knowledge that exists in our model. Since the pre-trained BERT model is trained on general corpora, it has learned general knowledge from normal textual data without any purposely hateful or offensive language. Therefore, despite the bias in the data, our model can differentiate hate and offensive samples accurately by leveraging knowledge-aware language understanding that it has and it can be the main reason for high misclassifications of hate samples as offensive (in reality they are more similar to offensive rather than hate by considering social context, geolocation, and dialect of tweeters). Conclusion Conflating hatred content with offensive or harmless language causes online automatic hate speech detection tools to flag user-generated content incorrectly. Not addressing this problem may bring about severe negative consequences for both platforms and users such as decreasement of platforms' reputation or users abandonment. Here, we propose a transfer learning approach advantaging the pre-trained language model BERT to enhance the performance of a hate speech detection system and to generalize it to new datasets. To that end, we introduce new fine-tuning strategies to examine the effect of different layers of BERT in hate speech detection task. The evaluation results indicate that our model outperforms previous works by profiting the syntactical and contextual information embedded in different transformer encoder layers of the BERT model using a CNN-based fine-tuning strategy. Furthermore, examining the results shows the ability of our model to detect some biases in the process of collecting or annotating datasets. It can be a valuable clue in using the pre-trained BERT model to alleviate bias in hate speech datasets in future studies, by investigating a mixture of contextual information embedded in the BERT’s layers and a set of features associated to the different type of biases in data.
What baseline is used?
e101e38efaa4b931f7dd75757caacdc945bb32b4
What Ġbaseline Ġis Ġused ?
W ase em Ġand ĠH ovy ĠB IB REF 5 , ĠDavidson Ġet Ġal . ĠB IB REF 9 , ĠW ase em Ġet Ġal . ĠB IB REF 10
<s> What Ġbaseline Ġis Ġused ? </s> Introduction </s> People Ġare Ġincreasingly Ġusing Ġsocial Ġnetworking Ġplatforms Ġsuch Ġas ĠTwitter , ĠFacebook , ĠYouTube , Ġetc . Ġto Ġcommunicate Ġtheir Ġopinions Ġand Ġshare Ġinformation . ĠAlthough Ġthe Ġinteractions Ġamong Ġusers Ġon Ġthese Ġplatforms Ġcan Ġlead Ġto Ġconstructive Ġconversations , Ġthey Ġhave Ġbeen Ġincreasingly Ġexploited Ġfor Ġthe Ġpropagation Ġof Ġabusive Ġlanguage Ġand Ġthe Ġorganization Ġof Ġhate - based Ġactivities ĠB IB REF 0 , ĠB IB REF 1 , Ġespecially Ġdue Ġto Ġthe Ġmobility Ġand Ġanonymous Ġenvironment Ġof Ġthese Ġonline Ġplatforms . ĠViolence Ġattributed Ġto Ġonline Ġhate Ġspeech Ġhas Ġincreased Ġworldwide . ĠFor Ġexample , Ġin Ġthe ĠUK , Ġthere Ġhas Ġbeen Ġa Ġsignificant Ġincrease Ġin Ġhate Ġspeech Ġtowards Ġthe Ġimmigrant Ġand ĠMuslim Ġcommunities Ġfollowing Ġthe ĠUK 's Ġleaving Ġthe ĠEU Ġand Ġthe ĠManchester Ġand ĠLondon Ġattacks . ĠThe ĠUS Ġalso Ġhas Ġbeen Ġa Ġmarked Ġincrease Ġin Ġhate Ġspeech Ġand Ġrelated Ġcrime Ġfollowing Ġthe ĠTrump Ġelection . ĠTherefore , Ġgovernments Ġand Ġsocial Ġnetwork Ġplatforms Ġconfronting Ġthe Ġtrend Ġmust Ġhave Ġtools Ġto Ġdetect Ġaggressive Ġbehavior Ġin Ġgeneral , Ġand Ġhate Ġspeech Ġin Ġparticular , Ġas Ġthese Ġforms Ġof Ġonline Ġaggression Ġnot Ġonly Ġpoison Ġthe Ġsocial Ġclimate Ġof Ġthe Ġonline Ġcommunities Ġthat Ġexperience Ġit , Ġbut Ġcan Ġalso Ġprovoke Ġphysical Ġviolence Ġand Ġserious Ġharm ĠB IB REF 1 . </s> Recently , Ġthe Ġproblem Ġof Ġonline Ġabusive Ġdetection Ġhas Ġattracted Ġscientific Ġattention . ĠProof Ġof Ġthis Ġis Ġthe Ġcreation Ġof Ġthe Ġthird ĠWorkshop Ġon ĠAb usive ĠLanguage ĠOnline Ġor ĠK agg le âĢ Ļ s ĠToxic ĠComment ĠClassification ĠChallenge Ġthat Ġgathered Ġ4 , 551 Ġteams Ġin Ġ2018 Ġto Ġdetect Ġdifferent Ġtypes Ġof Ġtoxic ities Ġ( threat s , Ġobsc en ity , Ġetc .). ĠIn Ġthe Ġscope Ġof Ġthis Ġwork , Ġwe Ġmainly Ġfocus Ġon Ġthe Ġterm Ġhate Ġspeech Ġas Ġabusive Ġcontent Ġin Ġsocial Ġmedia , Ġsince Ġit Ġcan Ġbe Ġconsidered Ġa Ġbroad Ġumbrella Ġterm Ġfor Ġnumerous Ġkinds Ġof Ġinsulting Ġuser - generated Ġcontent . ĠHate Ġspeech Ġis Ġcommonly Ġdefined Ġas Ġany Ġcommunication Ġcriticizing Ġa Ġperson Ġor Ġa Ġgroup Ġbased Ġon Ġsome Ġcharacteristics Ġsuch Ġas Ġgender , Ġsexual Ġorientation , Ġnationality , Ġreligion , Ġrace , Ġetc . ĠHate Ġspeech Ġdetection Ġis Ġnot Ġa Ġstable Ġor Ġsimple Ġtarget Ġbecause Ġmis class ification Ġof Ġregular Ġconversation Ġas Ġhate Ġspeech Ġcan Ġseverely Ġaffect Ġusers âĢ Ļ Ġfreedom Ġof Ġexpression Ġand Ġreputation , Ġwhile Ġmis class ification Ġof Ġhateful Ġconversations Ġas Ġun problem atic Ġwould Ġmaintain Ġthe Ġstatus Ġof Ġonline Ġcommunities Ġas Ġunsafe Ġenvironments ĠB IB REF 2 . </s> To Ġdetect Ġonline Ġhate Ġspeech , Ġa Ġlarge Ġnumber Ġof Ġscientific Ġstudies Ġhave Ġbeen Ġdedicated Ġby Ġusing ĠNatural ĠLanguage ĠProcessing Ġ( N LP ) Ġin Ġcombination Ġwith ĠMachine ĠLearning Ġ( ML ) Ġand ĠDeep ĠLearning Ġ( DL ) Ġmethods ĠB IB REF 3 , ĠB IB REF 4 , ĠB IB REF 5 , ĠB IB REF 6 , ĠB IB REF 7 , ĠB IB REF 0 . ĠAlthough Ġsupervised Ġmachine Ġlearning - based Ġapproaches Ġhave Ġused Ġdifferent Ġtext Ġmining - based Ġfeatures Ġsuch Ġas Ġsurface Ġfeatures , Ġsentiment Ġanalysis , Ġlex ical Ġresources , Ġlinguistic Ġfeatures , Ġknowledge - based Ġfeatures Ġor Ġuser - based Ġand Ġplatform - based Ġmetadata ĠB IB REF 8 , ĠB IB REF 9 , ĠB IB REF 10 , Ġthey Ġnecess itate Ġa Ġwell - defined Ġfeature Ġextraction Ġapproach . ĠThe Ġtrend Ġnow Ġseems Ġto Ġbe Ġchanging Ġdirection , Ġwith Ġdeep Ġlearning Ġmodels Ġbeing Ġused Ġfor Ġboth Ġfeature Ġextraction Ġand Ġthe Ġtraining Ġof Ġclass ifiers . ĠThese Ġnewer Ġmodels Ġare Ġapplying Ġdeep Ġlearning Ġapproaches Ġsuch Ġas ĠConv olution al ĠNeural ĠNetworks Ġ( CNN s ), ĠLong ĠShort - Term ĠMemory ĠNetworks Ġ( L ST Ms ), Ġetc . BI B REF 6 , ĠB IB REF 0 Ġto Ġenhance Ġthe Ġperformance Ġof Ġhate Ġspeech Ġdetection Ġmodels , Ġhowever , Ġthey Ġstill Ġsuffer Ġfrom Ġlack Ġof Ġlabelled Ġdata Ġor Ġinability Ġto Ġimprove Ġgeneral ization Ġproperty . </s> Here , Ġwe Ġpropose Ġa Ġtransfer Ġlearning Ġapproach Ġfor Ġhate Ġspeech Ġunderstanding Ġusing Ġa Ġcombination Ġof Ġthe Ġun super vised Ġpre - trained Ġmodel ĠB ERT ĠB IB REF 11 Ġand Ġsome Ġnew Ġsupervised Ġfine - tun ing Ġstrategies . ĠAs Ġfar Ġas Ġwe Ġknow , Ġit Ġis Ġthe Ġfirst Ġtime Ġthat Ġsuch Ġexhaustive Ġfine - tun ing Ġstrategies Ġare Ġproposed Ġalong Ġwith Ġa Ġgener ative Ġpre - trained Ġlanguage Ġmodel Ġto Ġtransfer Ġlearning Ġto Ġlow - resource Ġhate Ġspeech Ġlanguages Ġand Ġimprove Ġperformance Ġof Ġthe Ġtask . ĠIn Ġsummary : </s> We Ġpropose Ġa Ġtransfer Ġlearning Ġapproach Ġusing Ġthe Ġpre - trained Ġlanguage Ġmodel ĠB ERT Ġlearned Ġon ĠEnglish ĠWikipedia Ġand ĠBook Corp us Ġto Ġenhance Ġhate Ġspeech Ġdetection Ġon Ġpublicly Ġavailable Ġbenchmark Ġdatasets . ĠTow ard Ġthat Ġend , Ġfor Ġthe Ġfirst Ġtime , Ġwe Ġintroduce Ġnew Ġfine - tun ing Ġstrategies Ġto Ġexamine Ġthe Ġeffect Ġof Ġdifferent Ġembed ding Ġlayers Ġof ĠB ERT Ġin Ġhate Ġspeech Ġdetection . </s> Our Ġexperiment Ġresults Ġshow Ġthat Ġusing Ġthe Ġpre - trained ĠB ERT Ġmodel Ġand Ġfine - tun ing Ġit Ġon Ġthe Ġdownstream Ġtask Ġby Ġleveraging Ġsynt act ical Ġand Ġcontextual Ġinformation Ġof Ġall ĠB ERT 's Ġtransform ers Ġoutper forms Ġprevious Ġworks Ġin Ġterms Ġof Ġprecision , Ġrecall , Ġand ĠF 1 - score . ĠFurthermore , Ġexamining Ġthe Ġresults Ġshows Ġthe Ġability Ġof Ġour Ġmodel Ġto Ġdetect Ġsome Ġbiases Ġin Ġthe Ġprocess Ġof Ġcollecting Ġor Ġannot ating Ġdatasets . ĠIt Ġcan Ġbe Ġa Ġvaluable Ġclue Ġin Ġusing Ġpre - trained ĠB ERT Ġmodel Ġfor Ġdeb i asing Ġhate Ġspeech Ġdatasets Ġin Ġfuture Ġstudies . </s> Previous ĠWorks </s> Here , Ġthe Ġexisting Ġbody Ġof Ġknowledge Ġon Ġonline Ġhate Ġspeech Ġand Ġoffensive Ġlanguage Ġand Ġtransfer Ġlearning Ġis Ġpresented . </s> Online ĠHate ĠSpeech Ġand ĠOffensive ĠLanguage : ĠResearchers Ġhave Ġbeen Ġstudying Ġhate Ġspeech Ġon Ġsocial Ġmedia Ġplatforms Ġsuch Ġas ĠTwitter ĠB IB REF 9 , ĠReddit ĠB IB REF 12 , ĠB IB REF 13 , Ġand ĠYouTube ĠB IB REF 14 Ġin Ġthe Ġpast Ġfew Ġyears . ĠThe Ġfeatures Ġused Ġin Ġtraditional Ġmachine Ġlearning Ġapproaches Ġare Ġthe Ġmain Ġaspects Ġdistinguishing Ġdifferent Ġmethods , Ġand Ġsurface - level Ġfeatures Ġsuch Ġas Ġbag Ġof Ġwords , Ġword - level Ġand Ġcharacter - level Ġ$ n $ - gram s , Ġetc . Ġhave Ġproven Ġto Ġbe Ġthe Ġmost Ġpredictive Ġfeatures ĠB IB REF 3 , ĠB IB REF 4 , ĠB IB REF 5 . ĠApart Ġfrom Ġfeatures , Ġdifferent Ġalgorithms Ġsuch Ġas ĠSupport ĠVector ĠMachines ĠB IB REF 15 , ĠNa ive ĠBay e ĠB IB REF 1 , Ġand ĠLog istic ĠReg ression ĠB IB REF 5 , ĠB IB REF 9 , Ġetc . Ġhave Ġbeen Ġapplied Ġfor Ġclassification Ġpurposes . ĠW ase em Ġet Ġal . ĠB IB REF 5 Ġprovided Ġa Ġtest Ġwith Ġa Ġlist Ġof Ġcriteria Ġbased Ġon Ġthe Ġwork Ġin ĠGender ĠStudies Ġand ĠCritical ĠRace ĠTheory Ġ( CR T ) Ġthat Ġcan Ġannot ate Ġa Ġcorpus Ġof Ġmore Ġthan Ġ$ 16 k $ Ġtweets Ġas Ġracism , Ġsexism , Ġor Ġneither . ĠTo Ġclassify Ġtweets , Ġthey Ġused Ġa Ġlog istic Ġregression Ġmodel Ġwith Ġdifferent Ġsets Ġof Ġfeatures , Ġsuch Ġas Ġword Ġand Ġcharacter Ġ$ n $ - gram s Ġup Ġto Ġ4 , Ġgender , Ġlength , Ġand Ġlocation . ĠThey Ġfound Ġthat Ġtheir Ġbest Ġmodel Ġproduces Ġcharacter Ġ$ n $ - gram Ġas Ġthe Ġmost Ġindicative Ġfeatures , Ġand Ġusing Ġlocation Ġor Ġlength Ġis Ġdetrimental . ĠDavidson Ġet Ġal . ĠB IB REF 9 Ġcollected Ġa Ġ$ 24 K $ Ġcorpus Ġof Ġtweets Ġcontaining Ġhate Ġspeech Ġkeywords Ġand Ġlabelled Ġthe Ġcorpus Ġas Ġhate Ġspeech , Ġoffensive Ġlanguage , Ġor Ġneither Ġby Ġusing Ġcrowd - s ourcing Ġand Ġextracted Ġdifferent Ġfeatures Ġsuch Ġas Ġ$ n $ - gram s , Ġsome Ġtweet - level Ġmetadata Ġsuch Ġas Ġthe Ġnumber Ġof Ġhasht ags , Ġmentions , Ġret we ets , Ġand ĠURLs , ĠPart ĠOf ĠSpeech Ġ( POS ) Ġtagging , Ġetc . ĠTheir Ġexperiments Ġon Ġdifferent Ġmulti - class Ġclass ifiers Ġshowed Ġthat Ġthe ĠLog istic ĠReg ression Ġwith ĠL 2 Ġregular ization Ġperforms Ġthe Ġbest Ġat Ġthis Ġtask . ĠMal mas i Ġet Ġal . ĠB IB REF 15 Ġproposed Ġan Ġensemble - based Ġsystem Ġthat Ġuses Ġsome Ġlinear ĠS VM Ġclass ifiers Ġin Ġparallel Ġto Ġdistinguish Ġhate Ġspeech Ġfrom Ġgeneral Ġprof anity Ġin Ġsocial Ġmedia . </s> As Ġone Ġof Ġthe Ġfirst Ġattempts Ġin Ġneural Ġnetwork Ġmodels , ĠDj ur ic Ġet Ġal . ĠB IB REF 16 Ġproposed Ġa Ġtwo - step Ġmethod Ġincluding Ġa Ġcontinuous Ġbag Ġof Ġwords Ġmodel Ġto Ġextract Ġparagraph 2 vec Ġembed d ings Ġand Ġa Ġbinary Ġclass ifier Ġtrained Ġalong Ġwith Ġthe Ġembed d ings Ġto Ġdistinguish Ġbetween Ġhate Ġspeech Ġand Ġclean Ġcontent . ĠBad j ati ya Ġet Ġal . ĠB IB REF 0 Ġinvestigated Ġthree Ġdeep Ġlearning Ġarchitectures , ĠFast Text , ĠCNN , Ġand ĠL ST M , Ġin Ġwhich Ġthey Ġinitialized Ġthe Ġword Ġembed d ings Ġwith Ġeither Ġrandom Ġor ĠGl o Ve Ġembed d ings . ĠGamb Ã¤ ck Ġet Ġal . ĠB IB REF 6 Ġproposed Ġa Ġhate Ġspeech Ġclass ifier Ġbased Ġon ĠCNN Ġmodel Ġtrained Ġon Ġdifferent Ġfeature Ġembed d ings Ġsuch Ġas Ġword Ġembed d ings Ġand Ġcharacter Ġ$ n $ - gram s . ĠZhang Ġet Ġal . ĠB IB REF 7 Ġused Ġa ĠCNN + GR U Ġ( G ated ĠRec urrent ĠUnit Ġnetwork ) Ġneural Ġnetwork Ġmodel Ġinitialized Ġwith Ġpre - trained Ġword 2 vec Ġembed d ings Ġto Ġcapture Ġboth Ġword / character Ġcombinations Ġ( e . Ġg ., Ġ$ n $ - gram s , Ġphrases ) Ġand Ġword / character Ġdependencies Ġ( order Ġinformation ). ĠW ase em Ġet Ġal . ĠB IB REF 10 Ġbrought Ġa Ġnew Ġinsight Ġto Ġhate Ġspeech Ġand Ġabusive Ġlanguage Ġdetection Ġtasks Ġby Ġproposing Ġa Ġmulti - task Ġlearning Ġframework Ġto Ġdeal Ġwith Ġdatasets Ġacross Ġdifferent Ġannotation Ġschemes , Ġlabels , Ġor Ġgeographic Ġand Ġcultural Ġinfluences Ġfrom Ġdata Ġsampling . ĠF ount a Ġet Ġal . ĠB IB REF 17 Ġbuilt Ġa Ġunified Ġclassification Ġmodel Ġthat Ġcan Ġefficiently Ġhandle Ġdifferent Ġtypes Ġof Ġabusive Ġlanguage Ġsuch Ġas Ġcyber bull ying , Ġhate , Ġsarc asm , Ġetc . Ġusing Ġraw Ġtext Ġand Ġdomain - specific Ġmetadata Ġfrom ĠTwitter . ĠFurthermore , Ġresearchers Ġhave Ġrecently Ġfocused Ġon Ġthe Ġbias Ġderived Ġfrom Ġthe Ġhate Ġspeech Ġtraining Ġdatasets ĠB IB REF 18 , ĠB IB REF 2 , ĠB IB REF 19 . ĠDavidson Ġet Ġal . ĠB IB REF 2 Ġshowed Ġthat Ġthere Ġwere Ġsystematic Ġand Ġsubstantial Ġracial Ġbiases Ġin Ġfive Ġbenchmark ĠTwitter Ġdatasets Ġannot ated Ġfor Ġoffensive Ġlanguage Ġdetection . ĠW ieg and Ġet Ġal . ĠB IB REF 19 Ġalso Ġfound Ġthat Ġclass ifiers Ġtrained Ġon Ġdatasets Ġcontaining Ġmore Ġimplicit Ġabuse Ġ( t we ets Ġwith Ġsome Ġabusive Ġwords ) Ġare Ġmore Ġaffected Ġby Ġbiases Ġrather Ġthan Ġonce Ġtrained Ġon Ġdatasets Ġwith Ġa Ġhigh Ġproportion Ġof Ġexplicit Ġabuse Ġsamples Ġ( t we ets Ġcontaining Ġsarc asm , Ġjokes , Ġetc .). </s> Transfer ĠLearning : ĠPre - trained Ġvector Ġrepresentations Ġof Ġwords , Ġembed d ings , Ġextracted Ġfrom Ġvast Ġamounts Ġof Ġtext Ġdata Ġhave Ġbeen Ġencountered Ġin Ġalmost Ġevery Ġlanguage - based Ġtasks Ġwith Ġpromising Ġresults . ĠTwo Ġof Ġthe Ġmost Ġfrequently Ġused Ġcontext - independent Ġneural Ġembed d ings Ġare Ġword 2 vec Ġand ĠGl ove Ġextracted Ġfrom Ġshallow Ġneural Ġnetworks . ĠThe Ġyear Ġ2018 Ġhas Ġbeen Ġan Ġinf lection Ġpoint Ġfor Ġdifferent ĠN LP Ġtasks Ġthanks Ġto Ġremarkable Ġbreakthrough s : ĠUniversal ĠLanguage ĠModel ĠFine - T uning Ġ( UL M Fi T ) ĠB IB REF 20 , ĠEmb edd ing Ġfrom ĠLanguage ĠModels Ġ( EL MO ) ĠB IB REF 21 , ĠOpen AI âĢ Ļ Ġs ĠGener ative ĠPre - trained ĠTrans former Ġ( G PT ) ĠB IB REF 22 , Ġand ĠGoogle âĢ Ļ s ĠB ERT Ġmodel ĠB IB REF 11 . ĠHoward Ġet Ġal . ĠB IB REF 20 Ġproposed ĠU LM Fi T Ġwhich Ġcan Ġbe Ġapplied Ġto Ġany ĠN LP Ġtask Ġby Ġpre - training Ġa Ġuniversal Ġlanguage Ġmodel Ġon Ġa Ġgeneral - domain Ġcorpus Ġand Ġthen Ġfine - tun ing Ġthe Ġmodel Ġon Ġtarget Ġtask Ġdata Ġusing Ġdiscrim in ative Ġfine - tun ing . ĠPeters Ġet Ġal . ĠB IB REF 21 Ġused Ġa Ġbi - direction al ĠL ST M Ġtrained Ġon Ġa Ġspecific Ġtask Ġto Ġpresent Ġcontext - sensitive Ġrepresentations Ġof Ġwords Ġin Ġword Ġembed d ings Ġby Ġlooking Ġat Ġthe Ġentire Ġsentence . ĠRad ford Ġet Ġal . ĠB IB REF 22 Ġand ĠDev lin Ġet Ġal . ĠB IB REF 11 Ġgenerated Ġtwo Ġtransformer - based Ġlanguage Ġmodels , ĠOpen AI ĠG PT Ġand ĠB ERT Ġrespectively . ĠOpen AI ĠG PT ĠB IB REF 22 Ġis Ġan Ġun id irection al Ġlanguage Ġmodel Ġwhile ĠB ERT ĠB IB REF 11 Ġis Ġthe Ġfirst Ġdeeply Ġbid irection al , Ġun super vised Ġlanguage Ġrepresentation , Ġpre - trained Ġusing Ġonly Ġa Ġplain Ġtext Ġcorpus . ĠB ERT Ġhas Ġtwo Ġnovel Ġprediction Ġtasks : ĠMask ed ĠLM Ġand ĠNext ĠSent ence ĠPrediction . ĠThe Ġpre - trained ĠB ERT Ġmodel Ġsignificantly Ġoutper formed ĠEL Mo Ġand ĠOpen AI ĠG PT Ġin Ġa Ġseries Ġof Ġdownstream Ġtasks Ġin ĠN LP ĠB IB REF 11 . ĠIdent ifying Ġhate Ġspeech Ġand Ġoffensive Ġlanguage Ġis Ġa Ġcomplicated Ġtask Ġdue Ġto Ġthe Ġlack Ġof Ġundis puted Ġlabelled Ġdata ĠB IB REF 15 Ġand Ġthe Ġinability Ġof Ġsurface Ġfeatures Ġto Ġcapture Ġthe Ġsubtle Ġsemantics Ġin Ġtext . ĠTo Ġaddress Ġthis Ġissue , Ġwe Ġuse Ġthe Ġpre - trained Ġlanguage Ġmodel ĠB ERT Ġfor Ġhate Ġspeech Ġclassification Ġand Ġtry Ġto Ġfine - t une Ġspecific Ġtask Ġby Ġleveraging Ġinformation Ġfrom Ġdifferent Ġtransformer Ġenc od ers . </s> Method ology </s> Here , Ġwe Ġanalyze Ġthe ĠB ERT Ġtransformer Ġmodel Ġon Ġthe Ġhate Ġspeech Ġdetection Ġtask . ĠB ERT Ġis Ġa Ġmulti - layer Ġbid irection al Ġtransformer Ġenc oder Ġtrained Ġon Ġthe ĠEnglish ĠWikipedia Ġand Ġthe ĠBook ĠCorpus Ġcontaining Ġ2 , 500 M Ġand Ġ800 M Ġtokens , Ġrespectively , Ġand Ġhas Ġtwo Ġmodels Ġnamed ĠB ERT base Ġand ĠB ERT large . ĠB ERT base Ġcontains Ġan Ġenc oder Ġwith Ġ12 Ġlayers Ġ( trans former Ġblocks ), Ġ12 Ġself - att ention Ġheads , Ġand Ġ110 Ġmillion Ġparameters Ġwhereas ĠB ERT large Ġhas Ġ24 Ġlayers , Ġ16 Ġattention Ġheads , Ġand Ġ340 Ġmillion Ġparameters . ĠExt racted Ġembed d ings Ġfrom ĠB ERT base Ġhave Ġ768 Ġhidden Ġdimensions ĠB IB REF 11 . ĠAs Ġthe ĠB ERT Ġmodel Ġis Ġpre - trained Ġon Ġgeneral Ġcorpor a , Ġand Ġfor Ġour Ġhate Ġspeech Ġdetection Ġtask Ġwe Ġare Ġdealing Ġwith Ġsocial Ġmedia Ġcontent , Ġtherefore Ġas Ġa Ġcrucial Ġstep , Ġwe Ġhave Ġto Ġanalyze Ġthe Ġcontextual Ġinformation Ġextracted Ġfrom ĠB ERT ' Ġs Ġpre - trained Ġlayers Ġand Ġthen Ġfine - t une Ġit Ġusing Ġannot ated Ġdatasets . ĠBy Ġfine - tun ing Ġwe Ġupdate Ġweights Ġusing Ġa Ġlabelled Ġdataset Ġthat Ġis Ġnew Ġto Ġan Ġalready Ġtrained Ġmodel . ĠAs Ġan Ġinput Ġand Ġoutput , ĠB ERT Ġtakes Ġa Ġsequence Ġof Ġtokens Ġin Ġmaximum Ġlength Ġ512 Ġand Ġproduces Ġa Ġrepresentation Ġof Ġthe Ġsequence Ġin Ġa Ġ768 - dimensional Ġvector . ĠB ERT Ġinserts Ġat Ġmost Ġtwo Ġsegments Ġto Ġeach Ġinput Ġsequence , Ġ[ CL S ] Ġand Ġ[ SE P ]. Ġ[ CL S ] Ġembed ding Ġis Ġthe Ġfirst Ġtoken Ġof Ġthe Ġinput Ġsequence Ġand Ġcontains Ġthe Ġspecial Ġclassification Ġembed ding Ġwhich Ġwe Ġtake Ġthe Ġfirst Ġtoken Ġ[ CL S ] Ġin Ġthe Ġfinal Ġhidden Ġlayer Ġas Ġthe Ġrepresentation Ġof Ġthe Ġwhole Ġsequence Ġin Ġhate Ġspeech Ġclassification Ġtask . ĠThe Ġ[ SE P ] Ġseparates Ġsegments Ġand Ġwe Ġwill Ġnot Ġuse Ġit Ġin Ġour Ġclassification Ġtask . ĠTo Ġperform Ġthe Ġhate Ġspeech Ġdetection Ġtask , Ġwe Ġuse ĠB ERT base Ġmodel Ġto Ġclassify Ġeach Ġtweet Ġas ĠRac ism , ĠSex ism , ĠNeither Ġor ĠHate , ĠOffensive , ĠNeither Ġin Ġour Ġdatasets . ĠIn Ġorder Ġto Ġdo Ġthat , Ġwe Ġfocus Ġon Ġfine - tun ing Ġthe Ġpre - trained ĠB ERT base Ġparameters . ĠBy Ġfine - tun ing , Ġwe Ġmean Ġtraining Ġa Ġclass ifier Ġwith Ġdifferent Ġlayers Ġof Ġ768 Ġdimensions Ġon Ġtop Ġof Ġthe Ġpre - trained ĠB ERT base Ġtransformer Ġto Ġminimize Ġtask - specific Ġparameters . </s> Method ology Ġ: :: ĠFine - T uning ĠStrategies </s> Different Ġlayers Ġof Ġa Ġneural Ġnetwork Ġcan Ġcapture Ġdifferent Ġlevels Ġof Ġsynt actic Ġand Ġsemantic Ġinformation . ĠThe Ġlower Ġlayer Ġof Ġthe ĠB ERT Ġmodel Ġmay Ġcontain Ġmore Ġgeneral Ġinformation Ġwhereas Ġthe Ġhigher Ġlayers Ġcontain Ġtask - specific Ġinformation ĠB IB REF 11 , Ġand Ġwe Ġcan Ġfine - t une Ġthem Ġwith Ġdifferent Ġlearning Ġrates . ĠHere , Ġfour Ġdifferent Ġfine - tun ing Ġapproaches Ġare Ġimplemented Ġthat Ġexploit Ġpre - trained ĠB ERT base Ġtransformer Ġenc od ers Ġfor Ġour Ġclassification Ġtask . ĠMore Ġinformation Ġabout Ġthese Ġtransformer Ġenc od ers ' Ġarchitectures Ġare Ġpresented Ġin ĠB IB REF 11 . ĠIn Ġthe Ġfine - tun ing Ġphase , Ġthe Ġmodel Ġis Ġinitialized Ġwith Ġthe Ġpre - trained Ġparameters Ġand Ġthen Ġare Ġfine - tun ed Ġusing Ġthe Ġlabelled Ġdatasets . ĠDifferent Ġfine - tun ing Ġapproaches Ġon Ġthe Ġhate Ġspeech Ġdetection Ġtask Ġare Ġdepicted Ġin ĠFigure ĠFIG REF 8 , Ġin Ġwhich Ġ$ X _{ i } $ Ġis Ġthe Ġvector Ġrepresentation Ġof Ġtoken Ġ$ i $ Ġin Ġa Ġtweet Ġsample , Ġand Ġare Ġexplained Ġin Ġmore Ġdetail Ġas Ġfollows : </s> 1 . ĠB ERT Ġbased Ġfine - tun ing : ĠIn Ġthe Ġfirst Ġapproach , Ġwhich Ġis Ġshown Ġin ĠFigure ĠFIG REF 8 , Ġvery Ġfew Ġchanges Ġare Ġapplied Ġto Ġthe ĠB ERT base . ĠIn Ġthis Ġarchitecture , Ġonly Ġthe Ġ[ CL S ] Ġtoken Ġoutput Ġprovided Ġby ĠB ERT Ġis Ġused . ĠThe Ġ[ CL S ] Ġoutput , Ġwhich Ġis Ġequivalent Ġto Ġthe Ġ[ CL S ] Ġtoken Ġoutput Ġof Ġthe Ġ12 th Ġtransformer Ġenc oder , Ġa Ġvector Ġof Ġsize Ġ768 , Ġis Ġgiven Ġas Ġinput Ġto Ġa Ġfully Ġconnected Ġnetwork Ġwithout Ġhidden Ġlayer . ĠThe Ġsoft max Ġactivation Ġfunction Ġis Ġapplied Ġto Ġthe Ġhidden Ġlayer Ġto Ġclassify . </s> 2 . ĠInsert Ġnon linear Ġlayers : ĠHere , Ġthe Ġfirst Ġarchitecture Ġis Ġupgraded Ġand Ġan Ġarchitecture Ġwith Ġa Ġmore Ġrobust Ġclass ifier Ġis Ġprovided Ġin Ġwhich Ġinstead Ġof Ġusing Ġa Ġfully Ġconnected Ġnetwork Ġwithout Ġhidden Ġlayer , Ġa Ġfully Ġconnected Ġnetwork Ġwith Ġtwo Ġhidden Ġlayers Ġin Ġsize Ġ768 Ġis Ġused . ĠThe Ġfirst Ġtwo Ġlayers Ġuse Ġthe ĠLe aky ĠRel u Ġactivation Ġfunction Ġwith Ġnegative Ġslope Ġ= Ġ0 . 01 , Ġbut Ġthe Ġfinal Ġlayer , Ġas Ġthe Ġfirst Ġarchitecture , Ġuses Ġsoft max Ġactivation Ġfunction Ġas Ġshown Ġin ĠFigure ĠFIG REF 8 . </s> 3 . ĠInsert ĠBi - L ST M Ġlayer : ĠUnlike Ġprevious Ġarchitectures Ġthat Ġonly Ġuse Ġ[ CL S ] Ġas Ġthe Ġinput Ġfor Ġthe Ġclass ifier , Ġin Ġthis Ġarchitecture Ġall Ġoutputs Ġof Ġthe Ġlatest Ġtransformer Ġenc oder Ġare Ġused Ġin Ġsuch Ġa Ġway Ġthat Ġthey Ġare Ġgiven Ġas Ġinputs Ġto Ġa Ġbid irection al Ġrecurrent Ġneural Ġnetwork Ġ( Bi - L ST M ) Ġas Ġshown Ġin ĠFigure ĠFIG REF 8 . ĠAfter Ġprocessing Ġthe Ġinput , Ġthe Ġnetwork Ġsends Ġthe Ġfinal Ġhidden Ġstate Ġto Ġa Ġfully Ġconnected Ġnetwork Ġthat Ġperforms Ġclassification Ġusing Ġthe Ġsoft max Ġactivation Ġfunction . </s> 4 . ĠInsert ĠCNN Ġlayer : ĠIn Ġthis Ġarchitecture Ġshown Ġin ĠFigure ĠFIG REF 8 , Ġthe Ġoutputs Ġof Ġall Ġtransformer Ġenc od ers Ġare Ġused Ġinstead Ġof Ġusing Ġthe Ġoutput Ġof Ġthe Ġlatest Ġtransformer Ġenc oder . ĠSo Ġthat Ġthe Ġoutput Ġvectors Ġof Ġeach Ġtransformer Ġenc oder Ġare Ġconc aten ated , Ġand Ġa Ġmatrix Ġis Ġproduced . ĠThe Ġconv olution al Ġoperation Ġis Ġperformed Ġwith Ġa Ġwindow Ġof Ġsize Ġ( 3 , Ġhidden Ġsize Ġof ĠB ERT Ġwhich Ġis Ġ768 Ġin ĠB ERT base Ġmodel ) Ġand Ġthe Ġmaximum Ġvalue Ġis Ġgenerated Ġfor Ġeach Ġtransformer Ġenc oder Ġby Ġapplying Ġmax Ġpool ing Ġon Ġthe Ġconv olution Ġoutput . ĠBy Ġconc aten ating Ġthese Ġvalues , Ġa Ġvector Ġis Ġgenerated Ġwhich Ġis Ġgiven Ġas Ġinput Ġto Ġa Ġfully Ġconnected Ġnetwork . ĠBy Ġapplying Ġsoft max Ġon Ġthe Ġinput , Ġthe Ġclassification Ġoperation Ġis Ġperformed . </s> Exper iments Ġand ĠResults </s> We Ġfirst Ġintroduce Ġdatasets Ġused Ġin Ġour Ġstudy Ġand Ġthen Ġinvestigate Ġthe Ġdifferent Ġfine - tun ing Ġstrategies Ġfor Ġhate Ġspeech Ġdetection Ġtask . ĠWe Ġalso Ġinclude Ġthe Ġdetails Ġof Ġour Ġimplementation Ġand Ġerror Ġanalysis Ġin Ġthe Ġrespective Ġsubsections . </s> Exper iments Ġand ĠResults Ġ: :: ĠDat as et ĠDescription </s> We Ġevaluate Ġour Ġmethod Ġon Ġtwo Ġwidely - stud ied Ġdatasets Ġprovided Ġby ĠW ase em Ġand ĠH ove y ĠB IB REF 5 Ġand ĠDavidson Ġet Ġal . ĠB IB REF 9 . ĠW ase em Ġand ĠH ovy ĠB IB REF 5 Ġcollected Ġ$ 16 k $ Ġof Ġtweets Ġbased Ġon Ġan Ġinitial Ġad - h oc Ġapproach Ġthat Ġsearched Ġcommon Ġslurs Ġand Ġterms Ġrelated Ġto Ġreligious , Ġsexual , Ġgender , Ġand Ġethnic Ġminorities . ĠThey Ġannot ated Ġtheir Ġdataset Ġmanually Ġas Ġracism , Ġsexism , Ġor Ġneither . ĠTo Ġextend Ġthis Ġdataset , ĠW ase em ĠB IB REF 23 Ġalso Ġprovided Ġanother Ġdataset Ġcontaining Ġ$ 6 . 9 k $ Ġof Ġtweets Ġannot ated Ġwith Ġboth Ġexpert Ġand Ġcrowds ourcing Ġusers Ġas Ġracism , Ġsexism , Ġneither , Ġor Ġboth . ĠSince Ġboth Ġdatasets Ġare Ġoverl apped Ġpartially Ġand Ġthey Ġused Ġthe Ġsame Ġstrategy Ġin Ġdefinition Ġof Ġhateful Ġcontent , Ġwe Ġmerged Ġthese Ġtwo Ġdatasets Ġfollowing ĠW ase em Ġet Ġal . ĠB IB REF 10 Ġto Ġmake Ġour Ġimbalance Ġdata Ġa Ġbit Ġlarger . ĠDavidson Ġet Ġal . ĠB IB REF 9 Ġused Ġthe ĠTwitter ĠAPI Ġto Ġaccumulate Ġ84 . 4 Ġmillion Ġtweets Ġfrom Ġ33 , 458 Ġtwitter Ġusers Ġcontaining Ġparticular Ġterms Ġfrom Ġa Ġpre - defined Ġlex icon Ġof Ġhate Ġspeech Ġwords Ġand Ġphrases , Ġcalled ĠHate based . org . ĠTo Ġannot ate Ġcollected Ġtweets Ġas ĠHate , ĠOffensive , Ġor ĠNeither , Ġthey Ġrandomly Ġsampled Ġ$ 25 k $ Ġtweets Ġand Ġasked Ġusers Ġof ĠCrowd Fl ower Ġcrowds ourcing Ġplatform Ġto Ġlabel Ġthem . ĠIn Ġdetail , Ġthe Ġdistribution Ġof Ġdifferent Ġclasses Ġin Ġboth Ġdatasets Ġwill Ġbe Ġprovided Ġin ĠSub section ĠSEC REF 15 . </s> Exper iments Ġand ĠResults Ġ: :: ĠPre - Process ing </s> We Ġfind Ġmentions Ġof Ġusers , Ġnumbers , Ġhasht ags , ĠURLs Ġand Ġcommon Ġemot icons Ġand Ġreplace Ġthem Ġwith Ġthe Ġtokens Ġ< user >, < number >, < hash tag >, < url >, < em ot icon >. ĠWe Ġalso Ġfind Ġelong ated Ġwords Ġand Ġconvert Ġthem Ġinto Ġshort Ġand Ġstandard Ġformat ; Ġfor Ġexample , Ġconverting Ġy ee e ess ss Ġto Ġyes . ĠWith Ġhasht ags Ġthat Ġinclude Ġsome Ġtokens Ġwithout Ġany Ġwith Ġspace Ġbetween Ġthem , Ġwe Ġreplace Ġthem Ġby Ġtheir Ġtextual Ġcounterparts ; Ġfor Ġexample , Ġwe Ġconvert Ġhashtag ĠâĢ ľ # not sex ist " Ġto ĠâĢ ľ not Ġsexist ". ĠAll Ġpunct uation Ġmarks , Ġunknown Ġun i - codes Ġand Ġextra Ġdelim iting Ġcharacters Ġare Ġremoved , Ġbut Ġwe Ġkeep Ġall Ġstop Ġwords Ġbecause Ġour Ġmodel Ġtrains Ġthe Ġsequence Ġof Ġwords Ġin Ġa Ġtext Ġdirectly . ĠWe Ġalso Ġconvert Ġall Ġtweets Ġto Ġlower Ġcase . </s> Exper iments Ġand ĠResults Ġ: :: ĠImplementation Ġand ĠResults ĠAnalysis </s> For Ġthe Ġimplementation Ġof Ġour Ġneural Ġnetwork , Ġwe Ġused Ġpy tor ch - pret rained - bert Ġlibrary Ġcontaining Ġthe Ġpre - trained ĠB ERT Ġmodel , Ġtext Ġtoken izer , Ġand Ġpre - trained ĠWord P iece . ĠAs Ġthe Ġimplementation Ġenvironment , Ġwe Ġuse ĠGoogle ĠCol abor atory Ġtool Ġwhich Ġis Ġa Ġfree Ġresearch Ġtool Ġwith Ġa ĠTesla ĠK 80 ĠGPU Ġand Ġ12 G ĠRAM . ĠBased Ġon Ġour Ġexperiments , Ġwe Ġtrained Ġour Ġclass ifier Ġwith Ġa Ġbatch Ġsize Ġof Ġ32 Ġfor Ġ3 Ġepoch s . ĠThe Ġdrop out Ġprobability Ġis Ġset Ġto Ġ0 . 1 Ġfor Ġall Ġlayers . ĠAdam Ġoptim izer Ġis Ġused Ġwith Ġa Ġlearning Ġrate Ġof Ġ2 e - 5 . ĠAs Ġan Ġinput , Ġwe Ġtoken ized Ġeach Ġtweet Ġwith Ġthe ĠB ERT Ġtoken izer . ĠIt Ġcontains Ġinvalid Ġcharacters Ġremoval , Ġpunct uation Ġsplitting , Ġand Ġlower c asing Ġthe Ġwords . ĠBased Ġon Ġthe Ġoriginal ĠB ERT ĠB IB REF 11 , Ġwe Ġsplit Ġwords Ġto Ġsub word Ġunits Ġusing ĠWord P iece Ġtoken ization . ĠAs Ġtweets Ġare Ġshort Ġtexts , Ġwe Ġset Ġthe Ġmaximum Ġsequence Ġlength Ġto Ġ64 Ġand Ġin Ġany Ġshorter Ġor Ġlonger Ġlength Ġcase Ġit Ġwill Ġbe Ġpadded Ġwith Ġzero Ġvalues Ġor Ġtrunc ated Ġto Ġthe Ġmaximum Ġlength . </s> We Ġconsider Ġ80 % Ġof Ġeach Ġdataset Ġas Ġtraining Ġdata Ġto Ġupdate Ġthe Ġweights Ġin Ġthe Ġfine - tun ing Ġphase , Ġ10 % Ġas Ġvalidation Ġdata Ġto Ġmeasure Ġthe Ġout - of - sample Ġperformance Ġof Ġthe Ġmodel Ġduring Ġtraining , Ġand Ġ10 % Ġas Ġtest Ġdata Ġto Ġmeasure Ġthe Ġout - of - sample Ġperformance Ġafter Ġtraining . ĠTo Ġprevent Ġover fitting , Ġwe Ġuse Ġstrat ified Ġsampling Ġto Ġselect Ġ0 . 8 , Ġ0 . 1 , Ġand Ġ0 . 1 Ġportions Ġof Ġtweets Ġfrom Ġeach Ġclass Ġ( rac ism / sex ism / ne ither Ġor Ġhate / offensive / ne ither ) Ġfor Ġtrain , Ġvalidation , Ġand Ġtest . ĠClasses ' Ġdistribution Ġof Ġtrain , Ġvalidation , Ġand Ġtest Ġdatasets Ġare Ġshown Ġin ĠTable ĠT AB REF 16 . </s> As Ġit Ġis Ġunderstandable Ġfrom ĠTables ĠT AB REF 16 ( class dist ribution w ase em ) Ġand ĠT AB REF 16 ( class dist ribution d avid son ), Ġwe Ġare Ġdealing Ġwith Ġimbalance Ġdatasets Ġwith Ġvarious Ġclasses âĢ Ļ Ġdistribution . ĠSince Ġhate Ġspeech Ġand Ġoffensive Ġlanguages Ġare Ġreal Ġphenomena , Ġwe Ġdid Ġnot Ġperform Ġovers am pling Ġor Ġunders am pling Ġtechniques Ġto Ġadjust Ġthe Ġclasses âĢ Ļ Ġdistribution Ġand Ġtried Ġto Ġsupply Ġthe Ġdatasets Ġas Ġrealistic Ġas Ġpossible . ĠWe Ġevaluate Ġthe Ġeffect Ġof Ġdifferent Ġfine - tun ing Ġstrategies Ġon Ġthe Ġperformance Ġof Ġour Ġmodel . ĠTable ĠT AB REF 17 Ġsummarized Ġthe Ġobtained Ġresults Ġfor Ġfine - tun ing Ġstrategies Ġalong Ġwith Ġthe Ġofficial Ġbas elines . ĠWe Ġuse ĠW ase em Ġand ĠH ovy ĠB IB REF 5 , ĠDavidson Ġet Ġal . ĠB IB REF 9 , Ġand ĠW ase em Ġet Ġal . ĠB IB REF 10 Ġas Ġbas elines Ġand Ġcompare Ġthe Ġresults Ġwith Ġour Ġdifferent Ġfine - tun ing Ġstrategies Ġusing Ġpre - trained ĠB ERT base Ġmodel . ĠThe Ġevaluation Ġresults Ġare Ġreported Ġon Ġthe Ġtest Ġdataset Ġand Ġon Ġthree Ġdifferent Ġmetrics : Ġprecision , Ġrecall , Ġand Ġweighted - average ĠF 1 - score . ĠWe Ġconsider Ġweighted - average ĠF 1 - score Ġas Ġthe Ġmost Ġrobust Ġmetric Ġversus Ġclass Ġimbalance , Ġwhich Ġgives Ġinsight Ġinto Ġthe Ġperformance Ġof Ġour Ġproposed Ġmodels . ĠAccording Ġto ĠTable ĠT AB REF 17 , ĠF 1 - sc ores Ġof Ġall ĠB ERT Ġbased Ġfine - tun ing Ġstrategies Ġexcept ĠB ERT Ġ+ Ġnon linear Ġclass ifier Ġon Ġtop Ġof ĠB ERT Ġare Ġhigher Ġthan Ġthe Ġbas elines . ĠUsing Ġthe Ġpre - trained ĠB ERT Ġmodel Ġas Ġinitial Ġembed d ings Ġand Ġfine - tun ing Ġthe Ġmodel Ġwith Ġa Ġfully Ġconnected Ġlinear Ġclass ifier Ġ( BER T base ) Ġoutper forms Ġprevious Ġbas elines Ġyielding ĠF 1 - score Ġof Ġ81 % Ġand Ġ91 % Ġfor Ġdatasets Ġof ĠW ase em Ġand ĠDavidson Ġrespectively . ĠInsert ing Ġa ĠCNN Ġto Ġpre - trained ĠB ERT Ġmodel Ġfor Ġfine - tun ing Ġon Ġdownstream Ġtask Ġprovides Ġthe Ġbest Ġresults Ġas ĠF 1 - Ġscore Ġof Ġ88 % Ġand Ġ92 % Ġfor Ġdatasets Ġof ĠW ase em Ġand ĠDavidson Ġand Ġit Ġclearly Ġexceeds Ġthe Ġbas elines . ĠInt uitive ly , Ġthis Ġmakes Ġsense Ġthat Ġcombining Ġall Ġpre - trained ĠB ERT Ġlayers Ġwith Ġa ĠCNN Ġyields Ġbetter Ġresults Ġin Ġwhich Ġour Ġmodel Ġuses Ġall Ġthe Ġinformation Ġincluded Ġin Ġdifferent Ġlayers Ġof Ġpre - trained ĠB ERT Ġduring Ġthe Ġfine - tun ing Ġphase . ĠThis Ġinformation Ġcontains Ġboth Ġsynt act ical Ġand Ġcontextual Ġfeatures Ġcoming Ġfrom Ġlower Ġlayers Ġto Ġhigher Ġlayers Ġof ĠB ERT . </s> Exper iments Ġand ĠResults Ġ: :: ĠError ĠAnalysis </s> Although Ġwe Ġhave Ġvery Ġinteresting Ġresults Ġin Ġterm Ġof Ġrecall , Ġthe Ġprecision Ġof Ġthe Ġmodel Ġshows Ġthe Ġportion Ġof Ġfalse Ġdetection Ġwe Ġhave . ĠTo Ġunderstand Ġbetter Ġthis Ġphenomenon , Ġin Ġthis Ġsection Ġwe Ġperform Ġa Ġdeep Ġanalysis Ġon Ġthe Ġerror Ġof Ġthe Ġmodel . ĠWe Ġinvestigate Ġthe Ġtest Ġdatasets Ġand Ġtheir Ġconfusion Ġmat rices Ġresulted Ġfrom Ġthe ĠB ERT base Ġ+ ĠCNN Ġmodel Ġas Ġthe Ġbest Ġfine - tun ing Ġapproach ; Ġdepicted Ġin ĠFigures ĠFIG REF 19 Ġand ĠFIG REF 19 . ĠAccording Ġto ĠFigure ĠFIG REF 19 Ġfor ĠW ase em - dat as et , Ġit Ġis Ġobvious Ġthat Ġthe Ġmodel Ġcan Ġseparate Ġsexism Ġfrom Ġracism Ġcontent Ġproperly . ĠOnly Ġtwo Ġsamples Ġbelonging Ġto Ġracism Ġclass Ġare Ġmis classified Ġas Ġsexism Ġand Ġnone Ġof Ġthe Ġsexism Ġsamples Ġare Ġmis classified Ġas Ġracism . ĠA Ġlarge Ġmajority Ġof Ġthe Ġerrors Ġcome Ġfrom Ġmis class ifying Ġhateful Ġcategories Ġ( rac ism Ġand Ġsexism ) Ġas Ġhat less Ġ( ne ither ) Ġand Ġvice Ġversa . Ġ0 . 9 % Ġand Ġ18 . 5 % Ġof Ġall Ġracism Ġsamples Ġare Ġmis classified Ġas Ġsexism Ġand Ġneither Ġrespectively Ġwhereas Ġit Ġis Ġ0 % Ġand Ġ12 . 7 % Ġfor Ġsexism Ġsamples . ĠAlmost Ġ12 % Ġof Ġneither Ġsamples Ġare Ġmis classified Ġas Ġracism Ġor Ġsexism . ĠAs ĠFigure ĠFIG REF 19 Ġmakes Ġclear Ġfor ĠDavidson - dat as et , Ġthe Ġmajority Ġof Ġerrors Ġare Ġrelated Ġto Ġhate Ġclass Ġwhere Ġthe Ġmodel Ġmis classified Ġhate Ġcontent Ġas Ġoffensive Ġin Ġ63 % Ġof Ġthe Ġcases . ĠHowever , Ġ2 . 6 % Ġand Ġ7 . 9 % Ġof Ġoffensive Ġand Ġneither Ġsamples Ġare Ġmis classified Ġrespectively . </s> To Ġunderstand Ġbetter Ġthe Ġmis label ed Ġitems Ġby Ġour Ġmodel , Ġwe Ġdid Ġa Ġmanual Ġinspection Ġon Ġa Ġsubset Ġof Ġthe Ġdata Ġand Ġrecord Ġsome Ġof Ġthem Ġin ĠTables ĠT AB REF 20 Ġand ĠT AB REF 21 . ĠConsidering Ġthe Ġwords Ġsuch Ġas ĠâĢ ľ d aughters ", ĠâĢ ľ women ", Ġand ĠâĢ ľ bur ka " Ġin Ġtweets Ġwith ĠIDs Ġ1 Ġand Ġ2 Ġin ĠTable ĠT AB REF 20 , Ġit Ġcan Ġbe Ġunderstood Ġthat Ġour ĠB ERT Ġbased Ġclass ifier Ġis Ġconfused Ġwith Ġthe Ġcontextual Ġsemantic Ġbetween Ġthese Ġwords Ġin Ġthe Ġsamples Ġand Ġmis classified Ġthem Ġas Ġsexism Ġbecause Ġthey Ġare Ġmainly Ġassociated Ġto Ġfemin inity . ĠIn Ġsome Ġcases Ġcontaining Ġimplicit Ġabuse Ġ( like Ġsubtle Ġinsults ) Ġsuch Ġas Ġtweets Ġwith ĠIDs Ġ5 Ġand Ġ7 , Ġour Ġmodel Ġcannot Ġcapture Ġthe Ġhateful / offensive Ġcontent Ġand Ġtherefore Ġmis class ifies . ĠIt Ġshould Ġbe Ġnoticed Ġthat Ġeven Ġfor Ġa Ġhuman Ġit Ġis Ġdifficult Ġto Ġdiscriminate Ġagainst Ġthis Ġkind Ġof Ġimplicit Ġabuses . </s> By Ġexamining Ġmore Ġsamples Ġand Ġwith Ġrespect Ġto Ġrecently Ġstudies ĠB IB REF 2 , ĠB IB REF 24 , ĠB IB REF 19 , Ġit Ġis Ġclear Ġthat Ġmany Ġerrors Ġare Ġdue Ġto Ġbiases Ġfrom Ġdata Ġcollection ĠB IB REF 19 Ġand Ġrules Ġof Ġannotation ĠB IB REF 24 Ġand Ġnot Ġthe Ġclass ifier Ġitself . ĠSince ĠW ase em Ġet Ġal . BI B REF 5 Ġcreated Ġa Ġsmall Ġad - h oc Ġset Ġof Ġkeywords Ġand ĠDavidson Ġet Ġal . BI B REF 9 Ġused Ġa Ġlarge Ġcrowds ourced Ġdictionary Ġof Ġkeywords Ġ( H ate base Ġlex icon ) Ġto Ġsample Ġtweets Ġfor Ġtraining , Ġthey Ġincluded Ġsome Ġbiases Ġin Ġthe Ġcollected Ġdata . ĠEspecially Ġfor ĠDavidson - dat as et , Ġsome Ġtweets Ġwith Ġspecific Ġlanguage Ġ( written Ġwithin Ġthe ĠAfrican ĠAmerican ĠVern acular ĠEnglish ) Ġand Ġgeographic Ġrestriction Ġ( United ĠStates Ġof ĠAmerica ) Ġare Ġovers am pled Ġsuch Ġas Ġtweets Ġcontaining Ġdispar age Ġwords ĠâĢ ľ n ig ga ", ĠâĢ ľ f agg ot ", ĠâĢ ľ coon ", Ġor ĠâĢ ľ que er ", Ġresult Ġin Ġhigh Ġrates Ġof Ġmis class ification . ĠHowever , Ġthese Ġmis class ifications Ġdo Ġnot Ġconfirm Ġthe Ġlow Ġperformance Ġof Ġour Ġclass ifier Ġbecause Ġannot ators Ġtended Ġto Ġannot ate Ġmany Ġsamples Ġcontaining Ġdisrespectful Ġwords Ġas Ġhate Ġor Ġoffensive Ġwithout Ġany Ġpresumption Ġabout Ġthe Ġsocial Ġcontext Ġof Ġtweet ers Ġsuch Ġas Ġthe Ġspeaker âĢ Ļ s Ġidentity Ġor Ġdialect , Ġwhereas Ġthey Ġwere Ġjust Ġoffensive Ġor Ġeven Ġneither Ġtweets . ĠTwe ets ĠIDs Ġ6 , Ġ8 , Ġand Ġ10 Ġare Ġsome Ġsamples Ġcontaining Ġoffensive Ġwords Ġand Ġslurs Ġwhich Ġare not Ġhate Ġor Ġoffensive Ġin Ġall Ġcases Ġand Ġwriters Ġof Ġthem Ġused Ġthis Ġtype Ġof Ġlanguage Ġin Ġtheir Ġdaily Ġcommunications . ĠGiven Ġthese Ġpieces Ġof Ġevidence , Ġby Ġconsidering Ġthe Ġcontent Ġof Ġtweets , Ġwe Ġcan Ġsee Ġin Ġtweets ĠIDs Ġ3 , Ġ4 , Ġand Ġ9 Ġthat Ġour ĠB ERT - based Ġclass ifier Ġcan Ġdiscriminate Ġtweets Ġin Ġwhich Ġneither Ġand Ġimplicit Ġhatred Ġcontent Ġexist . ĠOne Ġexplanation Ġof Ġthis Ġobservation Ġmay Ġbe Ġthe Ġpre - trained Ġgeneral Ġknowledge Ġthat Ġexists Ġin Ġour Ġmodel . ĠSince Ġthe Ġpre - trained ĠB ERT Ġmodel Ġis Ġtrained Ġon Ġgeneral Ġcorpor a , Ġit Ġhas Ġlearned Ġgeneral Ġknowledge Ġfrom Ġnormal Ġtextual Ġdata Ġwithout Ġany Ġpurposely Ġhateful Ġor Ġoffensive Ġlanguage . ĠTherefore , Ġdespite Ġthe Ġbias Ġin Ġthe Ġdata , Ġour Ġmodel Ġcan Ġdifferentiate Ġhate Ġand Ġoffensive Ġsamples Ġaccurately Ġby Ġleveraging Ġknowledge - aware Ġlanguage Ġunderstanding Ġthat Ġit Ġhas Ġand Ġit Ġcan Ġbe Ġthe Ġmain Ġreason Ġfor Ġhigh Ġmis class ifications Ġof Ġhate Ġsamples Ġas Ġoffensive Ġ( in Ġreality Ġthey Ġare Ġmore Ġsimilar Ġto Ġoffensive Ġrather Ġthan Ġhate Ġby Ġconsidering Ġsocial Ġcontext , Ġge ol ocation , Ġand Ġdialect Ġof Ġtweet ers ). </s> Conclusion </s> Con fl ating Ġhatred Ġcontent Ġwith Ġoffensive Ġor Ġharmless Ġlanguage Ġcauses Ġonline Ġautomatic Ġhate Ġspeech Ġdetection Ġtools Ġto Ġflag Ġuser - generated Ġcontent Ġincorrectly . ĠNot Ġaddressing Ġthis Ġproblem Ġmay Ġbring Ġabout Ġsevere Ġnegative Ġconsequences Ġfor Ġboth Ġplatforms Ġand Ġusers Ġsuch Ġas Ġdecre as ement Ġof Ġplatforms ' Ġreputation Ġor Ġusers Ġabandonment . ĠHere , Ġwe Ġpropose Ġa Ġtransfer Ġlearning Ġapproach Ġadvant aging Ġthe Ġpre - trained Ġlanguage Ġmodel ĠB ERT Ġto Ġenhance Ġthe Ġperformance Ġof Ġa Ġhate Ġspeech Ġdetection Ġsystem Ġand Ġto Ġgeneral ize Ġit Ġto Ġnew Ġdatasets . ĠTo Ġthat Ġend , Ġwe Ġintroduce Ġnew Ġfine - tun ing Ġstrategies Ġto Ġexamine Ġthe Ġeffect Ġof Ġdifferent Ġlayers Ġof ĠB ERT Ġin Ġhate Ġspeech Ġdetection Ġtask . ĠThe Ġevaluation Ġresults Ġindicate Ġthat Ġour Ġmodel Ġoutper forms Ġprevious Ġworks Ġby Ġprof iting Ġthe Ġsynt act ical Ġand Ġcontextual Ġinformation Ġembedded Ġin Ġdifferent Ġtransformer Ġenc oder Ġlayers Ġof Ġthe ĠB ERT Ġmodel Ġusing Ġa ĠCNN - based Ġfine - tun ing Ġstrategy . ĠFurthermore , Ġexamining Ġthe Ġresults Ġshows Ġthe Ġability Ġof Ġour Ġmodel Ġto Ġdetect Ġsome Ġbiases Ġin Ġthe Ġprocess Ġof Ġcollecting Ġor Ġannot ating Ġdatasets . ĠIt Ġcan Ġbe Ġa Ġvaluable Ġclue Ġin Ġusing Ġthe Ġpre - trained ĠB ERT Ġmodel Ġto Ġalleviate Ġbias Ġin Ġhate Ġspeech Ġdatasets Ġin Ġfuture Ġstudies , Ġby Ġinvestigating Ġa Ġmixture Ġof Ġcontextual Ġinformation Ġembedded Ġin Ġthe ĠB ERT âĢ Ļ s Ġlayers Ġand Ġa Ġset Ġof Ġfeatures Ġassociated Ġto Ġthe Ġdifferent Ġtype Ġof Ġbiases Ġin Ġdata .