Title: BERT WEARS GLOVES: DISTILLING STATIC EMBEDDINGS FROM PRETRAINED CONTEXTUAL REPRESENTATIONS

Abstract: Contextualized word representations such as ELMo and BERT have become the de facto starting point for incorporating pretrained representations for downstream NLP tasks. In these settings, contextual representations have largely made obsolete their static embedding predecessors such as Word2Vec and GloVe. However, static embeddings do have their advantages in that they are straightforward to understand and faster to use. Additionally, embedding analysis methods for static embeddings are far more diverse and mature than those available for their dynamic counterparts. In this work, we introduce simple methods for generating static lookup table embeddings from existing pretrained contextual representations and demonstrate they outperform Word2Vec and GloVe embeddings on a variety of word similarity and word relatedness tasks. In doing so, our results also reveal insights that may be useful for subsequent downstream tasks using our embeddings or the original contextual models. Further, we demonstrate the increased potential for analysis by applying existing approaches for estimating social bias in word embeddings. Our analysis constitutes the most comprehensive study of social bias in contextual word representations (via the proxy of our distilled embeddings) and reveals a number of inconsistencies in current techniques for quantifying social bias in word embeddings. We publicly release our code and distilled word embeddings to support reproducible research and the broader NLP community.

1. INTRODUCTION:

Word embeddings (Bengio et al., 2003; Collobert & Weston, 2008; Collobert et al., 2011) have been a hallmark of modern natural language processing (NLP) for several years. Pretrained embeddings in particular have seen widespread use and have experienced parallel and complementary innovations alongside neural networks for NLP. Advances in embedding quality in part have come from integrating additional information such as syntax (Levy & Goldberg, 2014b; Li et al., 2017) , morphology (Cotterell & Schütze, 2015) , subwords (Bojanowski et al., 2017) , subcharacters (Stratos, 2017; Yu et al., 2017) and, most recently, context (Peters et al., 2018; Devlin et al., 2019) . As a consequence of their representational potential, pretrained word representations have seen widespread adoption across almost every task in NLP and reflect one of the greatest successes of both representation learning and transfer learning for NLP (Ruder, 2019b) .

The space of pretrained word representations can be partitioned into static vs. dynamic embeddings methods. Static methods such as Word2Vec (Mikolov et al., 2013) , GloVe (Pennington et al., 2014) , and FastText (Bojanowski et al., 2017) yield representations that are fixed after training and generally associate a single vector with a given word in the style of a lookup table. While subsequent work addressed the fact that words may have multiple senses and should have different representations for different senses (Pilehvar & Collier, 2016; Lee & Chen, 2017; Pilehvar et al., 2017; Athiwaratkun & Wilson, 2017; Camacho-Collados & Pilehvar, 2018) , fundamentally these methods cannot easily adapt to the inference time context in which they are applied. This contrasts with contextual, or dynamic, methods such as CoVe (McCann et al., 2017) , ELMo (Peters et al., 2018) , and BERT (Devlin et al., 2019) , which produce vector representations for a word conditional on the inference time context in which it appears. Given that dynamic representations are arguably more linguistically valid, more expressive (static embeddings are a special-case of dynamic embeddings that are optimally ineffective at being dynamic), and have yielded significant empirical improvements (Wang et al., 2019b; a; Ruder, 2019a) , it would seem that static embeddings are outdated.

Static embeddings, however, have significant advantages over dynamic embeddings with regard to speed, computational resources, and ease of use. These benefits have important implications for time-sensitive systems, resource-constrained settings (Shen et al., 2019) or environmental concerns (Strubell et al., 2019) , and broader accessibility of NLP technologies1 . As a consequence of this dichotomy between static and dynamic representations and their disparate benefits, we propose in this work a simple yet effective mechanism for converting from dynamic representations to static representations. We begin by demonstrating that our method when applied to pretrained contextual models (BERT, GPT-2, RoBERTa, XLNet, DistilBERT) yields higher quality static embeddings than Word2Vec and GloVe when evaluated intrinsically on four word similarity and word relatedness datasets. Further, since our procedure does not rely on specific properties of the pretrained contextual model, it can be applied as needed to generate ever-improving static embeddings that will track advances in pretrained contextual word representations. Our approach offers the hope that high-quality embeddings can be maintained in both settings given their unique advantages and appropriateness in different settings.

At the same time, we show that by distilling static embeddings from their dynamic counterparts, we can then employ the more comprehensive arsenal of embedding analysis tools that have been developed in the static embedding setting to better understand the original contextual embeddings.

As an example, we employ methods for identifying gender, racial, and religious bias (Bolukbasi et al., 2016; Garg et al., 2018; Manzini et al., 2019) to our distilled representations and find that these experiments not only shed light on the properties of our distilled embeddings for downstream use but can also serve as a proxy for understanding existing biases in the original pretrained contextual representations. Our large-scale and exhaustive evaluation of bias further reveals dramatic inconsistencies in existing measures of social bias and highlights sizeable discrepancies in the bias estimates obtained for distilled embeddings drawn from different pretrained models and individual model layers.

2. BACKGROUND:

In this work, we study pretrained word embeddings, primarily of the static variety. As such, we focus on comparing our embeddings against existing pretrained static embeddings that have seen widespread adoption. We identify Word2Vec and GloVe as being the most prominent static embeddings currently in use and posit that these embeddings have been frequently chosen not only because of their high quality representations but also because lookup tables pretrained on large corpora are publicly accessible and easy to use. Similarly, in considering contextual models to distill from, we begin with BERT as it has been the most prominent in downstream use among the growing number of alternatives (e.g. ELMo (Peters et al., 2018) , GPT (Radford et al., 2018) , BERT (Devlin et al., 2019) , Transformer-XL (Dai et al., 2019) , GPT-2 (Radford et al., 2019) , XLNet (Yang et al., 2019) , RoBERTa (Liu et al., 2019b) , and DistilBERT (Sanh, 2019 )) though we provide similar analyses for several of the other models (GPT-2, XLNet, RoBERTa, DistilBERT) and more comprehensively address them in the appendices. We primarily report results for the bert-base-uncased model and include complete results for the bert-large-uncased model in the appendices as well.

3. METHODS:

In order to use a contextual model like BERT to compute a single context-agnostic representation for a given word w, we define two operations. The first is subword pooling: the application of a pooling mechanism over the subword representations generated for w in context c to compute a single representation for w in c, i.e. {w 1 c , . . . , w k c } → w c . Beyond this, we define context combination to be the mapping from representations w c1 , . . . , w cn of w in different contexts c 1 , . . . , c n to a single static embedding w that is agnostic of context.

3.1. SUBWORD POOLING:

The tokenization procedure for BERT can be decomposed into two steps: performing a simple word-level tokenization and then potentially deconstructing a word into multiple subwords, yielding w 1 , . . . , w k such that cat(w 1 , . . . , w k ) = w where cat(•) indicates concatenation. In English, the subword tokenization algorithm is WordPiece (Wu et al., 2016) . As a consequence, the decomposition of a word into subwords is the same across contexts and the subwords can be unambiguously associated with their source word. Therefore, any given layer of the model outputs vectors w 1 c , . . . , w k c . We consider four potential pooling mechanisms to compute w c given these vectors:

EQUATION

min(•) and max(•) are element-wise min and max pooling, mean(•) indicates mean pooling, i.e.

mean x∈X g(x) = x∈X g(x) |X |

and last(•) indicates selecting the last vector, w k c .

3.2. CONTEXT COMBINATION:

In order to convert contextual representations into static ones, we describe two methods of specifying contexts c 1 , . . . , c n and then combining the resulting representations w c1 , . . . , w cn .

