On the interpretation and significance of bias metrics in texts: a PMI-based approach

In recent years, the use of word embeddings has become popular to measure the presence of biases in texts. Despite the fact that these measures have been shown to be effective in detecting a wide variety of biases, metrics based on word embeddings lack transparency, explainability and interpretability. In this study, we propose a PMI-based metric to quantify biases in texts. We show that this metric can be approximated by an odds ratio, which allows estimating the confidence interval and statistical significance of textual bias. We also show that this PMI-based measure can be expressed as a function of conditional probabilities, providing a simple interpretation in terms of word co-occurrences. Our approach produces a performance comparable to GloVe-based and Skip-gram-based metrics in experiments of gender-occupation and gender-name associations. We discuss the advantages and disadvantages of using methods based on first-order vs second-order co-occurrences, from the point of view of the interpretability of the metric and the sparseness of the data.

In recent years, the use of word embeddings has become popular to measure the presence of biases in texts. Despite the fact that these measures have been shown to be effective in detecting a wide variety of biases, metrics based on word embeddings lack transparency, explainability and interpretability. In this study, we propose a PMI-based metric to quantify biases in texts. We show that this metric can be approximated by an odds ratio, which allows estimating the confidence interval and statistical significance of textual bias. We also show that this PMI-based measure can be expressed as a function of conditional probabilities, providing a simple interpretation in terms of word cooccurrences. Our approach produces a performance comparable to GloVe-based and Skipgram-based metrics in experiments of genderoccupation and gender-name associations. We discuss the advantages and disadvantages of using methods based on first-order vs secondorder co-occurrences, from the point of view of the interpretability of the metric and the sparseness of the data.

Introduction
Techniques for estimating the semantic closeness between words are a core component in a wide va-riety of NLP applications. One particularly prolific idea behind these methods is that the meaning of words is at least partially determined by the context in which they appear (Harris, 1954), of which word embeddings are their most popular instantiation (Mikolov et al., 2013;Pennington et al., 2014).
In particular, word embedding-based approaches have been used to detect and quantify the presence of gender, ethnic, racial and other stereotypes in texts (Lenton et al., 2009;Caliskan et al., 2017;Garg et al., 2018). As the size of corpora that are fed into AI applications keeps growing, the need for efficient and accurate techniques for the analysis of biases has become an urgent matter (Font and Costa-jussà, 2019).

Bias quantification in texts
Consider two sets of target words A and B, and a set of context words C. Generally speaking, bias measures seek to quantify how much more the words of C are associated with the words of A than with arXiv:2104.06474v1 [cs.CL] 13 Apr 2021 those of B (or vice versa). Consider for instance the case of gender biases in occupations: the fact that certain jobs (C) are more likely to be associated with one particular gender (A) than other(s) (B). Here target words are often taken to be pronouns and simple gendered nouns, e.g., A = {she, her, woman,..} and B = {he, him, man,...} (Garg et al., 2018;Caliskan et al., 2017;Gálvez et al., 2019;Lenton et al., 2009;Lewis and Lupyan, 2020).
A popular choice for C is to consider one word at a time, i.e. estimating how a specific job (such as nurse, doctor or engineer) is associated with the two previously defined sets. Once these sets have been defined, most metrics can be parametrized as a difference between the similarities between A and C, on the one hand, and B and C, on the other (Lenton et al., 2009;Garg et al., 2018;Lewis and Lupyan, 2020); in most cases subtracting the similarities A vs C and B vs C, One particularly influential case that belongs to this class of metrics is that of Caliskan et al. (2017), who define In the present paper we propose a metric to measure biases that follows eq. 1 based on Point-wise Mutual Information (PMI) (Church and Hanks, 1990;Jurafsky and Martin, 2000) as our plugin measure for similarity between words.
PMI is a non-parametric measure of statistical association derived from information theory (Fano, 1961). Given two words w x and w y , PMI is defined as Here, p(w x , w y ) is the probability of cooccurrence of words w x and w y in a given window of k words. The PMI (Equation 3) compares the probability of co-occurrence of the words w x and w y with that of the case in which w x and w y are independent. Moreover, the same expression (eq. 3) can be used to calculate associations between word-lists X and Y , Here p(X, Y ) is the probability of co-occurrence between any word in X with anyone in Y . Similarly, p(X) and p(Y ) are the probability of occurrence of any word in X and any word in Y , respectively. The usage of PMI in the study of textual biases is not new (Gálvez et al., 2019). However, in this article we will show a number of statistical and interpretability benefits associated with PMI-based measures that have been overlooked until now.
In particular, we make the following contributions: • In section 2 we show how the bias measurement using PMI can be approximated by an odds ratio. This comes with a number of statistical perks, including the possibility of performing computationally unexpensive null hypothesis statistical testing • In section 3 we demonstrate that methods based on Glove, Skip-gram and PMI produce comparable results in Caliskan et al. (2017) tasks, in which statistics of gender biases in occupations and names are compared with the biases measured in texts • In section 4 we contend that the use of PMI in bias metrics is substantially more transparent and interpretable than counterparts based on word embedding techniques 2 Approximation of the PMI-based bias metric to an odds ratio PMI can be expressed in terms of context words' conditional probability, Therefore, the PMI-based bias can be rewritten as follows, To compute the PMI-based bias, we can estimate probabilities via maximum likelihood, Here f A,C and f B,C represent the number of times words in C appear in the context of words in A and B, respectively, and f A,nC and f B,nC represent how many times words in C appear in the context of words that are not in A and B, respectively. See contingency table in Table 1 for reference.
In the case in which the following condition is fulfilled, equation 5 can be approximated by where OR is the odds ratio associated with Table  1. This quantity has a confidence interval given by This last approximation considers condition 6.

