[RE] Double-Hard Debias: Tailoring Word Embeddings for Gender Bias Mitigation
Anonymous Author(s)
AfﬁliationAddress email
Reproducibility Summary
Scope of Reproducibility
The authors claim that the frequency of the words in the training corpus contributes to gender bias in the embeddings.
Removing this frequency component from embeddings along with neutralizing the gender component yields genderdebiased embeddings with new benchmarks on gender bias quantifying metrics.
Methodology
We use the authors code and verify the algorithm provided in the paper for consistency.
The double-hard debiasalgorithm is a post-training algorithm.
After applying this algorithm, we test the results on the different datasets used bythe authors to benchmark it.
We use the free google colab to run these experiments.
We add comments and renamevariables to improve the readability of the code in our release 1 .
Results
The authors use two sets of evaluations to prove the efﬁcacy of their algorithm.
First, they use neighborhood metric,
WEAT, and co-reference resolution task to quantify the gender bias in embeddings.
We were not able to reproduce thelatter task of co-reference resolution owing to the difﬁculty in the readability of the code.
Moreover, we report that theneighborhood metric test is not reproducible with the information provided by the authors in their paper and code.
Wetry to reproduce this by ﬁlling in our own assumptions but get drastically different results.
Second, they test their wordembedding quality on existing benchmarking tasks - word analogy and concept categorization.
This part is reproducibleto within 0.5% of the reported value.
What was easy
The author’s code readability is low, which we modify in our implementation.
Other than that, the code is providedin form of notebooks that run on the latest versions of all libraries.
We run these notebooks on the free google colab,making it economically feasible to reproduce.
So code and results are essentially easy to re-implement.
What was difﬁcult
It was difﬁcult to map the algorithm provided in the paper to the code implementation due to poor code writing standards
Introduction
Despite widespread use in natural language processing (NLP) tasks, word embeddings have been criticized for inheritingunintended gender bias from training corpora.
[1] highlight that in word2vec embeddings trained on the Google Newsdataset [2], “programmer” is more closely associated with “man” and “homemaker” is more closely associated with“woman”.
Such gender bias has also been shown to propagate in downstream tasks.
Despite plenty of work in thisﬁeld, with methods ranging from corpus level modiﬁcations to post-training modiﬁcations to embeddings, it remains anunsolved problem.
With this work, the authors combine two techniques to reduce gender bias in embeddings.
First, theyargue that the frequency of words in the corpus adds to the bias.
And thus use the work of [3] to remove the frequencycomponent from trained embeddings.
Second, they use the hard debias algorithm of [1], to remove the gender directionfrom the trained embeddings of most biased words.
Combining these two techniques, they benchmark the result of theiralgorithm by showcasing reduction in bias and limited loss of information in the resultant word embeddings.
Scope of reproducibility
The authors claim that the frequency of words in the training corpus contributes towards gender bias in the embeddings.
Removing this frequency component from embeddings along with neutralizing the gender component yields genderdebiased embeddings with new benchmarks.
• Claim 1: The double hard debias algorithm reduces gender bias signiﬁcantly.
This is veriﬁed on 3 benchmarking
datasets described in the section 3.2 below.
We showcase the outcome of our experiments of these in Table
and Table
• Claim 2: The above post-processing algorithm of gender debiasing doesn’t hamper the inherent use-case ofword embeddings.
This is veriﬁed on standard embedding quality measurement techniques described below.
We present the results of our experiments on these in Table 3.
Each
subsection in section
4 refers to above claims and talks
about the level and ease of reproducibility
of above claimsand experiments as performed by the authors for these claims.
Methodology
We use the authors code to ease our understanding of the experiments and to reproduce the claims presented by theauthor.
We used google colab for re-running these experiments.
For complete understanding of the algorithm, we usedthe mixture of paper and code.
3.1 Model descriptions
The authors introduce the double hard debias algorithm in this paper.
This is a post-training algorithm that works afterthe embeddings have been trained to reduce the gender bias in those embeddings.
Hence, this algorithm requires noparameters to train.
First, the frequency information from these embeddings is removed.
This is done by calculating theﬁrst k principal components of the trained embeddings.
The value of k is empirically determined.
These projectionsof embeddings along these k components are then removed from the embeddings.
Second, the gender direction isdetermined by averaging the difference of 10 gender pair words.
Then the projection of embeddings along this genderdirection is removed.
The double hard debias is now done.
3.2 Datasets and Experimental Setup
The authors perform two sets of experiments to highlight the efﬁcacy of their approach.
In the ﬁrst set, they prove thereduction in gender bias through 3 methods: co-reference resolution via the [4] and the OntoNotes 5.0 dataset, the
WEAT, the NeighbourHood Metric.
• Co-reference Resolution : Coreference resolution aims at identifying noun phrases referring to the same entity.
[4] identiﬁed gender bias in modern coreference systems, e
g. “doctor” is prone to be linked to “he”
and also created a new WINO bias dataset to quantify the bias in word embeddings.
• WEAT : The Word Embeddings Association Test is a permutation test used to measure bias.
The authors
consider male names and females names as attribute sets and compute the differential association of two sets
of target words as used in [5]
and the gender attribute sets.
Embeddings
[Table]
• Neighbourhood Metric : Introduced by [6], this is a metric to measure bias by clustering.
The authors take
the top k most biased words according to their cosine similarity with gender direction in the original GloVe
[7] embedding space.
They then run k-Means to cluster them into two clusters and compute the alignment
accuracy with respect to gender, results are presented in Table 2.
The lower the accuracy, the less the gender
bias in the embeddings.
In the second set [Table] the authors prove the information retention of the embeddings post applying their algorithm.
Theyuse two tasks for it: word analogy task and concept
categorization task.
• Word Analogy :
Given three words A, B and C, the analogy task is to ﬁnd word D such that “A is to B as Cis to D”.
In the experiments, D is the word that maximize the cosine similarity between D and C - A + B.
The authors evaluate all non-debiased and debiased embeddings on the MSR [8] word analogy task, which
contains 8000 syntactic questions, and on a second Google word analogy [9] dataset that contains 19,
(Total) questions, including 8,869 semantic (Sem) and 10, 675 syntactic (Syn) questions.
• Concept Categorization :
The goal of concept categorization is to cluster a set of words into different
categorical subsets.
For example, “sandwich” and “hotdog” are both food and “dog” and “cat” are animals.
The clustering performance is evaluated in terms of purity [10] - the fraction of the total number of the words
that are correctly classiﬁed.
Experiments are conducted on four benchmark datasets: the Almuhareb-Poesio (AP) dataset [11]; the ESSLLI 2008 [12]; the Battig 1969 set [13] and the BLESS dataset [14].
All of the above are standard datasets and evaluation methods which do not require any post-processing and can bedirectly used for testing any word embedding.
Our code used to replicate the above experiments can be found here.
3.3 Computational requirements
We used the free google colab to run our experiments.
Apart from the data download time, all these experiments runwithin 30 mins on the free google GPU setup.
For experimenting with various variants of Glove Embedding, we use thelink 3 provided by the authors.
Results
Barring the two tests in claim 1 that highlight the reduction in gender bias of their method, we were able to reproduceall other results published by the authors and thus were able to fully verify claim 2.
[Table]
4.1 Results reproducing original paper
[Figure]
4.1.1 Result
[Figure]
This section veriﬁes the claim 1 of the authors that highlights the reduction of gender bias on 3 metrics.
We successfullyexecuted the WEAT test and got results as presented in Table 1 comparable to the ones published by authors.
We werenot able to reproduce 2 of these.
The Neighbourhood Metric calculation is largely not reproducible because of tworeasons:
Authors do not state whether they have normalized word vectors or not before performing this experiment.
Authors do not provide the random state with which they have initialised the K-means clustering which lead to
different results.
[Figure]
We try to replicate this using our own set of assumptions but are not able to reproduce the authors claims.
We replicateit via following assumptions:
We experiment with both normalized and unnormalized vectors, and report the best result that came withunnormalized vectors in Table 2.
We experiment with various random states and report the one with best outcome.
We remove frequency feature along the second principal component as this is the one reported by authors in
Figure to have the best performance.
Also
there is an unexplained mismatch between the above ﬁgure andresults posted in Table 2.
The best score in the above ﬁgure is close to which is calculated on Top
male and female words
, but
in
the table,
authors showcase the best result to be close to 0.59.
This mismatch of
outcomes is unexplained in the paper or the code.
We add the t-SNE [15] visualization comparison between the ones published by the authors and the ones which wegot in Figure 5.
We are unable to reproduce these visualizations as one owing to the challenges and differences inassumptions posted above.
The second result which we were not able to reproduce is the co-reference resolution task.
Due to bad readability of theauthors code, we were unable to execute this experiment. [Figure] [Figure] [Figure]
4.1.2 Result
This veriﬁes claim 2 of the authors that the resultant word embeddings retain the semantic and associative informationwhich makes this distributed word embeddings useful for natural language processing tasks.
The authors use the
Word Analogy task and Concept Categorization task as explained above in 3.2.
We were able to reproduce the resultspublished by authors to within 0.5% accuracy and present the outcomes in Table 3.
4.2 Results beyond the paper
In here, we present the qualitative analysis we did to measure the gender bias aspect of the word embeddings.
We drawcomparison with heavily biased words and their association with gender pair words - he
and she.
In Table 4, we presentthe difference in cosine similarity of a few biased words with respect to ’he’ and ’she’. With this we try to showcasethat the authors’ algorithm has indeed contribute towards reduced gender bias.
[Table]
[Table]
biased towards ’she’ and positive means that the words are biased ’he’.
Discussion
The authors present a viable post-training method to reduce gender bias from non-contextual word embeddings.
Theauthor uses 3 benchmarks to showcase a reduction in gender bias.
However, we were only able to reproduce only 1 ofthe benchmarks, with different results on the neighborhood metric.
We were strongly able to reproduce the experiments that validate claim 2 of the paper, which showcases that the paper’sdouble debias algorithm doesn’t hamper the useful properties of word embeddings.
5.1 What was easy
The authors code for claim 2 and double debias algorithm was easy to run as it was shared in the form of jupyternotebook.
The pseudo-code for the algorithm was easy to understand and this made it easier to follow in the give code.
The authors structured the claims in the paper very well, which made it easier to match experiments with these claims.
5.2 What was difﬁcult
The authors code lacked structure for claim 1 and other sub parts of the paper, and thus it was difﬁcult to follow.
For theco-reference resolution task, a sub part of claim 1, we spent a lot of time to execute the reference code but we were stillunable to execute the experiment owing to the poor code organization and readability.