Decontextualized -For a word w, we use a single context where c 1 = w. That is, we feed the single word w by itself into the pretrained contextual model and consider the resulting vector to be the representation (applying subword pooling if the word is split into multiple subwords).

Aggregated -Observing that the Decontextualized strategy may be presenting an unnatural input to the pretrained encoder which may have never encountered w by itself without a surrounding phrase or sentence, we instead consider ways of combining the representations for w in multiple contexts. In particular, we sample n sentences from a large corpus D, each of which contains the word w, and compute the vectors w c1 , . . . , w cn . Then, we apply a pooling strategy to yield a single representation that aggregates the representations across the n contexts as is shown in Equation 2.

EQUATION

4. REPRESENTATION QUALITY:

To assess the representational quality of our static embeddings, we evaluate on several word similarity and word relatedness datasets (see §A.2 for additional commentary). We consider 4 such datasets: RG65 (Rubenstein & Goodenough, 1965) , WS353 (Agirre et al., 2009) , SIMLEX999 (Hill et al., 2015) and SIMVERB3500 (Gerz et al., 2016) . Taken together, these datasets contain 4917 examples and contain a vocabulary V of 2005 unique words. Each example is a pair of words (w 1 , w 2 ) with a gold-standard annotation (provided by one or more humans depending on the dataset) of how semantically similar or how semantically related w 1 and w 2 are. A word embedding is evaluated by the relative correctness of its ranking of the similarity/relatedness of all examples in a dataset with respect to the gold-standard ranking using the Spearman ρ coefficient. Embedding predictions are computed using cosine similarity as in Equation 3:

cos(w 1 , w 2 ) = w 1 • w 2 w 1 w 2 (3) 4.1 INTRINSIC EVALUATION

We begin by studying how the choices of f and g2 impact the performance of embeddings distilled from bert-base-uncased. In Figure 1 , we show the performance on all four datasets of the resulting static embeddings where embeddings computed using the Aggregated strategy are pooled over N = 100000 sentences. Here, N is the number of total contexts for all words (see §A.4). Across all four datasets, we see that g = mean is the best performing pooling mechanism within the Aggregated strategy and also outperforms the Decontexualized strategy by a substantial margin.

Fixing g = mean, we further observe that mean pooling at the subword level also performs best.

We further find that this trend that f = mean, g = mean is optimal among the 16 possible pairs consistently holds for almost all pretrained contextual models we considered.

If we further consider the impacts of N as shown in Table 1 , we see that performance for both bert-base-uncased and bert-large-uncased tends to steadily increase for all datasets with increasing N (and this trend holds for the 7 other pretrained models). In particular, in the largest setting with N = 1000000, the bert-large-uncased embeddings distilled from the best performing layer for each dataset dramatically outperform both Word2Vec and GloVe. However, this can be seen as an unfair comparison given that we are selecting the layer for specific datasets. As the middle band of table shows, we can fix a layer and still outperform both Word2Vec and Glove.

Beyond the benefits of using a larger N , Table 1 reveals an interesting relationship between N and the best-performing layer. In Figure 1 , there is a clear preference towards the first quarter of the model's layers (layers 0-3) with a sharp drop-off in performance immediately thereafter (we see a similar preference for the first quarter in models with a different number of layers, e.g. Figure 3 , Figure 10 ) . Given that our intrinsic evaluation is centered on lexical semantic understanding, this appears to be largely consistent with the findings of Liu et al. (2019a) ; Tenney et al. (2019) . However, as we pool over a larger number of contexts, we see that the best-performing layer monotonically (with a single exception) shifts to be later and later within the pretrained model. What this indicates is that since the later layers did not perform better for smaller values of N , these layers demonstrate greater variance with respect to the layer-wise distributional mean and reducing this variance helps in our evaluation3 . This may have implications for downstream use, given that later layers of the model are generally preferred by downstream practitioners (Zhang et al., 2019) and it is precisely these layers where we see the greatest variance. Accordingly, combining our stable static embeddings from layer with the contextual example-specific embeddings also from layer of the pretrained model as was suggested in Peters et al. (2018) may be a potent strategy in downstream settings.

In general, we find these results suggest there may be merits towards further work studying the unification of static and dynamic methods.

Along with a trend towards later layers for larger values of N , we see a similar preference towards later layers as we consider each column of results from left to right. In particular, while the datasets are ordered chronologically4 , each dataset was explicitly introduced as an improvement over its predecessors (perhaps transitively, see §A.3). While it is unclear from our evaluation as to what differences in the examples in each dataset may cause this behavior, we find this correlation with dataset difficulty and layer-wise optimality to be intriguing. In particular, we see that SIMVERB3500 which contains verbs primarily (as opposed to nouns or adjectives which dominate the other datasets) tends to yield the best performance for embeddings distilled from the intermediary layers of the model (most clear for bert-large-uncased).

Remarkably, we find that most tendencies we observe generalize well to all other pretrained models we study (specifically the optimality of f = mean, g = mean, the improved performance for larger N , and the layer-wise tendencies with respect to N and dataset). In Table 2 , we summarize the results of all models employing the Aggregated strategy with f = mean, g = mean and N = 100000 contexts. Surprisingly, despite the fact that many of these models perform approximately equally on many downstream evaluations, we observe that their corresponding distilled embeddings perform radically differently even when the same distillation procedure is applied. These results can be interpreted as suggesting that some models learn better lexical semantic representations whereas others learn other behaviors such as context representation and semantic composition more accurately. More generally, we argue that these results warrant reconsideration of analyses performed on only one pretrained model as they may not generalize to other pretrained models even when the models considered have (nearly) identical Transformer architectures. A noteworthy result in Table 2 is that of DistilBert-6 which outperforms BERT-12 on three out of the four datasets despite being distilled using knowledge distillation (Ba & Caruana, 2014; Hinton et al., 2015) from BERT-12. Analogously, RoBERTa, which was introduced as a direct improvement over BERT, does not reliably outperform the corresponding BERT models when comparing the derived static embeddings. 

5. BIAS:

Bias is a complex and highly relevant topic in developing representations and models in machine learning and natural language processing. In this context, we study the social bias encoded within static word representations. As Kate Crawford argued for in her NIPS 2017 keynote, while studying individual models is important given that specific models may propagate, accentuate, or diminish biases in different ways, studying the representations that serve as the starting point and that are shared across models (which are used for possibly different tasks) allows for more generalizable understanding of bias (Barocas et al., 2017) .

In this work, we simultaneously consider multiple axes of social bias (i.e. gender, race, and religion) and multiple proposed methods for computationally quantifying these biases. We do so precisely because we find that existing NLP literature has primarily prioritized gender (which may be a technically easier setting) and because we find that different computational specifications of bias that evaluate the same social phenomena yield different results. As a direct consequence, we strongly caution that the results should be taken with respect to the definitions of bias being applied. Further, we note that an embedding which receives low bias scores cannot be assumed to be (nearly) unbiased, rather that under existing definitions the embedding exhibits low bias and perhaps additional more nuanced definitions are needed.

5.1 DEFINITIONS Bolukbasi et al. (2016) introduced a definition for computing gender bias which assumes access to a set P = {(m 1 , f 1 ), . . . , (m n , f n )} of (male, female) word pairs where m i and f i only differ in gender (e.g. 'men' and 'women'). They compute a gender direction g:

EQUATION

where E(•) is the embedding function, ";" indicates horizontal concatenation/stacking and [0] indicates taking the first principal component.

