Top Banner
HW5 Part II + Bias in NLP Spring 2019 Caleb Kaiji Lu
40

HW5 Part II + Biasin NLP

Jan 26, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HW5 Part II + Biasin NLP

HW5PartII+Bias inNLP

Spring2019CalebKaijiLu

Page 2: HW5 Part II + Biasin NLP

HW5PartII:Debiasing WordEmbeddings[Bolukabasi 2016]

• Man:King::Woman:Queen• Paris:France::Tokyo:Japan

• He:Brother ::She:Sister• He:Blue ::She:Pink• He:Doctor ::She:Nurse• He:Realist ::She:Feminist• She:Pregnancy ::He:Kidney Stone• She:Baking::He:Roasting• She:Blonde::He:Blond

Page 3: HW5 Part II + Biasin NLP

HW5PartII:Debiasing WordEmbeddings[Bolukabasi 2016]

• Tobereleasedtoday• Threesteps

• Identifygendersubspace(PCAusingSVD)• Neutralize• Equalize

• Evaluation• Analogycompletionforhe—she• AnalogycompletionforaWEevaluationdataset

• Threewordfiles:• Gender-definitionalwords(foridentifying thegendersubspace)• Gender-specificwords(foridentifyingwordstoneutralize)• Equalizedpairs(wordstoequalize)

Page 4: HW5 Part II + Biasin NLP

TheGeometryofGender

she

he

her

his woman

man

female

maleMary

John

Gender(he-she) AxisFirst Principal Component

Page 5: HW5 Part II + Biasin NLP

PrincipalComponentAnalysis

• PrincipalComponents(PC)areorthogonaldirectionsthatcapturemostofthevarianceinthedata.• 1st PC– direction ofgreatestvariabilityindata

• 2nd PC– Next orthogonal(uncorrelated)direction ofgreatestvariability(removeallvariability infirstdirection,thenfindnextdirectionofgreatestvariability)

• Andsoon…

Page 6: HW5 Part II + Biasin NLP

PrincipalComponentAnalysis(PCA)

• Letv1,v2,…,vd denotethedprincipalcomponents.• Visorthonormal

• LetX=[x1,x2,…,xn](columnsarethedatapoints)• Datapointsarecentered

• Findvectorthatmaximizessamplevarianceofprojecteddata• Findvectorthatminimizes theaveragereconstruction error

Page 7: HW5 Part II + Biasin NLP

PrincipalComponentAnalysis(PCA)

• Blackboard

Page 8: HW5 Part II + Biasin NLP

Identify GenderSubspace

Page 9: HW5 Part II + Biasin NLP

Neutralizeandequalize

Page 10: HW5 Part II + Biasin NLP

NeutralizeandEqualize

• B:gendersubspace• w_B:projectionofwonB• BlackBoard

Page 11: HW5 Part II + Biasin NLP

Agenda

• Introduction• GenderBiasinNLPtasks• CounterfactualData-Augmentation• GenderBiasinRNNLanguageModels• NeuralCoreference ResolutionBasics• GenderBiasinCoreference Resolution

Page 12: HW5 Part II + Biasin NLP

NaturalQuestions• Doesbiasexistdownstreamtasks?• Doesmitigatingbiasinwordembeddings alsomitigatebiasinthedownstreamtasks?• Doesmitigatingbiasinwordembeddings impacttheperformanceofthedownstreamtasks?

12

Page 13: HW5 Part II + Biasin NLP

BiasinNLPtasks

• Biasinlanguagemodeling • BiasinCoreference resolution

Page 14: HW5 Part II + Biasin NLP

BiasinNLPtasks[Lu,18]

• Definitionofbias:• CausalTesting• DefineMatchedpairsofindividuals(instances) thatdifferinonlyatargetedconcept(gender)

• Calculatedifference inoutcomes(conditional log-likelihood)

• Causal influence oftheconcept inthescrutinizedmodel

14

Figure:TwomatchedPairs

Page 15: HW5 Part II + Biasin NLP

BiasinNLPtasks[Lu,18]

