<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Gender Bias in Contextualized Word Embeddings</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2019</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10144868</idno>
					<idno type="doi">10.18653/v1/N19-1064</idno>
					<title level='j'>Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies</title>
<idno></idno>
<biblScope unit="volume">1</biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Jieyu Zhao</author><author>Tianlu Wang</author><author>Mark Yatskar</author><author>Ryan Cotterell</author><author>Vicente Ordonez</author><author>Kai-Wei Chang</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[In this paper, we quantify, analyze and mitigate gender bias exhibited in ELMo’s contextualized word vectors. First, we conduct several intrinsic analyses and find that (1) training data for ELMo contains significantly more male than female entities, (2) the trained ELMo embeddings systematically encode gender information and (3) ELMo unequally encodes gender information about male and female entities. Then, we show that a state-of-the-art coreference system that depends on ELMo inherits its bias and demonstrates significant bias on the WinoBias probing corpus. Finally, we explore two methods to mitigate such gender bias and show that the bias demonstrated on WinoBias can be eliminated.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>Distributed representations of words in the form of word embeddings <ref type="bibr">(Mikolov et al., 2013;</ref><ref type="bibr">Pennington et al., 2014)</ref> and contextualized word embeddings <ref type="bibr">(Peters et al., 2018;</ref><ref type="bibr">Devlin et al., 2018;</ref><ref type="bibr">Radford et al., 2018;</ref><ref type="bibr">McCann et al., 2017;</ref><ref type="bibr">Radford et al., 2019)</ref> have led to huge performance improvement on many NLP tasks. However, several recent studies show that training word embeddings in large corpora could lead to encoding societal biases present in these human-produced data <ref type="bibr">(Bolukbasi et al., 2016;</ref><ref type="bibr">Caliskan et al., 2017)</ref>. In this work, we extend these analyses to the ELMo contextualized word embeddings.</p><p>Our work provides a new intrinsic analysis of how ELMo represents gender in biased ways. First, the corpus used for training ELMo has a significant gender skew: male entities are nearly three times more common than female entities, which leads to gender bias in the downloadable pre-trained contextualized embeddings. Then, we apply principal component analysis (PCA) to show that after training on such biased corpora, there exists a lowdimensional subspace that captures much of the gender information in the contextualized embeddings. Finally, we evaluate how faithfully ELMo preserves gender information in sentences by measuring how predictable gender is from ELMo representations of occupation words that co-occur with gender revealing pronouns. Our results show that ELMo embeddings perform unequally on male and female pronouns: male entities can be predicted from occupation words 14% more accurately than female entities.</p><p>In addition, we examine how gender bias in ELMo propagates to the downstream applications. Specifically, we evaluate a state-of-the-art coreference resolution system <ref type="bibr">(Lee et al., 2018)</ref> that makes use of ELMo's contextual embeddings on WinoBias <ref type="bibr">(Zhao et al., 2018a)</ref>, a coreference diagnostic dataset that evaluates whether systems behave differently on decisions involving male and female entities of stereotyped or anti-stereotyped occupations. We find that in the most challenging setting, the ELMo-based system has a disparity in accuracy between pro-and anti-stereotypical predictions, which is nearly 30% higher than a similar system based on GloVe <ref type="bibr">(Lee et al., 2017)</ref>.</p><p>Finally, we investigate approaches for mitigating the bias which propagates from the contextualized word embeddings to a coreference resolution system. We explore two different strategies: (1) a training-time data augmentation technique <ref type="bibr">(Zhao et al., 2018a)</ref>, where we augment the corpus for training the coreference system with its genderswapped variant (female entities are swapped to male entities and vice versa) and, afterwards, retrain the coreference system; and (2) a test-time embedding neutralization technique, where input contextualized word representations are averaged with word representations of a sentence with entities of the opposite gender. Results show that testtime embedding neutralization is only partially effective, while data augmentation largely mitigates bias demonstrated on WinoBias by the coreference system.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Related Work</head><p>Gender bias has been shown to affect several realworld applications relying on automatic language analysis, including online news <ref type="bibr">(Ross and Carter, 2011)</ref>, advertisements <ref type="bibr">(Sweeney, 2013)</ref>, abusive language detection <ref type="bibr">(Park et al., 2018)</ref>, machine translation <ref type="bibr">(Font and Costa-juss&#224;, 2019;</ref><ref type="bibr">Vanmassenhove et al., 2018)</ref>, and web search <ref type="bibr">(Kay et al., 2015)</ref>. In many cases, a model not only replicates bias in the training data but also amplifies it <ref type="bibr">(Zhao et al., 2017)</ref>.</p><p>For word representations, <ref type="bibr">Bolukbasi et al. (2016)</ref> and <ref type="bibr">Caliskan et al. (2017)</ref> show that word embeddings encode societal biases about gender roles and occupations, e.g. engineers are stereotypically men, and nurses are stereotypically women. As a consequence, downstream applications that use these pretrained word embeddings also reflect this bias. For example, <ref type="bibr">Zhao et al. (2018a)</ref> and <ref type="bibr">Rudinger et al. (2018)</ref> show that coreference resolution systems relying on word embeddings encode such occupational stereotypes. In concurrent work, <ref type="bibr">May et al. (2019)</ref> measure gender bias in sentence embeddings, but their evaluation is on the aggregation of word representations. In contrast, we analyze bias in contextualized word representations and its effect on a downstream task.</p><p>To mitigate bias from word embeddings, Bolukbasi et al. ( <ref type="formula">2016</ref>) propose a post-processing method to project out the bias subspace from the pre-trained embeddings. Their method is shown to reduce the gender information from the embeddings of gender-neutral words, and, remarkably, maintains the same level of performance on different downstream NLP tasks. <ref type="bibr">Zhao et al. (2018b)</ref> further propose a training mechanism to separate gender information from other factors. However, <ref type="bibr">Gonen and Goldberg (2019)</ref> argue that entirely removing bias is difficult, if not impossible, and the gender bias information can be often recovered. This paper investigates a natural follow-up question: What are effective bias mitigation techniques for contextualized embeddings?</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Gender Bias in ELMo</head><p>In this section we describe three intrinsic analyses highlighting gender bias in trained ELMo contextual word embeddings <ref type="bibr">(Peters et al., 2018)</ref>. We show that (1) training data for ELMo contains sig-#occurrence #M-biased occs. #F-biased occs. M 5,300,000 170,000 81,000 F 1,600,000 33,000 36,000</p><p>Table <ref type="table">1</ref>: Training corpus for ELMo. We show total counts for male (M) and female (F) pronouns in the corpus, and counts corresponding to their cooccurrence with occupation words where the occupations are stereotypically male (M-biased) or female (Fbiased).</p><p>nificantly more male entities compared to female entities leading to gender bias in the pre-trained contextual word embeddings (2) the geometry of trained ELMo embeddings systematically encodes gender information and (3) ELMo propagates gender information about male and female entities unequally.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1">Training Data Bias</head><p>Table <ref type="table">1</ref> lists the data analysis on the One Billion Word Benchmark <ref type="bibr">(Chelba et al., 2013)</ref> corpus, the training corpus for ELMo. We show counts for the number of occurrences of male pronouns (he, his and him) and female pronouns (she and her) in the corpus as well as the co-occurrence of occupation words with those pronouns. We use the set of occupation words defined in the WinoBias corpus and their assignments as prototypically male or female <ref type="bibr">(Zhao et al., 2018a)</ref>. The analysis shows that the Billion Word corpus contains a significant skew with respect to gender: (1) male pronouns occur three times more than female pronouns and</p><p>(2) male pronouns co-occur more frequently with occupation words, irrespective of whether they are prototypically male or female.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2">Geometry of Gender</head><p>Next, we analyze the gender subspace in ELMo.</p><p>We first sample 400 sentences with at least one gendered word (e.g., he or she from the OntoNotes 5.0 dataset <ref type="bibr">(Weischedel et al., 2012)</ref> and generate the corresponding gender-swapped variants (changing he to she and vice-versa). We then calculate the difference of ELMo embeddings between occupation words in corresponding sentences and conduct principal component analysis for all pairs of sentences.</p><p>Figure <ref type="figure">1</ref> shows there are two principal components for gender in ELMo, in contrast to GloVe which only has one <ref type="bibr">(Bolukbasi et al., 2016)</ref>. The two principal components in ELMo seem to represent the gender from the contextual information (Contextual Gender) as well as the gender embedded in the word itself (Occupational Gender). To visualize the gender subspace, we pick a few sentence pairs from WinoBias <ref type="bibr">(Zhao et al., 2018a)</ref>. Each sentence in the corpus contains one gendered pronoun and two occupation words, such as "The developer corrected the secretary because she made a mistake" and also the same sentence with the opposite pronoun (he). In Figure <ref type="figure">1</ref> on the right, we project the ELMo embeddings of occupation words that are co-referent with the pronoun (e.g. secretary in the above example) for when the pronoun is male (blue dots) and female (orange dots) on the two principal components from the PCA analysis. Qualitatively, we can see the first component separates male and female contexts while the second component groups male related words such as lawyer and developer and female related words such as cashier and nurse.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3">Unequal Treatment of Gender</head><p>To test how ELMo embeds gender information in contextualized word embeddings, we train a classifier to predict the gender of entities from occupation words in the same sentence. We collect sentences containing gendered words (e.g., he-she, father-mother) and occupation words (e.g., doctor) 1 from the OntoNotes 5.0 corpus <ref type="bibr">(Weischedel et al., 2012)</ref>, where we treat occupation words as a mention to an entity, and the gender of that entity is taken to the gender of a co-referring gendered word, if one exists. For example, in the sentence "the engineer went back to her home," we take engineer to be a female mention. Then we split all such instances into training and test, with 539 and 62 instances, respectively and augment these sentences by swapping all the gendered words with words of the opposite gender such that the numbers of male 1 We use the list collected in <ref type="bibr">(Zhao et al., 2018a)</ref> and female entities are balanced.</p><p>We first test if ELMo embedding vectors carry gender information. We train an SVM classifier with an RBF kernel<ref type="foot">foot_0</ref> to predict the gender of a mention (i.e., an occupation word) based on its ELMo embedding. On development data, this classifier achieves 95.1% and 80.6% accuracy on sentences where the true gender was male and female respectively. For both male and female contexts, the accuracy is much larger than 50%, demonstrating that ELMo does propagate gender information to other words. However, male information is more than 14% more accurately represented in ELMo than female information, showing that ELMo propagates the information unequally for male and female entities.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">Bias in Coreference Resolution</head><p>In this section, we establish that coreference systems that depend on ELMo embeddings exhibit significant gender bias. Then we evaluate two simple methods for removing the bias from the systems and show that the bias can largely be reduced.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1">Setup</head><p>We evaluate bias with respect to the WinoBias dataset <ref type="bibr">(Zhao et al., 2018a)</ref>, a benchmark of paired male and female coreference resolution examples following the Winograd format <ref type="bibr">(Hirst, 1981;</ref><ref type="bibr">Rahman and Ng, 2012;</ref><ref type="bibr">Peng et al., 2015)</ref>. It contains two different subsets, pro-stereotype, where pronouns are associated with occupations predominately associated with the gender of the pronoun, or anti-stereotype, when the opposite relation is true. ELMo improves the performance on the OntoNotes dataset by 5% but shows stronger bias on the WinoBias dataset. Avg. stands for averaged F1 score on the pro-and anti-stereotype subsets while "Diff." is the absolute difference between these two subsets. * indicates the difference between pro/anti stereotypical conditions is significant (p &lt; .05) under an approximate randomized test <ref type="bibr">(Graham et al., 2014)</ref>. Mitigating bias by data augmentation reduces all the bias from the coreference model to a neglect level. However, the neutralizing ELMo approach only mitigates bias when there are other strong learning signals for the task.</p><p>Each subset consists of two types of sentences: one that requires semantic understanding of the sentence to make coreference resolution (Semantics Only) and another that relies on syntactic cues (w/ Syntactic Cues). Gender bias is measured by taking the difference of the performance in pro-and antistereotypical subsets. Previous work <ref type="bibr">(Zhao et al., 2018a)</ref> evaluated the systems based on GloVe embeddings but here we evaluate a state-of-the-art system that trained on the OntoNotes corpus with ELMo embeddings <ref type="bibr">(Lee et al., 2018)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2">Bias Mitigation Methods</head><p>Next, we describe two methods for mitigating bias in ELMo for the purpose of coreference resolution:</p><p>(1) a train-time data augmentation approach and</p><p>(2) a test-time neutralization approach.</p><p>Data Augmentation <ref type="bibr">Zhao et al. (2018a)</ref> propose a method to reduce gender bias in coreference resolution by augmenting the training corpus for this task. Data augmentation is performed by replacing gender revealing entities in the OntoNotes dataset with words indicating the opposite gender and then training on the union of the original data and this swapped data. In addition, they find it useful to also mitigate bias in supporting resources and therefore replace standard GloVe embeddings with bias mitigated word embeddings from <ref type="bibr">Bolukbasi et al. (2016)</ref>. We evaluate the performance of both aspects of this approach.</p><p>Neutralization We also investigate an approach to mitigate bias induced by ELMo embeddings without retraining the coreference model. Instead of augmenting training corpus by swapping gender words, we generate a gender-swapped version of the test instances. We then apply ELMo to obtain contextualized word representations of the original and the gender-swapped sentences and use their average as the final representations.  <ref type="bibr">Gonen and Goldberg (2019)</ref>, where they show that entirely removing bias from an embedding is difficult and depends on the manner, by which one measures the bias.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3">Results</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Conclusion and Future Work</head><p>Like word embedding models, contextualized word embeddings inherit implicit gender bias. We analyzed gender bias in ELMo, showing that the corpus it is trained on has significant gender skew and that ELMo is sensitive to gender, but unequally so for male and female entities. We also showed this bias transfers to downstream tasks, such as coreference resolution, and explored two bias mitigation strategies: 1) data augmentation and 2) neutralizing embeddings, effectively eliminating the bias from ELMo in a state-of-the-art system. With increasing adoption of contextualized embeddings to get better results on core NLP tasks, e.g. BERT <ref type="bibr">(Devlin et al., 2018)</ref>, we must be careful how such unsupervised methods perpetuate bias to downstream applications and our work forms the basis of evaluating and mitigating such bias.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_0"><p>We use the &#957;-SVC formulation and tune the hyperparameter &#957;<ref type="bibr">(Chang and Lin, 2011)</ref> in the range of [0.1, 1] with a step 0.1.</p></note>
		</body>
		</text>
</TEI>