Then, given a set N of target words that we are interested in evaluating the bias with respect to, Bolukbasi et al. (2016) specifies the bias as:

bias

BOLUKBASI (N ) = mean w∈N | cos (E(w), g) | (5)

This definition is only inherently applicable to binary bias settings, i.e. where there are exactly two protected classes, but still is difficult to apply to binary settings beyond gender as constructing a set P can be challenging. Similarly, multi-class generalizations of this bias definition are also difficult to propose due to the issue of constructing k-tuples that only differ in the underlying social attribute. This definition also assumes the first principal component is capable of explaining a large fraction of the variance. Garg et al. (2018) introduced a different definition for computing binary bias that is not restricted to gender, which assumes access to sets

A 1 = {m 1 , • • • , m n } and A 2 = {f 1 , • • • , f n } of representa-

tive words for each of the two protected classes. For each class, µ i = mean w∈Ai E(w) is computed. Garg et al. (2018) computes the bias in the following ways:

bias

GARG-EUC (N ) = mean w∈N E(w) -µ 1 2 -E(w) -µ 2 2 (6) bias GARG-COS (N ) = mean w∈N cos(E(w), µ 1 ) -cos(E(w), µ 2 ) (7)

Compared to the definition of Bolukbasi et al. (2016) , these definitions may be more general as constructing P is strictly more difficult than constructing A 1 , A 2 (as P can always be split into two such sets but the reverse is not generally true) and Garg et al. (2018) 's definition does not rely on the first principal component explaining a large fraction of the variance. However, unlike the first definition, Garg et al. (2018) computes the bias in favor of/against a specific class (meaning if N = {'programmer', 'homemaker'} and 'programmer' was equally male-biased as 'homemaker' was female-biased, then under the definition of Garg et al. (2018) , there would be no bias in aggregate).

For the purposes of comparison, we adjust their definition by taking the absolute value of each term in the mean over N . Inspired by the results of Nissim et al. (2019) , in this work we transparently report social bias in existing static embeddings as well as the embeddings we compute. In particular, we exhaustively report the bias for all 3542 valid (pretrained model, layer, social attribute, bias definition) 4-tuples which describe all combinations of static embeddings and bias measures referenced in this work.

We specifically report results for binary gender (male, female), two-class religion (Christianity, Islam) and three-class race (white, Hispanic, and Asian), directly following Garg et al. (2018) . These results are by no means intended to be comprehensive with regards to the breadth of bias socially and only address a restricted class of social biases which notably does not include the important class of intersectional biases. The types of biases being evaluated for are taken with respect to specific word lists (which are sometimes subjective albeit being peer-reviewed) that serve as exemplars and with respect to definitions of bias grounded in the norms of the United States.

Beginning with bert-base-uncased, we report the layer-wise bias across all (attribute, definition) pairs in Figure 2 . What we immediately observe is that for any given social attribute, there is a great deal of variation across the layers in the quantified amount of bias. Further, while we are unsurprised that different bias measures for the same social attribute assign different absolute scores, we observe that they also do not agree in relative judgments. For gender, we observe that the bias estimated by the definition of Manzini et al. (2019) steadily increases before peaking at the penultimate layer and slightly decreasing thereafter. In contrast, under bias GARG-EUC we see a distribution with two peaks corresponding to layers at the start or end of the pretrained contextual model with lower bias observed in the intermediary layers. For estimating the same quantity, bias GARG-COS is mostly uniform across the layers (though the scale of the axes visually lessens the variation displayed). Similarly, in looking at the religious bias, we see similar inconsistencies with the bias increasing monotonically from layers 2 through 8 under bias MANZINI , decreasing monotonically under bias GARG-EUC , and remaining roughly constant under bias GARG-COS . In general, while the choice of N (and the choice of A i in the gender bias case) does affect the absolute bias estimates under any given definition, we find that the general trends in the bias across layers are approximately invariant under these choices for a specific definition.

Taken together, our analysis suggests a concerning state of affairs regarding bias quantification measures for (static) word embeddings. In particular, while estimates are seemingly stable to some types of choices regarding word lists, bias scores for a particular word embedding are tightly related to the definition being used and existing bias measures are markedly inconsistent with each other. We find this has important consequences beyond understanding the social biases in our representations. Concretely, we argue that without certainty regarding the extent to which embeddings are biased, it is impossible to properly interpret the meaningfulness of debiasing procedures (Bolukbasi et al., 2016; Zhao et al., 2018a; b; Sun et al., 2019) as we cannot reliably estimate the bias in the embeddings both before and after the procedure. This is further compounded with the existing evidence that current intrinsic measures of social bias may not handle geometric behavior such as clustering (Gonen & Goldberg, 2019) .

In light of the above, next we compare bias estimates across different pretrained models in Table 3 . Given the conflicting scores assigned by different definitions, we retain all definitions along with all social attributes in this comparison. However, we only consider target words given by N prof for visual clarity as well as due to the aforementioned stability to the choice of N , with the results for adjectives provided in Table 8 . We begin by noting that since we do not perform preprocessing to normalize embeddings, the scores using bias GARG-EUC are not comparable (and may not have been proper to compare in the layer-wise case either) as they are sensitive to the absolute norms of the embeddings which cannot be expected to be similar across models6 . Further, we note that bias BOLUKBASI may not be a reliable indicator as similar to Zhao et al. (2019a) , we find that the first principal component explains less than 35% of the variance in the majority of the static embeddings distilled from contextual models. Of the two bias definitions not mentioned thus far, we find that all distilled static embeddings have substantially higher scores under bias MANZINI but generally lower scores under bias GARG-COS when compared to Word2Vec and GloVe. Interestingly, we see that under bias MANZINI both GPT-2 and RoBERTa embedding consistently get high scores across social attributes when compared to other distilled embeddings but under bias GARG-COS they receive the lowest scores among distilled embeddings.

Ultimately, given the aforementioned issues regarding the reliability of bias measures, it is difficult to arrive at a clear consensus of the comparative bias between our distilled embeddings and prior static embeddings. What our analysis does resolutely reveal is a pronounced and likely problematic effect of existing bias definitions on the resulting bias scores.

6. RELATED WORK:

