A Foundation Model for Zero-shot Logical Query Reasoning

Mikhail Galkin, Jincheng Zhou, Bruno Ribeiro, Jian Tang, Zhaocheng Zhu

TL;DR

ULTRAQUERY is the first foundation model for complex logical query answering that works "zero-shot" on any knowledge graph (KG). By decoupling reasoning logic from specific entity and relation vocabularies, a single model trained on just one dataset can answer complex queries on entirely unseen graphs—outperforming specialized, graph-specific models by an average of 50%.

What Problem Does This Paper Address?

Knowledge Graphs (KGs) like Wikidata or Freebase are massive but notoriously incomplete. Complex Logical Query Answering (CLQA) aims to find answers to multi-step questions involving logical operators (AND, OR, NOT)—for example, "Which US citizens won a Nobel Prize and graduated from a university in Zurich?"

Traditionally, solving this required training a model specifically for a single KG. These models learn "embeddings" (fixed numerical signatures) for every entity and relation. If you move to a new KG with different relations (e.g., moving from a medical database to a music database), the model breaks. Even "inductive" models usually only handle new entities, not new relation types.

ULTRAQUERY enables zero-shot logical reasoning by transferring knowledge from a training graph to an entirely new inference graph with different entities and relations.

This paper tackles the "hardest" inductive setup: answering logical queries on a graph where both the entities and the relations are entirely new at inference time.

Methods

The authors introduce ULTRAQUERY, which treats logical reasoning as a set of vocabulary-independent functions. Its architecture rests on two pillars:

  1. Inductive Relation Projection: Instead of learning what a specific relation like "graduated_from" means, the model uses a backbone called ULTRA. ULTRA represents relations based on their structural interactions (e.g., how often relation A follows relation B) in a "meta-graph." This allows the model to understand the behavior of a new relation without ever having seen its name before.
  2. Non-parametric Logical Operators: Rather than learning neural networks to represent "AND" ($\wedge$) or "OR" ($\vee$), ULTRAQUERY uses fuzzy logic (specifically product t-norms). These are fixed mathematical operations (like element-wise multiplication) that aggregate probabilities across the graph. Because these operators have no learnable parameters, they cannot overfit to a specific graph's vocabulary.

A key technical challenge addressed is the multi-source propagation issue. In simple link prediction, you start from one node. In complex queries, intermediate steps might produce hundreds of candidate nodes with varying probabilities. To handle this "noise," the authors use either a short fine-tuning phase on complex queries or a thresholding technique (ULTRAQUERY LP) to keep the signal sharp.

Datasets

The researchers evaluated ULTRAQUERY on a massive suite of 23 datasets:

  • 3 Transductive: Standard benchmarks like FB15k-237 and NELL995.
  • 9 Inductive (Entity-only): Where relations are known, but entities are new.
  • 11 Inductive (Entity & Relation): The authors curated a new suite called WikiTopics-QA, derived from Wikipedia, featuring entirely disjoint sets of relations across different topics (e.g., Art vs. Science).

Key Insights and Ideas

  • Structural Invariance is Key: The "aha moment" is that logical reasoning in KGs is more about graph topology and relation interactions than the semantic labels of the nodes. If a model understands the "grammar" of how relations interact, it doesn't need to know the "vocabulary."
  • Foundation Models for Graphs: This work moves KG reasoning toward the "foundation model" paradigm seen in NLP. Instead of thousands of tiny models for thousands of KGs, we can have one robust model that generalizes everywhere.
  • Zero-shot beats Supervised: Surprisingly, a single ULTRAQUERY model trained only on the FB15k-237 dataset often outperformed baselines that were trained specifically on the target test graphs. This suggests that learning general reasoning patterns is more powerful than memorizing graph-specific facts.

Key Results

Performance comparison of ULTRAQUERY against baselines across 23 datasets, showcasing its dominance in fully inductive (e, r) settings.
  • Performance: ULTRAQUERY set a new state-of-the-art on 15 out of 23 datasets.
  • Relative Gain: On average, it outperformed the best available baselines by 50% in Mean Reciprocal Rank (MRR).
  • Faithfulness: The model almost perfectly recovers "easy" answers (those reachable by simple graph traversal) while still excelling at predicting "hard" answers (those requiring the model to infer missing links).
  • Efficiency: Despite its power, the model is relatively small (177k parameters), whereas some baselines require tens of millions of parameters to store entity embeddings.

Limitations and Future Work

  • Backbone Dependency: ULTRAQUERY’s performance is tied to the quality of its inductive projection backbone (ULTRA). Improvements there will directly translate to better query answering.
  • Scaling to Massive Graphs: While effective, the GNN-based approach might face latency issues on KGs with millions or billions of nodes. The authors suggest integrating more scalable predictors like A*Net in the future.
  • Query Complexity: The current model focuses on standard First-Order Logic queries. Future work could extend this to temporal queries (questions involving time) or queries involving numerical literals (e.g., "population > 1 million").

Summary updated

BibTeX
@inproceedings{galkin2024foundation,
  author = {Mikhail Galkin and Jincheng Zhou and Bruno Ribeiro and Jian Tang and Zhaocheng Zhu},
  title = {{A Foundation Model for Zero-shot Logical Query Reasoning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=JRSyMBBJi6},
}
Figure