A Latent Variable Model Approach to PMI-based Word Embeddings

Semantic word embeddings represent the meaning of a word via a vector, and are created by diverse methods. Many use nonlinear operations on co-occurrence statistics, and have hand-tuned hyperparameters and reweighting methods. This paper proposes a new generative model, a dynamic version of the log-linear topic model of Mnih and Hinton (2007). The methodological novelty is to use the prior to compute closed form expressions for word statistics. This provides a theoretical justification for nonlinear models like PMI, word2vec, and GloVe, as well as some hyperparameter choices. It also helps explain why low-dimensional semantic embeddings contain linear algebraic structure that allows solution of word analogies, as shown by Mikolov et al. (2013a) and many subsequent papers. Experimental support is provided for the generative model assumptions, the most important of which is that latent word vectors are fairly uniformly dispersed in space.


Introduction
Vector representations of words (word embeddings) try to capture relationships between words as distance or angle, and have many applications in computational linguistics and machine learning. They are constructed by various models whose unifying philosophy is that the meaning of a word is defined by "the company it keeps" (Firth, 1957), namely, co-occurrence statistics. The simplest meth-ods use word vectors that explicitly represent cooccurrence statistics. Reweighting heuristics are known to improve these methods, as is dimension reduction (Deerwester et al., 1990). Some reweighting methods are nonlinear, which include taking the square root of co-occurrence counts (Rohde et al., 2006), or the logarithm, or the related Pointwise Mutual Information (PMI) (Church and Hanks, 1990). These are collectively referred to as Vector Space Models, surveyed in (Turney and Pantel, 2010).
Neural network language models (Rumelhart et al., 1986;Rumelhart et al., 1988;Bengio et al., 2006;Collobert and Weston, 2008a) propose another way to construct embeddings: the word vector is simply the neural network's internal representation for the word. This method is nonlinear and nonconvex. It was popularized via word2vec, a family of energy-based models in (Mikolov et al., 2013b;Mikolov et al., 2013c), followed by a matrix factorization approach called GloVe (Pennington et al., 2014). The first paper also showed how to solve analogies using linear algebra on word embeddings. Experiments and theory were used to suggest that these newer methods are related to the older PMI-based models, but with new hyperparameters and/or term reweighting methods (Levy and Goldberg, 2014b).
But note that even the old PMI method is a bit mysterious. The simplest version considers a symmetric matrix with each row/column indexed by a word. The entry for (w, w ) is PMI(w, w ) = log p(w,w ) p(w)p(w ) , where p(w, w ) is the empirical probability of words w, w appearing within a window of certain size in the corpus, and p(w) is the marginal probability of w. (More complicated models could use asymmetric matrices with columns corresponding to context words or phrases, and also involve tensorization.) Then word vectors are obtained by lowrank SVD on this matrix, or a related matrix with term reweightings. In particular, the PMI matrix is found to be closely approximated by a low rank matrix: there exist word vectors in say 300 dimensions, which is much smaller than the number of words in the dictionary, such that v w , v w ≈ PMI(w, w ) ( 1.1) where ≈ should be interpreted loosely. There appears to be no theoretical explanation for this empirical finding about the approximate low rank of the PMI matrix. The current paper addresses this. Specifically, we propose a probabilistic model of text generation that augments the log-linear topic model of Mnih and Hinton (2007) with dynamics, in the form of a random walk over a latent discourse space. The chief methodological contribution is using the model priors to analytically derive a closedform expression that directly explains (1.1); see Theorem 2.2 in Section 2. Section 3 builds on this insight to give a rigorous justification for models such as word2vec and GloVe, including the hyperparameter choices for the latter. The insight also leads to a mathematical explanation for why these word embeddings allow analogies to be solved using linear algebra; see Section 4. Section 5 shows good empirical fit to this model's assumtions and predictions, including the surprising one that word vectors are pretty uniformly distributed (isotropic) in space.

