Year: 2021

Abstract:
A large number of studies analyze deep neural network models and their ability to encode various linguistic and non-linguistic concepts, and subsequently provide an interpretation of the inner mechanics of these models. A major caveat to these studies, however, is that their scope of interpretation is limited to pre-defined concepts that mainly reinforce the traditional linguistic knowledge. Consequently, the interpretation does not reflect on novel concepts learned by a model. We address this limitation by discovering and analyzing latent concepts learned in a model in an unsupervised fashion, thus providing interpretation from the model’s perspective. In this work, we study i) what latent concepts exist in the pre-trained BERT model, ii) how the discovered latent concepts align or diverge from the classical linguistic hierarchy and iii) how the concepts evolve across layers. Some notable findings of our analysis include: i) the model learns novel concepts such as animal categories and demographic groups, which do not strictly adhere to any predefined categorization (e.g., POS, semantic tags), ii) several latent concepts are based on multiple properties which may include semantics, syntax or morphology, iii) lower layers dominate in learning shallow lexical concepts while higher layers learn semantic relations and iv) the discovered latent concepts highlight potential biases learned in the model. We also release a novel BERT concept dataset (BCD) consisting of 183 concept labels and 1M annotated instances.

text: A large number of studies analyze deep neural network models and their ability to encode various linguistic and non-linguistic concepts, and subsequently provide an interpretation of the inner mechanics of these models. A major caveat to these studies, however, is that their scope of interpretation is limited to pre-defined concepts that mainly reinforce the traditional linguistic knowledge. Consequently, the interpretation does not reflect on novel concepts learned by a model. We address this limitation by discovering and analyzing latent concepts learned in a model in an unsupervised fashion, thus providing interpretation from the model’s perspective. In this work, we study i) what latent concepts exist in the pre-trained BERT model, ii) how the discovered latent concepts align or diverge from the classical linguistic hierarchy and iii) how the concepts evolve across layers. Some notable findings of our analysis include: i) the model learns novel concepts such as animal categories and demographic groups, which do not strictly adhere to any predefined categorization (e.g., POS, semantic tags), ii) several latent concepts are based on multiple properties which may include semantics, syntax or morphology, iii) lower layers dominate in learning shallow lexical concepts while higher layers learn semantic relations and iv) the discovered latent concepts highlight potential biases learned in the model. We also release a novel BERT concept dataset (BCD) consisting of 183 concept labels and 1M annotated instances.

heading: 1 INTRODUCTION
text: Interpreting deep neural networks (DNNs) is essential for understanding their inner working and for their successful deployment to real world scenarios, especially for applications where fairness, trust, accountability, reliability and ethical decision-making are considered critically important metrics. A large number of studies have been devoted towards interpreting DNNs. A major line of work in interpreting deep NLP models reflects on their ability to learn various language concepts (Tenney et al., 2019b; Liu et al., 2019a). More specifically, they rely on pre-defined linguistic concepts such as: parts-of-speech tags and semantic tags, and probe whether the specific linguistic knowledge is learned in various parts of the network. For example, Belinkov et al. (2020) found that lower layers in the NMT model capture word morphology and the higher layers learn long-range dependencies.
A pitfall to this line of research is its sole reliance on pre-defined concepts which may only provide a narrow view of what the model knows, largely ignoring any latent concepts learned within these models. Another drawback of using user-defined concepts is the involvement of human bias in choosing a concept which may result in a misleading interpretation. In this work, we target this issue and approach interpretability from a model’s perspective by discovering latent concepts in pre-trained models.
Mikolov et al. (2013); Reif et al. (2019) showed that words group together in the high dimensional space based on syntactic and semantic relationships. We hypothesize that these groupings represent latent concepts, a model learns about the language. To this end, we cluster contextualized representations in high dimensional space and study the relation behind each group. More specifically, we use hierarchical clustering to identify groups of related words. We manually annotate the groups and assemble a concept dataset. This is the first concept dataset that enables model-centric interpretation and will serve as a benchmark for analyzing such models. We base our study on BERT (Devlin et al., 2019b). However, our method can be generically applied to other models.
We study i) what latent concepts exist in BERT, ii) how the discovered latent concepts align with pre-defined concepts, and iii) how the concepts evolve across layers. Our analysis reveals interesting findings such as: i) the model learns novel concepts like the hierarchy in animal kingdom, demographic hierarchy etc. which do not strictly adhere to any pre-defined concepts, ii) the lower layers focus on shallow lexical concepts while the higher layers learn semantic relations, iii) the concepts learned at higher layers are more aligned with the linguistically motivated concepts compared to the lower layers, and iv) the discovered latent concepts highlight potential biases learned in the model.
There are two main contributions of our work: i) we interpret BERT by analyzing latent concepts learned in the network, ii) we provide a first multi-facet hierarchical concept dataset (BCD) that addresses a major limitation of a prominent class of interpretation studies. Our proposed concept pool facilitates interpretation from the perspective of the model and will serve as a common benchmark for future research. Moreover, it enriches existing linguistic and pre-defined concepts and has the potential to serve as a new classification dataset for NLP in general. BCD consists of 183 fine-grained concept labels with a total of 1M annotated instances.

