Poincaré Embeddings for Learning Hierarchical Representations
Maximilian Nickel, Douwe Kiela
Introduction
Learning representations of symbolic data such as text, graphs and multi-relational data has become a central paradigm in machine learning and artificial intelligence. For instance, word embeddings such as word2vec , GloVe and FastText are widely used for tasks ranging from machine translation to sentiment analysis. Similarly, embeddings of graphs such as latent space embeddings , node2vec , and DeepWalk have found important applications for community detection and link prediction in social networks. Embeddings of multi-relational data such as Rescal , TransE , and Universal Schema are being used for knowledge graph completion and information extraction.
Although embedding methods have proven successful in numerous applications, they suffer from a fundamental limitation: their ability to model complex patterns is inherently bounded by the dimensionality of the embedding space. For instance, Nickel et al. showed that linear embeddings of graphs can require a prohibitively large dimensionality to model certain types of relations. Although non-linear embeddings can mitigate this problem , complex graph patterns can still require a computationally infeasible embedding dimensionality. As a consequence, no method yet exists that is able to compute embeddings of large graph-structured data – such as social networks, knowledge graphs or taxonomies – without loss of information. Since the ability to express information is a precondition for learning and generalization, it is therefore important to increase the representation capacity of embedding methods such that they can realistically be used to model complex patterns on a large scale. In this work, we focus on mitigating this problem for a certain class of symbolic data, i.e., large datasets whose objects can be organized according to a latent hierarchy – a property that is inherent in many complex datasets. For instance, the existence of power-law distributions in datasets can often be traced back to hierarchical structures . Prominent examples of power-law distributed data include natural language (Zipf’s law ) and scale-free networks such as social and semantic networks . Similarly, the empirical analysis of Adcock et al. indicated that many real-world networks exhibit an underlying tree-like structure.
To exploit this structural property for learning more efficient representations, we propose to compute embeddings not in Euclidean but in hyperbolic space, i.e., space with constant negative curvature. Informally, hyperbolic space can be thought of as a continuous version of trees and as such it is naturally equipped to model hierarchical structures. For instance, it has been shown that any finite tree can be embedded into a finite hyperbolic space such that distances are preserved approximately . We base our approach on a particular model of hyperbolic space, i.e., the Poincaré ball model, as it is well-suited for gradient-based optimization. This allows us to develop an efficient algorithm for computing the embeddings based on Riemannian optimization, which is easily parallelizable and scales to large datasets. Experimentally, we show that our approach can provide high quality embeddings of large taxonomies – both with and without missing data. Moreover, we show that embeddings trained on WordNet provide state-of-the-art performance for lexical entailment. On collaboration networks, we also show that Poincaré embeddings are successful in predicting links in graphs where they outperform Euclidean embeddings, especially in low dimensions.
The remainder of this paper is organized as follows: In Section 2 we briefly review hyperbolic geometry and discuss related work regarding hyperbolic embeddings. In Section 3 we introduce Poincaré embeddings and discuss how to compute them. In Section 4 we evaluate our approach on tasks such as taxonomy embedding, link prediction in networks and predicting lexical entailment.
Embeddings and Hyperbolic Geometry
Due to these properties, hyperbolic space has recently been considered to model complex networks. For instance, Kleinberg introduced hyperbolic geometry for greedy routing in geographic communication networks. Similarly, Boguñá et al. proposed hyperbolic embeddings of the AS Internet topology to perform greedy shortest path routing in the embedding space. Krioukov et al. developed a framework to model complex networks using hyperbolic spaces and discussed how typical properties such as heterogeneous degree distributions and strong clustering emerges by assuming an underlying hyperbolic geometry to these networks. Adcock et al. proposed a measure based on Gromov’s -hyperbolicity to characterize the tree-likeness of graphs.
In machine learning and artificial intelligence on the other hand, Euclidean embeddings have become a popular approach for learning from symbolic data. For instance, in addition to the methods discussed in Section 1, Paccanaro and Hinton proposed one of the first embedding methods to learn from relational data. More recently, Holographic and Complex Embeddings have shown state-of-the-art performance in Knowledge Graph completion. In relation to hierarchical representations, Vilnis and McCallum proposed to learn density-based word representations, i.e., Gaussian embeddings, to capture uncertainty and asymmetry. Given information about hierarchical relations in the form of ordered input pairs, Vendrov et al. proposed Order Embeddings to model visual-semantic hierarchies over words, sentences, and images.
Poincaré Embeddings
In the following, we are interested in finding embeddings of symbolic data such that their distance in the embedding space reflects their semantic similarity. We assume that there exists a latent hierarchy in which the symbols can be organized. In addition to the similarity of objects, we intend to also reflect this hierarchy in the embedding space to improve over existing methods in two ways:
By inducing an appropriate bias on the structure of the embedding space, we aim at learning more parsimonious embeddings for superior generalization performance and decreased runtime and memory complexity.
By capturing the hierarchy explicitly in the embedding space, we aim at gaining additional insights about the relationships between symbols and the importance of individual symbols.
where and denotes the Euclidean metric tensor. Furthermore, the distance between points is given as
The boundary of the ball is denoted by . It corresponds to the sphere and is not part of the hyperbolic space, but represents infinitely distant points. Geodesics in are then circles that are orthogonal to (as well as all diameters). See Figure 1 for an illustration.
It can be seen from Equation 1, that the distance within the Poincaré ball changes smoothly with respect to the location of and . This locality property of the Poincaré distance is key for finding continuous embeddings of hierarchies. For instance, by placing the root node of a tree at the origin of it would have a relatively small distance to all other nodes as its Euclidean norm is zero. On the other hand, leaf nodes can be placed close to the boundary of the Poincaré ball as the distance grows very fast between points with a norm close to one. Furthermore, please note that Equation 1 is symmetric and that the hierarchical organization of the space is solely determined by the distance of points to the origin. Due to this self-organizing property, Equation 1 is applicable in an unsupervised setting where the hierarchical order of objects is not specified in advance such as text and networks. Remarkably, Equation 1 allows us therefore to learn embeddings that simultaneously capture the hierarchy of objects (through their norm) as well a their similarity (through their distance).
Since a single hierarchical structure can already be represented in two dimensions, the Poincaré disk () is typically used to represent hyperbolic geometry. In our method, we instead use the Poincaré ball (), for two main reasons: First, in many datasets such as text corpora, multiple latent hierarchies can co-exist, which can not always be modeled in two dimensions. Second, a larger embedding dimension can decrease the difficulty for an optimization method to find a good embedding (also for single hierarchies) as it allows for more degrees of freedom during the optimization process.
To compute Poincaré embeddings for a set of symbols , we are then interested in finding embeddings , where . We assume we are given a problem-specific loss function which encourages semantically similar objects to be close in the embedding space according to their Poincaré distance. To estimate , we then solve the optimization problem
We will discuss specific loss functions in Section 4.
Since the Poincaré Ball has a Riemannian manifold structure, we can optimize Equation 2 via stochastic Riemannian optimization methods such as RSGD or RSVRG . In particular, let denote the tangent space of a point . Furthermore, let denote the Riemannian gradient of and let denote the Euclidean gradient of . Using RSGD, parameter updates to minimize Equation 2 are then of the form
where denotes the retraction onto at and denotes the learning rate at time . Hence, for the minimization of Equation 2, we require the Riemannian gradient and a suitable retraction. Since the Poincaré ball is a conformal model of hyperbolic space, the angles between adjacent vectors are identical to their angles in the Euclidean space. The length of vectors however might differ. To derive the Riemannian gradient from the Euclidean gradient, it is sufficient to rescale with the inverse of the Poincaré ball metric tensor, i.e., . Since is a scalar matrix, the inverse is trivial to compute. Furthermore, since Equation 1 is fully differentiable, the Euclidean gradient can easily be derived using standard calculus. In particular, the Euclidean gradient depends on the gradient of , which we assume is known, and the partial derivatives of the Poincaré distance, which can be computed as follows: Let , and let
The partial derivate of the Poincaré distance with respect to is then given as
Since is symmetric, the partial derivative can be derived analogously. As retraction operation we use . In combination with the Riemannian gradient, this corresponds then to the well-known natural gradient method . Furthermore, we constrain the embeddings to remain within the Poincaré ball via the projection
where is a small constant to ensure numerical stability. In all experiments we used . In summary, the full update for a single embedding is then of the form
It can be seen from Equations 4 and 5 that this algorithm scales well to large datasets, as the computational and memory complexity of an update depends linearly on the embedding dimension. Moreover, the algorithm is straightforward to parallelize via methods such as Hogwild , as the updates are sparse (only a small number of embeddings are modified in an update) and collisions are very unlikely on large-scale data.
2 Training Details
In addition to this optimization procedure, we found that the following training details were helpful for obtaining good representations: First, we initialize all embeddings randomly from the uniform distribution . This causes embeddings to be initialized close to the origin of . Second, we found that a good initial angular layout can be helpful to find good embeddings. For this reason, we train during an initial "burn-in" phase with a reduced learning rate . In combination with initializing close to the origin, this can improve the angular layout without moving too far towards the boundary. In our experiments, we set and the duration of the burn-in to 10 epochs.
Evaluation
In this section, we evaluate the quality of Poincaré embeddings for a variety of tasks, i.e., for the embedding of taxonomies, for link prediction in networks, and for modeling lexical entailment. We compare the Poincaré distance as defined in Equation 1 to the following two distance functions:
In all cases, we include the Euclidean distance . As the Euclidean distance is flat and symmetric, we expect that it requires a large dimensionality to model the hierarchical structure of the data.
For asymmetric data, we also include the score function , as proposed by Bordes et al. for modeling large-scale graph-structured data. For this score function, we also learn the global translation vector during training.
Note that the translational score function has, due to its asymmetry, more information about the nature of an embedding problem than a symmetric distance when the order of indicates the hierarchy of elements. This is, for instance, the case for relations in taxonomies. For the Poincaré distance and the Euclidean distance we could randomly permute the order of and obtain the identical embedding, while this is not the case for the translational score function. As such, it is not fully unsupervised and only applicable where this hierarchical information is available.
In the first set of experiments, we are interested in evaluating the ability of Poincaré embeddings to embed data that exhibits a clear latent hierarchical structure. For this purpose, we conduct experiments on the transitive closure of the WordNet noun hierarchy in two settings:
To evaluate representation capacity, we embed fully observed data and reconstruct it from the embedding. The reconstruction error in relation to the embedding dimension is then a measure for the capacity of the model.
To test generalization performance, we split the data into a train, validation and test set by randomly holding out observed links. Links in the validation and test set do not include the root or leaf nodes as these links would either be trivial to predict or impossible to predict reliably.
Since we are using the transitive closure, the hypernymy relations form a directed acyclic graph such that the hierarchical structure is not directly visible from the raw data but has to be inferred. The transitive closure of the WordNet noun hierarchy consists of 82,115 nouns and 743,241 hypernymy relations. On this data, we learn embeddings in both settings as follows: Let be the set of observed hypernymy relations between noun pairs. We then learn embeddings of all symbols in such that related objects are close in the embedding space. In particular, we minimize the loss function
where is the set of negative examples for (including ). For training, we randomly sample 10 negative examples per positive example. Equation 6 can be interpreted as a soft ranking loss where related objects should be closer than objects for which we didn’t observe a relationship. This choice of loss function is motivated by the fact that we don’t want to push symbols belonging to distinct subtrees arbitrarily far apart as their subtrees might still be close. Instead we want them to be farther apart than symbols with an observed relation.
We evaluate the quality of the embeddings as commonly done for graph embeddings : For each observed relationship , we rank its distance among the ground-truth negative examples for , i.e., among the set . In the Reconstruction setting, we evaluate the ranking on all nouns in the dataset. We then record the mean rank of as well as the mean average precision (MAP) of the ranking. The results of these experiments are shown in Table 1. It can be seen that Poincaré embeddings are very successful in the embedding of large taxonomies – both with regard to their representation capacity and their generalization performance. Even compared to Translational embeddings, which have more information about the structure of the task, Poincaré embeddings show a greatly improved performance while using an embedding that is smaller by an order of magnitude. Furthermore, the results of Poincaré embeddings in the link prediction task are very robust with regard to the embedding dimension. We attribute this result to the structural bias of Poincaré embeddings, what could lead to reduced overfitting on this kind of data with a clear latent hierarchy. In Figure 2 we show additionally a visualization of a two-dimensional Poincaré embedding. For purpose of clarity, this embedding has been trained only on the mammals subtree of WordNet.
2 Network Embeddings
Next, we evaluated the performance of Poincaré embeddings for link prediction in networks. Since edges in complex networks can often be explained via latent hierarchies over their nodes , we are interested in the benefits of Poincaré embeddings both in terms representation size and generalization performance. We performed our experiments on four commonly used social networks, i.e, AstroPh, CondMat, GrQc, and HepPh. These networks represent scientific collaborations such that there exists an undirected edge between two persons if they co-authored a paper. For these networks, we model the probability of an edge as proposed by Krioukov et al. via the Fermi-Dirac distribution
where are hyperparameters. Here, corresponds to the radius around each point such that points within this radius are likely to have an edge with . The parameter specifies the steepness of the logistic function and influences both average clustering as well as the degree distribution . We use the cross-entropy loss to learn the embeddings and sample negatives as in Section 4.1.
For evaluation, we split each dataset randomly into train, validation, and test set. The hyperparameters and where tuned for each method on the validation set. Table 2 lists the MAP score of Poincaré and Euclidean embeddings on the test set for the hyperparameters with the best validation score. Additionally, we again list the reconstruction performance without missing data. Translational embeddings are not applicable to these datasets as they consist of undirected edges. It can be seen that Poincaré embeddings perform again very well on these datasets and – especially in the low-dimensional regime – outperform Euclidean embeddings.
3 Lexical Entailment
An interesting aspect of Poincaré embeddings is that they allow us to make graded assertions about hierarchical relationships as hierarchies are represented in a continuous space. We test this property on HyperLex , which is a gold standard resource for evaluating how well semantic models capture graded lexical entailment by quantifying to what degree is a type of via ratings on a scale of $d=5\texttt{is-a}(u,v)$ is true, we used the score function:
Here, the term acts as a penalty when is lower in the embedding hierarchy, i.e., when has a higher norm than . The hyperparameter determines the severity of the penalty. In our experiments we set .
Using Equation 8, we scored all noun pairs in HyperLex and recorded Spearman’s rank correlation with the ground-truth ranking. The results of this experiment are shown in Table 3. It can be seen that the ranking based on Poincaré embeddings clearly outperforms all state-of-the-art methods evaluated in . Methods in Table 3 that are prefixed with WN also use WordNet as a basis and therefore are most comparable. The same embeddings also achieved a state-of-the-art accuracy of on Wbless , which evaluates non-graded lexical entailment.
Discussion and Future Work
In this paper, we introduced Poincaré embeddings for learning representations of symbolic data and showed how they can simultaneously learn the similarity and the hierarchy of objects. Furthermore, we proposed an efficient algorithm to compute the embeddings and showed experimentally, that Poincaré embeddings provide important advantages over Euclidean embeddings on hierarchical data: First, Poincaré embeddings enable very parsimonious representations whats allows us to learn high-quality embeddings of large-scale taxonomies. Second, excellent link prediction results indicate that hyperbolic geometry can introduce an important structural bias for the embedding of complex symbolic data. Third, state-of-the-art results for predicting lexical entailment suggest that the hierarchy in the embedding space corresponds well to the underlying semantics of the data.
The main focus of this work was to evaluate the general properties of hyperbolic geometry for the embedding of symbolic data. In future work, we intend, to both expand the applications of Poincaré embeddings – for instance to multi-relational data – and also to derive models that are tailored to specific applications such as word embeddings. Furthermore, we have shown that natural gradient based optimization already produces very good embeddings and scales to large datasets. We expect that a full Riemannian optimization approach can further increase the quality of the embeddings and lead to faster convergence.