Related work
Latent variable probabilistic models of language have been used for word embeddings before, including Latent Dirichlet Allocation (LDA) and its more complicated variants (see the survey (Blei, 2012)), and some neurally inspired nonlinear models (Mnih and Hinton, 2007;Maas et al., 2011). In fact, LDA evolved out of efforts in the 1990s to provide a generative model that "explains" the success of older vector space methods like Latent Semantic Indexing (Papadimitriou et al., 1998;Hofmann, 1999). However, none of these earlier generative models has been linked to PMI models. Levy and Goldberg (2014b) tried to relate word2vec to PMI models. They showed that if there were no dimension constraint in word2vec, specifically, the "skip-gram with negative sampling (SGNS)" version of the model, then its solutions would satisfy (1.1), provided the right hand side were replaced by PMI(w, w ) − β for some scalar β. However, skip-gram is a discriminative model (due to the use of negative sampling), not generative. Furthermore, their argument only applies to very highdimensional word embeddings, and thus does not address low-dimensional embeddings, which have superior quality in applications. Hashimoto et al. (2016) focuses on issues similar to our paper. They model text generation as a random walk on words, which are assumed to be embedded as vectors in a geometric space. Given that the last word produced was w, the probability that the next word is w is assumed to be given by h(|v w − v w | 2 ) for a suitable function h, and this model leads to an explanation of (1.1). By contrast our random walk involves a latent discourse vector, which has a clearer semantic interpretation and has proven useful in subsequent work, e.g. understanding structure of word embeddings for polysemous words Arora et al. (2016). Also our work clarifies some weighting and bias terms in the training objectives of previous methods (Section 3) and also the phenomenon discussed in the next paragraph.
Researchers have tried to understand why vectors obtained from the highly nonlinear word2vec models exhibit linear structures (Levy and Goldberg, 2014a;Pennington et al., 2014). Specifically, for analogies like "man:woman::king:??," queen happens to be the word whose vector v queen is the most similar to the vector v king − v man + v woman . This suggests that simple semantic relationships, such as masculine vs feminine tested in the above example, correspond approximately to a single direction in space, a phenomenon we will henceforth refer to as RELATIONS=LINES. Section 4 surveys earlier attempts to explain this phenomenon and their shortcoming, namely, that they ignore the large approximation error in relationships like (1.1). This error appears larger than the difference between the best solution and the second best (incorrect) solution in analogy solving, so that this error could in principle lead to a complete 386 failure in analogy solving. In our explanation, the low dimensionality of the word vectors plays a key role. This can also be seen as a theoretical explanation of the old observation that dimension reduction improves the quality of word embeddings for various tasks. The intuitive explanation often given -that smaller models generalize better-turns out to be fallacious, since the training method for creating embeddings makes no reference to analogy solving. Thus there is no a priori reason why lowdimensional model parameters (i.e., lower model capacity) should lead to better performance in analogy solving, just as there is no reason they are better at some other unrelated task like predicting the weather.

Benefits of generative approaches
In addition to giving some form of "unification" of existing methods, our generative model also brings more intepretability to word embeddings beyond traditional cosine similarity and even analogy solving. For example, it led to an understanding of how the different senses of a polysemous word (e.g., bank) reside in linear superposition within the word embedding (Arora et al., 2016). Such insight into embeddings may prove useful in the numerous settings in NLP and neuroscience where they are used.
Another new explanatory feature of our model is that low dimensionality of word embeddings plays a key theoretical role -unlike in previous papers where the model is agnostic about the dimension of the embeddings, and the superiority of low-dimensional embeddings is an empirical finding (starting with Deerwester et al. (1990)). Specifically, our theoretical analysis makes the key assumption that the set of all word vectors (which are latent variables of the generative model) are spatially isotropic, which means that they have no preferred direction in space. Having n vectors be isotropic in d dimensions requires d n. This isotropy is needed in the calculations (i.e., multidimensional integral) that yield (1.1). It also holds empirically for our word vectors, as shown in Section 5.
The isotropy of low-dimensional word vectors also plays a key role in our explanation of the RELATIONS=LINES phenomenon (Section 4). The isotropy has a "purification" effect that mitigates the effect of the (rather large) approximation error in the PMI models.