heading: 2 RELATED WORK
text: The interpretation of DNNs in NLP has been largely dominated by the post-hoc model analysis (Liu et al., 2019a; Shi et al., 2016; Belinkov et al., 2020; Tenney et al., 2019a) where the primary question is what linguistic concepts are encoded in the representation (Radford et al., 2018; Lakretz et al., 2019; Dalvi et al., 2019; Durrani et al., 2020). The studies have analyzed a range of concepts varying from low-level shallow concepts such as word position and sentence length to linguistically motivated concepts such as parts of speech (POS), syntax and semantic tags. They provide interesting insights into what concepts are learned and encoded in the representation. One of the shortcomings of these studies is their reliance on pre-defined concepts for interpretation. Consequently, novel concepts that models learn about the language are largely undiscovered.
Recently Michael et al. (2020) analyzed latent concepts learned in pre-trained models. They used a binary classification task to induce latent concepts relevant to that task and showed the presence of linguistically motivated and novel concepts in the representation. Mamou et al. (2020) analyzed representations of pre-trained models using mean-field theoretic manifold analysis and showed the emergence of linguistic structure across layer depth. Similar to Michael et al. (2020); Mamou et al. (2020), we aim to analyze latent concepts learned in the representation. However different from them, we intend to analyze raw representations independent of a supervised task. The reliance on a supervision task effects the type of latent concepts found and may not fully reflect the latent concepts encoded in the raw representation. Moreover, the post-hoc classifiers require a careful evaluation to mitigate the concerns regarding the power of the probe (Hewitt & Liang, 2019; Zhang & Bowman, 2018). In this work, we address these limitations by analyzing latent concepts learned in BERT in an unsupervised fashion. In addition, we provide a novel multi-facet hierarchical concept dataset that significantly enrich already existing pre-defined concepts.

heading: 3 WHAT IS A CONCEPT?
text: A concept represents a notion and can be viewed as a coherent fragment of knowledge. Stock (2010) defines concept as “a class containing certain objects as elements, where the objects have certain properties”. Deveaud et al. (2014) considers latent concepts as words that convey the most information or that are the most relevant to the initial query. A concept in language can be anything ranging from a shallow lexical property such as character bigram, to a complex syntactic phenomenon such as a adjectival phrase or a semantic property such as an event. Here, we loosely define concept as a group of words that are meaningful where meaningful can be a lexical, semantic, syntactic, morphological and/or any other relationship. For example, names of ice-hockey teams form a semantic cluster, words that occur in a certain position of a sentence represent a syntactic concept, words that are first person singular verbs form a morphological cluster, words that begin with ”anti” form a lexical cluster. In our implementation, we consider clusters of word contextual representations in BERT as hidden concept candidates and the human-annotated candidates with linguistic meanings as our discovered hidden concepts. However, if a human is unable to identify a relation behind a group of words i.e. not-meaningful, we consider it as uninterpretable. Since, a relation may exist that humans are unable to comprehend.

heading: 4 METHODOLOGY
text: Consider a Neural Network (NN) model M with L layers {l1, l2, ...ll, ..., lL}, where each layer contains H hidden nodes. An input sentence consisting of M words w1, w2, ...wi, ..., wM is fed into NN. For the i-th word input, we can compute the node output (after applying the activation functions) ylh(i) of every hidden node h ∈ {1, ...,H} in each layer l, where
−→y l(i) is the vector representation of all hidden node outputs in layer l for wi. Our goal is to cluster −→y l, the contextual representation, among all i-th input words. We call this clustering as latent concepts that map words into meaningful groups. We introduce an annotation schema and manually assign labels to each cluster following our definition of a concept. In the following, we discuss each step in detail.

heading: 4.1 CLUSTERING
text: Algorithm 1 (Appendix A) presents the clustering procedure. For each layer, we cluster the hidden nodes into K groups using agglomerative hierarchical clustering (Gowda & Krishna, 1978) trained on the contextualized representation. We apply Ward’s minimum variance criterion that minimizes the total within-cluster variance. The distance between two vector representations is calculated with the squared Euclidean distance. The number of clustersK is a hyperparameter. We found an optimal value ofK using the Elbow method. Figure 2 shows the Elbow scores over a range of cluster values. We set K = 1000 since after that point, the inertia starts decreasing linearly.