• MatchedPairs• Templates: He/She isa/an|[OCCUPATION]• Aggregatetemplates• Aggregateoccupationwords(crosslistedfromUSlabordataandlanguagemodelvocabulary)

15

Figure:TwomatchedPairs

Page 16: HW5 Part II + Biasin NLP

HowtoEliminatetheBias

• Simplestsolution:Collectunbiaseddata• Notrealizable

• Changethemodelparameters/Changetheobjectivefunction

16

Page 17: HW5 Part II + Biasin NLP

Previously:Debiasing bychanging trainingobjective[Zhang,2018]

• Foreachanalogyinthedataset,weletx=(x1,x2,x3)• x1=he;x2=doctor;x3=doctor;x4=?

• OriginalModel(Lp)• Groundtruthforthefourthword• Estimate forthefourthword:

• AdversarialModel(LA)• Estimate forAdversarial network:• Ground truth forAdversarial Network:

Page 18: HW5 Part II + Biasin NLP

Previously:Debiasing bychanging themodelparameters

• Debiasing theembeddinglayer?

18

Page 19: HW5 Part II + Biasin NLP

WordEmbeddings:TrainableorFixed?

WordEmbedding canbeusedtoreplacewordsasinputstothemodel• Pros

• Efficient• HandleOOVcases ifthetrainingdataset issmall

• Cons:• Cannottailortothetask

• Debiasing wordembeddingmaybehelpful

WordEmbedding canbetrainedaspartofthemodel• Pros:

• LearnUseful representations specific tothetask

• Cons:• Expensive• Datasetmight betoosmall tolearn useful

representations• Datasetmight notcover allthevocabularies

• DebiasingWordembeddingmaynotbehelpful• Destroy themodel• Biasisrelearned

19

Page 20: HW5 Part II + Biasin NLP

HowtoEliminatetheBias

• Simplestsolution:Collectunbiaseddata• Notrealizable

• Fixthemodel/Changetheobjectivefunction• Invasive,couldhurtperformance• Model-dependent

• SynthesizeUnbiaseddata• Model-agnostic• Counterfactual DataAugmentation

20

Page 21: HW5 Part II + Biasin NLP

Debiasing bySynthesizingdata:CounterfactualDataAugmentation

21

• Generateanewsentencebyflippinggender-specificwordstotheircounterpartsofoppositegender• Addthenewsentencestothetrainingdata• Trainanewmodel

Page 22: HW5 Part II + Biasin NLP

CounterfactualDataAugmentation

• Identifythelistofgenderedwordpairs• (he,she), (man,woman),(actor,actress), (monk,nun),(actors,actresses),…..

• Makesurethattheflippedsentencesaregrammaticallycorrect• “BillClinton’swifeisHillary."

• Can’tflip!BillClinton’shusband isHillary.• Rule:Ifthegenderedwordreferstothesameperson/entitywithapropernoun,weshallnotflip.

• Handleothercornercases• Ex:her(his/him)

• CouldbeappliedtootherNLPtasks

22

Page 23: HW5 Part II + Biasin NLP

Experiment1:LanguageModeling

• Models:• AbenchmarkLSTM

• Embeddingsize:1500• LSTMcellsize:1500

• Debiasing :• Debias thetrainedembedding[baseline]()• CDA(naïve):Flipeverygender-specificwordswithout anygrammaticalconstraints• CDA(grammar):CDA(naïve)+grammaticalconstraint• Initializetheembedding layerfrombaselineandtrainonaugmenteddataset()

• Data:• Wiki-text2dataset• 36718sentences, atleast7579sentences withonegender-specific word

23

Page 24: HW5 Part II + Biasin NLP

Results

• OccupationBias• Negativeoccupation bias:biased towardsfemale;Positiveoccupationbias:biased towardsmale• Thebiasintheoriginal model roughlyaligns withexpectations ongender-occupation stereotypesintherealworld

• ApplyingCDAconsistentlymitigatebiasforalmostalloccupations.

24

Page 25: HW5 Part II + Biasin NLP

Results

25

• AOB:AggregateOccupationBias;TestPerp:TestPerplexity• BothCDAmitigatebiaswhilepreservingtheperformance