Generative model and its properties
The model treats corpus generation as a dynamic process, where the t-th word is produced at step t. The process is driven by the random walk of a discourse vector c t ∈ d . Its coordinates represent what is being talked about. 1 Each word has a (timeinvariant) latent vector v w ∈ d that captures its correlations with the discourse vector. We model this bias with a log-linear word production model: The discourse vector c t does a slow random walk (meaning that c t+1 is obtained from c t by adding a small random displacement vector), so that nearby words are generated under similar discourses. We are interested in the probabilities that word pairs cooccur near each other, so occasional big jumps in the random walk are allowed because they have negligible effect on these probabilities.
A similar log-linear model appears in Mnih and Hinton (2007) but without the random walk. The linear chain CRF of Collobert and Weston (2008b) is more general. The dynamic topic model of Blei and Lafferty (2006) utilizes topic dynamics, but with a linear word production model. Belanger and Kakade (2015) have proposed a dynamic model for text using Kalman Filters, where the sequence of words is generated from Gaussian linear dynamical systems, rather than the log-linear model in our case.
The novelty here over such past works is a theoretical analysis in the method-of-moments tradition (Hsu et al., 2012;Cohen et al., 2012). Assuming a prior on the random walk we analytically integrate out the hidden random variables and compute a simple closed form expression that approximately connects the model parameters to the observable joint probabilities (see Theorem 2.2). This is reminiscent of analysis of similar random walk models in finance (Black and Scholes, 1973).
Model details. Let n denote the number of words and d denote the dimension of the discourse space, where 1 ≤ d ≤ n. Inspecting (2.1) suggests word vectors need to have varying lengths, to fit the empirical finding that word probabilities satisfy a power law. Furthermore, we will assume that in the bulk, the word vectors are distributed uniformly in space, earlier referred to as isotropy. This can be quantified as a prior in the Bayesian tradition. More precisely, the ensemble of word vectors consists of i.i.d draws generated by v = s ·v, wherev is from the spherical Gaussian distribution, and s is a scalar random variable. We assume s is a random scalar with expectation τ = Θ(1) and s is always upper bounded by κ, which is another constant. Here τ governs the expected magnitude of v, c t , and it is particularly important to choose it to be Θ(1) so that the distribution Pr[w|c t ] ∝ exp( v w , c t ) is interesting. 2 Moreover, the dynamic range of word probabilities will roughly equal exp(κ 2 ), so one should think of κ as an absolute constant like 5. These details about s are important for realistic modeling but not too important in our analysis. (Furthermore, readers uncomfortable with this simplistic Bayesian prior should look at Section 2.1 below.) Finally, we clarify the nature of the random walk. We assume that the stationary distribution of the random walk is uniform over the unit sphere, denoted by C. The transition kernel of the random walk can be in any form so long as at each step the movement of the discourse vector is at most 2 / √ d in 2 norm. 3 This is still fast enough to let the walk mix quickly in the space.
The following lemma (whose proof appears in the appendix) is central to the analysis. It says that under the Bayesian prior, the partition function Z c = w exp( v w , c ), which is the implied normalization in equation (2.1), is close to some constant Z for most of the discourses c. This can be seen as a plausible theoretical explanation of a phenomenon called self-normalization in log-linear models: ignoring the partition function or treating it as a constant (which greatly simplifies training) is known to often give good results. This has also been studied 2 A larger τ will make Pr[w|ct] too peaked and a smaller one will make it too uniform.
3 More precisely, the proof extends to any symmetric product stationary distribution C with sub-Gaussian coordinate satisfying Ec c 2 = 1, and the steps are such that for all ct, in (Andreas and Klein, 2014).

