Q uery2 T riple: Unified Query Encoding for Answering Diverse Complex Queries over Knowledge Graphs (2023)

Abstract: Complex Query Answering (CQA) is a challenge task of Knowledge Graph (KG). Due to the incompleteness of KGs, query embedding (QE) methods have been proposed to encode queries and entities into the same embedding space, and treat logical operators as neural set operators to obtain answers. However, these methods train KG embeddings and neural set operators concurrently on both simple (one-hop) and complex (multi-hop and logical) queries, which causes performance degradation on simple queries and low training efficiency. In this paper, we propose Query to Triple (Q2T), a novel approach that decouples the training for simple and complex queries. Q2T divides the training into two stages: (1) Pre-training the neural link predictor on simple queries to predict tail entities based on the head entity and relation. (2) Training the query encoder on complex queries to encode diverse complex queries into a unified triple form that can be efficiently solved by the pretrained link predictor. Our proposed Q2T is not only efficient to train, but also modular, thus easily adaptable to various neural link predictors that have been studied well. Extensive experiments demonstrate that, even without explicit modeling for neural set operators, Q2T still achieves state-of-the-art performance on diverse complex queries over three public benchmarks.

## introduction knowledge graphs (kgs) organize world knowledge as inter-linked triples which describe entities and their relationships in symbolic form @xcite . complex query answering (cqa), a knowledge reasoning task over kgs, has been proposed in recent years @xcite . compared with simple link prediction, which involves predicting a missing entity in a factual triple @xcite , cqa is more challenging as it requires first-order ## preliminary in this section, we formally introduce knowledge graph (kg). then, we use symbols of kg to define efo-1 query and its corresponding disjunctive normal form (dnf). finally, we introduce neural link predictors. ## q2t: transforming query to triple there are two main components in q2t: (1) the neural link predictor. (2) the query encoder. this section begins with an introduction to the pretraining of neural link predictors. subsequently, we present querygraphormer, a transformer-based model that incorporates structural information, as a query encoder. q2t utilizes the query encoder to encode complex queries, producing representations that are used as inputs in neural link predictors, as depicted in figure 4 . ## experiments in this section, we conduct experiments to demonstrate the effectiveness and efficiency of q2t and the necessity of decoupling the training for simple and complex queries. ## conclusion in this paper, we present q2t to transform diverse complex queries into a unified triple form that can be solved by pretrained neural link predictors. q2t not only decouples the training of complex queries and simple queries from the training perspective, but also decouples kge and the query encoder from the model perspective. the experiments on three datasets demonstrate that q2t can achieve the state-of-the-art performance on almost all positive queries.