Complex Query Answering with Neural Link Predictors

Erik Arakelyan, Daniel Daza, Pasquale Minervini, Michael Cochez

Abstract

Knowledge Graphs (KGs) are essential for representing structured knowledge but frequently suffer from incompleteness. While neural link predictors are effective at predicting single missing edges, answering complex logical queries involving multiple steps and logical operators remains difficult. We introduce Continuous Query Decomposition (CQD), a framework that answers complex queries by reusing simple, pre-trained link predictors. CQD treats complex query answering as an optimization problem, utilizing fuzzy logic to combine atomic predictions. This method achieves state-of-the-art accuracy with significantly less training data than previous end-to-end models and provides human-readable reasoning paths.

The Challenge of Complex Queries

Knowledge Graphs like DBpedia or Freebase are massive but incomplete. Traditional "Neural Link Predictors" (e.g., ComplEx, DistMult) are designed for simple 1-hop queries, such as "Is drug A associated with protein B?". However, real-world information needs often involve complex, multi-step logical expressions.

Examples of complex logical queries in different domains, showing the natural language question, the formal logical expression, and the corresponding graph structure.

Existing approaches to this "Complex Query Answering" (CQA) problem typically involve training large neural networks on millions of synthetic queries. These "black-box" models learn to embed entire logical expressions into a vector space. While effective, they are computationally expensive, require massive amounts of generated training data, and lack interpretability.

Continuous Query Decomposition (CQD)

CQD shifts the paradigm from supervised learning to optimization. Instead of training a model to answer complex queries directly, CQD decomposes them into atomic steps that a standard link predictor can handle.

1. Atomic Scoring

The framework starts with a pre-trained neural link predictor (like ComplEx) that provides scores for single-hop relations.

2. Fuzzy Logic Integration

To handle logical operators, CQD employs T-Norms from fuzzy logic. Conjunctions ($\wedge$) are mapped to differentiable functions like the product or minimum, while disjunctions ($\vee$) use T-conorms. This transformation allows a complex logical query to be represented as a single mathematical objective function.

3. Optimization Strategies

To identify the entities that best satisfy the query, the authors propose two methods:

  • CQD-CO (Continuous Optimization): Uses gradient-based methods (e.g., Adam) to find a "virtual" entity embedding in the continuous space that maximizes the query score.
  • CQD-Beam (Combinatorial Search): Employs a greedy beam search to traverse the query graph. At each step, it selects the top-$k$ most likely entities based on the link predictor's scores.

Evaluation and Results

The model was benchmarked on three standard KG datasets: FB15k, FB15k-237, and NELL995. The evaluation covered a variety of query structures including projections, intersections, and unions.

Key Findings

  • Zero-Shot Generalization: CQD can answer complex queries "out of the box" without being trained on them. By mastering 1-hop links, it generalizes to 8+ complex structures.
  • Extreme Data Efficiency: On FB15k, CQD outperformed models trained on 65 million synthetic queries using only the original 273k graph edges.
  • Search vs. Gradients: CQD-Beam consistently outperformed CQD-CO, suggesting that discrete search is better suited for the irregular probability landscapes of KGs.
  • Transparency: Unlike embedding-based models, CQD allows researchers to inspect intermediate entities in the reasoning chain, providing a level of explainability.

Performance

CQD-Beam achieved state-of-the-art results, with relative improvements in Hits@3 ranging from 8% to 40% over previous models like GQE and Query2Box. Furthermore, it remains computationally efficient, with an average query response time under 50ms.

Limitations and Future Outlook

While CQD is a significant step forward, it has limitations. The model can occasionally arrive at the correct answer through incorrect intermediate reasoning, inheriting biases from the underlying link predictor. Additionally, the current framework is optimized for "Existential Positive First-Order" queries; extending it to handle logical negation ($\neg$) and extremely large branching factors are key areas for future research.

Summary updated

BibTeX
@inproceedings{arakelyan2022complex,
  author = {Erik Arakelyan and Daniel Daza and Pasquale Minervini and Michael Cochez},
  title = {{Complex Query Answering with Neural Link Predictors}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.24963/ijcai.2022/741},
}
Figure