Lemma 2.1 (Concentration of partition functions).
If the word vectors satisfy the Bayesian prior described in the model details, then The concentration of the partition functions then leads to our main theorem (the proof is in the appendix). The theorem gives simple closed form approximations for p(w), the probability of word w in the corpus, and p(w, w ), the probability that two words w, w occur next to each other. The theorem states the result for the window size q = 2, but the same analysis works for pairs that appear in a small window, say of size 10, as stated in Corollary 2.3. Recall that PMI(w, w ) = log[p(w, w )/(p(w)p(w ))]. Theorem 2.2. Suppose the word vectors satisfy the inequality (2.2), and window size q = 2. Then, . Jointly these imply: Remarks 1. Since the word vectors have 2 norm of the order of √ d, for two typical word vectors v w , v w , v w + v w 2 2 is of the order of Θ(d). Therefore the noise level is very small compared to the leading term 1 2d v w + v w 2 2 . For PMI however, the noise level O( ) could be comparable to the leading term, and empirically we also find higher error here.
Remarks 2. Variants of the expression for joint probability in (2.3) had been hypothesized based upon empirical evidence in Mikolov et al. (2013b) and also Globerson et al. (2007), and Maron et al. (2010) .
Remarks 3. Theorem 2.2 directly leads to the extension to a general window size q as follows: 388 Corollary 2.3. Let p q (w, w ) be the co-occurrence probability in windows of size q, and PMI q (w, w ) be the corresponding PMI value. Then It is quite easy to see that Theorem 2.2 implies the Corollary 2.3, as when the window size is q the pair w, w could appear in any of q 2 positions within the window, and the joint probability of w, w is roughly the same for any positions because the discourse vector changes slowly. (Of course, the error term gets worse as we consider larger window sizes, although for any constant size, the statement of the theorem is correct.) This is also consistent with the shift β for fitting PMI in (Levy and Goldberg, 2014b), which showed that without dimension constraints, the solution to skip-gram with negative sampling satisfies PMI (w, w ) − β = v w , v w for a constant β that is related to the negative sampling in the optimization. Our result justifies via a generative model why this should be satisfied even for low dimensional word vectors.

Weakening the model assumptions
For readers uncomfortable with Bayesian priors, we can replace our assumptions with concrete properties of word vectors that are empirically verifiable (Section 5.1) for our final word vectors, and in fact also for word vectors computed using other recent methods.
The word meanings are assumed to be represented by some "ground truth" vectors, which the experimenter is trying to recover. These ground truth vectors are assumed to be spatially isotropic in the bulk, in the following two specific ways: (i) For almost all unit vectors c the sum w exp( v w , c ) is close to a constant Z; (ii) Singular values of the matrix of word vectors satisfy properties similar to those of random matrices, as formalized in the paragraph before Theorem 4.1. Our Bayesian prior on the word vectors happens to imply that these two conditions hold with high probability. But the conditions may hold even if the prior doesn't hold. Furthermore, they are compatible with all sorts of local structure among word vectors such as existence of clusterings, which would be absent in truly random vectors drawn from our prior.

