Knowledge graph (KG) representation learning techniques that learn continuous embeddings of entities and relations in the KG have become popular in many AI applications. With a large KG, the embeddings consume a large amount of storage and memory. This is problematic and prohibits the deployment of these techniques in many real world settings. Thus, we propose an approach that compresses the KG embedding layer by representing each entity in the KG as a vector of discrete codes and then composes the embeddings from these codes. The approach can be trained end-to-end with simple modifications to any existing KG embedding technique. We evaluate the approach on various standard KG embedding evaluations and show that it achieves 50-1000x compression of embeddings with a minor loss in performance. The compressed embeddings also retain the ability to perform various reasoning tasks such as KG inference. Knowledge graphs (KGs) are a popular way of storing world knowledge, lending support to a number of AI applications such as search (Singhal, 2012), question answering (Lopez et al., 2013; Berant et al., 2013) and dialog systems (He et al., 2017; Young et al., 2018). Typical KGs are huge, consisting of millions of entities and relations. With the growth in use of KGs, researchers have explored ways to learn better representations of KGs in order to improve generalization and robustness in downstream tasks. In particular, there has been interest in learning embeddings of KGs in continuous vector spaces (Bordes et al., 2011, 2013; Socher et al., 2013). KG embedding approaches represent entities as learnable continuous vectors while each relation is modeled as an operation in the same space such as translation, projection, etc. (Bordes et al., 2013; Wang et al., 2014; Lin et al., 2015; Ji et al., 2015). These approaches give us a way to perform reasoning in KGs with simple numerical computation in continuous spaces. Despite the simplicity and wide-applicability of KG embedding approaches, they have a few key issues. A major issue is that the number of embedding parameters grow linearly with the number of entities. This is challenging when we have millions or billions of entities in the KG, especially when there are a lot of sparse entities or relations in the KG. There is a clear redundancy in the continuous parameterization of embeddings given that many entities are actually similar to each other. This over-parameterization can lead to a drop in performance due to overfitting in downstream models. The large memory requirement of continuous representations also prevents models that rely on them from being deployed on modest user-facing computing devices such as mobile phones. To address this issue, we propose a coding scheme that replaces the traditional KG embedding layer by representing each entity in the KG with a K -way D dimensional code (KD code) (van den Oord et al., 2017; Chen et al., 2018; Chen and Sun, 2019). Each entity in the KG is represented as a sequence of D codes where each code can take values in { 1 . . . K } . The codes for each entity are learnt in such a way that they capture the semantics and the relational structure of the KG  i.e., the codes that represent similar or related entities are typically also similar 1 . The coding scheme is much more compact than traditional KG embedding schemes. We learn the discrete codes for entities using an autoencoder style model which learns a discretization function that maps continuous entity representations to discrete codes and a reverse-discretization function that maps the discrete codes 1 For example, Barack Obama = 2-1-3-3 and Michelle Obama = 2-1-3-2 (for D = 4 and K = 3 ) back to continuous entity representations. The discretization and reverse-discretization functions are jointly learnt end-to-end. The inherent discreteness of the representation learning problem poses several learning issues. We tackle these issues by resorting to the straight-through estimator (Bengio et al., 2013) or the tempering softmax (Maddison et al., 2016; Jang et al., 2016) and using guidance from existing KG embeddings to smoothly guide learning of the discrete representations. We evaluate our approach on various standard KG embedding evaluations and we find that we can massively reduce the size of the KG embedding layer while suffering only a minimal loss in performance (if at all). We show that the proposed approach for learning discrete KG representations leads to a good performance in the task of link prediction (cloze entity prediction) as well as in the task of KG reasoning and inference. A knowledge graph (KG) G  E  R  E can be formalized as a set of triplets ( e i , r, e j ) composed of head and tail entities e i and e j ( e i , e j  E , E being the set of entities) and a relation r  R ( R being the set of relations)  n e = |E| , n r = |R| . The goal of learning KG embeddings is to learn vector embeddings e  R d e for each entity e  E (and possibly also relation embeddings r  R d r ). Typical KG embedding approaches are multilayer neural networks which consist of an embedding component and a scoring component. The embedding component maps each entity to its corresponding embedding. The scoring component learns a scoring function f : E  R  E  R where f ( e i , r, e j ) defines the score of the triplet ( e i , r, e j ) . KG embeddings are learnt by defining a loss function L and solving the following optimization problem: min  (cid:88) ( e i ,r,e j ) G L  ( e i , r, e j ) (1) Here  includes all embedding parameters and any other neural network parameters. The loss function typically encourages the score of a positive triplet ( e i , r, e j ) to be higher than that of a (corrupted) negative triplet. In Table 1, we summarize the scoring function for several existing KG embedding approaches as well as their corresponding entity (and relation) representation parameters. In all the KG embedding models, the number of parameters grow super-linearly with the number of entities and relations in the KG as well as the size of their representations. This number can be very large and learning KG embeddings can be a challenge for large, sparse KGs. In this paper, we present a novel coding scheme that significantly reduces the number of embedding parameters. We do so by leveraging recent advances in discrete representation learning. We summarize them below. Typical deep learning methods define an embedding function as F : V  R d , where V denotes the vocabulary such as words, sub-words, entities, relations, etc. and each symbol in the vocabulary is mapped to a continuous vector in R d . The embedding function can be trained separate from the task in a completely unsupervised manner or jointly with other neural net parameters to optimize the target loss function. A common specification of the embedding function in NLP is a lookup table L  R n  d with n = |V| . The total number of bits used to represent this table is O ( nd ) ( 32 nd if each real number is represented by 32-bit floating point). This is problematic for large n and/or d . Thus, various approaches have been proposed to compress embedding layers in neural networks. These include weight-tying (Press and Wolf, 2016; Inan et al., 2016; Li et al., 2018), matrix-factorization based approaches (Acharya et al., 2019), and approaches that rely on gumbel softmax (Baevski and Auli, 2018), vector quantization (Chen and Sun, 2019) and codebook learning (Shu and Nakayama, 2017). In this work, we build on discrete representation learning approaches (van den Oord et al., 2017; Chen et al., 2018; Chen and Sun, 2019). Discrete representation learning gives us a way to mitigate this issue by representing each symbol v in the vocabulary as a discrete vector z v = [ z (1) v , . . . z ( D ) v ] . Discrete representations have another clear benefit that they are interpretable and are a natural fit for complex reasoning, planning and predictive learning tasks. Learning discrete representations is challenging due to the inherent non-differentiability in the embedding layer. Thus, a number of solutions such as the gumbel softmax trick (Maddison et al., 2016; Jang et al., 2016) and the straight-through estimator (Bengio et al., 2013) have been proposed to tackle this issue. Making the discrete representation learn-KG Embedding Model Scoring function f # Ent. ing process differentiable enables end-to-end learning of discrete representations via optimizing some task-specific objectives from language modelling and machine translation. In this work, we use discrete representation learning to compress KG embeddings. We describe it below. In order to learn discrete KG representations, we define a quantization function Q : R d  R d , which (during training) takes raw KG embeddings and produces their quantized representations. Q = D  R is composed of two functions: 1. A discretization function D : R d e  ZD that maps the continuous KG embedding into a K -way D -dimensional discrete code with cardinality | Z | = K (we call this KD code) 2. A reverse-discretization function R : ZD  R d e that maps the KD code back to the continuous embedding. During training, both D and R are learned. Then, every entity in the KG is represented by a KD code via applying the discretization function D to save space (compression). The continuous embeddings and the parameters of the discretization function are then no longer needed. In the test/inference stage, the reverse-discretization function R is used to decode the KD codes into regular embedding vectors for every entity. We use vector quantization (Chen et al., 2018; Chen and Sun, 2019) and codebook learning (Cai et al., 2010) to define the discretization and reverse-discretization functions D and R . We describe them below. The goal of the discretization function is to map continuous KG embedding vectors into KD codes. We model the discretization function using nearest neighbor search (Cayton, 2008). Given continuous KG embeddings { e i | i = 1 . . . n e } as query vectors, we define a set of K key vectors { k k | k = 1 . . . K } where k k  R d e . In order to learn D -dimensional discrete codes, we partition the query and key vectors into D partitions where each partition corresponds to one of the D discrete codes  e ( j ) i  R n  d e /D and k ( j ) k  RK  d e /D , j = 1 . . . D . Vector Quantization (VQ): Our first alternative for discretization is vector-quantization (Ballard, 1997), a classical quantization technique for data compression. We assume that the j th discrete code of the i th entity z ( j ) i can be computed by calculating distances between the corresponding query vector partition e ( j ) i and various corresponding key vector partitions { k ( j ) k } , and choosing the one with the minimum distance: z ( j ) i = arg min k dist (cid:16) e ( j ) i , k ( j ) k (cid:17) (2) We use the Euclidean distance function: dist ( a , b ) = || a  b || 22 in our experiments. Note that the argmin operation is inherently nondifferentiable. The resulting quantization function Q has no gradient towards the input query vectors. Thus, we use the straight-through estimator (Ben-gio et al., 2013) to compute a pseudo gradient. This means that during the forward pass, we compute Q as defined here, but during the backward pass, we use the gradient of the query vectors. Tempering Softmax (TS): Vector quantization is a popular method for learning discrete representations. Yet another popular approach is continuous relaxation of (2) via the tempering softmax (Maddi-son et al., 2016; Jang et al., 2016). We again use dot product and softmax for computing the proximity between query and key vectors: z ( j ) i = arg max k exp (cid:16) (cid:104) e ( j ) i , k ( j ) k (cid:105) / (cid:17) (cid:80) k (cid:48) exp (cid:16) (cid:104) e ( j ) i , k ( j ) k (cid:48) (cid:105) / (cid:17) Here,  is the temperature and (cid:104) a , b (cid:105) = a T b denotes the dot product operation. Note that this function still carries an inherent non-differentiability. Hence, we relax the above and compute probability vectors  z ( j ) i which represent the probability distribution of the j th dimension of the discrete code for the i th entity taking a particular value (say k ). Given probabilistic vectors  z ( j ) i , we can compute the discrete codes z ( j ) i simply by taking the argmax. To compute discrete KD codes, we set a small value of  . As   0 , the softmax becomes spiky concentrated on the true z ( j ) i -th dimension. We again estimate pseudo gradients by setting a very small  in the forward pass (i.e. close to the discrete case (eq. 1)) and  = 1 in the backward pass. The goal of the reverse-discretization function is to map discrete KD codes into continuous KG embedding vectors. We model the reverse-discretization process first by a simple linear model which maps the discrete codes to continuous vectors by looking up a learnt codebook. Then, we present an alternative  a non-linear model for reverse-discretization based on recurrent neural networks. Codebook Lookup (CL): We first define the reverse-discretization function in a simple manner where we substitute every discrete code with a continuous vector from a codebook. Let C be a set of codebooks. C consists of a number of codebooks  a separate codebook C ( j ) for each position j = 1 . . . D in the KD code. We model each codebook simply as a set of vectors: C ( j ) = { c ( j ) i | i = 1 . . . K } where c ( j ) i  R d e /D . We simply compute the embedding vector for the j th dimension of the i th entity as: e ( j ) i = c ( j ) i The final entity embedding vector e i is achieved by the concatenation of the embedding vectors for each dimension: e i = [ e (1) i . . . e ( D ) i ] . Non-linear Reconstruction (NL): While the codebook lookup approach is simple and efficient, due to its linear nature, the capacity of the generated KG embedding may be limited. Thus, we also employ neural network based non-linear approaches for embedding reconstruction. We propose a non-linear embedding reconstruction approach based on the Bi-LSTM network. Given the KD code z i as a sequence of codes z (1) i , . . . , z ( D ) i , we map the KD code to a continuous embedding vector by feeding the code to a Bi-LSTM followed by mean pooling. Let ( h (1) i , . . . , h ( D ) i ) = Bi-LSTM (cid:16) z (1) i , . . . , z ( D ) i (cid:17) be the hidden state representations for the various Bi-LSTM cells. Finally, we reconstruct the entity embedding  e i by mean-pooling the code embedding vectors followed by a linear transformation: e i = W Trev (cid:16)(cid:80) j h ( j ) i (cid:17) . We also tried to map the KD code to a continuous embedding vector by feeding the code to variations of a character level CNN (Kim et al., 2016). However, the Char CNN model always performed worse than the Bi-LSTM model in our experiments. This was because our discretization function which discretizes contiguous partitions of the continuous representation better suits the Bi-LSTM reconstruction model. In the future, we would like to consider more complex discretization functions with other complex non-linear reconstruction models. Storage Efficiency: A key motivation of learning discrete representations is that we can significantly compress the embedding layer at test time. The size of the embedding layer for typical KG representations is 32 n e d e (assuming a 32 bit representation)  this can be very large. In contrast, with discrete representation learning, we only need to store code embeddings { z i } and the parameters used in the reverse-discretization function such as the codebooks C or the parameters of the embedding reconstruction Bi-LSTM {  LSTM , W rev } . The entity codes require n e D log 2 K bits. The codebook lookup approach needs to also maintain codebooks which require 32 Kd e parameters and the non-linear reconstruction approach requires Dd (cid:48)  6 parameters (two set of parameter matrices each for the input, output and forget gates) for the Bi-LSTM and d e d (cid:48) parameters for storing W rev  a total of (6 D + d e ) d (cid:48) parameters. Here, d (cid:48) is the size of the code embedding vectors. In both codebook lookup and non-linear reconstruction formulations, discrete representation learning neatly decouples the KG size (number of entities) and dimensionality of the continuous embeddings. Thus, the discrete embedding layer can be compactly stored as typically D and log 2 K are smaller than 32 d e (considering only the dominating term n e ). Test Time Inference of Embeddings: At test time, we retrieve continuous embeddings for an entity by looking up the codebook or running inference on the reconstruction model using its discrete representation. For codebook lookup, the steps involved are (a) looking up a simple index for each code, and (b) concatenation. Since only index lookups and concatenation are needed, the extra computation complexity and memory footprint are very small O ( D ) time and memory. In the nonlinear reconstruction setting, we need to run inference on the Bi-LSTM model. This requires O ( D ) matrix vector multiplications (to compute various LSTM gates) which takes O ( Dd e d (cid:48) ) time. Finally, we have another linear transformation W rev  this takes O ( d e d (cid:48) ) time. We can further cache the embedding lookups and various intermediate results such as matrix vector products to improve performance. We show in our results that the test time inference overhead is typically very small. Learning: Similar to previous continuous KG representation learning methods, we learn discrete entity representations by minimizing the triplet loss function. We extend equation 1 as: min { z e } ,,  (cid:88) ( e i ,r,e j ) G L { z e } ,,  ( e i , r, e j | , ) (3) Here, z e are code embeddings,  are the parameters of the reverse-discretization function ( C or {  LSTM , W rev } ) and  denotes parameters of the KG embedding approaches (listed in Table 1). The aforementioned loss function (eq 3) is differentiable w.r.t. the embedding parameters and parameters of entity representation learning methods. However, the discrete codes introduce a non-differentiability. Thus, we use straight-through (Bengio et al., 2013) or the tempering softmax (Maddison et al., 2016; Jang et al., 2016) to estimate pseudo-gradients as described before (section 3.1). Guidance from KG embeddings: We find that even with sophisticated discrete representation learning methods, solving the above optimization problem can be challenging in practice. Due to discreteness of the problem, this can lead to a suboptimal solution where discrete codes are not as good. Therefore, we also use guidance from continuous KG embeddings to solve (3) when provided 2 . The key idea is that in addition to optimizing (3), we can encourage the reconstructed embeddings from the learnt discrete codes to mimic continuous embeddings. In order to provide this guidance from continuous embeddings, during the training, instead of using the reconstructed embedding vector generated from the discrete code, we use a weighted average of the reconstructed embeddings and continuous embeddings obtained using methods described in Table 1: (1   ) D  R ( e ) +  e . Here   (0 , 1) is a linear interpolant for selecting between reconstructed embeddings and pre-learnt continuous embeddings. We initialize  to 1 and gradually decrease  as training proceeds. This enables the method to gradually rely more and more on reconstruction from discrete embeddings. We also add a regularization term ||D  R ( e )  e || 22 during the training to encourage the reconstructed embeddings to match the pre-learnt continuous embeddings. This procedure is similar to knowledge-distillation guidance (Hinton et al., 2015) in previous discrete representation learning works (Chen et al., 2018). Here   (0 , 1) is a linear interpolant for selecting between reconstructed embeddings and pre-learnt continuous embeddings. We initialize  to 1 and gradually decrease  as training proceeds. This enables the method to gradually rely more and more on reconstruction from discrete embeddings. We also add a regularization term ||D R ( e )  e || 22 during the training to encourage the reconstructed embeddings to match the pre-learnt continuous em-2 We show in our experiments that this guidance, while helpful, is not always needed. We compare the baseline continuous representations described earlier in Table 1 with four discrete representation learning techniques described in this paper: VQ-CL: D = VQ and R = CL  VQ-NL: D = VQ and R = NL  TS-CL: D = TS and R = CL  TS-NL: D = TS and R = NL We evaluate our approach on four standard link prediction datasets: FB15k (Bordes et al., 2013) is a subset of Freebase. FB15k-237 (Toutanova et al., 2015) is a subset of the FB15k dataset created by removing inverse relations that cause test leakage. WN18 (Bordes et al., 2013) is a subset of WordNet. WN18RR (Dettmers et al., 2018) is a subset of the WN18 dataset created by removing inverse relations. We summarize all the data statistics in Table 2. We also use the Countries dataset (Bouchard et al., 2015) for some in-depth analysis of inference abilities of discrete representations. We implement discrete KG representation learning by extending OpenKE (Han et al., 2018), an open-source framework for learning KG embeddings implemented on PyTorch 3 . We train and test all our models on a single 2080Ti system. We set K = 32 and D = 10 in our experiments unless stated otherwise. For the linear embedding transformation function in the non-linear reconstruction approach, we use a hidden layer of 100 hidden units. We 3 https://github.com/thunlp/OpenKE set  as  = 1  t at the t th epoch. We tune the regularization coefficient using grid search on the validation set. Link Prediction: We learn discrete representations corresponding to various continuous KG representations (described in Table 1) and compare the obtained discrete representations with their continuous counterparts. We use the same hyper-parameter settings as in the original KG embedding papers. We generate n e candidate triples for each test triple by combining the test entity-relation pair with all possible entities E . We use the filtered setting (Bor-des et al., 2013), i.e. all known true triples are removed from the candidate set except for the current test triple. We use standard evaluation metrics previously used in the literature: mean reciprocal rank (MRR) and hits@10 (H@10). Mean reciprocal rank is the average of the inverse of the mean rank assigned to the true triple over all candidate triples. Hits@10 measures the percentage of times a true triple is ranked within the top 10 candidate triples. In addition, in order to report the compression efficiency of the discrete representations, we also report the compression ratio which is computed as follows: CR = Storage(continuous) Storage(discrete) Here, Storage(continuous) is the storage used to store full continuous KG representations. Stor-age(discrete) is the storage used in the discrete representation learning method (during the testing stage). This includes discrete KG representations as well as parameters of the reverse-discretization function (i.e. codebook or Bi-LSTM parameters). Tables 3, 4, 5 and 6 show our results on the link prediction task on the four datasets respectively. In Table 3, we compare various continuous representations with the four discrete representation learning techniques described in this paper. We find that the discrete representations sustain only minor losses in performance (and are sometimes actually better than their continuous counterparts) in terms of both evaluation metrics: MRR and H@10, while being able to obtain significant embedding compression (42x-585x). Table 3 also compares the different discrete representation learning approaches. We observe that TS-NL which uses tempering softmax and non-linear reconstruction performs the best in most of the settings. This observation was also Continuous CR VQ-CL TS-CL CR VQ-NL TS-NL MRR H@10 (CL) MRR H@10 MRR H@10 (NL) MRR H@10 MRR H@10 TransE 0.463 0.749 46.3 0.462 0.748 0.467 0.749 42.6 0.463 0.746 0.477 0.755 DistMult 0.798 0.893 77.6 0.750 0.859 0.775 0.864 71.4 0.756 0.868 0.790 0.882 HolE 0.524 0.739 112.6 0.515 0.708 0.517 0.711 103.8 0.517 0.717 0.525 0.726 ComplEx 0.692 0.840 262.3 0.651 0.802 0.653 0.814 228.4 0.670 0.818 0.678 0.833 ConvE 0.657 0.831 77.6 0.618 0.774 0.620 0.798 71.4 0.626 0.793 0.644 0.820 RotatE 0.797 0.884 585.3 0.765 0.840 0.782 0.876 495.2 0.789 0.878 0.798 0.881 HypER 0.790 0.734 177.5 0.743 0.706 0.754 0.715 161.1 0.758 0.718 0.763 0.726 TuckER 0.795 0.741 177.5 0.773 0.714 0.782 0.729 161.1 0.787 0.723 0.783 0.726 Table 3: Results of several models and our proposed discrete counterparts evaluated on the FB15K dataset Continuous Discrete (TS-NL) MRR H@10 CR MRR H@10 TransE 0.495 0.943 103.3 0.499 0.940 DistMult 0.797 0.946 143.2 0.774 0.921 HolE 0.938 0.949 228.6 0.938 0.929 ComplEx 0.941 0.947 437.1 0.934 0.936 ConvE 0.943 0.956 143.2 0.933 0.936 RotatE 0.949 0.959 952.6 0.946 0.952 HypER 0.951 0.947 327.9 0.946 0.942 TuckER 0.953 0.949 327.9 0.924 0.920 Table 4: Results of several models and our proposed discrete counterpart (TS-NL) evaluated on the WN18 dataset Continuous Discrete (TS-NL) MRR H@10 CR MRR H@10 TransE 0.294 0.465 43.1 0.298 0.463 DistMult 0.241 0.419 71.8 0.241 0.422 HolE 0.318 0.430 104.0 0.316 0.428 ComplEx 0.247 0.428 228.5 0.238 0.411 ConvE 0.325 0.501 71.8 0.321 0.488 RotatE 0.338 0.533 495.2 0.336 0.528 HypER 0.341 0.252 161.3 0.332 0.286 TuckER 0.358 0.266 161.3 0.331 0.279 Table 5: Results of several models and our proposed discrete counterpart (TS-NL) evaluated on the FB15K-237 dataset. made on the other three datasets. Hence, in Tables 4, 5 and 6, we only compare TS-NL with the continuous representations. We again observe that TS-NL compresses the KG embeddings (71x-952x) while suffering only a minor loss in performance. Logical Inference with Discrete representations: KG embeddings give us a way to perform logical inference and reason about knowledge. In this experiment, we explore if discrete representations retain the ability to perform inference and reasoning in KGs. We evaluate our models on the countries dataset (Bouchard et al., 2015) which was designed to test the logical inference capabilities of KG embedding models. We use the same evaluation protocol as in (Nickel et al., 2016) for our Continuous Discrete (TS-NL) MRR H@10 CR MRR H@10 TransE 0.226 0.501 105.2 0.230 0.498 DistMult 0.430 0.490 143.8 0.423 0.476 HolE 0.338 0.438 228.8 0.346 0.435 ComplEx 0.440 0.510 437.2 0.433 0.494 ConvE 0.430 0.520 143.8 0.431 0.500 RotatE 0.476 0.571 952.6 0.452 0.546 HypER 0.465 0.436 328.0 0.460 0.437 TuckER 0.470 0.443 328.0 0.452 0.442 Table 6: Results of several models and our proposed discrete counterpart (TS-NL) evaluated on the WN18RR dataset experiments. The countries dataset contains 2 relations and 272 entities (244 countries, 5 regions and 23 subregions) and 3 tasks are posed, requiring subsequently longer and harder inference than the previous one: 1. Task S1 poses queries of the form locatedIn(c; ?), and the answer is one of the five regions. 2. Task S2 poses queries of the form neighbo-rOf(c1; c2)  locatedIn(c2; r) =  locate-dIn(c1; r) 3. Task S3 poses queries of the form neighbo-rOf(c1; c2)  locatedIn(c2; s)  locatedIn(s; r) =  locatedIn(c1; r): We use the AUC-PR metric, which was also used in previous works (Bouchard et al., 2015; Nickel et al., 2016). Table 7 shows our results. We find that TS-NL is a very good KG representation for KG inference. Infact, we find that TS-NL outperforms many of their continuous counterparts. Additional Inference Cost: A tradeoff in learning discrete KG representations is that the inference time increases as we need to decompress discrete representations into continuous embeddings for every entity before using them by looking up the S1 S2 S3 Ct. codebook or running inference on the LSTM reconstruction model. In practice, we found that this additional inference cost was very small. For example, the additional inference cost of running TransE on the entire FB15K test set was  1 minute for codebook lookup and  2 . 5 minutes for non-linear reconstruction approach on our single 2080Ti system. The additional inference cost for the other continuous KG representations were similarly low. Varying K and D : There is an evident tradeoff between the extent of compression (which is dictated by the choice of K and D) and model performance. In order to explore this tradeoff, we plot heatmaps of performance (MRR) and compression ratio (CR) on the FB15K test set as we vary K and D for TransE in Figure 1. Not surprisingly, the performance drops as the compression increases. Plotting these heat maps would allow the end user to pick K and D depending on their tolerance to loss in performance. Dependence on guidance from continuous embeddings: We evaluate the contribution of the guidance from continuous embeddings in learning discrete KG representations. Figure 2 compares the test MRR for TS-NL as training proceeds on the FB-15K dataset when we do or do not have guidance from the continuous representation (TransE). We observe that learning in the unguided model is much slower than the guided model. However, the guided model achieves almost similar performance in the end. Thus, we conclude that while guidance helps us achieve faster and more stable convergence, it is not necessary to learn discrete representations. Quality of the Discrete representations: We also assess the quality of the learnt discrete entity representations directly as features for the link predic-5 10 25 D 2 8 32 128 K 0.451 0.456 0.462 0.465 0.468 0.480 0.473 0.477 0.483 0.477 0.480 0.486 0.455 0.460 0.465 0.470 0.475 0.480 0.485 MRR 5 10 25 D 2 8 32 128 K 440.2 217.7 100.2 148.3 72.4 39.7 82.4 42.6 29.8 51.8 26.6 14.7 50 100 150 200 250 300 350 400 MRR Figure 1: Heatmaps of performance (MRR) and CR for TS-NL on FB15K dataset as we vary K and D  darker is better. tion task. In this case, we only retain the discrete entity representations learnt by TS-NL and learn a new LSTM based non-linear reverse-discretization on the validation set. Then, we obtain the link-prediction performance on the test set as before (see Table 8 for transfer results on the FB15K dataset). We observe that the performance of this transfer model is close to that of the original model which used a pre-trained reverse-discretization model (compare Table 8 with the shaded part of Table 3). Note that, in the transfer setting, we can achieve much higher compression as we do not even need to store the reverse-discretization model. Interpretability of discrete representations: The discrete codes provide us with additional interpretability which continuous representations can lack. In Table 9, we show a sample of learned codes for the two datasets. We observe that semantically similar entities are assigned to close-by codes. Deep learning model compression has attracted many research efforts in the last few years (Han et al., 2015). These efforts include network pruning (Reed, 1993; Castellano et al., 1997), weight sharing (Ullrich et al., 2017), quantization (Lin et al., 2016), low-precision computation (Hwang and Sung, 2014; Courbariaux et al., 2015) and knowledge distillation (Hinton et al., 2015) These techniques can also be used for embedding compression. Press and Wolf (2016) and Inan et al. (2016) propose weight-tying approaches that learn input and output representations jointly. Matrix factorization-based methods (Acharya et al., 2019; Shu and Nakayama, 2017; Li et al., 2018) have also been proposed which approximate an embedding matrix with smaller matrices or clusters. Closest to our work are (Shu and Nakayama, 2017; Chen et al., 2018; Chen and Sun, 2019) who present similar approaches to learn discrete codings for word embeddings using multiple codebooks, i.e. product quantization (Jegou et al., 2010). Similar techniques have used been used by van den Oord et al. (2017) who extend VAEs to learn discrete representations using vector quantization in the image domain. This allows the VAE model to circumvent its well known issues of posterior collapse. All these previous works have been applied to the image domain, and sometimes in language to learn discrete word embeddings. In this work, we present the first results on compressing KG embeddings and also show how the compressed embeddings can be used to support various knowledge based applications such as KG inference. The embedding layer contains majority of the parameters in any representation learning approach on knowledge graphs. This is a barrier in successful deployment of models using knowledge graphs at scale on user-facing computing devices. In this work, we proposed novel and general approaches for KG embedding compression. Our approaches learn to represent entities in a KG as a vector of discrete codes in an end-to-end fashion. At test time, the discrete KG representation can be cheaply and efficiently converted to a dense embedding and then used in any downstream application requiring the use of a knowledge graph. We evaluated our proposed methods on different link prediction and KG inference tasks and show that the proposed methods for KG embedding compression can effectively compress the KG embedding table without suffering any significant loss in performance. In this work, we only considered the problem of learning discrete entity representations. In the future, we would like to jointly learn discrete representations of entities as well as relations. MS would like to thank the anonymous reviewers, along with Karen Livescu, Kevin Gimpel and Shun-ing Jin for their valuable comments and suggestions on this work.
abstain abstain abstain objective abstain result abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain method result objective other abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method method abstain abstain abstain abstain abstain method abstain method method abstain abstain abstain abstain method abstain abstain method method abstain abstain method abstain abstain method method abstain abstain method abstain method method method abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain method abstain method abstain method method method abstain method abstain abstain abstain abstain other abstain abstain abstain method abstain abstain abstain abstain abstain abstain method abstain abstain abstain other abstain abstain method abstain abstain abstain method abstain abstain method abstain method abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain result abstain abstain abstain abstain abstain abstain abstain abstain abstain result abstain result abstain result other abstain abstain result abstain abstain abstain other abstain abstain abstain abstain abstain abstain abstain result result result abstain abstain result abstain abstain abstain abstain abstain abstain abstain abstain result abstain result other abstain abstain result result result abstain result result other other other other method other other other objective abstain abstain objective abstain abstain objective method abstain other