Complex Query Answering with Neural Link Predictors

Erik Arakelyan, Daniel Daza, Pasquale Minervini, Michael Cochez

TL;DR

Instead of training massive "black-box" models on millions of complex logical queries, this paper demonstrates that we can answer them by simply re-using pre-trained neural link predictors. By treating a complex query as an optimization problem over "fuzzy" logic operations, the authors achieve state-of-the-art results with orders of magnitude less training data.

The Challenge of Complex Queries in Knowledge Graphs

Knowledge Graphs (KGs) like Freebase or Google’s Knowledge Graph are massive networks of facts (e.g., Martin Lawrence $\xrightarrow{perform}$ Bad Boys). However, they are notoriously incomplete. While standard "neural link predictors" are great at guessing a single missing edge, they struggle with complex queries—questions that involve multiple steps of reasoning, logical "AND" ($\wedge$), "OR" ($\vee$), and "there exists" ($\exists$) operations.

Examples of complex logical queries on Knowledge Graphs, translating natural language questions into logical formulas and graph structures.

For example, consider the query: "Which drugs interact with proteins associated with diseases $t_1$ or $t_2$?"

Previous state-of-the-art methods attempted to solve this by training specialized neural architectures on millions of generated complex queries. This approach is computationally expensive and often fails to generalize to query structures the model never saw during training.

Methods: Continuous Query Decomposition (CQD)

The authors propose Continuous Query Decomposition (CQD). The core idea is to break a complex query down into its atomic parts (single edges) and use a pre-trained link predictor (like ComplEx) to score each part individually.

  1. Logical to Mathematical Translation: They use t-norms and t-conorms—mathematical functions that act as continuous relaxations of logical "AND" and "OR." This translates a rigid logical formula into a differentiable scoring function.
  2. Optimization Strategies: To find the best answer (the entity that maximizes the overall query score), they propose two distinct methods:
  3. CQD-CO (Continuous Optimization): This method treats the unknown variables in the query as vectors in an embedding space and uses gradient descent (Adam) to find the "location" of the best answer.
  4. CQD-Beam (Combinatorial Optimization): A "beam search" approach that greedily picks the top-$k$ most likely discrete entities at each step of the query chain.

The beauty of this approach is that the underlying link predictor is trained only on simple 1-hop facts. The complex "reasoning" happens entirely at inference time through optimization.

Datasets and Baselines

The researchers evaluated their framework on three standard Knowledge Graph benchmarks:

  • FB15k: A subset of Freebase containing general factual knowledge.
  • FB15k-237: A harder version of FB15k with redundant inverse relations removed.
  • NELL995: Data from the "Never-Ending Language Learning" system.

They compared CQD against major baselines like GQE (Graph Query Embedding) and Query2Box, using the same query structures (chains, intersections, and unions) established in previous literature.

Key Insights

  • Zero-Shot Generalization: Unlike previous models, CQD doesn't need to see complex queries during training. It learns from simple facts and successfully generalizes to complex structures up to 8 hops deep.
  • The Power of Beam Search: Surprisingly, the combinatorial beam search (CQD-Beam) consistently outperformed the gradient-based continuous optimization (CQD-CO). This suggests that searching over discrete, known entities is more robust than navigating the high-dimensional, continuous embedding "void."
  • Built-In Explainability: Because the model explicitly decomposes the query, users can inspect the intermediate scores. If the model answers a question about "actors in Oscar-winning movies," you can check which specific movies and actors it identified as intermediate steps to verify its "thought process."

Key Results

  • Superior Accuracy: CQD-Beam outperformed state-of-the-art models like Query2Box across almost all query types. On FB15k, it achieved a Hits@3 of 0.680, compared to Query2Box's 0.484.
  • Data Efficiency: The model achieves these results using orders of magnitude less training data—it only requires the original KG triples, rather than millions of synthetically generated training queries.
  • Relative Improvements: The authors reported relative improvements in Hits@3 ranging from 8% to 40% across different KGs.
  • Inference Speed: Despite being an optimization-based method at inference time, CQD-Beam is fast, requiring less than 50ms to answer most queries.

Limitations and Future Work

  • Link Predictor Dependency: The performance of CQD is strictly capped by the quality of the underlying link predictor. If the base model (e.g., ComplEx) cannot accurately model a specific relation, the complex query relying on it will fail.
  • Search Complexity: While beam search is efficient for the tested queries, extremely long or highly branched queries might lead to a "branching factor" explosion, requiring more sophisticated pruning strategies in the future.
  • Negation: The current framework focuses on "Existential Positive" queries (AND, OR, EXISTS). It does not yet handle logical negation ("NOT"), which remains a challenging frontier for embedding-based reasoning.

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