<p>What word embeddings provide is the ability to trace analogies, an example <a href="https://krishansubudhi.github.io/deeplearning/2019/06/13/WordEmbeddings.html" rel="nofollow noreferrer">here</a>, a paper <a href="https://arxiv.org/pdf/1901.09813.pdf" rel="nofollow noreferrer">here</a></p>
<p><code>v('king') - v('man') ~ v('queen') - v('woman')</code></p>
<p>You can even visualize a projection of these vectors in a 2D plot, a great interactive example where you can explore not only gender analogies <a href="https://lamyiowce.github.io/word2viz/" rel="nofollow noreferrer">here</a></p>
<p>The strategy to find bias is, you hypothesize about some possible bias in the training data, then you look for those analogies that would exist in that biased view but not in a fair/unbiased view.</p>
<p><a href="https://i.stack.imgur.com/nSmlh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nSmlh.png" alt="enter image description here" /></a></p>
How to find gender bias in word embeddings?
<p>I have <code>glove.twitter.27B.200d.txt</code> word embeddings. These embeddings in <code>GloVe</code> format. I transfered it to <code>w2v</code> format using this code:</p>
<pre><code>model = KeyedVectors.load_word2vec_format(
&quot;data/glove.twitter.27B.200d.w2v.txt&quot;, binary=False
)
</code></pre>
<p><code>len(model.vocab) == 1193514</code></p>
<p>There is a gender bias in this word embeddings:</p>
<p><code>model.similarity(&quot;man&quot;, &quot;kitchen&quot;) == 0.32785824</code></p>
<p><code>model.similarity(&quot;woman&quot;, &quot;kitchen&quot;) == 0.40180725</code></p>
<p>I want to find a gender bias direction in this word embeddings, but not sure how.</p>