Experiments
To compare the measure of bias based on PMI with those based on embeddings, we follow the approach of Caliskan et al. (2017). They compare biases present in texts with those of two census datasets: (1) an U.S. occupation-gender dataset, which contains the percentage of participation of women in a list of occupations, and (2) an U.S. name-gender dataset, which shows, for a list of androgynous names, the percentage of people with that name who are women.
Experimental setup. We build a corpus with articles from an English Wikipedia dump from august 2014. We pre-process the dump by removing non alpha-numeric symbols, removing articles with less than 50 tokens and sentence splitting. We use a window size of 10 in all models and we ignore words with less than 100 occurrences, resulting in a vocabulary of 173,056 words. Word embeddings with 300 dimensions are trained with skip-gram with negative-sampling (SGNS) and GloVe. For SGNS we use the word2vec implementation of the Gensim library (Řehůřek and Sojka, 2010) with default hyperparameters. GloVe is trained with the original implementation (Pennington et al., 2014) with 100 iterations. This version uses by default additive word representations, in which each word embedding is the sum of its corresponding context and word vectors.
Using PMI, SGNS and GloVe, we replicate the gender bias experiments performed in the Word Embedding Factual Association Tests (WEFATs) in Caliskan et al. (2017). To represent female and male contexts we use the same sets of words as in Caliskan et al. (2017) 1 . The female proportions for names and occupations in the U.S. were extracted from the datasets provided by Will Lowe's cbn R library 2 , which contains tools for replicating Caliskan et al. (2017).
For both occupations and names association tests, we assess the correlation between the realworld female proportion and the female bias as measured by PMI, SGNS and GloVe. Female bias refers to the bias metrics where A and B represent the lists of female and male words, respectively. Therefore, positive values imply that the context word is more associated with female words than with male ones.
We emphasize that the objective of this experiment is not to find which method produces a greater correlation between the biases in the U.S. census data and the ones from Wikipedia -the aim is to show that the three bias metrics produce comparable correlations in these tasks.
Results. Figure 1 and Table 2 show the scatterplots and Pearson's r coefficients for each of the six experiments (two association tests with three bias measures each). Weighted Pearson's r coefficients are shown in Table 2 for the PMI-based metric for both association tests. Weighted Pearson's r takes into account the variance of each point, thus reducing the influence of relatively noisy estimates on the correlation. This type of adjustment is not feasible with embeddings-based methods, which lack a natural notion of statistical variability.
In the androgynous names setup, we find similar degrees of correlation for the three bias measurement methods, for both weighted and unweighted correlations. In the occupation experiment, we find similar values of Pearson's r for the three methods; and a slight increase in the correlation is observed when the variability of bias is considered in the estimation.
All in all, our results show that the embeddingbased methods and the PMI-based method produce comparable performances in the WEFAT tasks of Caliskan et al. (2017).

Significance testing
A permutations test that shuffles target words (A, B) is a way that has been used in similar metrics in order to calculate statistical significance. (Caliskan et al., 2017;Garg et al., 2018;Charlesworth et al., 2021). A limitation of this technique is that, for the test to have enough power, many words are required in the lists. To show this, we perform permutation tests in the occupations experiment using the SGNS-based method. We shuffle the words from lists A and B repeatedly and estimate the probability of obtaining an absolute value of bias that is equal to or greater than the one obtained in the original configuration (North et al., 2002). In Figure 2 we compare the p-values of the permutation test in the SGNS-based metric with the p-values of the odds ratio test of the PMI-based metric. A Benjamini-Hochberg correction was applied to the p-values obtained by both methods to account for multiple comparisons. The permutation test indicates that only the two words with the highest female SGNS-based bias are significantly different from zero. This supports our hypothesis that permutations tests don't have enough power whenever word-lists are small. In contrast, in the case of the PMI-based metric, the odds ratio test indicates that the majority of points are significantly different from zero, with the exception of some points with bias values close to zero.