heading: 4.2 DATA PREPARATION
text: The choice of a dataset is an important factor to be considered when generating latent concepts. Ideally, one would like to form latent clusters over a large collection with diverse domains. However, clustering a large number of points is computationally and memory intensive. In the case of agglomerative hierarchical clustering using Ward linkage, the memory complexity is O(n2), which translates to about 400GB of runtime memory for 200k input vectors. A potential workaround is to use a different linkage algorithm like single or average linkage, but each of these come with their own caveats regarding assumptions around how the space is structured and how noisy the inputs are.
We address these problems by using a subset of a large dataset of News 2018 WMT1 (359M tokens). We randomly select 250k sentences from the dataset (≈5 million tokens). We further limit the number of tokens to ≈210k by discarding singletons, closed-class words, and tokens with a frequency higher than 10. For every token, we extract its contextualized representations and embedding layer representation using the 12-layered BERT-base-cased model (Devlin et al., 2019a) in the following way: First, we tokenize sentences using the Moses tokenizer2 and pass them through the standard pipeline of BERT as implemented in HuggingFace3. We extract layer-wise representations of every token. If the BERT tokenizer splits an input token into subwords or multiple tokens, we mean pool over them to create an embedding of the input token. For every layer, we cluster tokens using their contextualized representations.

heading: 4.3 CONCEPT LABELS
text: We define a hierarchical concept-tagset, starting with the core language properties i.e., semantics, parts-of-speech, lexical, syntax, etc. For each cluster, we assign the core properties that are represented by that cluster, and further enrich the label with finer hierarchical information. It is worth noting that the core language properties are not mutually exclusive i.e., a cluster can belong to more than one core properties at the same time. Consider a group of words mentioning first name of the football players of the German team and all of the names occur at the start of a sentence, the following series of tags will be assigned to the cluster: semantic:origin:Germany, semantic:entertainment:sport:football, semantic:namedentity:person:firstname, syntax:position:firstword. Here, we preserve the hierarchy at various levels such as, sport, person name, origin, etc., which can be used to combine clusters to analyze a larger group.
1http://data.statmt.org/news-crawl/en/ 2https://pypi.org/project/mosestokenizer/ 3https://huggingface.co

heading: 4.4 ANNOTATION TASK
text: Following our definition of concepts, we formulated the annotation task using the two questions below. The annotation task consists of looking at the cluster and answer the following questions.
Q1: Is the cluster meaningful? Q2: Can the two clusters be combined to form a meaningful group?
The answers of both questions are (i) yes, (ii) no, and (iii) don’t know or can’t judge. Q1 mainly involves identifying if the cluster is meaningful, according to our definition of a concept (Section 3). Based on the yes answer of Q1, annotators’ task is to either introduce a new concept label where it belongs or classify it into an appropriate existing concept label. Note that at the initial phase of the annotation, the existing concept label set was empty. As the annotators annotate and finalize the concept labels, we accumulate them into the existing concept label set and provide them in the next round of annotations, in order to facilitate and speed-up the annotations. In Q2, we ask the annotators to identify whether two sibling clusters can be also combined to form a meaningful super-cluster. Our motivation here is to keep the hierarchical information that BERT is capturing intact. For example, a cluster capturing Rock music bands in the US can be combined with its sibling that groups Rock music bands in the UK to form a Rock music bands cluster. Similarly, based on the yes answer of Q2, annotators’ need to assign a concept label for the super-cluster. We show annotators, the contextual information (i.e., corresponding sentences) of the words for each of these questions. Having contextual information enables very fine-grained concepts: for example, named-entities:person can be classified into finer named-entities:person:Hollywood. The annotation guidelines combined with the examples and screenshots of the annotation platform is provided in Appendix B.
The annotators are asked to maintain hierarchy while annotating e.g., a cluster of ice hockey will be annotated as semantic:entertainment:sport:ice hockey since the words are semantically grouped and the group belongs to sports, which is a subcategory of entertainment. In case of more than one possible properties that form a cluster, we annotate it with both properties e.g., title case and country names where the former is a lexical property and the latter is a semantic property.
Since annotation is an expensive process, we carried out annotation of the final layer of BERT only. The concept annotation is performed by three annotators followed by a consolidation step to resolve disagreements if there are any. For the annotation task, we randomly selected 234 clusters out of 1000 clusters obtained during the clustering step (see Section 4.1).

heading: 5 ANNOTATED DATASET

heading: 5.1 INTER ANNOTATION AGREEMENT
text: We computed Fleiss κ (Fleiss et al., 2013) and found the average value for Q1 and Q2 to be 0.61 and 0.64, respectively, which is substantial in the κ measurement (Landis & Koch, 1977). The detail on κ measures and agreement computation using other metrics are reported in Appendix (Table 2).