Distilled Static Representations. Recently, Akbik et al. (2019) introduced an approach similar to our Aggregated strategy where representations are gradually aggregated across instances in a dataset during training to model global information. Between epochs, the memory of past instances is reset and during testing, inference-time instances are added into the memory. In that work, the computed static embeddings are an additional feature that is used to achieve the state-of-the-art on several NER datasets. Based on our results, we believe their approach could be further improved by different decisions in pretrained model and layer choice. Their results may be explained by the (desirable) variance reduction we observe in pooling over many contexts. Additionally, since they only pool over instances in an online fashion within an epoch, the number of contexts is relatively small in their approach as compared to ours which may help to explain why they find that min or max pooling perform slightly better than mean pooling as the choice for g. May et al. (2019) proposes a different approach to convert representations from sentence encoders into static embeddings as a means for applying the WEAT (Caliskan et al., 2017) implicit bias tests to a sentence encoder. In their method, a single semantically-bleached sentence is synthetically constructed from a template and then fed into the encoder to compute a static embedding for the word of interest. We argue that this approach may inherently not be appropriate for quantifying bias in sentence encoders7 in the general case as sentence encoders are trained on semantically-meaningful sentences and semantically-bleached constructions are not representative of this distribution. Moreover, the types of templated constructions presented heavily rely on deictic expressions and therefore are difficult to adapt for certain syntactic categories such as verbs (as would be required for the SimVerb3500 dataset especially) without providing arguments for the verb. These concerns are further exacerbated by our findings given the poor representational behavior seen in our Decontextualized embeddings which have similar deficiencies with their static embeddings and the poor representational behavior when we pool over relatively few semantically-meaningful contexts using the Aggregated strategy (e.g. our results for N = 10000 which is still 50 instances per word on average and is much more than the single instance they consider). We believe our quantification of bias as a result can be taken as a more faithful estimator of bias in sentence encoders. Concurrently, Hu et al. (2019) considers a similar approach towards diachronic sense modelling. In particular, given a word, they find its senses and example sentences of each sense in the Oxford English Dictionary and use these to compute static embeddings using the Aggregated strategy with the last layer of bert-base-uncased and n i upper-bounded at 10. Given our results, their performance could likely be improved by pooling over more sentences, using bert-large-uncased, and considering layer choice as their task heavily relies on lexical understanding which seems to be better captured in earlier layers of the model than the last one. Since they require sense annotations for their setting (and the number of example sentences in a dictionary for a sense is inherently constrained), our findings also suggest that additional sense-annotated or weakly sense-annotated sentences would be beneficial. Lightweight Pretrained Representations. Taken differently, our approach can be seen as a method for integrating pretraining in a more lightweight fashion. Model compression (LeCun et al., 1990; Frankle & Carbin, 2019) and knowledge distillation (Ba & Caruana, 2014; Hinton et al., 2015) are well-studied techniques in machine learning that have been recently applied for similar purposes. In particular, several concurrent approaches have been proposed to yield lighter pretrained sentence encoders and contextual word representations (Gururangan et al., 2019; Shen et al., 2019; Sanh, 2019; Tsai et al., 2019; Tang et al., 2019; Jiao et al., 2019) . Our approach along with these recent approaches yield representations that are more appropriate for resource-constrained settings such as on-device models for mobile phones (Shen et al., 2019) , for real-time settings where we require low-latency and short inference times, and for users that may not have access to GPU or TPU computational resources (Tsai et al., 2019) . Additionally, this line of work is particularly timely given the emergent concerns of the environmental impact/harm of training and using increasingly large models in NLP (Strubell et al., 2019) , machine learning (Li et al., 2016; Canziani et al., 2016) , and the broader AI community (Schwartz et al., 2019) . Bias. Social bias in NLP has been primarily evaluated in three ways: (a) using geometric similarity between embeddings (Bolukbasi et al., 2016; Garg et al., 2018; Manzini et al., 2019) , (b) adapting psychological association tests (Caliskan et al., 2017; May et al., 2019) , and (c) considering down-stream behavior (Zhao et al., 2017; 2018a; 2019a; Stanovsky et al., 2019) 8 . In relation to this body of work, our bias evaluation is in the style of (a) as we are interested in intrinsic bias in embeddings and considers (potentially) multi-class social bias in the lens of gender, race, and religion whereas prior work has primarily focused on gender. Additionally, while most of the work on bias in embeddings has considered the static embedding setting, recent work has considered sentence encoders and contextual models. Zhao et al. (2019a) considers gender bias in ELMo when applied to NER and Kurita et al. (2019) extends these results by considering not only NER but also bias using WEAT by leveraging the masked language modeling objective of BERT. Similarly, Basta et al. (2019) considers intrinsic gender bias using ELMo by studying gender-swapped sentences. When compared to these approaches, we study a broader class of biases under more than one bias definition and consider more than one model. Further, while these approaches generally neglect reporting bias values for different layers of the model, we show this is crucial as bias is not uniformly distributed throughout model layers and downstream practitioners often do not use the last layer of deep Transformer models (Liu et al., 2019a; Tenney et al., 2019; Zhang et al., 2019; Zhao et al., 2019b) 9 .

7. FUTURE DIRECTIONS:

Pretrained contextual word representations have quickly gained traction in the NLP community, largely because of the flurry of empirical successes that have followed since their introduction. For downstream practitioners, our work suggests several simple (e.g. subword pooling mechanism choice) and more sophisticated (e.g. layer choice, benefits of variance reduction by using multiple contexts) strategies that may yield better downstream performance. Additionally, some recent models have combined static and dynamic embeddings (Peters et al., 2018; Bommasani et al., 2019; Akbik et al., 2019) and our representations may support drop-in improvements in these settings. Beyond furthering efforts in representation learning, this work introduces a new approach towards the understanding of contextual word representations via proxy analysis. In particular, while in this work we choose to study social bias, similar analyses toward other forms of interpretability and understanding would be valuable. Additionally, post-processing approaches that go beyond analysis such as dimensionality reduction may be particularly intriguing given that this is often challenging to do within large multi-layered networks like BERT (Sanh, 2019) but has been successfully done for static embeddings (Nunes & Antunes, 2018; Mu & Viswanath, 2018; Raunak et al., 2019) . Future work may also consider the choice of the corpus D from which contexts are drawn. In particular, we believe choosing D to be drawn from the target domain for some downstream task may serve as an extremely lightweight domain adaptation strategy. Additionally, in this work we choose to provide contexts of sentence length in order to facilitate regularity in the comparison across models. But for some models, such as Transformer-XL or XLNet which are trained with memories to handle larger contexts, better performance may be achieved by using larger contexts.

8. CONCLUSION:

In this work, we propose simple but effective procedures for converting contextual word representations into static word embeddings. When applied to pretrained models like BERT, we find the resulting embeddings outperform Word2Vec and GloVe substantially under intrinsic evaluation and provide insights into the pretrained model. We further demonstrate the resulting embeddings are more amenable to (existing) embedding analysis methods and report the extent of various social biases (gender, race, religion) across a number of measures. Our large-scale analysis furnishes several findings with respect to social bias encoded in popular pretrained contextual representations via the proxy of our embeddings and has implications towards the reliability of existing protocols for quantifying bias in word embeddings.

9. REPRODUCIBILITY:

All data, code, visualizations (and code to produce to them), and distilled word embeddings will be publicly released. Additional reproducibility details are provided in Appendix A. 8 Sun et al. (2019) provides a taxonomy of the work towards understanding gender bias within NLP.

A.2 EVALUATION DECISIONS:

In this work, we chose to conduct intrinsic evaluation experiments that focused on word similarity and word relatedness. We did not consider the related evaluation of lexical understanding via word analogies as they have been shown to decompose into word similarity subtasks (Levy & Goldberg, 2014a) and there are significant concerns about the validity of these analogies tests (Nissim et al., 2019) . We acknowledge that word similarity and word relatedness tasks have also been heavily scrutinized (Faruqui et al., 2016; Gladkova & Drozd, 2016) . A primary concern is that results are highly sensitive to (hyper)parameter selection (Levy et al., 2015) . In our setting, where the parameters of the embeddings are largely fixed based on which pretrained models are publicly released and where we exhaustively report the impact of most remaining parameters, we find these concerns to still be valid but less relevant.

To this end, prior work has considered various preprocessing operations on static embeddings such as clipping embeddings on an elementwise basis (Hasan & Curry, 2017) when performing intrinsic evaluation. We chose not to study these preprocessing choices as they create discrepancies between the embeddings used in intrinsic evaluation and those used in downstream tasks (where this form of preprocessing is generally not considered) and would have added additional parameters implicitly. Instead, we directly used the computed embeddings from the pretrained model with no changes throughout this work.