Training objective and relationship to other models
To get a training objective out of Theorem 2.2, we reason as follows. Let X w,w be the number of times words w and w co-occur within the same window in the corpus. The probability p(w, w ) of such a co-occurrence at any particular time is given by (2.3). Successive samples from a random walk are not independent. But if the random walk mixes fairly quickly (the mixing time is related to the logarithm of the vocabulary size), then the distribution of X w,w 's is very close to a multinomial distribution Mul(L, {p(w, w )}), whereL = w,w X w,w is the total number of word pairs. Assuming this approximation, we show below that the maximum likelihood values for the word vectors correspond to the following optimization, As is usual, empirical performance is improved by weighting down very frequent word pairs, possibly because very frequent words such as "the" do not fit our model. This is done by replacing the weighting X w,w by its truncation min{X w,w , X max } where X max is a constant such as 100. We call this objective with the truncated weights SN (Squared Norm).
We now give its derivation. Maximizing the likelihood of {X w,w } is equivalent to maximizing Denote the logarithm of the ratio between the expected count and the empirical count as Then with some calculation, we obtain the following where c is independent of the empirical observations X w,w 's.
On the other hand, using e x ≈ 1 + x + x 2 /2 when x is small, 4 we havẽ Plugging this into (3.2) leads to So maximizing the likelihood is approximately equivalent to minimizing the right hand side, which (by examining (3.1)) leads to our objective.
Objective for training with PMI. A similar objective PMI can be obtained from (2.5), by computing an approximate MLE, using the fact that the error between the empirical and true value of PMI(w, w ) is driven by the smaller term p(w, w ), and not the larger terms p(w), p(w ).
This is of course very analogous to classical VSM methods, with a novel reweighting method. Fitting to either of the objectives involves solving a version of Weighted SVD which is NP-hard, but empirically seems solvable in our setting via Ada-Grad (Duchi et al., 2011).
is well justified. The terms where ∆ w,w is significant correspond to X w,w 's that are small. But empirically, X w,w 's obey a power law distribution (see, e.g. Pennington et al. (2014)) using which it can be shown that these terms contribute a small fraction of the final objective (3.3). So we can safely ignore the errors. Full details appear in the ArXiv version of this paper (Arora et al., 2015).
Connection to GloVe. Compare SN with the objective used by GloVe (Pennington et al., 2014): w,w , 100}. Their weighting methods and the need for bias terms s w , s w , C were derived by trial and error; here they are all predicted and given meanings due to Theorem 2.2, specifically s w = v w 2 .
Connection to word2vec(CBOW). The CBOW model in word2vec posits that the probability of a word w k+1 as a function of the previous k words w 1 , w 2 , . . . , w k : This expression seems mysterious since it depends upon the average word vector for the previous k words. We show it can be theoretically justified. Assume a simplified version of our model, where a small window of k words is generated as follows: sample c ∼ C, where C is a uniformly random unit vector, then sample (w 1 , w 2 , . . . , w k ) ∼ exp( k i=1 v w i , c )/Z c . Furthermore, assume Z c = Z for any c. Lemma 3.1. In the simplified version of our model, the Maximum-a-Posteriori (MAP) estimate of c Proof. The c maximizing p (c|w 1 , w 2 , . . . , w k ) is the maximizer of p(c)p (w 1 , w 2 , . . . , w k |c). Since p(c) = p(c ) for any c, c , and we have p (w 1 , w 2 , . . . , Thus using the MAP estimate of c t gives essentially the same expression as CBOW apart from the rescaling, which is often omitted due to computational efficiency in empirical works.

Explaining RELATIONS=LINES
As mentioned, word analogies like "a:b::c:??" can be solved via a linear algebraic expression: where vectors have been normalized such that v d 2 = 1. This suggests that the semantic relationships being tested in the analogy are characterized by a straight line, 5 referred to earlier as RELA-TIONS=LINES.
Using our model we will show the following for low-dimensional embeddings: for each such relation R there is a direction µ R in space such that for any word pair a, b satisfying the relation, v a − v b is like µ R plus some noise vector. This happens for relations satisfying a certain condition described below. Empirical results supporting this theory appear in Section 5, where this linear structure is further leveraged to slightly improve analogy solving.
A side product of our argument will be a mathematical explanation of the empirically wellestablished superiority of low-dimensional word embeddings over high-dimensional ones in this setting (Levy and Goldberg, 2014a). As mentioned earlier, the usual explanation that smaller models generalize better is fallacious.
We first sketch what was missing in prior attempts to prove versions of RELATIONS=LINES from first principles. The basic issue is approximation error: the difference between the best solution and the 2nd best solution to (4.1) is typically small, whereas the approximation error in the objective in the lowdimensional solutions is larger. For instance, if one uses our PMI objective, then the weighted average of the termwise error in (2.5) is 17%, and the expression in (4.1) above contains six inner products. Thus in principle the approximation error could lead to a failure of the method and the emergence of linear relationship, but it does not.
Prior explanations. Pennington et al. (2014) try to propose a model where such linear relationships should occur by design. They posit that queen is a solution to the analogy "man:woman::king:??" be-5 Note that this interpretation has been disputed; e.g., it is argued in Levy and Goldberg (2014a) that (4.1) can be understood using only the classical connection between inner product and word similarity, using which the objective (4.1) is slightly improved to a different objective called 3COSMUL. However, this "explanation" is still dogged by the issue of large termwise error pinpointed here, since inner product is only a rough approximation to word similarity. Furthermore, the experiments in Section 5 clearly support the RELATIONS=LINES interpretation.
where p(χ | king) denotes the conditional probability of seeing word χ in a small window of text around king. Relationship (4.2) is intuitive since both sides will be ≈ 1 for gender-neutral χ like "walks" or "food", will be > 1 when χ is like "he, Henry" and will be < 1 when χ is like "dress, she, Elizabeth." This was also observed by Levy and Goldberg (2014a). Given (4.2), they then posit that the correct model describing word embeddings in terms of word occurrences must be a homomorphism from ( d , +) to ( + , ×), so vector differences map to ratios of probabilities. This leads to the expression and their method is a (weighted) least squares fit for this expression. One shortcoming of this argument is that the homomorphism assumption assumes the linear relationships instead of explaining them from a more basic principle. More importantly, the empirical fit to the homomorphism has nontrivial approximation error, high enough that it does not imply the desired strong linear relationships. Levy and Goldberg (2014b) show that empirically, skip-gram vectors satisfy v w , v w ≈ PMI(w, w ) (4.3) up to some shift. They also give an argument suggesting this relationship must be present if the solution is allowed to be very high-dimensional. Unfortunately, that argument does not extend to lowdimensional embeddings. Even if it did, the issue of termwise approximation error remains.
Our explanation. The current paper has introduced a generative model to theoretically explain the emergence of relationship (4.3). However, as noted after Theorem 2.2, the issue of high approximation error does not go away either in theory or in the empirical fit. We now show that the isotropy of word vectors (assumed in the theoretical model and verified empirically) implies that even a weak version of (4.3) is enough to imply the emergence of the observed linear relationships in low-dimensional embeddings.
This argument will assume the analogy in question involves a relation that obeys Pennington et al.'s suggestion in (4.2). Namely, for such a relation R there exists function ν R (·) depending only upon R such that for any a, b satisfying R there is a noise function ξ a,b,R (·) for which: For different words χ there is huge variation in (4.4), so the multiplicative noise may be large.
Our goal is to show that the low-dimensional word embeddings have the property that there is a vector µ R such that for every pair of words a, b in that relation, v a − v b = µ R + noise vector, where the noise vector is small.
Taking logarithms of (4.4) results in: Theorem 2.2 implies that the left-hand side simplifies to log p(χ|a) where captures the small approximation errors induced by the inexactness of Theorem 2.2. This adds yet more noise! Denoting by V the n × d matrix whose rows are the v χ vectors, we rewrite (4.5) as: where log(ν R ) in the element-wise log of vector ν R and ζ a,b,R = d(ζ a,b,R − a,b,R ) is the noise. In essence, (4.6) shows that v a −v b is a solution to a linear regression in d variables and m constraints, with ζ a,b,R being the "noise." The design matrix in the regression is V , the matrix of all word vectors, which in our model (as well as empirically) satisfies an isotropy condition. This makes it random-like, and thus solving the regression by left-multiplying by V † , the pseudo-inverse of V , ought to "denoise" effectively. We now show that it does.
Our model assumed the set of all word vectors satisfies bulk properties similar to a set of Gaussian vectors. The next theorem will only need the following weaker properties. (1) The smallest nonzero singular value of V is larger than some constant c 1 times the quadratic mean of the singular values, namely, V F / √ d. Empirically we find c 1 ≈ 1/3 holds; see Section 5.
(2) The left singular vectors behave like random vectors with respect to ζ a,b,R , namely, have inner product at most c 2 ζ a,b,R / √ n with ζ a,b,R , for some constant c 2 .
(3) The max norm of a row in V is O( √ d). The proof is included in the appendix.
Theorem 4.1 (Noise reduction). Under the conditions of the previous paragraph, the noise in the dimension-reduced semantic vector space satisfies As a corollary, the relative error in the dimensionreduced space is a factor of d/n smaller.

Experimental verification
In this section, we provide experiments empirically supporting our generative model.
Corpus. All word embedding vectors are trained on the English Wikipedia (March 2015 dump). It is pre-processed by standard approach (removing nontextual elements, sentence splitting, and tokenization), leaving about 3 billion tokens. Words that appeared less than 1000 times in the corpus are ignored, resulting in a vocabulary of 68, 430. The cooccurrence is then computed using windows of 10 tokens to each side of the focus word.
Training method. Our embedding vectors are trained by optimizing the SN objective using Ada-Grad (Duchi et al., 2011) with initial learning rate of 0.05 and 100 iterations. The PMI objective derived from (2.5) was also used. SN has average (weighted) term-wise error of 5%, and PMI has 17%. We observed that SN vectors typically fit the model better and have better performance, which can be explained by larger errors in PMI, as implied by Theorem 2.2. So, we only report the results for SN. For comparison, GloVe and two variants of word2vec (skip-gram and CBOW) vectors are trained. GloVe's vectors are trained on the same cooccurrence as SN with the default parameter values. 6 word2vec vectors are trained using a window size of 10, with other parameters set to default values. 7 Each dot in the plot corresponds to a word, where x-axis is the natural logarithm of the word frequency, and y-axis is the squared norm of the word vector. The Pearson correlation coefficient between the two is 0.75, indicating a significant linear relationship, which strongly supports our mathematical prediction, that is, equation (2.4) of Theorem 2.2.

Model verification
Experiments were run to test our modeling assumptions. First, we tested two counter-intuitive properties: the concentration of the partition function Z c for different discourse vectors c (see Theorem 2.1), and the random-like behavior of the matrix of word embeddings in terms of its singular values (see Theorem 4.1). For comparison we also tested these properties for word2vec and GloVe vectors, though they are trained by different objectives. Finally, we tested the linear relation between the squared norms of our word vectors and the logarithm of the word frequencies, as implied by Theorem 2.2.
Partition function. Our theory predicts the counter-intuitive concentration of the partition function Z c = w exp(c v w ) for a random discourse vector c (see Lemma 2.1). This is verified empirically by picking a uniformly random direction, of norm c = 4/µ w , where µ w is the average norm of the word vectors. 8 Figure 1(a) shows the histogram of Z c for 1000 such randomly chosen c's for our vectors. The values are concentrated, mostly in the range [0.9, 1.1] times the mean. Concentration is also observed for other types of vectors, especially for GloVe and CBOW.
Isotropy with respect to singular values. Our theoretical explanation of RELATIONS=LINES assumes that the matrix of word vectors behaves like a random matrix with respect to the properties of singular values. In our embeddings, the quadratic mean of the singular values is 34.3, while the minimum non-zero singular value of our word vectors is 11. Therefore, the ratio between them is a small constant, consistent with our model. The ratios for GloVe, CBOW, and skip-gram are 1.4, 10.1, and 3.1, respectively, which are also small constants.
Squared norms v.s. word frequencies. Figure 2 shows a scatter plot for the squared norms of our vectors and the logarithms of the word frequencies.
A linear relationship is observed (Pearson correlation 0.75), thus supporting Theorem 2.2. The correlation is stronger for high frequency words, possibly because the corresponding terms have higher weights in the training objective. This correlation is much weaker for other types 8 Note that our model uses the inner products between the discourse vectors and word vectors, so it is invariant if the discourse vectors are scaled by s while the word vectors are scaled by 1/s for any s > 0. Therefore, one needs to choose the norm of c properly. We assume c µw = √ d/κ ≈ 4 for a constant κ = 5 so that it gives a reasonable fit to the predicted dynamic range of word frequencies according to our theory; see model details in Section 2. of word embeddings. This is possibly because they have more free parameters ("knobs to turn"), which imbue the embeddings with other properties. This can also cause the difference in the concentration of the partition function for the two methods.

Performance on analogy tasks
We compare the performance of our word vectors on analogy tasks, specifically the two testbeds GOOGLE and MSR (Mikolov et al., 2013a;Mikolov et al., 2013c). The former contains 7874 semantic questions such as "man:woman::king:??", and 10167 syntactic ones such as "run:runs::walk:??." The latter has 8000 syntactic questions for adjectives, nouns, and verbs.
To solve these tasks, we use linear algebraic queries. 9 That is, first normalize the vectors to unit norm and then solve "a:b::c:??" by (5.1) The algorithm succeeds if the best d happens to be correct. The performance of different methods is presented in Table 1. Our vectors achieve performance comparable to the state of art on semantic analogies (similar accuracy as GloVe, better than word2vec). On syntactic tasks, they achieve accuracy 0.04 lower than GloVe and skip-gram, while CBOW typically outperforms the others. 10 The reason is probably 9 One can instead use the 3COSMUL in (Levy and Goldberg, 2014a), which increases the accuracy by about 3%. But it is not linear while our focus here is the linear algebraic structure.
10 It was earlier reported that skip-gram outperforms CBOW (Mikolov et al., 2013a;Pennington et al., 2014). This may be due to the different training data sets and hyperparameters used.   pairs (a, b) in the relation, and then calculate the top singular vectors of the matrix formed by these v ab 's. The row with label "1st"/"2nd" shows the cosine similarities of individual v ab to the 1st/2nd singular vector (the mean and standard deviation).
that our model ignores local word order, whereas the other models capture it to some extent. For example, a word "she" can affect the context by a lot and determine if the next word is "thinks" rather than "think". Incorporating such linguistic features in the model is left for future work.

Verifying RELATIONS=LINES
The theory in Section 4 predicts the existence of a direction for a relation, whereas earlier Levy and Goldberg (2014a) had questioned if this phenomenon is real. The experiment uses the analogy testbed, where each relation is tested using 20 or more analogies. For each relation, we take the set of vectors v ab = v a − v b where the word pair (a, b) satisfies the relation. Then calculate the top singular vectors of the matrix formed by these v ab 's, and compute the cosine similarity (i.e., normalized inner product) of individual v ab to the singular vectors. We observed that most (v a − v b )'s are correlated with the first singular vector, but have inner products around 0 with the second singular vector. Over all relations, the average projection on the first singular vector is 0.51 (semantic: 0.58; syntactic: 0.46), and the average on the second singular vector is 0.035. For example, Table 2 shows the mean similarities and standard deviations on the first and second singular vectors for 4 relations. Similar results are also obtained for word embedings by GloVe and word2vec. Therefore, the first singular vector can be taken as the direction associated with this relation, while the other components are like random noise, in line with our model.  Table 3: The accuracy of the RD algorithm (i.e., the cheater method) on the GOOGLE testbed. The RD algorithm is described in the text. For comparison, the row "w/o RD" shows the accuracy of the old method without using RD.
Cheating solver for analogy testbeds. The above linear structure suggests a better (but cheating) way to solve the analogy task. This uses the fact that the same semantic relationship (e.g., masculinefeminine, singular-plural) is tested many times in the testbed. If a relation R is represented by a direction µ R then the cheating algorithm can learn this direction (via rank 1 SVD) after seeing a few examples of the relationship. Then use the following method of solving "a:b::c:??": look for a word d such that v c − v d has the largest projection on µ R , the relation direction for (a, b). This can boost success rates by about 10%.
The testbed can try to combat such cheating by giving analogy questions in a random order. But the cheating algorithm can just cluster the presented analogies to learn which of them are in the same relation. Thus the final algorithm, named analogy solver with relation direction (RD), is: take all vectors v a − v b for all the word pairs (a, b) presented among the analogy questions and do k-means clustering on them; for each (a, b), estimate the relation direction by taking the first singular vector of its cluster, and substitute that for v a − v b in (5.1) when solving the analogy. Table 3 shows the performance on GOOGLE with different values of k; e.g. using our SN vectors and k = 30 leads to 0.79 accuracy. Thus future designers of analogy testbeds should remember not to test the same relationship too many times! This still leaves other ways to cheat, such as learning the directions for interesting semantic relations from other collections of analogies.
Non-cheating solver for analogy testbeds. Now we show that even if a relationship is tested only once in the testbed, there is a way to use the above structure. Given "a:b::c:??," the solver first finds the top 300 nearest neighbors of a and those of  Table 4: The accuracy of the RD-nn algorithm on the GOOGLE testbed. The algorithm is described in the text. For comparison, the row "w/o RD-nn" shows the accuracy of the old method without using RD-nn.
b, and then finds among these neighbors the top k pairs (a , b ) so that the cosine similarities between v a − v b and v a − v b are largest. Finally, the solver uses these pairs to estimate the relation direction (via rank 1 SVD), and substitute this (corrected) estimate for v a −v b in (5.1) when solving the analogy. This algorithm is named analogy solver with relation direction by nearest neighbors (RD-nn). Table 4 shows its performance, which consistently improves over the old method by about 3%.

Conclusions
A simple generative model has been introduced to explain the classical PMI based word embedding models, as well as recent variants involving energybased models and matrix factorization. The model yields an optimization objective with essentially "no knobs to turn", yet the embeddings lead to good performance on analogy tasks, and fit other predictions of our generative model. A model with fewer knobs to turn should be seen as a better scientific explanation (Occam's razor), and certainly makes the embeddings more interpretable. The spatial isotropy of word vectors is both an assumption in our model, and also a new empirical finding of our paper. We feel it may help with further development of language models. It is important for explaining the success of solving analogies via low dimensional vectors (RELA-TIONS=LINES). It also implies that semantic relationships among words manifest themselves as special directions among word embeddings (Section 4), which lead to a cheater algorithm for solving analogy testbeds.
Our model is tailored to capturing semantic similarity, more akin to a log-linear dynamic topic model. In particular, local word order is unim-395 portant. Designing similar generative models (with provable and interpretable properties) with linguistic features is left for future work.