heading: 5.2 STATISTICS
text: For Q1, we found 198 (84.6%) meaningful clusters and 36 (15.4%) non-meaningful clusters. For Q2, we found 142 (75.9%) clusters out of 187 clusters that form a meaningful cluster when combined with their siblings. The annotation process resulted in 183 unique concept labels from the 234 clusters (See Appendix B.3 for the complete list of labels). The high number of concept labels is due to the fine-grained distinctions and multi-facet nature of the clusters where a cluster can get more than one labels. The label set consists of 20 lexical labels, 10 morphological labels, 152 semantic labels and one syntactic label. The semantic labels form the richest hierarchy where the next level of hierarchy consists of 42 labels such as: entertainment, sports, geo-politics, etc.

heading: 5.3 EXAMPLES OF CONCEPT HIERARCHY
text: In this Section, we describe the concept hierarchy that we have achieved through our annotation process. Figure 1 illustrates an example of a resulting tree found by hierarchical clustering. Each node is a concept candidate. We capture different levels of fine-grained meanings of word groups, which do not exist in pre-defined concepts. For example, a SEM or an NE tagger would mark a name as person, but our discovery of latent concepts show that BERT uses a finer hierarchy by further classifying them as “baseball players”, “soccer players”, and “athletes”. Our annotation process preserves this information and will result in hierarchical labels such as semantic:named-entity:person:celebrity:actor and semantic:named-entity:person:athletes:soccer. Due to the multi-faceted nature of the latent clusters, many of them are annotated with more than one concept label. In the case of the clusters shown in Figure 1, they have a common lexical property (title case) and hence will also get the label LEX:case:title during annotation. Figure 3 shows word clouds of a few annotated clusters along with their descriptions.4

heading: 6 ANALYSIS AND FINDINGS

heading: 6.1 QUALITATIVE ANALYSIS
text: Our annotated dataset unveils insightful analysis of the latent concepts learned within BERT representations. Figure 4 presents a few examples of the discovered concepts. The two clusters of decimal numbers (Figure 4a, 4b) look quite similar, but are semantically different. The former represents numbers appearing as percentages e.g., 9.6% or 2.4 percent and the latter captures monetary figures e.g., 9.6 billion Euros or 2.4 million dollars. We found these two clusters to be sibling, which shows that BERT is learning a morpho-semantic hierarchy where it grouped all the decimal numbers together (morphologically) and then further made a semantic distinction by dividing them into percentages and monetary figures. Such a subtle difference in the usage of decimal numbers shows the importance of using fine-grained concepts for interpretation. For example, numbers are generally analyzed as one concept (CD tag in POS) which may be less informative or even misleading given that BERT treats them in a variety of different ways. Figure 4c shows an example of a cluster where the model captures an era of time, specifically 18 and 19 hundreds. Learning such
4The size of a word represents it’s relative frequency in the cluster.
information may help the model to learn relation between a particular era and the events occurring in that time period. Similarly, we found BERT learning semantic distinction of animal kingdom and separated animals into land, sea and flying groups (see Appendix B.3). These informative categories support the use of pre-trained models as a knowledge base (Petroni et al., 2019).
We further observed that BERT learns aspects specific to the training data. Figure 4d shows a cluster of words where female roles (Moms, Mothers, Granny, Aunt) are grouped together with job roles such as (housekeeper, Maid, Nanny). The contextual information in the sentences where these words appear, do not explicate whether the person is a male or a female, but based on the data used for the training of BERT, it has associated these roles to females. For example, the sentence “Welfare staff ’s ’ good housekeeping ’ praised for uncovering disability benefits error” is a general sentence. However, the contextualized representation of housekeeping in this sentence associates it to a female-related concept. Similarly, in another example BERT clustered names based on demography even though the context in which the word is used, does not explicitly provide such information. An example is the sentence, “Bookings : Dzagoev , Schennikov , Musa , Akinfeev” where the name Musa is used in a diverse context but it is associated to a cluster of specific demography (Arab region). While it is natural to form clusters based on specific data aspects, we argue that the use of such concepts while making a general prediction raises concerns of bias and fairness. For example, a loan prediction application should not rely on the background of the name of the applicant.