A.3 REPRESENTATION QUALITY DATASET TRENDS Rubenstein & Goodenough (1965) introduced a set of 65 noun-pairs and demonstrated strong correlation (exceeding 95%) between the scores in their dataset and additional human validation. Miller & Charles (1991) introduced a larger collection of pairs which they argued was an improvement over RG65 as it more faithfully addressed semantic similarity. Agirre et al. (2009) followed this work by introducing a even more pairs that included those of Miller & Charles (1991) as a subset and again demonstrated correlations with human scores exceeding 95%. Hill et al. (2015) argued that SIMLEX999 was an improvement in coverage over RG65 and more correctly quantified semantic similarity as opposed to semantic relatedness or association when compared to WS353. Beyond this, SIMVERB3500 was introduced by Gerz et al. (2016) to further increase coverage over all predecessors. Specifically, it shifted the focus towards verbs which had been heavily neglected in the prior datasets which centered on nouns and adjectives.

A.4 EXPERIMENTAL DETAILS:

We used PyTorch (Paszke et al., 2017) throughout this work with the pretrained contextual word representations taken from the HuggingFace pytorch-transformers repository 13 . Tokenization for each model was conducted using its corresponding tokenizer, i.e. results for GPT2 use the GPT2Tokenizer in pytorch-transformers. For simplicity, throughout this work, we introduce N as the total number of contexts used in distilling with the Aggregated strategy. Concretely, N = wi∈V n i where V is the vocabulary used (generally the 2005 words in the four datasets considered). As a result, in finding contexts, we filter for sentences in D that contain at least one word in V. We choose to do this as this requires a number of candidate sentences upper bounded with respect to the most frequent word in V as opposed to filtering for a specific value for n which requires a number of sentences scaling in the frequency of the least frequent word in V. The N samples from D for the Aggregated strategy were sampled uniformly at random. Accordingly, as the aforementioned discussion suggests, for word w i , the number of examples n i which contain w i scales in the frequency of w i in the vocabulary being used. As a consequence, for small values of N , it is possible that rare words would have no examples and computing a representation w using the Aggregated strategy would be impossible. In this case, we back-offed to using the Decontextualized representation for w i . Given this concern, in the bias evaluation, we fix n i = 20 for every w i . In initial experiments, we found the bias results to be fairly stable when choosing values n i ∈ {20, 50, 100}. The choice of n i would correspond to N = 40100 (as the vocabulary size was 2005) in the representation quality section in some sense (however this assumes a uniform distribution of word frequency as opposed to a Zipf distribution). The embeddings in the bias evaluation are drawn from layer X 4 using f = mean, g = mean as we found these to be the best performing embeddings generally across pretrained models and datasets in the representational quality evaluation.

A.5 BIAS WORD LISTS:

The set of gender-paired tuples P were taken from Bolukbasi et al. (2016) . In the gender bias section, P for definitions involving sets A i indicates that P was split into equal-sized sets of male and female work. For the remaining gender results, the sets described in §G.3 were used. The various attribute sets A i and target sets N j were taken from Garg et al. (2018) which can be further sourced to a number of prior works in studying social bias. We remove any multi-word terms from these lists. 'baker', 'ballerina', 'ballplayer', 'banker', 'barber', 'baron', 'barrister', 'bartender', 'biologist', 'bishop', 'bodyguard', 'bookkeeper', 'boss', 'boxer', 'broadcaster', 'broker', 'bureaucrat', 'businessman', 'businesswoman', 'butcher', 'cabbie', 'cameraman', 'campaigner', 'captain', 'cardiologist', 'caretaker', 'carpenter', 'cartoonist', 'cellist', 'chancellor', 'chaplain', 'character', 'chef', 'chemist', 'choreographer', 'cinematographer', 'citizen', 'cleric', 'clerk', 'coach', 'collector', 'colonel', 'columnist', 'comedian', 'comic', 'commander', 'commentator', 'commissioner', 'composer', 'conductor', 'confesses', 'congressman', 'constable', 'consultant', 'cop', 'correspondent', 'councilman', 'councilor', 'counselor', 'critic', 'crooner', 'crusader', 'curator', 'custodian', 'dad', 'dancer', 'dean', 'dentist', 'deputy', 'dermatologist', 'detective', 'diplomat', 'director', 'doctor', 'drummer', 'economist', 'editor', 'educator', 'electrician', 'employee', 'entertainer', 'entrepreneur', 'environmentalist', 'envoy', 'epidemiologist', 'evangelist', 'farmer', 'filmmaker', 'financier', 'firebrand', 'firefighter', 'fireman', 'fisherman', 'footballer', 'foreman', 'gangster', 'gardener', 'ge-'solemn', 'systematic', 'vague', 'peaceful', 'humble', 'dull', 'expedient', 'loyal', 'decisive', 'arbitrary', 'earnest', 'confident', 'conservative', 'foolish', 'moderate', 'helpful', 'delicate', 'gentle', 'dedicated', 'hostile', 'generous', 'reliable', 'dramatic', 'precise', 'calm', 'healthy', 'attractive', 'artificial', 'progressive', 'odd', 'confused', 'rational', 'brilliant', 'intense', 'genuine', 'mistaken', 'driving', 'stable', 'objective', 'sensitive', 'neutral', 'strict', 'angry', 'profound', 'smooth', 'ignorant', 'thorough', 'logical', 'intelligent', 'extraordinary', 'experimental', 'steady', 'formal', 'faithful', 'curious', 'reserved', 'honest', 'busy', 'educated', 'liberal', 'friendly', 'efficient', 'sweet', 'surprising', 'mechanical', 'clean', 'critical', 'criminal', 'soft', 'proud', 'quiet', 'weak', 'anxious', 'solid', 'complex', 'grand', 'warm', 'slow', 'false', 'extreme', 'narrow', 'dependent', 'wise', 'organized', 'pure', 'directed', 'dry', 'obvious', 'popular', 'capable', 'secure', 'active', 'independent', 'ordinary', 'fixed', 'practical', 'serious', 'fair', 'understanding', 'constant', 'cold', 'responsible', 'deep', 'religious', 'private', 'simple', 'physical', 'original', 'working', 'strong', 'modern', 'determined', 'open', 'political', 'difficult', 'knowledge', ' kind'} P = {('she', 'he'), ('her', 'his'), ('woman', 'man'), ('mary', 'john'), ('herself', 'himself'), ('daughter', 'son'), ('mother', 'father'), ('gal', 'guy'), ('girl', 'boy'), ('female', 'male')}

B BERT-LARGE:

A male = {'he ', 'son', 'his', 'him', 'father', 'man', 'boy', 'himself', 'male', 'brother', 'sons', 'fathers', 'men', 'boys', 'males', 'brothers', 'uncle', 'uncles', 'nephew', ' nephews'} 'daughter', 'hers', 'her', 'mother', 'woman', 'girl', 'herself', 'female', 'sister', 'daughters', 'mothers', 'women', 'girls', 'femen' 14 , 'sisters', 'aunt', 'aunts', 'niece', 'nieces'}

