Complex Hyperbolic Knowledge Graph Embeddings with Fast Fourier Transform

The choice of geometric space for knowledge graph (KG) embeddings can have significant effects on the performance of KG completion tasks. The hyperbolic geometry has been shown to capture the hierarchical patterns due to its tree-like metrics, which addressed the limitations of the Euclidean embedding models. Recent explorations of the complex hyperbolic geometry further improved the hyperbolic embeddings for capturing a variety of hierarchical structures. However, the performance of the hyperbolic KG embedding models for non-transitive relations is still unpromising, while the complex hyperbolic embeddings do not deal with multi-relations. This paper aims to utilize the representation capacity of the complex hyperbolic geometry in multi-relational KG embeddings. To apply the geometric transformations which account for different relations and the attention mechanism in the complex hyperbolic space, we propose to use the fast Fourier transform (FFT) as the conversion between the real and complex hyperbolic space. Constructing the attention-based transformations in the complex space is very challenging, while the proposed Fourier transform-based complex hyperbolic approaches provide a simple and effective solution. Experimental results show that our methods outperform the baselines, including the Euclidean and the real hyperbolic embedding models.

The choice of geometric space for knowledge graph (KG) embeddings can have significant effects on the performance of KG completion tasks. The hyperbolic geometry has been shown to capture the hierarchical patterns due to its tree-like metrics, which addressed the limitations of the Euclidean embedding models. Recent explorations of the complex hyperbolic geometry further improved the hyperbolic embeddings for capturing a variety of hierarchical structures. However, the performance of the hyperbolic KG embedding models for non-transitive relations is still unpromising, while the complex hyperbolic embeddings do not deal with multi-relations. This paper aims to utilize the representation capacity of the complex hyperbolic geometry in multi-relational KG embeddings. To apply the geometric transformations which account for different relations and the attention mechanism in the complex hyperbolic space, we propose to use the fast Fourier transform (FFT) as the conversion between the real and complex hyperbolic space. Constructing the attention-based transformations in the complex space is very challenging, while the proposed Fourier transform-based complex hyperbolic approaches provide a simple and effective solution. Experimental results show that our methods outperform the baselines, including the Euclidean and the real hyperbolic embedding models.