heading: 6.2 ALIGNMENT WITH PRE-DEFINED CONCEPTS
text: A number of works on interpreting DNNs study to what extent abstract linguistic concepts such as parts-of-speech tags, semantic tags, etc are captured within the learned representations. This is in view of one school of thought which believes that an NLP model needs to learn linguistic concepts in order to perform well and to generalize (Marasović, 2018). For example, the holy grail in machine translation is that a proficient model ought to be aware of word morphology, grammatical structure, and semantics to do well (Vauquois, 1968; Jones et al., 2012). In this section, we explored how well the latent concepts in BERT align with the pre-defined linguistic concepts.
We compared the resulting clusters with the following pre-defined concepts: parts of speech (POS) tags (Marcus et al., 1993), semantic tags (SEM) using the Parallel Meaning Bank data (Abzianidze et al., 2017), CCG supertagging using CCGBank (Hockenmaier, 2006), syntactic chunking (Chunking) using CoNLL 2000 shared task dataset (Tjong Kim Sang & Buchholz, 2000), WordNet (Miller, 1995) and LIWC psycholinguistic-based tags (Pennebaker et al., 2001). We also introduced lexical and syntactic concepts such as casing, ngram matches, affixes, first and last word in a sentence etc. Appendix D provides the complete list of pre-defined concepts. For POS, SEM, Chunking, and
CCG, we trained a BERT-based classifier using the training data of each task and tagged the words in the selected News dataset. For WordNet and LIWC, we directly used their lexicon.
We consider a latent concept to align with a corresponding pre-defined concept if 90% of the cluster’s tokens have been annotated with that pre-defined concept. For example, Figure 4a and 4b are assigned a tag POS:CD (parts-of-speech:cardinal numbers). Table 1 shows the statistics on the number of clusters matched with the pre-defined concepts. Of the 1000 clusters, we found the linguistic concepts in POS to have maximum alignment (30%) with the latent concepts in BERT, followed by Casing (23%). The remaining pre-defined concepts including various linguistic categories aligned with fewer than 10% of the latent concepts. We further explored the parallelism between the hierarchy of latent and pre-defined linguistic concepts using POS tags. We merged the POS tags into 9 coarse tags and aligned them with the latent concepts. The number of latent concepts aligned to these coarse concepts increased to 50%, showing that the model has learned coarser POS concepts and does not follow the same fine-grained hierarchy.

heading: 6.3 LAYER-WISE COMPARISON OF CONCEPTS
text: How do the latent concepts evolve in the network? To answer this question, we need to manually annotate per-layer latent concepts and do a cross-layer comparison. However, as manual annotation is an expensive process, we used pre-defined concepts as a proxy to annotate the concepts and compare across layers. Figure 5 shows various interesting patterns related to lexical (LEX), syntactic (SYN), morphological (Morph) and semantic (SEM) concepts. Interestingly, the layers differ significantly in terms of the concepts they capture. The lower layers tend to learn shallow linguistic concepts. For example, in Figure 5a – the embedding layer is dominated by the concepts based on common ngram affixes.5 The number of ngram-based shallow lexical clusters consistently decreases in the subsequent layers. The suffixes concept showed a different trend, where the information peaks at the lower-middle layers and then drops in the higher layers. The dominance of ngrams-based concepts in the lower layers is due to the subword segmentation. The noticeable presence in the middle layers might be due to the fact that suffixes often maintain grammatical information unlike other ngrams. For example, the ngram “ome” does not have a linguistic connotation, but suffix “ful” converts a noun into an adjective. Interestingly, casing information is least represented in the lower layers and is consistently improved for higher layers. Casing in English has a morphological role, marking a named entity, which is an essential knowledge to preserve at the higher layers.
The patterns using the classical NLP tasks: POS, SEM, CCG and Chunking all showed similar trends (See Figure 5b and 5c). The concepts were predominantly captured at the middle and higher layers, with minimal representation at the lower layers. WordNet and LIWC, which are cognitive and psychology based grouping of words respectively, showed a rather different trend. These concepts had a higher match at the embedding layer and a consistent drop after the middle layers. In other words, the higher and last layers of BERT are less aligned with the cognitive and psychology based grouping of words, and these concepts are better represented at the embedding and lower layers. We manually investigate a few clusters from the lower layers that match with WordNet and LIWC. We found that these clusters group words based on similar meaning e.g. all words related to ”family relations” or ”directions in space” form a cluster (See Appendix C for more examples). Lastly, Figure 5c also shows that the FirstWord position information is predominantly learned at the last layers only. This is somewhat unexpected, given that no clusters were based on this concept in the embedding layer, despite it having an explicitly position component.
Based on these trends, we can speculate about the evolution of knowledge across the network: lower layers encode the lexical and meaning-related knowledge and with the inclusion of context in the higher layers, the encoded concepts evolve into representing linguistic hierarchy. These findings are in line with Mamou et al. (2020) where they found the emergence of linguistic manifolds across layer depth.