A female = {'she',

A white = {'harris ', 'nelson', 'robinson', 'thompson', 'moore', 'wright', 'anderson', 'clark', 'jackson', 'taylor', 'scott', 'davis', 'allen', 'adams', 'lewis', 'williams', 'jones', 'wilson', 'martin', ' johnson'} 'gomez', 'soto', 'gonzalez', 'sanchez', 'rivera', 'martinez', 'torres', 'rodriguez', 'perez', 'lopez', 'medina', 'diaz', 'garcia', 'castro', ' 

A hispanic = {'castillo',

cruz'}:

A asian = {'cho', 'wong ', 'tang', 'huang', 'chu', 'chung', 'ng', 'wu', 'liu', 'chen', 'lin', 'yang', 'kim', 'chang', 'shah', 'wang', 'li', 'khan', 'singh', ' hong'} A islam = {'allah', 'ramadan ', 'turban', 'emir', 'salaam', 'sunni', 'koran', 'imam', 'sultan', 'prophet', 'veil', 'ayatollah', 'shiite', 'mosque', 'islam', 'sheik', 'muslim', 'muhammad'} A christian = {'baptism', 'messiah', 'catholicism', 'resurrection', 'christianity', 'salvation', 'protestant', 'gospel', 'trinity', 'jesus', 'christ', 'christian', 'cross', 'catholic', 'church'}

H NAMING CONVENTIONS:

Throughout this work, we make use of several naming conventions/substitutions. In the case of models, we use the form 'MODEL-X' where X indicates the number of layers in the model and consequently the model produces X + 1 representations for any given subword (including the initial layer 0 representation). Table 9 describes the complete correspondence of our shorthand and the full names. In the case of model names, the full form is the name assigned to the pretrained model (that was possibly reimplemented) released by HuggingFace. 

:

A recent account from the perspective of a humanist about the (in)accessibility of BERT: https:// tedunderwood.com/2019/07/15/do-humanists-need-bert/

For brevity, we treat Decontextualized as a choice for g and denote it as decont in the figures. Additional shorthand is described in Appendix H.

Shi et al. (2019) concurrently proposes a different approach with similar motivations.

Incidentally, they also are ordered by dataset size. However, we do not believe this explains the layer-wise trends.

Manzini et al. (2019) describes their score using slightly different phrasing; their score can easily be verified to be equivalent to our rephrasing up to two differences: (a) we use cosine similarity where they use cosine distance and (b) we insert absolute values in the mean over N . We make these changes to introduce consistency with the other definitions and to permit comparison.

When we did normalize using the Euclidean norm, we found the relative results to reliably coincide with those for biasGARG-COS which is consistent with the findings ofGarg et al. (2018).

The authors also identified several empirical concerns that draw the meaningfulness of this method into question.

This is the only layer studied inKurita et al. (2019).

https://blog.lateral.io/2015/06/the-unknown-perils-of-mining-wikipedia/

https://drive.google.com/file/d/0B7XkCwpI5KDYNlNUTTlSS21pQmM/edit

https://nlp.stanford.edu/projects/glove/

https://github.com/huggingface/pytorch-transformers

We remove 'femen' when using Word2Vec as it is not in the vocabulary of the pretrained embeddings we use.

Figures and Tables:

Figure 1: Layer-wise performance of distilled BERT-12 embeddings for all possible choices of f, g with N = 100000.

Figure 2: Layer-wise bias of distilled BERT-12 embeddings for f = mean, g = mean, N = 100000 Left: Gender, Center: Race, Right: Religion

Figure 3: Layerwise performance of BERT-24 static embeddings for all possible choices of f, g

Figure 6: Layerwise performance of RoBERTa-12 static embeddings for all possible choices of f, g

Figure 11: Layerwise bias of BERT-24 static embeddings for f = mean, g = mean, N = 100000 Left: Gender, Center: Race, Right: Religion

Performance of distilled BERT embeddings on word similarity and word relatedness tasks.

Table content: <table><tr><td>Model</td><td>N</td><td/><td>RG65</td><td colspan="2">WS353</td><td>SIMLEX999 SIMVERB3500</td></tr><tr><td>Word2Vec</td><td>-</td><td/><td>0.6787</td><td colspan="2">0.6838</td><td>0.4420</td><td>0.3636</td></tr><tr><td>GloVe</td><td>-</td><td/><td>0.6873</td><td colspan="2">0.6073</td><td>0.3705</td><td>0.2271</td></tr><tr><td colspan="3">BERT-12 (1) 500000</td><td>0.7206</td><td colspan="2">0.7038</td><td>0.5019</td><td>0.3550</td></tr><tr><td colspan="3">BERT-24 (1) 500000</td><td>0.7367</td><td colspan="2">0.7074</td><td>0.5114</td><td>0.3687</td></tr><tr><td colspan="3">BERT-24 (6) 500000</td><td>0.7494</td><td colspan="2">0.7282</td><td>0.5116</td><td>0.4062</td></tr><tr><td>BERT-12</td><td colspan="2">10000</td><td colspan="3">0.5167 (1) 0.6833 (1)</td><td>0.4573 (1)</td><td>0.3043 (1)</td></tr><tr><td>BERT-12</td><td colspan="5">100000 0.6980 (1) 0.7023 (1)</td><td>0.5007 (3)</td><td>0.3494 (3)</td></tr><tr><td>BERT-12</td><td colspan="5">500000 0.7262 (2) 0.7038 (1)</td><td>0.5115 (3)</td><td>0.3853 (4)</td></tr><tr><td>BERT-12</td><td colspan="5">1000000 0.7242 (1) 0.7048 (1)</td><td>0.5134 (3)</td><td>0.3948 (4)</td></tr><tr><td>BERT-24</td><td colspan="5">100000 0.7749 (2) 0.7179 (6)</td><td>0.5044 (1)</td><td>0.3686 (9)</td></tr><tr><td>BERT-24</td><td colspan="5">500000 0.7643 (2) 0.7282 (6)</td><td>0.5116 (6)</td><td>0.4146 (10)</td></tr><tr><td>BERT-24</td><td colspan="6">1000000 0.7768 (2) 0.7301 (6) 0.5244 (15)</td><td>0.4280 (10)</td></tr><tr><td>Model</td><td/><td/><td>RG65</td><td>WS353</td><td colspan="2">SIMLEX999 SIMVERB3500</td></tr><tr><td colspan="2">BERT-12</td><td colspan="3">0.6980 (1) 0.7023 (1)</td><td colspan="2">0.5007 (3)</td><td>0.3494 (3)</td></tr><tr><td colspan="2">BERT-24</td><td colspan="3">0.7749 (2) 0.7179 (6)</td><td colspan="2">0.5044 (1)</td><td>0.3686 (9)</td></tr><tr><td colspan="2">GPT2-12</td><td colspan="3">0.5156 (1) 0.6396 (0)</td><td colspan="2">0.4547 (2)</td><td>0.3128 (6)</td></tr><tr><td colspan="2">GPT2-24</td><td colspan="3">0.5328 (1) 0.6830 (0)</td><td colspan="2">0.4505 (3)</td><td>0.3056 (0)</td></tr><tr><td colspan="5">RoBERTa-12 0.6597 (0) 0.6915 (0)</td><td colspan="2">0.5098 (0)</td><td>0.4206 (0)</td></tr><tr><td colspan="5">RoBERTa-24 0.7087 (7) 0.6563 (6)</td><td colspan="2">0.4959 (0)</td><td>0.3802 (0)</td></tr><tr><td colspan="2">XLNet-12</td><td colspan="3">0.6239 (1) 0.6629 (0)</td><td colspan="2">0.5185 (1)</td><td>0.4044 (3)</td></tr><tr><td colspan="2">XLNet-24</td><td colspan="3">0.6522 (3) 0.7021 (3)</td><td colspan="2">0.5503 (6)</td><td>0.4545 (3)</td></tr><tr><td colspan="5">DistilBERT-6 0.7245 (1) 0.7164 (1)</td><td colspan="2">0.5077 (0)</td><td>0.3207 (1)</td></tr></table>



Table content: <table/>

Social bias within static embeddings from different pretrained models with respect to a set of professions N prof . Parameters are set as f = mean, g = mean, N = 100000 and the layer of the pretrained model used in distillation is X 4 . Lowest bias in a particular column is denoted in bold.

Table content: <table><tr><td/><td/><td/><td/><td>Gender</td><td/><td/><td/><td>Race</td><td/><td>Religion</td><td/></tr><tr><td/><td>B, P</td><td>GE, P</td><td>GC, P</td><td>M, P</td><td>GE</td><td>GC</td><td>M</td><td>M</td><td>GE</td><td>GC</td><td>M</td></tr><tr><td>Word2Vec</td><td>0.0503</td><td>0.1758</td><td>0.075</td><td>0.2403</td><td>0.1569</td><td>0.0677</td><td>0.2163</td><td>0.0672</td><td>0.0907</td><td>0.053</td><td>0.14</td></tr><tr><td>GloVe</td><td>0.0801</td><td>0.3534</td><td>0.0736</td><td>0.1964</td><td>0.357</td><td>0.0734</td><td>0.1557</td><td>0.1171</td><td>0.2699</td><td>0.0702</td><td>0.0756</td></tr><tr><td>BERT-12</td><td>0.0736</td><td>0.3725</td><td>0.0307</td><td>0.3186</td><td>0.2868</td><td>0.0254</td><td>0.3163</td><td>0.2575</td><td>1.2349</td><td>0.0604</td><td>0.2955</td></tr><tr><td>BERT-24</td><td>0.0515</td><td>0.6418</td><td>0.0462</td><td>0.234</td><td>0.4674</td><td>0.0379</td><td>0.2284</td><td>0.1956</td><td>0.6476</td><td>0.0379</td><td>0.2316</td></tr><tr><td>GPT2-12</td><td>0.4933</td><td>25.8743</td><td>0.0182</td><td>0.6464</td><td>2.0771</td><td>0.0062</td><td>0.7426</td><td>0.6532</td><td>4.5282</td><td>0.0153</td><td>0.776</td></tr><tr><td>GPT2-24</td><td>0.6871</td><td>40.1423</td><td>0.0141</td><td>0.8514</td><td>2.3244</td><td>0.0026</td><td>0.9019</td><td>0.8564</td><td>8.9528</td><td>0.0075</td><td>0.9081</td></tr><tr><td>RoBERTa-12</td><td>0.0412</td><td>0.2923</td><td>0.0081</td><td>0.8546</td><td>0.2077</td><td>0.0057</td><td>0.8551</td><td>0.8244</td><td>0.4356</td><td>0.0111</td><td>0.844</td></tr><tr><td>RoBERTa-24</td><td>0.0459</td><td>0.3771</td><td>0.0089</td><td>0.7879</td><td>0.2611</td><td>0.0064</td><td>0.783</td><td>0.7479</td><td>0.5905</td><td>0.0144</td><td>0.7636</td></tr><tr><td>XLNet-12</td><td>0.0838</td><td>1.0954</td><td>0.0608</td><td>0.3374</td><td>0.6661</td><td>0.042</td><td>0.34</td><td>0.2792</td><td>0.8537</td><td>0.0523</td><td>0.318</td></tr><tr><td>XLNet-24</td><td>0.0647</td><td>0.7644</td><td>0.0407</td><td>0.381</td><td>0.459</td><td>0.0268</td><td>0.373</td><td>0.328</td><td>0.8009</td><td>0.0505</td><td>0.368</td></tr><tr><td>DistilBERT-6</td><td>0.0504</td><td>0.5435</td><td>0.0375</td><td>0.3182</td><td>0.3343</td><td>0.0271</td><td>0.3185</td><td>0.2786</td><td>0.8128</td><td>0.0437</td><td>0.3106</td></tr></table>

Performance of Static Embeddings on Word Similarity and Word Relatedness Tasks. f and g are set to mean for all GPT2-models and (#) indicates the layer the embeddings are distilled from. Bold indicates best performing embeddings for a given dataset.

Table content: <table><tr><td>Model</td><td>N</td><td>RG65</td><td>WS353</td><td colspan="2">SIMLEX999 SIMVERB3500</td></tr><tr><td>Word2Vec</td><td>-</td><td>0.6787</td><td>0.6838</td><td>0.4420</td><td>0.3636</td></tr><tr><td>GloVe</td><td>-</td><td>0.6873</td><td>0.6073</td><td>0.3705</td><td>0.2271</td></tr><tr><td>GPT2-12</td><td colspan="3">10000 0.2843 (0) 0.4205 (1)</td><td>0.2613 (2)</td><td>0.1472 (6)</td></tr><tr><td>GPT2-12</td><td colspan="3">50000 0.5000 (2) 0.5815 (1)</td><td>0.4378 (2)</td><td>0.2607 (2)</td></tr><tr><td colspan="4">GPT2-12 100000 0.5156 (1) 0.6396 (0)</td><td>0.4547 (2)</td><td>0.3128 (6)</td></tr><tr><td>GPT2-24</td><td colspan="3">10000 0.3149 (0) 0.5209 (0)</td><td>0.2940 (0)</td><td>0.1697 (0)</td></tr><tr><td>GPT2-24</td><td colspan="3">50000 0.5362 (2) 0.6486 (0)</td><td>0.4350 (0)</td><td>0.2721 (0)</td></tr><tr><td colspan="4">GPT2-24 100000 0.5328 (1) 0.6830 (0)</td><td>0.4505 (3)</td><td>0.3056 (0)</td></tr></table>

Performance of Static Embeddings on Word Similarity and Word Relatedness Tasks. f and g are set to mean for all DistilBERT-models and (#) indicates the layer the embeddings are distilled from. Bold indicates best performing embeddings for a given dataset.

Table content: <table><tr><td>Model</td><td>N</td><td>RG65</td><td>WS353</td><td colspan="2">SIMLEX999 SIMVERB3500</td></tr><tr><td>Word2Vec</td><td>-</td><td>0.6787</td><td>0.6838</td><td>0.4420</td><td>0.3636</td></tr><tr><td>GloVe</td><td>-</td><td>0.6873</td><td>0.6073</td><td>0.3705</td><td>0.2271</td></tr><tr><td>DistilBERT-6</td><td>10000</td><td>0.57 (0)</td><td>0.6828 (1)</td><td>0.4705 (0)</td><td>0.2971 (0)</td></tr><tr><td>DistilBERT-6</td><td>50000</td><td colspan="2">0.7257 (1) 0.6928 (1)</td><td>0.5043 (0)</td><td>0.3121 (0)</td></tr><tr><td colspan="4">DistilBERT-6 100000 0.7245 (1) 0.7164 (1)</td><td>0.5077 (0)</td><td>0.3207 (1)</td></tr><tr><td colspan="4">DistilBERT-6 500000 0.7363 (1) 0.7239 (1)</td><td>0.5093 (0)</td><td>0.3444 (2)</td></tr><tr><td colspan="4">DistilBERT-6 1000000 0.7443 (1) 0.7256 (1)</td><td>0.5095 (0)</td><td>0.3536 (3)</td></tr></table>

Social bias within static embeddings from different pretrained models with respect to a set of adjectives, N adj . Parameters are set as f = mean, g = mean, N = 100000 and the layer of the pretrained model used in distillation is X 4 .

Table content: <table><tr><td/><td/><td/><td/><td>Gender</td><td/><td/><td/><td>Race</td><td/><td>Religion</td><td/></tr><tr><td/><td>B, P</td><td>GE, P</td><td>GC, P</td><td>M, P</td><td>GE</td><td>GC</td><td>M</td><td>M</td><td>GE</td><td>GC</td><td>M</td></tr><tr><td>Word2Vec</td><td>0.0482</td><td>0.1656</td><td>0.0435</td><td>0.1347</td><td>0.1247</td><td>0.0343</td><td>0.1178</td><td>0.0661</td><td>0.13</td><td>0.0434</td><td>0.1264</td></tr><tr><td>GloVe</td><td>0.095</td><td>0.2206</td><td>0.0403</td><td>0.1289</td><td>0.2017</td><td>0.0355</td><td>0.1108</td><td>0.0714</td><td>0.2341</td><td>0.0606</td><td>0.0675</td></tr><tr><td>BERT-12</td><td>0.0506</td><td>0.2637</td><td>0.0213</td><td>0.2684</td><td>0.1879</td><td>0.0175</td><td>0.2569</td><td>0.2358</td><td>0.8858</td><td>0.0365</td><td>0.2677</td></tr><tr><td>BERT-24</td><td>0.0389</td><td>0.4405</td><td>0.0277</td><td>0.199</td><td>0.2978</td><td>0.0248</td><td>0.189</td><td>0.1768</td><td>0.5505</td><td>0.0316</td><td>0.212</td></tr><tr><td>GPT2-12</td><td>0.4631</td><td>26.0809</td><td>0.0176</td><td>0.6126</td><td>2.1238</td><td>0.0068</td><td>0.7101</td><td>0.621</td><td>4.4775</td><td>0.0152</td><td>0.7525</td></tr><tr><td>GPT2-24</td><td>0.6707</td><td>40.4664</td><td>0.0141</td><td>0.8367</td><td>2.1771</td><td>0.0023</td><td>0.89</td><td>0.843</td><td>8.3889</td><td>0.0064</td><td>0.9006</td></tr><tr><td>RoBERTa-12</td><td>0.0381</td><td>0.1754</td><td>0.005</td><td>0.8472</td><td>0.1649</td><td>0.0046</td><td>0.8444</td><td>0.8153</td><td>0.2608</td><td>0.0069</td><td>0.8387</td></tr><tr><td>RoBERTa-24</td><td>0.0248</td><td>0.2626</td><td>0.0064</td><td>0.7647</td><td>0.1821</td><td>0.0048</td><td>0.7562</td><td>0.73</td><td>0.4492</td><td>0.0117</td><td>0.7472</td></tr><tr><td>XLNet-12</td><td>0.0399</td><td>0.6265</td><td>0.0312</td><td>0.2214</td><td>0.3354</td><td>0.0237</td><td>0.2196</td><td>0.1911</td><td>0.4716</td><td>0.0321</td><td>0.2549</td></tr><tr><td>XLNet-24</td><td>0.0468</td><td>0.5423</td><td>0.025</td><td>0.3307</td><td>0.2697</td><td>0.0153</td><td>0.3144</td><td>0.2871</td><td>0.4318</td><td>0.0282</td><td>0.3235</td></tr><tr><td>DistilBERT-6</td><td>0.0353</td><td>0.4274</td><td>0.0247</td><td>0.2825</td><td>0.2461</td><td>0.0185</td><td>0.2824</td><td>0.2603</td><td>0.6842</td><td>0.035</td><td>0.2994</td></tr><tr><td colspan="2">G.3 WORD SETS</td><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td colspan="12">N prof = {'accountant', 'acquaintance', 'actor', 'actress', 'administrator', 'adventurer', 'advo-</td></tr><tr><td colspan="12">cate', 'aide', 'alderman', 'ambassador', 'analyst', 'anthropologist', 'archaeologist', 'archbishop',</td></tr><tr><td colspan="12">'architect', 'artist', 'artiste', 'assassin', 'astronaut', 'astronomer', 'athlete', 'attorney', 'author',</td></tr></table>

Naming conventions used throughout this work

Table content: <table><tr><td>Our Shorthand</td><td>Full Name</td></tr><tr><td>BERT-12</td><td>bert-base-uncased</td></tr><tr><td>BERT-24</td><td>bert-large-uncased</td></tr><tr><td>GPT2-12</td><td>gpt2</td></tr><tr><td>GPT2-24</td><td>gpt2-medium</td></tr><tr><td>RoBERTa-12</td><td>roberta-base</td></tr><tr><td>RoBERTa-24</td><td>roberta-large</td></tr><tr><td>XLNet-12</td><td>xlnet-base-cased</td></tr><tr><td>XLNet-24</td><td>xlnet-base-cased</td></tr><tr><td colspan="2">DistilBERT-6 distilbert-base-uncased</td></tr><tr><td>SL999</td><td>SIMLEX999</td></tr><tr><td>SV3500</td><td>SIMVERB3500</td></tr><tr><td>B</td><td>bias BOLUKBASI</td></tr><tr><td>GE</td><td>bias GARG-EUC</td></tr><tr><td>GC</td><td>bias GARG-COS</td></tr><tr><td>M</td><td>bias MANZINI</td></tr></table>

Peer review (iclr2020):
This work introduces very simple methods that use contextualized embeddings from large-scale pretrained language models like BERT to distill / generate static Word2Vec-style word embeddings. The motivation for doing so is twofold: (1) static embeddings are faster to use and easier to understand, which makes them more appropriate for some real-time or resource-constrained systems; and (2) we can then use a variety of analysis methods that have been developed for static embeddings to analyze their contextualized counterparts. The proposed method is very simple, just pooling embeddings of a given word type across multiple contexts (if the word is decomposed into subwords in a context, its subword embeddings are averaged), and there is extensive evaluation across different combinations of pooling functions, pretrained base model, and layer to distill. The authors demonstrate that these distilled word embeddings outperform Word2Vec/GloVe on various word similarity/ relatedness tasks and reveal interesting insights into these embeddings. Additionally, they investigate social bias in contextualized representations and reveal inconsistencies in existing techniques for studying social bias. Overall, I found this paper to be well-written and the bias experiments in particular to be compelling. However, I felt that there were too many obvious questions left unexplored, which I*ve noted below, and I didn*t quite buy some of the explanations of the results. As such, I am a weak reject for now. comments: - While mean pooling is simple conceptually and to implement, I do wonder if the authors could have gone further with the methodology. A natural continuation is to weight different contexts differently (e.g., upweight common contexts and downweight rare ones). Another is to extend the idea to multisense word embeddings (e.g., through some clustering over contexts). - One confounding factor that could affect the experimental results is the embedding dimensionality. The GloVe / Word2Vec embeddings are both 300d, while I suppose BERT*s are 768d. Of course, it is hard to control for this when using pretrained public models, but perhaps PCA or some other dimensionality reduction technique could have been applied to BERT-derived embeddings before the comparison. As is, it is unclear how much of the improvement comes from the model size. - I would have liked to see the performance of the distilled static embeddings measured across a variety of downstream tasks (i.e., by plugging the embeddings into some task-specific model), not just word similarity / relatedness as these are not particularly insightful. Also, if the authors did this experiment, they could measure the change in the distilled embeddings before / after finetuning on the downstream task. - Fig 1 & 2 are hard to read and understand. In Fig 2, the entries in the legend don*t seem to be explained anywhere. What are *ADJ* and *PROF*? - The result that social bias is not consistent across different layers of BERT is perhaps to be expected in light of other similar results (e.g., the bottom layers of ELMo and the middle layers of BERT seem to contain more syntactic info than others as shown by Hewitt & Manning 2019). - I wonder if the inconsistency in layer-wise patterns across different bias measures is not an issue with the bias measures themselves but rather with the assumption that distance metrics (e.g., cosine) are as meaningful with distilled static embeddings as they are with Word2Vec / GloVe. The latter approaches incorporate the inner product between two embeddings into their relatively simple training objectives, while the distilled BERT embeddings are computed from highly nonlinear Transformer layers. Perhaps for some layers these distance metrics are not meaningful?