Introduction
Knowledge graph (KG) representation learning is important to the KG inference as well as the downstream tasks (Nickel et al., 2016). It has been noticed that the embedding space has significant effects on the performance of KG completion tasks. Previous works have proposed the KG embedding models in Euclidean space (Bordes et al., 2013;Nickel et al., 2011;, complex Euclidean space (Trouillon et al., 2016;   2019), hyperbolic space (Balazevic et al., 2019;Chami et al., 2020). 1 These models learn the embeddings of the KG entities in the selected geometric spaces and parameterize the relation representations as the geometric transformations, such as translation, rotation, matrix multiplication, etc.
The Euclidean and complex Euclidean embedding models can capture relation properties including symmetry/anti-symmetry, inversion, and composition, but they cannot handle the transitive relations such as hypernymy. Generally, the transitive relation forms a tree-like structure, for which hyperbolic geometry has a more powerful representation capacity than Euclidean geometry because the hyperbolic space can be regarded as a continuous approximation to trees (Krioukov et al., 2010).
However, most real-world graphs with transitivity do not necessarily form exact tree structures since the transitive relations can lead to a globally hierarchical structure with varying local structures, such as multitree structures (Griggs et al., 2012) and taxonomies (Suchanek et al., 2007). Thus, the hyperbolic geometry which resembles tree metrics still has limitations on capturing various and flexible hierarchical structures. To tackle the limitation of hyperbolic embeddings, a recent work (Xiao et al., 2021) proposed to explore the complex hyperbolic geometry to learn the embeddings of hierarchical graphs. Due to the variable negative curvature (Goldman, 1999), the complex hyperbolic space is more flexible in handling varying structures while the tree-like properties are still retained. Despite the remarkable improvements in single transitive relation inference, the complex hyperbolic geometry has not been utilized for multirelational embeddings.
In this paper, we are motivated to make use of the complex hyperbolic geometry's representation superiority in KGs. There are two main challenges in extending the complex hyperbolic embeddings to multiple relations. First, the geometric transformations in complex hyperbolic geometry are complicated and challenging to optimize due to the numerical instabilities, making it difficult to apply the complex geometric transformations for different relations. Second, it is hard to build the neural network unit or layer in the complex domain. Missing the complex attention mechanism would restrict the parameterization capability and make the complex domain-based model difficult to generalize to further downstream tasks.
To address the above problems, we propose a complex hyperbolic KG embedding approach with the fast Fourier transform. Our approach can utilize the representation capacity of the complex hyperbolic geometry as well as the well-developed attention-based geometric transformations as relation parameterization, while we borrow the fast Fourier transform (FFT) and inverse fast Fourier transform (IFFT) to provide the conversion between the real and complex hyperbolic space. We regard the complex hyperbolic embeddings in the unit ball model (a projective geometry-based model to identify the complex hyperbolic space) (Goldman, 1999) and the hyperbolic embeddings in the Poincaré ball model (a model of the real hyperbolic space) (Cannon et al., 1997) as frequency domain and spatial domain respectively. Then FFT and IFFT enable us to convert the embeddings between the two geometric spaces, accomplishing the leverage of real hyperbolic transformations to the complex hyperbolic model. The framework is simple and effective in learning the complex hyperbolic KG representations. Figure 1 summarizes the comparison among embedding spaces for hierarchical patterns and multi-relation properties. In experiments, we evaluate our approach on the KG link prediction task with two popular benchmarks-WN18RR (Bordes et al., 2013) and FB15k-237 (Toutanova and Chen, 2015). Empirical results show that our Fourier transform-based complex hyperbolic KG embedding approach outperforms the baseline models in other geometric spaces.
The code and data of our work are available at https://github.com/HKUST-KnowComp/ ComplexHyperbolicKGE.

Related Work
Euclidean KG embeddings. The traditional KG embedding models first started with the Euclidean geometry because of its convenient vectorial structure and closed-form computations such as distance formula and inner-product. After the occurrence of the translation-based models (Bordes et al., 2013) and bilinear models (Nickel et al., 2011;, several extensions (Wang et al., 2014;Lin et al., 2015;Ji et al., 2015) have been made to further develop the Euclidean methods.
Complex Euclidean KG embeddings. The follow-up works (Trouillon et al., 2016;Hayashi and Shimbo, 2017;Sun et al., 2019) extended the traditional Euclidean models to complex hyperbolic geometry. Specifically, ComplEx (Trouillon et al., 2016) found that the Hermitian dot product can effectively capture anti-symmetric relations while retaining the efficiency benefits of the dot product. RotatE (Sun et al., 2019) defined each relation as a rotation in the complex vector space to infer various relation patterns (symmetry/antisymmetry, inversion, composition). The effectiveness of these models revealed the potential of the complex geometry.
Hyperbolic embeddings. In recent years, the hyperbolic space attracted much attention for representation learning since it can naturally characterize tree structures. The hyperbolic embedding methods have developed from the single transitive relation graphs Kiela, 2017, 2018;Sonthalia and Gilbert, 2020) to multi-relational KGs (Balazevic et al., 2019;Chami et al., 2020). MurP (Balazevic et al., 2019) embedded the hier-archical multi-relational data in the Poincaré ball model and learned relation-specific parameters by Möbius operations. The state-of-the-art hyperbolic KG embedding models are a series of hyperbolic transformation-based models RefH, RotH, and AttH (Chami et al., 2020), which utilize the geometric tree-like property to capture the hierarchical structure naturally while using different geometric transformations as well as attention mechanism to parameterize other relation properties.
Lightweight Euclidean-based models. Based on the hyperbolic embedding model RotH (Chami et al., 2020), Wang et al. (2021) developed two lightweight Euclidean-based models RotL and Rot2L, which simplified the hyperbolic operations while keeping the flexible normalization effect.
Complex hyperbolic embeddings. Since many real-world hierarchically structured data such as taxonomies (Miller, 1995;Suchanek et al., 2007) and multitree networks (Griggs et al., 2012) have varying local structures, they do not ubiquitously match the hyperbolic geometry. Therefore, Xiao et al. (2021) explored the complex hyperbolic space to embed a variety of hierarchical structures. The complex hyperbolic embedding approach improved over the hyperbolic embedding models, but it only focused on the representation of single-relational graphs instead of multi-relational KGs.
Fourier Transform. Fourier transform (Heideman et al., 1984) converts a finite-sequence signal from its temporal or spatial domain to the frequency domain. FFT (Cooley et al., 1969) is a practical algorithm that computes the discrete Fourier transform (DFT) of a sequence. FFT and inverse FFT are widely used for many applications (Rockmore, 2000;Burgess, 2014) for their usefulness in signal processing as well as computation efficiency. They are also used to efficiently perform operations such as convolutions (Smith et al., 1997;Kipf and Welling, 2017) and cross-correlations (Bracewell and Bracewell, 1986;Wang et al., 2018). Hayashi and Shimbo (2019) also introduced the Fourier transform in KGE, where the main idea was to use the block circulant matrices to parameterize relations. While in our work, the Fourier transform is used to transform the entity embeddings between different geometric spaces.

Hyperbolic Geometry
The hyperbolic space is a homogeneous space with constant negative curvature (Cannon et al., 1997). In the hyperbolic space, the volume of a ball grows exponentially with its radius. Contrastively, in the Euclidean space, the curvature is constantly 0, and the volume of a ball grows polynomially with its radius. The exponential volume growth rate enables the hyperbolic space to have powerful representation capability for tree structures since the number of nodes grows exponentially with the depth in a tree, while the Euclidean space is too flat and narrow to embed trees.
The Poincaré Ball Model. To describe the hyperbolic space in mathematical language, there are several models, among which the Poincaré ball model is popular for graph representation (Nickel and Kiela, 2017;Chami et al., 2020) due to the relatively convenient computations.
Denote the Poincaré ball model with con- which represents the open N -dimension ball in the ambient Euclidean space ( · is the Euclidean L 2 norm). By the framework of gyrovector space (Ungar, 2008), the hyperbolic space can be formalized as an approximated vectorial structure, where the Möbius addition (Ganea et al., 2018) is used as the vector addition in P N R : Then the distance function in P N R is given by The practical computations in the hyperbolic space are often implemented using the tangent space. For x ∈ P N R , the associated tangent space T x P N R is an N -dimension Euclidean space containing all tangent vectors passing through x (do Carmo, 1976). The manifold of the Poincaré ball model and the tangent space have closed-form maps to each other, which are defined as the exponential map exp c 0 (v) : T 0 P N R → P N R and the logarithmic map log c 0 (y) :

Complex Hyperbolic Geometry
The complex hyperbolic space is a homogeneous space of variable negative curvature (Goldman, 1999). The complex hyperbolic space also maintains the tree-like exponential volume growth property. From the properties of the complex hyperbolic geometry, we see that the complex hyperbolic space can naturally handle data with diverse local structures because of the non-constant curvature while preserving the tree-like properties to better capture the transitivity (Xiao et al., 2021).
The Unit Ball Model. The complex hyperbolic space's ambient Hermitian vector space C n,1 is the complex Euclidean space C n+1 endowed with some Hermitian form z, w , where z, w ∈ C n+1 . Different choices of the Hermitian form z, w correspond to different models of complex hyperbolic geometry, such as the unit ball model and the Siegel domain model (Parker, 2003). Here we choose the standard Hermitian form which derives the unit ball model: where w denotes the complex conjugate of w.
Then via the projective geometry (Goldman, 1999), the formula of the unit ball model is: 2 B n C = {(z 1 , · · · , z n , 1)||z 1 | 2 + · · · + |z n | 2 < 1}. (6) The metric on B n C is Bergman metric, which takes the formula below in 2-d case: Then the distance function on B n C can be derived from the metric tensor: Although the unit ball model and the Poincaé ball model look similar in mathematical formulae, they have many differences in properties since the complex hyperbolic geometry and hyperbolic geometry are intrinsically different geometries. Not only the variable/constant negative curvature but also their distance functions and the geometric computations vary with each other. 2 Here we denote the dimension as n instead of N as in Section 3.1 since the dimensions of the two models can differ in Fourier transform, which we will see in Section 4.2.

Approach
Given the KG with entity set V = {e j } m j=1 , relation set R = {r j } k j=1 , and triplet set F = {(h, r, t)|h, t ∈ V, r ∈ R}, the link prediction task aims to predict the tail entity t for each test query (h, r). To train the models for a higher-quality inference, we learn the entity embeddings {e j } m j=1 in the unit ball model, while parameterizing the relations by the hyperbolic transformations RotH, RefH, and the hyperbolic attention-based model AttH (Chami et al., 2020). We construct the conversion between the two geometries through Fourier transform. Figure 2 presents the overview of our framework. In this section, we first present the attention-based hyperbolic transformations as relation parameterization, then introduce the Fourier transform as the conversion between complex hyperbolic domain and hyperbolic domain, followed by the details of our framework.

Relation Parameterization by Hyperbolic Transformations and Attention
In our work, we adopt the attention-based hyperbolic transformations developed by Chami et al. (2020) as the relation parameterization in the Poincaré ball model. Here we present the models RotH, RefH, and AttH. RotH and RefH represent rotations and reflections in the hyperbolic space respectively. They can be modeled using the Givens transformation matrices, which take the following formula: Let Θ r ≡ (θ r,j ) j∈{1,..., N 2 } and Φ r ≡ (φ r,j ) j∈{1,..., N 2 } be the relation parameters, where N denotes the dimension of the embedding space, then the hyperbolic rotation and reflection are parameterized by the block-diagonal Givens matrices: ). (11) Thus, given a query (h, r), RotH and RefH apply hyperbolic rotation and reflection with relationspecific parameters r to the head embeddings h ∈ P N R , and then get the query embeddings: In order to handle multiple relation properties, h ∈ ℬ n ℂh ∈ 2(n−1) ℝq ∈ 2(n−1) Figure 2: The inference process for a query (h, r) in our proposed complex hyperbolic KG embedding framework. h andh are the head entity embeddings in different spaces. q andq are the query embeddings in different spaces. B n C denotes the n-dimension unit ball model in the complex hyperbolic space while P 2(n−1) R denotes the 2(n − 1)dimension Poincaré ball model in the hyperbolic space.
AttH combines the above two representations using the hyperbolic attention and adding a hyperbolic translation r r by Möbius addition (Eq. (1)): AttH(h, r) = Att(RotH(h, r), RefH(h, r); a r )⊕ cr r r , (13) where c r is the curvature parameter of r. RotH, RefH, and AttH leverage the trainable curvature so that each relation has its own curvature parameterization. The hyperbolic attention is constructed from the exponential map (Eq. (3)) of the average in the tangent space (Chami et al., 2019;Liu et al., 2019). More details about the hyperbolic attention mechanism can be referred to (Chami et al., 2020).

