Answering Complex Logical Queries on Knowledge Graphs via Query Computation Tree Optimization
Yushi BaiXin LvJuanzi LiLei Hou
Proposes a forward-backward propagation algorithm over query computation trees to efficiently find exact optimal entity assignments for complex logical queries on incomplete knowledge graphs without requiring complex query training.
Real-world knowledge graphs are widely used to represent structured information, but they frequently suffer from incompleteness, making complex logical query answering difficult. Standard embedding approaches require costly training on millions of complex queries and struggle to generalize to unseen query structures. Recent optimization methods avoid complex query training by utilizing pretrained single-hop link predictors; however, because the combinatorial search space grows exponentially with the number of variables, they rely on heuristic approximations that degrade accuracy and provide limited interpretability for intermediate reasoning steps.
The main objective of the article is to introduce and evaluate Query Computation Tree Optimization (QTO), an optimization-based framework designed to find the exact, theoretically optimal answers to complex first-order logic queries without requiring complex query training.
The evaluated approach represents logical queries as tree-structured computation graphs and leverages structural independence to reduce the search space. QTO executes a forward-propagation pass to compute optimal subquery truth values from leaf entities to the root answer variable, followed by a backward-propagation pass that determines the exact entity assignments for all intermediate variables. The authors evaluated QTO across three benchmark datasets (FB15k, FB15k-237, and NELL995) spanning 14 query types, including existential positive queries and queries with negation, comparing it against established neural and optimization baselines.
The key findings demonstrate significant performance gains and enhanced reasoning capabilities. QTO outperformed the previous state-of-the-art method by an average of 22% overall, with relative gains of 13.5% on existential positive queries, 21.8% on out-of-distribution structures, and 37.5% on queries containing negation. Against optimization-based baselines, QTO achieved an average improvement of 30.8%. Furthermore, QTO provides strong interpretability, correctly assigning intermediate variables with over 90% accuracy for its top-ranked predictions. The framework is also mathematically guaranteed to achieve 100% accuracy on easy queries where reasoning paths exist in the graph, and it significantly reduced error in predicting answer set sizes compared to baseline models.
These results demonstrate that complex reasoning on knowledge bases can be decoupled from query-specific model training. Organizations can deploy existing, high-performing single-hop link predictors directly into multi-hop logical reasoning workflows without extensive retraining. This decoupling lowers computational costs, enhances system transparency through verifiable intermediate reasoning steps, and ensures robust generalization over longer reasoning paths.
Organizations implementing complex graph querying should consider QTO-style tree optimization frameworks to improve query accuracy and interpretability while reducing model retraining pipelines. As next steps, technical teams should explore adaptive calibration techniques for transforming single-hop predictor scores into probabilities and test subgraph decomposition techniques for very large enterprise graphs.
The primary limitations include memory and pre-computation scaling overheads when generating dense adjacency matrices for large-scale graphs, as well as a structural restriction that limits the algorithm to tree-like query topologies, excluding cyclic graph queries or queries with multiple answer variables. Confidence in the reported results is high, supported by rigorous theoretical optimality proofs and consistent empirical outperformance across standard benchmarks.
- Paper: Neural-Symbolic Models for Logical Queries on Knowledge Graphs, Zhaocheng Zhu et al. (2022). Read this earlier neural-symbolic framework for complex knowledge-graph queries to see the query-execution approach that QTO advances beyond with exact tree optimization.
- Paper: Embedding Entities and Relations for Learning and Inference in Knowledge Bases, Bishan Yang et al. (2014). Its unified treatment of knowledge-graph embeddings and link prediction clarifies the single-hop predictors QTO reuses as the basis for complex-query reasoning.
No sufficiently relevant recommendations were found.