• CDA(naïve)hassurprisinglybetterperformance

Page 26: HW5 Part II + Biasin NLP

Results

26

• Apply wordembeddingdebiasing afterthemodel istrained()greatlyreducesbias,butalsodestroysthemodelperformance• Reasonforlowbias:lowvarianceoftheoutputscoredistribution

• Applywordembeddingdebiasing ()andcontinuetrainingontheaugmenteddataset:• Reintroducebiasback

Page 27: HW5 Part II + Biasin NLP

BiasinCoreference Resolution

27

Page 28: HW5 Part II + Biasin NLP

Coreference ResolutionBasics

• Identifyallmentionsthatrefertothesamerealworldentity• Mentions:words/phrases thatreferstoarealentity intheworld• Antecedent ofamention:othermention/mentions thatprecedes saidmention,whichreferstothesame entity

Page 29: HW5 Part II + Biasin NLP

Coreference ResolutioninTwoSteps

• Detectthementions(easy)

• Clusterthementions(hard)

Page 30: HW5 Part II + Biasin NLP

AMentionRankingSystem[clark &Manning,2016]

• Assigneachmentionitshighestscoringcandidateantecedentaccordingtothemodel• DummyNAmentionallowsmodeltodecline linkingthecurrentmentiontoanything(“singleton”or“first”mention)

Page 31: HW5 Part II + Biasin NLP

AMentionRankingSystem[clark &Manning,2016]

Page 32: HW5 Part II + Biasin NLP

AMentionRankingSystem[clark &Manning,2016]

Page 33: HW5 Part II + Biasin NLP

AMentionRankingSystem[clark &Manning,2016]

• TestTime:• Clusterthepairs

Page 34: HW5 Part II + Biasin NLP

NeuralCoref Model[clark &Manning,2016]

Page 35: HW5 Part II + Biasin NLP

CDAforNeuralCoref Resolution

Page 36: HW5 Part II + Biasin NLP

BiasinCoreference Resolution

36

• OccupationBias• Negativeoccupation bias:biased towardsfemale;Positiveoccupationbias:biased towardsmale• Thebiasintheoriginal model roughlyaligns withexpectations ongender-occupation stereotypesintherealworld

• ApplyingCDAconsistentlymitigatebiasforalmostalloccupations.

Page 37: HW5 Part II + Biasin NLP

BiasinCoreference Resolution

37

• Pretrained Embedding(Word2vec)• AdditiveEffectof:

• Fixingtheembeddings usingdebiasing• Fixingotherparametersusingcounterfactualdataaugmentation

Page 38: HW5 Part II + Biasin NLP

BiasinCoreference Resolution

38

Page 39: HW5 Part II + Biasin NLP

Summary

• Genderbiasexistsindownstreamtasks• LanguageModels• Coreference Resolution

• Caneffectivelyreducebiasbytrainingonaugmenteddataset• Previousmethodsofaddressingbiasinwordembeddings

• Hurtsperformance ifdoneafteramodel istrained• Reintroduces thebiasbackifinitialized beforeamodel istrained• Additiveeffect iftheembedding ispretrained

39

Page 40: HW5 Part II + Biasin NLP

Questions?

• References:• T.Bolukbasi,K.-W.Chang,J.Y.Zou,V.Saligrama,andA.T.Kalai,“Manistocomputerprogrammeraswomanistohomemaker? debiasing wordembeddings,” inAdvances inneuralinformationprocessingsystems, 2016,pp.4349–4357.

• K.Lu,P.Mardziel,F.Wu,P.Amancharla,andA.Datta,“Genderbias inneuralnaturallanguage processing,”arXiv preprintarXiv:1807.11714,2018.

• KevinClarkandChristopherDManning.Deepreinforcement learningformention-ranking corefer- ence models.arXiv preprintarXiv:1609.08667,2016b.

• KentonLee,Luheng He,MikeLewis,andLukeZettlemoyer. End-to-endneuralcoreference resolution.arXiv preprintarXiv:1707.07045,2017.

40