heading: 6.4 UNALIGNED CLUSTERS
text: In this section, we discuss the concepts that were not matched with the pre-defined concepts. We have divided them into 3 categories: i) latent concepts that can be explained via composition of
5For every cluster we pick a matching ngram with highest frequency match. Longest ngram is used when tie-breaker is required. We ignore unigrams.
two pre-defined concepts, ii) concepts that cannot be explained via auto-labels but are meaningful and interpretable, iii) concepts that are uninterpretable. Figure 6a and 6b are examples of the first category mentioned above. The former describes a concept composed of different verb forms. It does not fully align with any of the fine-grained verb categories but can be deemed as a verb cluster at coarser level. Similarly the latter shows a cluster containing singular and plural nouns (described by POS:NN and POS:NNS) and WordNet concepts (WN:noun:food and WN:noun:plants) and can be aligned with a coarser noun category. Figure 6c shows a cluster that does not match with any human-defined concept but are interpretable in that the cluster is composed of compound words. Lastly in Figure 6d, we show a cluster that we found to be unaligned and uninterpretable.
7 BERT CONCEPT DATASET (BCD)
In addition to the manually labeled dataset, we also developed a large dataset, BCD, using a weakly supervised approach. The motivation of creating such a dataset is to provide a reasonable size dataset that can be effectively use for interpretation studies and other tasks. The idea is to expand the number of tokens for every concept cluster by finding new token occurrences that belong to the same cluster. There are several possible ways to develop such a dataset. Here, we explored two different approaches. First: we compute the centroid for each cluster and find the cluster that is closest to the representation of any given new token. However, this did not result in accurate cluster assignment because of the non-spherical and irregularly shaped clusters. Second: we developed a logistic regression classifier (as shown in Appendix A, Algorithm 2) using our manually annotated dataset to assign new tokens to given concept clusters. We found the second approach better than the former in terms of token to cluster assignment. We trained the model using 90% of the concept clusters and evaluate its performance on the remaining 10% concept clusters (held-out set). The classifier achieved a precision score of 75% on the held-out set. In order to achieve higher precision, we introduce a threshold t = 0.97 on the confidence of the predicted cluster id, assigning new tokens to particular clusters only when the confidence of the classifier is higher than the threshold. This enables better precision in cluster assignment to the new tokens, at the expense of discarding some potentially good assignments, which can be offset by using more data for prediction.
Using the trained model we labeled all the tokens from the 2 million random sentences from the unused News 2018 dataset (see Section 4). The resulting dataset: BCD is a unique multi-faceted resource consisting of 198 concept labels with a total of 989,424 annotated instances. The average number of annotated instances per concept label are 4,997. The utility of this resource is not limited to interpretation, but can serve as a valuable fine-grained dataset for the NLP community at large. The hierarchy present in the concept labels provides flexibility to use data with various granularity levels. Appendix F provides the detailed statistics for BCD.
Case Study In order to showcase the efficacy of BCD as a useful resource in interpretation, we present a case-study based on neuron-level interpretation in this section. The goal of Neuron-level interpretation in DNNs is to discover a set of neurons responsible for any given concept (Sajjad et al., 2021). Most of the work in this direction has identified neurons responsible for concepts belonging to the core NLP tasks such as POS, SEM and Chunking. In this work, we found that BERT learns finer categories compared to the ones defined in the core NLP tasks such as proper nouns (NNP). BCD splits proper nouns into a large number of fine-grained concepts, each representing a unique facet. We argue that the large number of neurons found for NNP are the result of it being a very diverse concept, and that there may be neurons that learn specific aspects of NNP. Neuron analysis for fine-grained concepts (as present in BCD) such as proper-noun:person:specific-demography would enable a more precise selection of neurons. Aside from the benefit of achieving more insightful analysis, the discovery of specific neurons will also facilitate various applications such as model control (Bau et al., 2019; Gu et al., 2021; Suau et al., 2020), domain adaptation (Gu et al., 2021) and debiasing.
In a preliminary experiment, we performed neuron analysis using the PER (person) concept of SEM and the fine-grained concept of Muslim names (Figure 4e). We then compared the amount of neurons required for each concept. For the SEM dataset, we used the standard splits (Appendix D). For the fine-grained concept, the BCD dataset consists of 2748 Muslim name instances. We randomly selected an equal amount of negative class instances and split the data into 80% train, 10% development and 10% test sets. We used Linguistic Correlation Analysis (Dalvi et al., 2019) and identified the minimum number of neurons responsible for each concept. We found that only 19 neurons are enough to represent the fine-grained concept as opposed to 74 neurons for the PER concept of SEM, showing that the BCD dataset enables selection of specialized neurons responsible for very specific aspects of the language.

heading: 8 CONCLUSION
text: In this work, we have provided a comprehensive analysis of latent concepts learned in the BERT model. Our analysis revealed various notable findings such as, i) the model learns novel concepts which do not strictly adhere to any pre-defined linguistic groups, ii) various latent concepts are composed of multiple independent properties, such as proper-nouns and first word in a sentence, iii) lower layers specialize in learning shallow lexical concepts while the middle and higher layers have a better representation of core linguistic and semantic concepts. We also released a novel BERTcentric concept dataset that not only facilitates future interpretation studies, but will also serve as an annotated dataset similar to POS, WordNet and SEM. Different from the classical NLP datasets, it provides a unique multi-facet set of concepts.
While this work has led to plenty of insight into the inner workings of BERT and led to a novel resource, increasing the diversity of the observed concepts is an important direction of future work. Working around the memory and algorithm constraints will allow the creation of a more varied concept set. Phrase-level concepts is yet another direction that can be explored further. Finally, a few works on analyzing word representations (both static and contextual) like Reif et al. (2019) and Ethayarajh (2019) have alluded that taking the principal components into account may lead to a more controlled analysis. Incorporating this line of work may yield useful insights into the type of discovered latent clusters.

