Word Equations: Inherently Interpretable Sparse Word Embeddings through Sparse Coding (2021)

Abstract: Word embeddings are a powerful natural language processing technique, but they are extremely difficult to interpret. To enable interpretable NLP models, we create vectors where each dimension is inherently interpretable. By inherently interpretable, we mean a system where each dimension is associated with some human-understandable hint that can describe the meaning of that dimension. In order to create more interpretable word embeddings, we transform pretrained dense word embeddings into sparse embeddings. These new embeddings are inherently interpretable: each of their dimensions is created from and represents a natural language word or specific grammatical concept. We construct these embeddings through sparse coding, where each vector in the basis set is itself a word embedding. Therefore, each dimension of our sparse vectors corresponds to a natural language word. We also show that models trained using these sparse embeddings can achieve good performance and are more interpretable in practice, including through human evaluations.

## introduction word embeddings represent each word in a natural language as a vector in a continuous high dimensional space. many different pretrained embeddings are readily available @xcite @xcite , and are used in a range of applications @xcite . this vector representation can be said to encode the meaning of the word; not only are similar words close together but linear relationships between words are thought to have conceptual meaning. in the famous example, the vector difference between 'man' and 'woman' is similar to the vector difference between 'king' and 'queen' @xcite . this observation suggests that the vector difference between 'woman' and 'man' represents a concept of gender within the vector space, implying that dimensions or linear combinations of dimensions in the vector space are related to human-understandable concepts. however, in practice, interpreting these vector spaces is extremely difficult. this obscures the behavior of any nlp model built on top of word embeddings. to enable interpretable nlp models, we create vectors where each dimension is inherently interpretable. by inherently interpretable, we mean a system where each dimension is associated with some human-understandable hint that can describe the meaning of that dimension. this allows us to directly interpret the coefficients of simple models trained on these vectors. by comparison, most other systems of interpretable word embeddings aim to create dimensions that humans may be able to manually interpret after the fact. to create our vectors, we represent word embeddings as the sparse linear combination of a basis set of other word embeddings. our primary contribution is that, instead of learning an optimal basis for our sparse vector space, we draw the columns of the basis from the original set of dense word embeddings. this strategy provides a natural label for each sparse dimension and allows us to represent each natural language word as the linear combination of a small number of other natural language words. this representation is itself a more 'interpretable' word embedding. this technique produces representations of words that have interpretable dimensions. we show that these representations are more interpretable and that models trained on these embeddings perform almost as well as models trained on standard dense embeddings. we show how the creation of inherently interpretable vectors can help us understand the behavior and structure of the original word embeddings. recent work has created more interpretable vectors through a variety of methods. however, relatively few approaches create inherently interpretable dimensions. therefore, we believe that our work, which creates inherently interpretable embeddings through a simple novel method can be the basis of future nlp tools where interpretability is crucial. as an example, we present one randomly selected embedding from our system. more examples can be found in the appendix. ## previous work park et al. @xcite find a more interpretable rotation of word embeddings using techniques associated with factor analysis. other work @xcite rotates dense vectors using different methods. @xcite tie concepts to dimensions in a more direct way. they select a concept for each dense dimension and identify words that are associated with these concepts. a penalty term pushes coefficients for these words towards the fixed values. other work has focused on interpretability through sparsity. subramian et al. @xcite created more interpretable embeddings by passing pretrained dense embeddings through a sparse autoencoder. panigrahi et al. @xcite proposed word2sense, a generative approach that models each dimension as a 'sense' and word embeddings as a sparse probability distribution over the senses. the mathematical technique we use in this paper, sparse coding, which is defined as the representation of vectors as the sparse linear combination of an overcomplete basis, is a well-studied optimization problem @xcite @xcite . previous work @xcite has also shown that basis vectors can be efficiently selected from the set that is being encoded. faruqui et al. @xcite used nonnegative sparse coding to recode dense word embeddings into more interpretable sparse vectors while learning a basis. however, because they create their basis through direct optimization, the basis vectors (and, consequently, the dimensions in their transformed sparse space) do not have any inherent interpretation and must be manually interpreted. zhang et al. @xcite also used nonnegative sparse coding to learn a set of word factors to recode word2vec embeddings. the basis vectors created in this way are highly redundant, so they then use spectral clustering to remove nearduplicate factors. then, they are able to manually infer reasonable post hoc interpretations for most of the factors. concurrently with our work, mathew et al. create an inherently interpretable subspace from pairs of antonyms. they then project embeddings into that subspace, producing lower-dimensional dense vectors @xcite . ## model our work uses sparse coding to transform a set of word embeddings from a dense and uninterpretable space into a sparse and interpretable space. let v d represent a dense word embedding, and let b represent a matrix with basis vectors along the columns. b has size (n s , n n ) where n d is the dimensionality of the dense vectors and n s is the dimensionality of the sparse vectors. we achieve sparse coding using regularized regression, inducing sparsity using the l 1 norm. formally, this corresponds to finding the sparse vector v s that minimizes the following objective function note that by 'basis' we mean a set of vectors in the dense space, each one corresponding to a dimension in the transformed, sparse, space. out of necessity, these vectors are overcomplete (there are more dimensions than vectors) and so they do not form a basis according to the traditional definition. previous work using sparse coding to create interpretable word embeddings has considered the basis b to be part of the optimization problem @xcite . our primary contribution is that, instead of learning an optimal basis, we draw the columns of the basis from the original set of dense word embeddings. this strategy provides a natural label for each sparse dimension. ## results we will evaluate this model in multiple ways. in particular, we care about two contradictory properties of our transformed vector space. first, we want our vector space to be useful in downstream machine learning applications. we expect that, in most applications, increased interpretability comes with some performance cost. therefore, we care about the performance loss when moving from dense vectors to our sparse vectors. the other goal is that our sparse vectors should be interpretable. it is much harder to articulate exactly what interpretability is or how we can measure it. metrics such as the word intrusion task (section2) can act as a useful proxy for interpretability, and we use it as our primary quantitative measure of interpretability. but part of interpretability is, by definition, subjective and any metric is imperfect. ## appendix a gramtacic basis descriptions our approach makes use of four types of grammatical basis vectors: the choice and construction of these grammatical basis vectors is highly arbitrary, and different grammatical basis vectors could easily be used in different applications or in follow up work.