Conversion by Fourier Transform
The orthonormal Discrete Fourier Transform (DFT) F and its inverse (IDFT) F −1 between two finite complex-valued sequences {x p } N −1 p=0 and {z q } N −1 q=0 take the following formulae: x In our models, we transform the unit ball embeddings z ∈ B n C to the Poincaré ball embeddings x ∈ P N R back and forth. Note that the Poincaré ball embeddings x = {x 0 , . . . , x N −1 } are all real numbers, then F{x} is symmetric: z q = z −q mod N , ∀q ∈ {0, . . . , N − 1}. The dimension N is even because of the construction of diagonal Givens transformations (Eqs. (10) and (11)). Then it follows that z 0 and z N 2 are realvalued, and the remainder of F{x} is completely specified by just N 2 − 1 complex numbers. Therefore, in practical algorithms, we set N = 2(n − 1), i.e., we use the first N 2 + 1 elements {z 0 , . . . , z N 2 } as the transformed unit ball embeddings.
We notice that the Fourier transform is not simply a conversion technique between complex and real domains. Performing circular convolutions in one domain equals the multiplication in another domain (Rader, 1972;Smith et al., 1997): Its effectiveness provides useful transforms, while its practicability is guaranteed by FFT and IFFT, where the fast Fourier algorithms can reduce the computing complexity from O(N 2 ) to O(N log N ) (Cooley and Tukey, 1965).

