P OINCAR ´ E G LO V E : H YPERBOLIC W ORD E MBEDDINGS
tifreaa@ethz.ch, { gary.becigneul,octavian.ganea } @inf.ethz.ch
A BSTRACT
Words are not created equal.
In fact, they form an aristocratic graph with a latent hierarchical structure that the next generation of unsupervised learned word embeddings should reveal.
In this paper, justiﬁed by the notion of delta-hyperbolicity or tree-likeliness of a space, we propose to embed words in a Cartesian product of hyperbolic spaces which we theoretically connect to the Gaussian word embeddings and their Fisher geometry.
This connection allows us to introduce a novel principled hypernymy score for word embeddings.
Moreover, we adapt the well-known Glove algorithm to learn unsupervised word embeddings in this type of Riemannian manifolds.
We further explain how to solve the analogy task using the Riemannian parallel transport that generalizes vector arithmetics to this new type of geometry.
Empirically, based on extensive experiments, we prove that our embeddings, trained unsupervised , are the ﬁrst to simultaneously outperform strong and popular baselines on the tasks of similarity, analogy and hypernymy detection.
In particular, for word hypernymy, we obtain new state-of-the-art on fully unsupervised WBLESS classiﬁcation accuracy.
I NTRODUCTION & M OTIVATION
Word embeddings are ubiquitous nowadays as ﬁrst layers in neural network and deep learning models for natural language processing.
They are essential in order to move from the discrete word space to the continuous space where differentiable loss functions can be optimized.
The popular models of
Glove (Pennington et al., 2014), Word2Vec (Mikolov et al., 2013b) or FastText (Bojanowski et al., 2016), provide efﬁcient ways to learn word vectors fully unsupervised from raw text corpora, solely based on word co-occurrence statistics.
These models are then successfully applied to word similarity and other downstream tasks and, surprisingly (or not (Arora et al., 2016)), exhibit a linear algebraic structure that is also useful to solve word analogy.
However, unsupervised word embeddings still largely suffer from revealing asymmetric word relations including the latent hierarchical structure of words.
This is currently one of the key limitations in automatic text understanding, e.g. for tasks such as textual entailment (Bowman et al., 2015).
To address this issue, (Vilnis & McCallum, 2015; Muzellec & Cuturi, 2018) propose to move from point embeddings to probability density functions, the simplest being Gaussian or Elliptical distributions.
Their intuition is that the variance of such a distribution should encode the generality/speciﬁcity of the respective word.
However, this method results in losing the arithmetic properties of point embeddings (e.g. for analogy reasoning) and becomes unclear how to properly use them in downstream tasks.
To this end, we propose to take the best from both worlds: we embed words as points in a Cartesian product of hyperbolic spaces and, additionally, explain how they are bijectively mapped to Gaussian embeddings with diagonal covariance matrices, where the hyperbolic distance between two points becomes the Fisher distance between the corresponding probability distribution functions (PDFs).
This allows us to derive a novel principled is-a score on top of word embeddings that can be leveraged for hypernymy detection.
We learn these word embeddings unsupervised from raw text by generalizing the Glove method.
Moreover, the linear arithmetic property used for solving word analogy has a mathematical grounded correspondence in this new space based on the established notion of parallel transport in Riemannian manifolds.
In addition, these hyperbolic embeddings outperform Euclidean Glove on word similarity benchmarks.
We thus describe, to our knowledge, the ﬁrst word embedding model that competitively addresses the above three tasks simultaneously.
Finally, these word vectors can also be used in downstream tasks as explained by Ganea et al.
(2018b).
We provide additional reasons for choosing the hyperbolic geometry to embed words.
We explain the notion of average δ -hyperbolicity of a graph, a geometric quantity that measures its ”democracy” (Borassi et al., 2015).
A small hyperbolicity constant implies ”aristocracy”, namely the existence of a small set of nodes that ”inﬂuence” most of the paths in the graph.
It is known that real-world graphs are mainly complex networks (e.g. scale-free exhibiting power-law node degree distributions) which in turn are better embedded in a tree-like space, i.e. hyperbolic (Krioukov et al., 2010).
Since, intuitively, words form an ”aristocratic” community (few generic ones from different topics and many more speciﬁc ones) and since a signiﬁcant subset of them exhibits a hierarchical structure (e.g. WordNet (Miller et al., 1990)), it is naturally to learn hyperbolic word embeddings.
Moreover, we empirically measure very low average δ -hyperbolicity constants of some variants of the word log-co-occurrence graph (used by the Glove method), providing additional quantitative reasons for why spaces of negative curvature (i.e. hyperbolic) are better suited for word representations.
R ELATED WORK
Recent supervised methods can be applied to embed any tree or directed acyclic graph in a low dimensional space with the aim of improving link prediction either by imposing a partial order in the embedding space (Vendrov et al., 2015; Vilnis et al., 2018; Athiwaratkun & Wilson, 2018), by using hyperbolic geometry (Nickel & Kiela, 2017; 2018), or both (Ganea et al., 2018a).
To learn word embeddings that exhibit hypernymy or hierarchical information, supervised methods (Vuli ´ c & Mrk ˇ si ´ c, 2018; Nguyen et al., 2017) leverage external information (e.g. WordNet) together with raw text corpora.
However, the same goal is also targeted by more ambitious fully unsupervised models which move away from the ”point” assumption and learn various probability densities for each word (Vilnis & McCallum, 2015; Muzellec & Cuturi, 2018; Athiwaratkun &
Wilson, 2017; Singh et al., 2018).
There have been two very recent attempts at learning unsupervised word embeddings in the hyperbolic space (Leimeister & Wilson, 2018; Dhingra et al., 2018).
However, they suffer from either not being competitive on standard tasks in high dimensions, not showing the beneﬁt of using hyperbolic spaces to model asymmetric relations, or not being trained on realistically large corpora.
We address these problems and, moreover, the connection with density based methods is made explicit and leveraged to improve hypernymy detection.
H YPERBOLIC SPACES AND THEIR CARTESIAN PRODUCT
[Figure]
In order to work in the hyperbolic space, we have to choose one model , among the ﬁve isometric models that exist.
We choose to embed words in the Poincar´e ball D n = { x ∈ R n | (cid:107) x (cid:107) 2 < 1 } .
This is illustrated in Figure 1a for n = 2 , where dark lines represent geodesics.
The distance function in this space is given by d
[Equation]
[Equation]
, y )
[Equation]
(cid:0)
[Equation] + λ [Equation] (cid:107) x − y (cid:107) 22 / 2 (cid:1) , λ x := 2 / (1 − (cid:107) x (cid:107) 22 ) being the conformal factor .
We will also embed words in products of hyperbolic spaces, and explain why later on.
A product of p balls ( D n ) p , with the induced product geometry, is known to have distance function d ( D n ) p ( x, y )
=
(cid:80) pi
=1 d D n ( x i , y i ) 2 .
Finally, another model of interest for us is the Poincar´e half-plane H 2 =
R × R ∗ + illustrated in Figure 1d, with distance function d H 2 ( x, y )
=
cosh − 1 (cid:0) 1 + (cid:107) x − y (cid:107) 22 / (2 y 1 y 2 ) (cid:1) .
Figure 1 shows an isometry ϕ from D 2 to
H 2 mapping the vertical segment { 0 } × ( − 1 , 1) to R ∗ + and ﬁxing (0 , 1) , sending the radius to ∞ .
A DAPTING G LO V E
Euclidean G LOVE .
The G LOVE (Pennington et al., 2014) algorithm is an unsupervised method for learning word representations in the Euclidean space from statistics of word co-occurrences in a text corpus, with the aim to geometrically capture the words’ meaning and relations.
We use the notations: X ij is the number of times word j occurs in the same window context as word i ; X i = (cid:80) k
X ik ; P ij =
X
ij /X
i is the probability that word j appears in the context of word i .
An embedding of a (target) word i is written w i , while an embedding of a context word k is written ˜ w k .
The initial formulation of the G LOVE model suggests to learn embeddings as to satisfy the equation w Ti ˜ w k = log( P ik )
= log( X ik ) − log
( X i ) .
Since X ik is symmetric in ( i, k ) but P
ik is not, (Pennington et al., 2014) propose to restore the symmetry by introducing biases for each word, absorbing log( X i ) into i ’s bias:
[Equation]
Finally, the authors suggest to enforce this equality by optimizing a weighted least-square loss:
[Equation]
where V is the size of the vocabulary and f down-weights the signal coming from frequent words (it is typically chosen to be f ( x ) =
min { 1 , ( x/x m ) α } , with α = 3 / 4 and x m = 100 ).
G LOVE in metric spaces.
Note that there is no clear correspondence of the Euclidean inner-product in a hyperbolic space.
However, we are provided with a distance function.
Further notice that one could rewrite Eq.
(1) with the Euclidean distance as − 12 (cid:107) w i − ˜ w k (cid:107)
+ b i +˜ b k = log( X ik ) , where we absorbed the squared norms of the embeddings into the biases.
We thus replace the G LOVE loss by:
[Equation]
where h is a function to be chosen as a hyperparameter of the model, and d can be any differentiable distance function.
Although the most direct correspondence with G LOVE would suggest h ( x ) = x 2 / 2 , we sometimes obtained better results with other functions, such as h = cosh 2 (see sections 8 & 9).
Note that De Sa et al.
(2018) also apply cosh to their distance matrix for hyperbolic MDS before applying PCA.
Understanding why h = cosh 2 is a good choice would be interesting future work.
C ONNECTING G AUSSIAN EMBEDDINGS & HYPERBOLIC EMBEDDINGS
In order to endow Euclidean word embeddings with richer information, Vilnis & McCallum (2015) proposed to represent words as Gaussians, i.e. with a mean vector and a covariance matrix 1 , expecting the variance parameters to capture how generic/speciﬁc a word is, and, hopefully, entailment relations.
On the other hand, Nickel & Kiela (2017) proposed to embed words of the WordNet hierarchy (Miller et al., 1990) in hyperbolic space, because this space is mathematically known to be better suited to embed tree-like graphs.
It is hence natural to wonder: is there a connection between the two?
The Fisher geometry of Gaussians is hyperbolic.
It turns out that there exists a striking connection (Costa et al., 2015).
Note that a 1D Gaussian N ( µ, σ 2 ) can be represented as a point ( µ, σ ) in R × R ∗ + .
Then, the Fisher distance between two distributions relates to the hyperbolic distance in H 2 :
[Equation]
For n -dimensional Gaussians with diagonal covariance matrices written Σ
= diag( σ ) 2 , it becomes:
[Equation]
Hence there is a direct correspondence between diagonal Gaussians and the product space ( H 2 ) n .
Fisher distance, KL & Gaussian embeddings.
The above paragraph lets us relate the
WORD 2 GAUSS algorithm (Vilnis & McCallum, 2015) to hyperbolic word embeddings.
Although one could object that WORD 2 GAUSS is trained using a KL divergence, while hyperbolic embeddings relate to Gaussian distributions via the Fisher distance d F , let us remind that KL and d F deﬁne the same local geometry.
Indeed, the KL is known to be related to d F , as its local approximation (Jeffreys, 1946).
In short, if P ( θ + dθ ) and P ( θ ) denote two closeby probability distributions for a small dθ , then KL( P ( θ + dθ )
||
P ( θ ))
= (1 / 2) (cid:80)
ij g ij dθ i dθ j + O ( (cid:107) dθ (cid:107) 3 ) , where ( g ij ) ij is the
Fisher information metric, inducing d F .
Riemannian optimization.
A beneﬁt of representing words in (products of) hyperbolic spaces, as opposed to (diagonal) Gaussian distributions, is that one can use recent Riemannian adaptive optimization tools such as R ADAGRAD (B´ecigneul & Ganea, 2018).
Note that without this connection, it would be unclear how to deﬁne a variant of A DAGRAD (Duchi et al., 2011) intrinsic to the statistical manifold of Gaussians.
Empirically, we indeed noticed better results using R ADAGRAD , rather than simply Riemannian SGD (Bonnabel, 2013).
Similarly, note that G LOVE trains with A DAGRAD .
A NALOGIES FOR HYPERBOLIC /G AUSSIAN EMBEDDINGS
The connection exposed in section 5 allows us to provide mathematically grounded (i) analogy computations for Gaussian embeddings using hyperbolic geometry, and (ii) hypernymy detection for hyperbolic embeddings using Gaussian distributions.
A common task used to evaluate word embeddings, called analogy , consists in ﬁnding which word d is to the word c , what the word b is to the word a .
For instance, queen is to woman what king is to man .
In the Euclidean embedding space, the solution to this problem is usually taken geometrically as d = c + ( b − a )
=
b + ( c − a ) .
Note that the same d is also to b , what c is to a .
How should one intrinsically deﬁne “analogy parallelograms” in a space of Gaussian distributions?
Note that Vilnis & McCallum (2015) do not evaluate their Gaussian embeddings on the analogy task, and that it would be unclear how to do so.
However, since we can go back and forth between (diagonal) Gaussians and (products of) hyperbolic spaces as explained in section 5, we can use the fact that parallelograms are naturally deﬁned in the Poincar´e ball, by the notion of gyro-translation (Ungar, 2012, section 4).
In the Poincar ´ e ball, the two solutions d 1 = c +( b − a ) and d 2 = b +( c − a ) are respectively generalized to
[Equation]
The formulas for these operations are described in closed-forms in appendix C, and are easy to implement.
The fact that d 1 and d 2 differ is due to the curvature of the space.
For evaluation, we chose a point m td 1 d 2 :=
d 1 ⊕ (( − d 1 ⊕ d 2 ) ⊗ t ) located on the geodesic between d 1 and d 2 for some t ∈ [0 , 1] ; if t = 1 / 2 , this is called the gyro-midpoint and then m 0 .
5 d 1 d 2 = m 0 .
5 d 2 d 1 , which is at equal hyperbolic distance from d 1 as from d 2 .
We explain in appendix A.2 how to select t , and that continuously deforming the Poincar´e ball to the Euclidean space (by sending its radius to inﬁnity) lets these analogy computations recover their Euclidean counterparts, which is a nice sanity check.
T OWARDS A PRINCIPLED SCORE FOR ENTAILMENT / HYPERNYMY
We now use the connection explained in section 5 to introduce a novel principled score that can be applied on top of our unsupervised learned Poincar´e Glove embeddings to address the task of hypernymy detection, i.e. to predict relations of type is-a(v,w) such as is-a(dog, animal) .
For this purpose, we ﬁrst explain how learned hyperbolic word embeddings are mapped to Gaussian embeddings, and subsequently we deﬁne our hypernymy score.
Invariance of distance-based embeddings to isometric transformations.
The method of Nickel & Kiela (2017) uses a heuristic entailment score in order to predict whether u is-a v , deﬁned for u, v ∈ D n as is-a ( u, v ) :
= − (1 + α ( (cid:107) v (cid:107) 2 − (cid:107) u (cid:107) 2 ))
d ( u, v ) , based on the intuition that the Euclidean norm should encode generality/speciﬁcity of a concept/word.
However, such a choice is not intrinsic to the hyperbolic space when the training loss involves only the distance function.
We say that training is intrinsic to D n , i.e. invariant to applying any isometric transformation ϕ : D n → D n to all word embeddings (such as hyperbolic translation).
But their “is-a” score is not intrinsic, i.e. depends on the parametrization.
For this reason, we argue that an isometry has to be found and ﬁxed before using the trained word embeddings in any non-intrinsic manner, e.g. to deﬁne hypernymy scores.
To discover it, we leverage the connection between hyperbolic and Gaussian embeddings as follows.
Mapping hyperbolic embeddings to Gaussian embeddings via an isometry .
For a 1D Gaussian
N ( µ, σ 2 ) representing a concept, generality should be naturally encoded in the magnitude of σ .
As shown in section 5, the space of Gaussians endorsed with the Fisher distance is naturally mapped to the hyperbolic upper half-plane H 2 , where the variance σ corresponds to the (positive) second coordinate in H
= R × R ∗ + .
Moreover, as shown in section 3, H 2 can be isometrically mapped to
D 2 , where the second coordinate σ ∈ R ∗ + corresponds to the open vertical segment { 0 } × ( − 1 , 1) in D 2 .
However, in D 2 , any (hyperbolic) translation or any rotation w.r.t.
the origin is an isometry 2 .
Hence, in order to map a word x ∈ D 2 to a Gaussian N ( µ, σ 2 ) via H 2 , we ﬁrst have to ﬁnd the correct isometry .
This transformation should align { 0 } × ( − 1 , 1) with whichever geodesic in Dencodes generality.
For simplicity, we assume it is composed of a centering and a rotation operations in D 2 .
Thus, we start by identifying two sets G and S of potentially generic and speciﬁc words, respectively.
For the re-centering, we then compute the means g and s of G and S respectively, and m :=
( s + g ) / 2 , and M¨obius translate all words by the global mean with the operation w (cid:55)→ (cid:9)
m ⊕ w .
For the rotation, we set u :=
( (cid:9)
m
⊕ g ) / (cid:107) (cid:9) m ⊕ g (cid:107) 2 , and rotate all words so that u is mapped to (0 , 1) .
Figure 2 and Algorithm 1 illustrate these steps.
In order to identify the two sets G and S we propose the following two methods.
• Unsupervised 5K+5K : a fully unsupervised method.
We ﬁrst deﬁne a restricted vocabulary of the 50k most frequent words among the unrestricted one of 190k words, and rank them by frequency; we then deﬁne G as the 5k most frequent ones, and S as the 5k least frequent ones of the 50k vocabulary (to avoid extremely rare words which might have received less signal during training).
• Weakly-supervised WN x + x : a weakly-supervised method that uses words from the WordNet hierarchy.
We deﬁne G as the top x words from the top 4 levels of the WordNet hierarchy, and S as x of the bottom words from the bottom 3 levels, randomly sampled in case of ties.
Gaussian embeddings.
Vilnis & McCallum (2015) propose using is-a ( P, Q ) :
= − KL ( P || Q ) for distributions P, Q , the argument being that a low KL ( P || Q ) indicates that we can encode Q easily as P , implying that Q entails P .
However, we would like to mitigate this statement.
Indeed, if P = N ( µ, σ ) and Q = N ( µ, σ (cid:48) ) are two 1D Gaussian distributions with same mean, then
KL ( P || Q ) =
z 2 − 1 − log( z ) where z :=
σ/σ (cid:48) , which is not a monotonic function of z .
This breaks the idea that the magnitude of the variance should encode the generality/speciﬁcity of the concept.
Another entailment score for Gaussian embeddings.
What would constitute a good number for the variance’s magnitude of a n -dimensional Gaussian distribution N ( µ, Σ) ?
It is known that 95% of its mass is contained within a hyper-ellipsoid of volume V Σ
= V n (cid:112) det(Σ) , where V n denotes the volume of a ball of radius 1 in R n .
For simplicity, we propose dropping the dependence in µ and deﬁne a simple score is-a (Σ , Σ (cid:48) ) :
= log( V (cid:48) Σ ) − log( V Σ ) =
(cid:80) ni
=1 (log( σ (cid:48)
i ) − log( σ i )) .
Note that using difference of logarithms has the beneﬁt of removing the scaling constant V n , and makes the entailment score invariant to a rescaling of the covariance matrices: is-a ( r Σ , r Σ (cid:48) )
= is-a (Σ , Σ (cid:48) ) , ∀ r > 0 .
To compute this is-a score between two hyperbolic word embeddings, we ﬁrst map all word embeddings to Gaussians as explained above and, subsequently, apply the above proposed is-a score.
Algorithm 1 illustrates these steps.
Results are shown in section 9: Figure 4 and Tables 6, 7.
Algorithm 1 is-a(v, w) hypernymy score using Poincar´e embeddings 1: procedure IS - A SCORE (v, w) 2:
Input: v, w ∈ ( D 2 ) p with v = [ v 1 , ..., v p ] , w =
[ w 1 , ..., w p ] , v i , w i ∈ D3:
Output: is-a(v, w) lexical entailment score 4:
G ← set of Poincar´e embeddings of generic words 5:
S ← set of Poincar ´ e embeddings of speciﬁc words 6: for i from 1 to p do // Fixing the correct isometry.
7: g i ← mean { x i | x ∈ G} //
Euclidean mean of generic words 8: s i ← mean { y i | y ∈ S} //
Euclidean mean of speciﬁc words 9: m i ← ( g i + s i ) ///
Total mean 10: v (cid:48)
i ← (cid:9) m i ⊕ v i //
M¨obius translation by m i 11: w (cid:48)
i ← (cid:9) m i ⊕ w i //
M ¨ obius translation by m i 12: u i ← ( (cid:9) m i ⊕ g i ) /
|| (cid:9) m i ⊕
g
i ||// Compute rotation vector 13: v (cid:48)(cid:48)
i ← rotate ( v (cid:48)
i , u i ) // rotate v (cid:48)
i 14: w (cid:48)(cid:48)
i ← rotate ( w (cid:48)
i , u i ) // rotate w (cid:48)
i // Convert from Poincar ´
e disk coordinates to half-plane coordinates.
15: ˜ v
i ← poincare2halfplane ( v (cid:48)(cid:48) i ) 16:
˜ w i ← poincare2halfplane ( w (cid:48)(cid:48) i ) // Convert half-plane coordinates to Gaussian parameters.
17: µ vi ← ˜ v i 1 / √ 2 ; σ vi ← ˜ v i18: µ wi ← ˜
w i 1 / √
; σ wi ← ˜ w ireturn (cid:80) pi =
(log( σ vi ) − log( σ wi ))
E MBEDDING SYMBOLIC DATA IN A CONTINUOUS SPACE WITH MATCHING HYPERBOLICITY
Why would we embed words in a hyperbolic space?
Given some symbolic data, such as a vocabulary along with similarity measures between words − in our case, co-occurrence counts X ij − can we understand in a principled manner which geometry would represent it best?
Choosing the right metric space to embed words can be understood as selecting the right inductive bias − an essential step. δ -hyperbolicity.
A particular quantity of interest describing qualitative aspects of metric spaces is the δ -hyperbolicity which we formally deﬁne in appendix
B. This metric introduced by Gromov (1987) quantiﬁes the tree-likeliness of a space.
However, for various reasons discussed in appendix B, we used the averaged δ -hyperbolicity, denoted δ avg , deﬁned by Albert et al.
Intuitively, a low δ avg of a ﬁnite metric space characterizes that this space has an underlying hyperbolic geometry, i.e. an approximate tree-like structure, and that the hyperbolic space would be well suited to isometrically embed it.
We also report the ratio 2 ∗ δ avg /d avg (invariant to metric scaling), where d avg is the average distance in the ﬁnite space, as suggested by Borassi et al.
, whose low value also characterizes the “hyperbolicness” of the space.
Computing δ avg .
Since our methods are trained on a weighted graph of co-occurrences, it makes sense to look for the corresponding hyperbolicity δ avg of this symbolic data.
The lower this value, the more hyperbolic is the underlying nature of the graph, thus indicating that the hyperbolic space should be preferred over the Euclidean space for embedding words.
However, in order to do so, one needs to be provided with a distance d ( i, j ) for each pair of words ( i, j ) , while our symbolic data is only made of similarity measures.
Note that one cannot simply associate the value − log( P ij ) to d ( i, j ) , as this quantity is not symmetric.
Instead, inspired from Eq.
(3), we associate to words i, j the distance 3 h ( d ( i, j )) :
= − log( X ij )
+ b i + b j ≥ 0 with the choice b i :=
log( X i ) , i.e. d ( i, j ) :
= h − 1 (log(( X i X j ) /X ij )) .
Table 1 shows values for different choices of h .
The discrete metric spaces we obtained for our symbolic data of co-occurrences appear to have a very low hyperbolicity, i.e. to be very much “hyperbolic”, which suggests to embed words in (products of) hyperbolic spaces.
We report in section 9 empirical results for h = ( · ) 2 and h = cosh 2 .
[Table]
for the metrics induced by different h functions, as deﬁned in Eq.
E XPERIMENTS : SIMILARITY , ANALOGY , ENTAILMENT
Experimental setup.
We trained all models on a corpus provided by Levy & Goldberg (2014);
Levy et al.
(2015) used in other word embeddings related work.
Corpus preprocessing is explained in the above references.
The dataset has been obtained from an English Wikipedia dump and contains 1.4 billion tokens.
Words appearing less than one hundred times in the corpus have been discarded, leaving 189 , 533 unique tokens.
The co-occurrence matrix contains approximately 700 millions non-zero entries, for a symmetric window size of 10 .
All models were trained for 50 epochs, and unless stated otherwise, on the full corpus of 189,533 word types.
For certain experiments, we also trained the model on a restricted vocabulary of the 50 , 000 most frequent words, which we specify by appending either “(190k)” or “(50k)” to the experiment’s name in the table of results.
Poincar´e models, Euclidean baselines.
We report results for both 100D embeddings trained in a 100D Poincar´e ball, and for 50x2D embeddings, which were trained in the Cartesian product
of2D Poincar ´ e balls.
Note that in the case of both models, one word will be represented by exactly 100 parameters.
For the Poincar ´ e models we employ both h ( x ) = x 2 and h ( x ) =
cosh 2 ( x ) .
All hyperbolic models were optimized with R ADAGRAD (B ´ ecigneul & Ganea, 2018) as explained in
Sec. 5.
On the tasks of similarity and analogy, we compare against a 100D Euclidean GloVe model which was trained using the hyperparameters suggested in the original GloVe paper (Pennington et al., 2014).
The vanilla GloVe model was optimized using A DAGRAD (Duchi et al., 2011).
For the Euclidean baseline as well as for models with h ( x ) = x 2 we used a learning rate of 0.05.
For
Poincar´e models with h ( x ) = cosh 2 ( x ) we used a learning rate of 0.01.
The initialization trick.
We obtained improvement in the majority of the metrics when initializing our Poincar´e model with pretrained parameters.
These were obtained by ﬁrst training the same model on the restricted (50k) vocabulary, and then using this model as an initialization for the full (190K) vocabulary.
This will be referred to as the “initialization trick”.
For fairness, we also trained the vanilla (Euclidean) GloVe model in the same fashion.
Similarity.
Word similarity is assessed using a number of well established benchmarks shown in
Table 2.
We summarize here our main results, but more extensive experiments (including in lower dimensions) are in Appendix A.1.
We note that, with a single exception, our 100D and 50x2D models outperform the vanilla Glove baselines in all settings.
[Table] [Table]
daughter wife, married, mother, cousin, son, [Table] , granddaughter [Table]
husband
[Table]
vapour, refrigerant, liquid, condenses, supercooled, ﬂuid, gaseous, gases, droplet ronaldo cristiano, ronaldinho, rivaldo, messi, zidane, romario, pele, zinedine, xavi, robinho mechanic electrician, ﬁreman, machinist, welder, technician, builder, janitor, trainer, brakeman algebra algebras, homological, heyting, geometry, subalgebra,
Analogy.
For word analogy, we evaluate on the Google benchmark (Mikolov et al., 2013a) and its two splits that contain semantic and syntactic analogy queries.
We also use a benchmark by MSR that is also commonly employed in other word embedding works.
For the Euclidean baselines we use 3COSADD (Levy et al., 2015).
For our models, the solution d to the problem “which d is to c , what b is to a ” is selected as m td 1 d 2 , as described in section 6.
In order to select the best t without overﬁtting on the benchmark dataset, we used the same 2-fold cross-validation method used by (Levy et al., 2015, section 5.1) (see our Table 15) − which resulted in selecting t = 0 .
We report our main results in Table 4, and more extensive experiments in various settings (including in lower dimensions) in appendix A.2.
We note that the vast majority of our models outperform the vanilla Glove baselines, with the 100D hyperbolic embeddings being the absolute best.
[Table]
) = cosh
[Table]
w
[Table]
Hypernymy evaluation.
For hypernymy evaluation we use the Hyperlex (Vuli´c et al., 2017) and
WBLess (subset of BLess) (Baroni & Lenci, 2011) datasets.
We classify all the methods in three categories depending on the supervision used for word embedding learning and for the hypernymy score, respectively.
For Hyperlex we report results in Tab. 6 and use the baseline scores reported in (Nickel & Kiela, 2017; Vuli´c et al., 2017).
For WBLess we report results in Tab. 7 and use the baseline scores reported in (Nguyen et al., 2017).
[Table]
Hypernymy results discussion.
We ﬁrst note that our fully unsupervised 50x2D, h ( x ) = x 2 model outperforms all its corresponding baselines setting a new state-of-the-art on unsupervised WBLESS accuracy and matching the previous state-of-the-art on unsupervised HyperLex Spearman correlation.
Second, once a small amount of weakly supervision is used for the hypernymy score, we obtain signiﬁcant improvements as shown in the same tables and also in Fig.
We note that this weak supervision is only as a post-processing step (after word embeddings are trained) for identifying the best direction encoding the variance of the Gaussian distributions as described in Sec. 7.
Moreover, it does not consist of hypernymy pairs, but only of 400 or 800 generic and speciﬁc sets of words from WordNet.
Even so, our unsupervised learned embeddings are remarkably able to outperform all (except WN-Poincar ´ e) supervised embedding learning baselines on HyperLex which have the great advantage of using the hypernymy pairs to train the word embeddings.
[Figure]
Which model to choose?
While there is no single model that outperforms all the baselines on all presented tasks, one can remark that the model 50x2D, h ( x ) = x 2 , with the initialization trick obtains state-of-the-art results on hypernymy detection and is close to the best models for similarity and analogy (also Poincar´e Glove models), but almost constantly outperforming the vanilla Glove baseline on these.
This is the ﬁrst model that can achieve competitive results on all these three tasks, additionally offering interpretability via the connection to Gaussian word embeddings.
[Table]
[Table]
C ONCLUSION
We propose to adapt the GloVe algorithm to hyperbolic spaces and to leverage a connection between statistical manifolds of Gaussian distributions and hyperbolic geometry, in order to better interpret entailment relations between hyperbolic embeddings.
We justify the choice of products of hyperbolic spaces via this connection to Gaussian distributions and via computations of the hyperbolicity of the symbolic data upon which GloVe is based.
Empirically we present the ﬁrst model that can simultaneously obtain state-of-the-art results or close on the three tasks of word similarity, analogy and hypernymy detection.
Our code is publicly available 4 .
A M ORE EXPERIMENTS
We show here extensive empirical results in various settings, including lower dimensions, different product structures, changing the vocabulary and using different h functions.
Experimental setup.
In the experiment’s name, we ﬁrst indicate which dimension was used: “ nD ” denotes D n while “ p × kD ” denotes ( D k ) p .
“Vanilla” designates the baseline, i.e. the standard
Euclidean GloVe from Eq.
(1), while “Poincar´e” designates our hyperbolic GloVe from Eq.
For
Poincar´e models, we then append to the experiment’s name which h function was applied to distances during training.
Every model was trained for 50 epochs.
Vanilla models were optimized with Adagrad (Duchi et al., 2011) while Poincar´e models were optimized with R ADAGRAD (B´ecigneul & Ganea, 2018).
For each experiment we tried using learning rates in { 0 . 01 , 0 . 05 } , and found that the best were 0 .
01 for h
= cosh 2 and 0 .
for h = ( · ) 2 and for Vanilla models − accordingly, we only report the best results.
For similarity, we only considered the “target word vector” and always ignored the “context word vector”.
We also tried using the Euclidean/M¨obius average 5 of these, but obtained (almost) consistently worse results for all experiments (including baselines) and do not report them.
A. S IMILARITY
Reported scores are Spearman’s correlations on the ranks for each benchmark dataset, as usual in the literature.
We used (minus) the Poincar ´ e distance as a similarity measure to rank neighbors.
[Table]
100D Vanilla
[Table] 100D
[Table]
100D [Table] e, [Table]
[Table] 100D [Table] 50x2D
[Table] 50x2D [Table]
48D Glove 48D Vanilla 0.
48D [Table]
[Table] 48D [Table]
24x2D [Table]
[Table] 24x2D [Table]
20D Glove 20D Vanilla 0.
20D Poincar´e, cosh0.
20D Poincar´e, ( · )0.
10x2D Poincar´e, cosh0.
10x2D Poincar´e, ( · )0.
4D Glove 4D Vanilla 0.
4D Poincar´e, cosh0.
4D Poincar´e, ( · )0.
[Table]
´ e, ( · )0.
20D Glove 20D Vanilla 0.
20D
Poincar ´ e, cosh0.
20D
Poincar ´ e, ( · )0.
10x2D Poincar ´ e, cosh 2 0.
10x2D Poincar´e, ( · )0.
4D Glove 4D Vanilla 0.
4D Poincar ´ e, cosh0.
4D Poincar´e, ( · )0.
Remark.
Note that restricting the vocabulary incurs a loss of certain pairs of words from the benchmark similarity datasets, hence similarity results on the restricted (50k) vocabulary from Tableshould be analyzed with caution, and in the light of Tables 10 and 11 (especially for Rare Word).
[Table] [Table]
A. A NALOGY
Details and notations.
In the column “method”, “3.c.a” denotes using 3COSADD to solve analogies, which was used for all Euclidean baselines; for Poincar´e models, as explained in section 9, the solution to the analogy problem is computed as m td 1 d 2 with t = 0 . 3 , and then the nearest neighbor in the vocabulary is selected either with the Poincar´e distance on the corresponding space, which we denote as “ d ”, or with cosine similarity on the full vector, which we denote as “ cos ”.
Finally, note that each cell contains two numbers, designated by w and w + ˜ w respectively: w denotes ignoring the context vectors, while w + ˜ w denotes considering as our embeddings the Euclidean/M¨obius average between the target vector w and the context vector ˜ w .
In each dimension, we bold best results for w .
[Table]
[Table]
[Table]
48D Poincar´e, coshd 0.2368 / 0.
cos 0.2479 / 0.
48D Poincar´e, ( · )d 0.2108 / 0.
0.1842 / 0.2790 cos 0.4513 / 0.
24x2D Poincar´e, cosh 2 d 0.2338 / 0.
cos 0.1294 / 0.
24x2D Poincar´e, ( · )d 0.4663 / 0.
cos 0.2479 / 0.
20D Glove 20D Vanilla 3.c.a 0.1234 / 0.
20D Poincar ´ e, coshd 0.1043 / 0.
[Table] [Table]
50x2D Poincar´e, ( · )d 0.5204 / 0.
cos 0.3873 / 0.
48D Glove 48D Vanilla 3.c.a 0.3212 / 0.
48D Poincar´e, coshd 0.2127 / 0.
cos 0.2180 / 0.
48D Poincar´e, ( · )d 0.2035 / 0.
cos 0.3063 / 0.
24x2D Poincar´e, cosh 2 d 0.2307 / 0.
0.3289 / 0.2979 cos 0.1328 / 0.
24x2D Poincar´e, ( · )d 0.3649 / 0.
0.3424 / 0.2985 cos 0.2041 / 0.
20D Glove 20D Vanilla 3.c.a 0.1223 / 0.
20D Poincar´e, coshd 0.0925 / 0.
0.1601 / 0.1286 cos 0.0917 / 0.
20D Poincar´e, ( · )d 0.1583 / 0.
0.1624 / 0.1419 cos 0.1757 / 0.
10x2D Poincar´e, cosh 2 d 0.0962 / 0.
0.1546 / 0.1279 cos 0.0403 / 0.
10x2D Poincar´e, ( · )d 0.1440 / 0.
cos 0.0614 / 0.
4D Glove 4D Vanilla
[Table]
Remark.
Note that restricting the vocabulary to the most frequent 190k or 50k words will remove some of the test instances in the benchmark analogy datasets.
These are described in Table
[Table] [Table]
[Table]
About analogy computations
[Table]
Note that one can rewrite Eq.
(6) with tools from differential geometry as
[Equation]
where P x → y =
λ x /λ y ) gyr
[ y, (cid:9) x ] denotes the parallel transport along the unique geodesic from x to y .
The exp and log maps of Riemannian geometry were related to the theory of gyrovector spaces (Ungar, 2008) by Ganea et al.
(2018b), who also mention that when continuously deforming the hyperbolic space D n into the Euclidean space R n , sending the curvature from − 1 to 0 ( i.e. the radius of D n from 1 to ∞ ), the M ¨ obius operations ⊕ κ , (cid:9) κ , ⊗ κ ,
gyr κ recover their respective Euclidean counterparts + , − , · , Id .
Hence, the analogy solutions d 1 , d 2 , m td 1 d 2 of Eq.
(6) would then all recover d = c + b − a , which seems a nice sanity check.
A. H YPERNYMY
We show here more plots illustrating the method (described in section 7) that we use to map points from a (product of)
Poincar ´ e disk(s) to a (diagonal) Gaussian.
Colors indicate WordNet levels: low levels are closer to the root.
Figures 5,6,7,8 show the three steps (centering, rotation, isometric mapping to half-plane) for 20D embeddings in ( D 2 ) 10 , i.e. each of these steps in each of thecorresponding 2D spaces.
In these ﬁgures, centering and rotation were determined with our proposed semi-supervised method, i.e. selecting 400+400 top and bottom words from the WordNet hierarchy.
We show these plots for two models in ( D 2 ) 10 : one trained with h = ( · ) 2 and one with h = cosh 2 .
Remark.
It is easily noticeable
that words trained with h = cosh 2 are embedded much closer to each other than those trained with h = ( · ) 2 .
This is expected: h is applied to the distance function, and according to Eq.
(3), d ( w i , ˜ w j ) should match h − 1 ( b i + ˜
b j − log( X ij )) , which is smaller for h = cosh 2 than for h = ( · ) 2 .
B δ - HYPERBOLICITY
Let us start by deﬁning the δ -hyperbolicity , introduced by Gromov (1987).
The hyperbolicity δ ( x, y, z, t ) of a 4 -tuple ( x, y, z, t ) is deﬁned as half the difference between the biggest two of the following sums: d ( x, y )
+
d ( z, t ) , d ( x, z )+ d ( y, t ) , d ( x, t )+ d ( y, z ) .
The δ -hyperbolicity of a metric space is deﬁned as the supremum of these numbers over all 4 -tuples.
Following Albert et al.
(2014), we will denote this number by δ worst , and by δ avg the average of these over all 4 -tuples, when the space is a ﬁnite set.
An equivalent and more intuitive deﬁnition holds for geodesic spaces, i.e. when we can deﬁne triangles: its δ -hyperbolicity ( δ worst ) is the smallest δ > 0 such that for any triangle ∆ xyz , there exists a point at distance at most δ from each side of the triangle.
Chen et al.
and
Borassi et al.
(2015) analyzed δ worst and δ avg for speciﬁc graphs, respectively.
A low hyperbolicity of a graph indicates that it has an underlying hyperbolic geometry, i.e. that it is approximately tree-like, or at least that there exists a taxonomy of nodes.
Conversely, a high hyperbolicity of a graph suggests that it possesses long cycles, or could not be embedded in a low dimensional hyperbolic space without distortion.
For instance, the Euclidean space R n is not δ -hyperbolic for any δ > 0 , and is hence described as ∞ -hyperbolic, while the Poincar´e disk D 2 is known to have a δ -hyperbolicity of log(1 + √ 2) (cid:39) 0 .
On the other-hand, a product D 2 × D 2 is ∞ -hyperbolic, because a 2 D plane Rcould be isometrically embedded in it using for instance the ﬁrst coordinates of each D 2 .
However, if Dwould constitute a good choice to embed some given symbolic data, then most likely D 2 × Dwould as well.
This stems from the fact that δ -hyperbolicity ( δ worst ) is a worst case measure which does not reﬂect what one could call the “hyperbolic capacity” of the space.
Furthermore, note that computing δ worst requires O ( n 4 ) for a graph of size n , while δ avg can be approximated via sampling.
Finally, δ avg is robust to adding/removing a node from the graph, while δ worst is not.
For all these reasons, we choose δ avg as a measure of hyperbolicity.
More experiments.
As explained in section 8, we computed hyperbolicities of the metric space induced by different h functions, on the matrix of co-occurrence counts, as reported in Table 1.
We also conducted similarity experiments, reported in Table 17.
Apart from WordSim, results improved for higher powers of cosh , corresponding to more hyperbolic spaces.
However, also note that higher powers will tend to result in words embedded much closer to each other, i.e. with smaller distances, as explained in appendix A.3.
In order to know whether this beneﬁt comes from contracting distances or making the space more “hyperbolic”, it would be interesting to learn (or cross-validate) the curvature c of the Poincar ´ e ball (or equivalently, its radius) jointly with the h function.
Finally, it order to explain why WordSim behaved differently compared to other benchmarks, we investigated different properties of these, as reported in Table 16.
The geometry of the words appearing in WordSim do not seem to have a different hyperbolicity compared to other benchmarks; however, WordSim seems to contain much more frequent words.
Since hyperbolicities are computed with the assumption that b i = log( X i ) (see Eq.
(7)), it would be interesting to explore whether learned biases indeed take these values.
We left this as future work.
The median of indexes seems to best discriminate WordSim from SimLex and SimVerb.
Property
[Table]
[Table]
C C LOSED - FORM FORMULAS OF M ¨ OBIUS OPERATIONS
We show closed form expressions for the most common operations in the Poincar´e ball, but we refer the reader to (Ungar, 2008; Ganea et al., 2018b) for more details.
M¨obius addition.
The M ¨ obius addition of x and y in D n is deﬁned as
[Equation]
We deﬁne x (cid:9) y :
= x ⊕ c ( − y ) .
M¨obius scalar multiplication.
The M¨obius scalar multiplication of x ∈ D n \ { 0 } by r ∈ R is deﬁned as
[Equation]
[Equation]
and r ⊗ 0 := 0 .
Exponential and logarithmic maps.
For any point x ∈ D n , the exponential map exp x : T x D n → D n and the logarithmic map log x : D n → T x D n are given for v (cid:54) =
and y (cid:54) =
x by: exp
[Equation]
Gyro operator and parallel transport.
Parallel transport is given for x, y ∈ D n , v ∈ T x D by the formula P x → y ( v ) =
λ x λ y · gyr [ y, − x ] v .
Gyr 6 is the gyroautomorphism on D n with closed form expression shown in Eq.
1.27 of (Ungar, 2008):
[Equation]
where the quantities A, B, D have closed-form expressions and are thus easy to implement:
[Equation] [Equation]