heading: A CLUSTERING ALGORITHM AND BCD ALGORITHM
text: Algorithm 1 Learning Latent Concept with Clustering Input: −→y l = word representation of all running words Parameter: K = No. of output clusters
1: for each word wi do 2: assign wi to cluster ci 3: end for 4: while No. of clusters 6= K do 5: for each cluster pair ci,ci′ do 6: di,i′ = inner-cluster difference of combined cluster ci and ci′ 7: end for 8: cj ,cj′ = cluster pair with minimum
value of d 9: merge clusters cj and cj′
10: end while
Algorithm 2 Concept Prediction with Logistic regression Input: Xtrain = word representations for train data, Ytrain = cluster id from Algorithm 1, Xtest = word representations for test data, Parameter: t = probability threshold
1: c = unique cluster ids from Ytrain 2: M = train Logistic Regression model on Xtrain and Ytrain 3: for each x ∈ Xtest do 4: p = predict K probabilities for each
cluster using M and input x 5: i = argmax p 6: if pi >= t then 7: assign x to cluster id ci 8: end if 9: end for

heading: B ANNOTATION DETAILS
text: For the annotation, we prepared detailed instructions to guide the annotators, which they followed during the annotation tasks. Our annotation consists of two questions: (i) Q1: Is the cluster meaningful?, (ii) Q2: Can the two clusters be combined to form a meaningful group?. The word cluster is represented in a form of a word cloud, where the frequency of the word in the data represents a relative size of the word in the word cloud. To understand the context of each word in the cluster we also facilitated annotators with associated sentences from the dataset. For the annotation, we provided specific instructions with examples for each question. With the second question, the idea is to understand whether two sibling clusters can be combined to form a meaningful super-cluster. For the second question, two clusters are siblings, which we automatically identified from our hierarchical clustering model. We showed the second question only if a sibling of the main cluster (cluster presented in the first question) was available or identified by the clustering algorithm. Hence, annotators did not see the second question in all annotations. Below we provided instructions which we accompanied with the annotation platform in a form of a tutorial.
B.1 ANNOTATION INSTRUCTIONS
The annotation task was to look first look at a group of words (i.e., representing as a cluster) and answer the first question. Then, look at two groups of words to answer the second question.
Q1: IS THE CLUSTER MEANINGFUL?
A word group is meaningful if it contains semantically, syntactically, or lexically similar words. The example in Figure 7 has only numbers with two digits, hence, this is a meaningful group. The labels for this question include the following:
1. Yes (if represents a meaningful cluster) 2. No (if it does not represent any meaningful cluster) 3. Don’t know or can’t judge (if it does not have enough information to make a judgment.
It is recommended to categorize the word groups using this label when the word group is not understandable at all.)
If the answer to this question is Yes, then the task would be to assign a name to the word cluster using one or more words. While assigning the name, it is important to maintain the hierarchy. For example, for the above word group in Figure 7, we can assign a name: semantic:number. This needs to be written in the text box right below this question. While deciding the name of the cluster, the priority has to be to focus on semantics first, syntax second, and followed by any other meaningful aspects. While annotating it is also important to consider (i) their relative frequency of the tokens in the cluster, which is clearly visible in the word cluster, (ii) context in a sentence where the word appears in.

heading: Q2: CAN THE TWO CLUSTERS BE COMBINED TO FORM A MEANINGFUL GROUP?
text: For this question, two clusters are shown and the task is to see if they can form a meaningful supercluster after combining. In these two clusters, the left one is the same cluster annotated for the first question. The answer (i.e., labels) of this question is similar to Q1: Yes, No and Don’t know or can’t judge. Depending on the answer to this question the task is to provide a meaningful name similar to Q1.
In Figure 8 and 9 we provide screenshots for Q1 and Q2, respectively.

heading: A1 - C 0.604 0.604 0.915

heading: A2 - C 0.622 0.623 0.921

heading: A1 - C 0.702 0.700 0.853

heading: A2 - C 0.625 0.621 0.814
text: B.2 ANNOTATION AGREEMENT
We computed annotation agreement using Fleiss κ Fleiss et al. (2013), Krippendorff’s α Krippendorff (1970) and average observed agreement Fleiss et al. (2013). In Table 2, we present the annotation agreement with different approaches.
B.3 CONCEPT LABELS
Out annotation process resultant in 183 concept labels. In Table 3, 4 and 5 we report LEX, POS and SEM concepts labels, respectively.

heading: C ANALYSIS
text: Figure 10 shows example concepts. Figure 11 shows examples of LIWC and WordNet concepts found in lowe layers.