Complex Hyperbolic Embeddings with Fourier Transform
For a query (h, r), Figure 2 briefly describes the inference process in our framework. The head embedding h ∈ B n C is in the n-dimension unit ball model. We apply inverse Fourier transform (Eq. (15)) to h and get the transformed head embeddings in the 2(n − 1)-dimension Poincaré ball modelh ∈ P 2(n−1) R :h = F −1 {h}. Then we can apply RotH, RefH (Eq. (12)), and AttH (Eq. (13)) to get the query embeddingq: where ModelH = {RotH, RefH, AttH} represents the corresponding hyperbolic embedding model. The query embeddingq then gets transformed back to the unit ball model by Fourier transform (Eq. (14)): q = F{q}.
Finally, we use the following score function (Balazevic et al., 2019) to measure the likelihood of a triplet (h, r, t): where d B (q, t) is the unit ball model distance (Eq. (8)) between the tail embeddings t and the query embeddings q computed by the above procedures. b h and b t are bias terms of the head and tail entity. The model learns the embeddings by maximizing the score functions of the training triplets, i.e., making the query embeddings of (h, r) close with its ground truth tail embeddings. The score function is also used to predict the test data.
In summary, our model parameters include the entity parameters: {e j } m j=1 ∈ B n C (embeddings), {b j } m j=1 (biases); and the relation parameters: Θ r (rotations), Φ r (reflections), r r (translations), a r (attention), c r (curvature). The FFT and IFFT can be computed very efficiently, so our models have almost the same computation cost with the base models RotH, RefH, and AttH, while we utilize a more powerful representation geometry to improve the embedding quality.