Interpretability
Model interpretability has become a core topic of research in NLP. Loosely speaking, it refers to the degree to which a human can understand the cause of a decision -which has become progressively more complex as current models steer away from simpler setups.
In general terms, there seems to be an inverse relationship between complexity of a model and its interpretability. In simpler models it tends to be easier to understand which is the true process of the model. This aspect is called faithfulness (Tim, 2019) 3 .
Although there are many studies on how the vector space of word embeddings is formed (Levy and Goldberg, 2014;Levy et al., 2015;Ethayarajh et al., 2019), there is no transparent interpretation of bias measurements formed by cosine distances between word-vectors. This can be partially observed in the growing literature which tries to construct metrics in order to measure word embedding interpretability (Senel et al., 2018;Jang and Myaeng, 2017;Panigrahi et al., 2019). Most of those metrics can be considered post-hoc 4 .
In contrast, the PMI-based bias measure can be expressed intrinsically in terms of conditional prob-  Table 2: Pearson's r coefficients for each experiment shown in Figure 1. Because the PMI-based metric provides a measure of variance, weighted Pearson's r coefficients have been calculated to account for the variance of each data point. The bias is interpreted as the logarithm of how many more times it is likely to find words in C in the context of words in A than in the context of words in B. This can be interpreted as stating that it is 272.81% more likely to find the word nurse in the context of words associated with women (A) than in the context of words associated with men (B).

Discussion
As far as we know, our bias metric is the first that provides a simple and efficient way of evaluating the statistical significance of the obtained biases. We highlight the importance of knowing if the measured patterns are indeed significant. Imagine the case where we want to know if a collection of texts has a particular bias. To address this situation, it is not only necessary to estimate the magnitude of the bias, but also to have a decision rule that lets us know up to what degree this value might have been due to statistical fluctuation. A statistical test associated with the bias measure is essential in this use case.
Skip-gram and GloVe embeddings can capture word associations of second order or higher. (Levy et al., 2015;Altszyler et al., 2018;Schlechtweg et al., 2019). Therefore, when embeddings are used to measure word associations, it is not possible to know whether the emerging biases are due to ostensive co-occurrences within chunks of text or whether they are derived from higher-order cooccurrences. Rekabsaz et al. (2018) evidenced the presence of these spurious associations when quantifying semantic similarity with second-order contributions, and Brunet et al. (2019) showed in a sensitivity analysis that second-order effects provide an important contribution in the quantification of bias with the WEAT metric from Caliskan et al. (2017). Nevertheless, bias metrics based on second-order associations have the advantage of managing data sparsity. For example, they can capture relevant associations in synonyms occurrences of target and context words (A,B and C). In the case of our first-order metric, this problem must be addressed by increasing the length of word-lists with synonyms and different forms of the words of interest. Rekabsaz et al. (2018) propose a metric based on word embeddings that only captures first-order associations. Their results show that their metric correlates with biases in employment more than other measures based on second-order co-occurrences. This measure uses the product of word and context matrices of the Skip-gram model (W and C), so this measure can be interpreted as a shifted-PMI with smoothing. In future work we will compare Rekabsaz et al. (2018) metric with ours. However, we emphasize that the benefit of using the PMI-based metric lies in the interpretability and the estimation of confidence intervals and statistical significance.

Conclusions
In this article we present a PMI-based metric to capture biases in texts, which has the benefits of (a) providing simple and computationally unexpensive statistical significance tests, (b) having a simple interpretation in terms of word co-occurrences, and (c) being explicit and transparent in the associations that it is quantifying, since it captures first-order co-occurrences.
We show our PMI-based bias measurement can be approximated by an odds ratio. This allows for the calculation of confidence intervals and statistical significance for bias, using as the null hypoth-esis the absence of bias. We demonstrate that our measure can be expressed as the logarithm of the ratio of the probabilities of the context words conditional on the target words. This provides a simple interpretation of the metric's magnitudes in terms of word co-occurrences: how much more likely is it to find context words C in a window around target words A than in a window around target words B?
Finally, we prove that the use of our method produces a performance comparable to the one produced by GloVe-based and Skip-gram-based metrics in Caliskan et al. (2017) experiments of gender-occupation and gender-name associations.