heading: D PRE-DEFINED CONCEPTS INFORMATION
text: D.1 PRE-DEFINED CONCEPTS
Table 6 provides a list of all pre-defined concepts used in this work.
D.2 DATA AND EXPERIMENTAL SETUP
We used standard splits for training, development and test data for the 4 linguistic tasks (POS, SEM, Chunking and CCG super tagging). The splits to preprocess the data are available through git
repository6 released with Liu et al. (2019a). See Table 7 for statistics. We obtained the understudied pre-trained models from the authors of the paper, through personal communication.

heading: E COMPARING PRE-TRAINED MODELS
text: How do models compare with respect to the pre-defined concepts? Similar to BERT, we created layer-wise latent clusters using RoBERTa (Liu et al., 2019b) and XLNet (Yang et al., 2019). We aligned the clusters with the pre-defined concepts. Figure 12 and 13 shows the results. The overall trend of the models learning shallow concepts in lower layers and linguistic concepts in the middle-higher layers is consistent across all models. A few exceptions are: suffixes have a consistently decreasing pattern for XLNet and RoBERTa, the FirstWord information improved for every higher layer till the last few layers. Moreover, XLNet showed a significant drop in matches with the linguistic tasks for the last layers. The last layers of the models are optimized for the objective function (Kovaleva et al., 2019) and there the drop in matches for most of the concepts reflects the existence of novel task-specific concepts which may not be well aligned with the human-defined concepts.
The number of matches as shown in brackets in Figure 5, 12 and 13 provides a relative comparison across models and pre-defined concepts. The RoBERTa and XLNet found substantially more
6https://github.com/nelson-liu/contextual-repr-analysis
matches with most of the classical NLP tasks compared to BERT. The difference is much more pronounced in the case of POS with RoBERTa have the highest match. This may reflect that the latent concepts of RoBERTa follow a closer hierarchy to POS compared to other models. On contrary, for WordNet and LIWC BERT showed substantially better alignment than the other two models.

heading: F BCD DETAILS
text: In Table 8, 9 and 10, we provide concept label with the number of token and type for LEX, POS and SEM.
Example of Sem tags Words
SEM:action:negative confine, cripple, decimate, demonised, disappoints, dislocation, disobeyed, disqualify, distort, downsized, jeopardise, hijacked, trashed, traumatizing, undercutting, underpins, underplayed, undervalue, spoilt, spouting, spurned, stifled SEM:action:body:face Gaze, LAUGH, Tears, admiring, blushing, chuckles, clap, frown, gasp,giggle, grimace, murmur, smirk, twinkle, wink SEM:activism:demonstration Aggression, Arguments, Armored, Attackers, Attacks, Backlash, Ceasefire, Clashes, Cops, Counterfeiting SEM:animal:land animal Ants, Bees, Beetle, Cobra, Frog, Jaws, Leopard, Paw, Snakes, Spider, Sumatran, frog SEM:animal:sea animal Salmon, Shellfish, Trout, catfish, crabs, eel, herring, octopus, oyster, oysters, snail, squid, trout
Table 11: Example of Sem tags with associated words.

Review summaries:
The paper performs a clustering analysis on the contextual representations of BERT on a subset of the News 2018 WMT corpus. These clusters are manually tagged by 3 annotators to connect these clusters to human concepts. The authors additionally release a dataset with these concepts labeled.

This paper studies the latent concept learned in BERT representations. The authors use a simple and effective clustering method to discover latent concepts in an unsupervised way. The contribution is primarily on the empirical side where the learned concepts are labeled and compared with pre-defined concepts. Then a layer-wise comparison is conducted where the results are similar to previous work but is done in an unsupervised way. The authors summarise this paper by organizing the discovered concepts into a BCD dataset. The writing is also clear. While there are many aspects deserving further pursuit, I think this is a solid paper that makes concrete contributions to the understanding of BERT. 

**Summary**    While a large number of previous papers evaluate DNN models on pre-defined concepts, this paper interprets the models (i.e., BERT) on latent concepts that are learned in an unsupervised manner. The analyses in this paper include: (1) Agglomerative hierarchical clustering from ~200k embedded tokens. (2) Comparing the clustered concepts to some hierarchical concept-tagsets. The authors find that lower layers learn many shallow lexical concepts, while higher layers learn more semantic relations. In addition, this paper releases a novel BERT concept dataset (BCD). With cross validation, the authors show that the BCD dataset has high consistency.  **Contributions**  1. Interpret BERT by analyzing latent concepts learned in the network 2. Collect and annotate a hierarchical concept dataset (BCD)

The paper analyses concepts that BERT can capture. The core idea is to use agglomerative hierarchical clustering method to discover latent concepts (i.e. clusters) with hierarchy. Those clusters were manually assigned labels / meanings. The authors then used these labelled clusters to analyse concepts that BERT captures, across several syntactic and semantics aspects. The labelled clusters were also used to build a concept dataset (namely BERT concept dataset - BCD) for 1M instances (i.e. words in contexts).