Experiments
In this section, we evaluate our approaches on the KG link prediction task. We show that our complex hyperbolic embedding models outperform the baseline methods based on other geometric spaces.

Data
We use two widely-used KG benchmarks to evaluate the embedding models. The data statistics are provided in Table 1. The global graph curvature ξ G (Gu et al., 2019) is provided in (Chami et al., 2020), which is a distance-based measure to estimate the tree-likeness of graphs. A lower ξ G corresponds to a more tree-like graph.
WN18RR. WN18RR (Bordes et al., 2013) is a knowledge graph dataset created from WN18, which is a subset of WordNet (Miller, 1995). Word-Net is a large lexical database with hypernymy relation, so WN18RR inherits the underlying hierarchical structure.
FB15k-237. FB15k-237 (Toutanova and Chen, 2015) is a knowledge graph dataset created from FB15k, which is derived from Freebase. Compared with WN18RR, FB15k-237 has much more relations and various relation properties, resulting in a more flexible structure, which can be reflected by the larger ξ G .
We follow the train-valid-test data splitting of previous works (Chami et al., 2020;Wang et al., 2021), where # train-valid-test triplets are 86, 134 for WN18RR and 272,466 for FB15k-237. The data can be obtained in the public repository of (Chami et al., 2020). 3

Training and Evaluation
For the baselines, we either take the results from the original papers (Chami et al., 2020;Wang et al., 2021) (Table 2) or use their released best hyperparameters as well as their open-source codes to train their models (Table 3, 4, and 5). For our approaches, we tune the hyperparameters by grid search on each validation set in 32-dimension complex hyperbolic space, which are given in Appendix A. Our embedding models are trained by optimizing the full cross-entropy loss with uniform negative sampling. We conduct all the experiments on four NVIDIA GTX 1080Ti GPUs with 11GB memory each.
We use the mean reciprocal rank (MRR) and the proportion of correct types that rank no larger than N (Hits@N) as our evaluation metrics, which are widely used for evaluating link prediction. We follow the filtered evaluation setting (Bordes et al., 2013) to filter out the true triplets during evaluation. In all experiments, each running is executed five times and the mean values of results are reported. Table 2 presents the results in 32-dimension embedding spaces. We strictly follow the experimental setting and data splitting of the previous works (Chami et al., 2020;Wang et al., 2021). The results of the baselines are taken from the original papers, where RotL and Rot2L do not report the Hits@3 scores, thus we leave them blank.   The results show that our Fourier transformbased complex hyperbolic approaches have the best performance on the link prediction task, demonstrating the powerful representation capacity of the complex hyperbolic geometry and the effectiveness of Fourier transform. Specifically, FFTRotH achieves the best results on WN18RR, while FF-TAttH outperforms other methods on FB15k-237. The relations in WN18RR typically have transitivity property, in which case the hyperbolic rotation takes more advantages. FB15k-237 is a more challenging link prediction dataset since it has more relations and varying structures as well as a larger scale of triplets. Therefore, the attention mechanism helps to generalize the hyperbolic transformations to multiple relation properties.

Overall Results
From Table 2, we see that the traditional complex Euclidean models  do not have competitive performance with the hyperbolic KG embedding models or their Euclidean analogues. The hyperbolic methods (MuRP, RefH, RotH, and AttH) have better results than their Euclidean analogues (MuRE, RefE, RotE, and AttE), revealing the improvements of the hyperbolic geometry over Euclidean geometry in lowdimensional KG representation. RotL replaced the Möbius addition of RotH with a new flexible addition operation, while Rot2L further utilizes two stacked rotation-translation layers in the Euclidean space. The two Euclidean-based methods outperform their base model RotH by adapting a lightweight architecture. However, they still cannot achieve as promising results as the complex hyperbolic embedding approaches.

Exploring the Relations
In Section 5.2, we see that the overall results of Fourier transform-based complex hyperbolic methods surpass their corresponding hyperbolic methods. Here we explore their performance on each relation of WN18RR. For each relation, we give their statistics of Krackhardt hierarchy score (Khs G ) (Balazevic et al., 2019) and estimated graph curvature ξ G (Chami et al., 2019). Higher Khs G and lower ξ G mean more tree-like, i.e., the relation is more transitive. We report the Hits@10 scores in Table 3.
We find that for most relations, FFT complex hyperbolic methods outperform hyperbolic methods significantly. For the transitive relations such as member meronym, hypernym, has part, etc, rotation has much better results than reflection. This phenomenon is consistent with the analysis of previous work (Chami et al., 2020), where they found hyperbolic rotations work better on anti-symmetric relations while hyperbolic reflections encode symmetric relations better. Transitivity fulfills anti-symmetry naturally, so rotation gains higher scores (RotH>RefH, FFTRotH>FFTRefH). For the symmetric relation such as also see, reflection outperforms rotation (RefH>RotH, FFTRefH>FFTRotH). Since most relations in WN18RR exhibit transitivity, the rota-tion models have better performance than the reflection models in overall results ( Table 2). Regardless of the relation properties, our approaches improve the corresponding hyperbolic methods largely, except for the relations with few test triplets such as similar to and verb group, where they all have close-to-1 Hits@10 results.

Exploring the Embedding Dimensions
In this section, we explore the performance of Fourier transform-based complex hyperbolic approaches and the corresponding hyperbolic methods in various embedding dimensions. The results are presented in Table 4 and 5. We find that when the embedding dimension is small, the complex hyperbolic approaches outperform the hyperbolic base models by a large margin. Remarkably, FFTRotH improves over RotH by around 100% in 8-dimension on WN18RR. With the increase of the embedding dimension, their predictions get more and more similar and gradually converge. The results reveal the effectiveness of our approaches especially in small dimensions, demonstrating the strong representation capacity of complex hyperbolic geometry.

Conclusion and Future Work
In this work, we explore the complex hyperbolic geometry for multi-relational KG embeddings. The whole framework utilizes the Fourier transform as the efficient conversion between geometric spaces. With the aid of the Fourier transform, the complex hyperbolic embeddings can be transformed into the real domain and be capable of applying real hyperbolic transformations, which enables our approach to take the advantages of both the powerful complex hyperbolic geometry and the attention-based real hyperbolic transformations. Experiments show that the Fourier transform-based complex hyperbolic embedding models can effectively learn the KG embeddings and outperform the baseline models of other spaces in the link prediction task. We believe our proposed approach not only provides a novel and interesting representation learning framework for KGs but also potentially inspires the learning algorithms for more general multi-relational data and contributes to improvements on more downstream tasks.

Limitations
Limited improvements in high dimensions. Although our approaches can significantly outperform the baselines in low-dimensional KG embedding setting, we find that our approaches would get converge and have close results with the hyperbolic base models in sufficiently high dimensions. For example, in Table 4, FFTRotH and RotH have the same results in 64-dimension embedding spaces on WN18RR.
This issue has been observed previously (Nickel and Kiela, 2017;Chami et al., 2020), though their comparisons are established between hyperbolic space and Euclidean space. The representation capacity gap between geometric spaces is distinctly revealed in low dimensions. The gap may get eliminated to some extent by increasing the dimension. The complex hyperbolic geometry and hyperbolic geometry usually converge their results in much lower dimensions than Euclidean geometry because of the exponential growth property, resulting in the limited improvements in high dimensions.