Inductive Logical Query Answering in Knowledge Graphs

Mikhail Galkin, Zhaocheng Zhu, Hongyu Ren, Jian Tang

TL;DR

Most knowledge graph (KG) models are "transductive," meaning they break the moment you add a new entity to the graph. This paper introduces the first methods for inductive logical query answering, allowing models to reason over entirely new nodes and edges at inference time without retraining, scaling to graphs with millions of nodes.

What Problem Does This Paper Address?

Knowledge Graphs like Wikidata or Freebase are notoriously incomplete and constantly evolving. To find missing information, researchers use "Complex Query Answering" (CQA)—using First-Order Logic (e.g., "Where did US citizens with Nobel Prizes graduate?") to predict missing links.

However, existing CQA methods are almost exclusively transductive. They learn a unique "ID" embedding for every single entity (like Albert Einstein or USA). If you update the graph with a new person (Richard Feynman) or a new university (Princeton), a transductive model is blind to them. It cannot represent entities it didn't see during training. To fix this, you’d usually have to retrain the entire model, which is computationally impossible for massive, fast-changing KGs.

Inductive Query Answering Setup

Methods

To solve the out-of-vocabulary problem, the authors propose two distinct inductive frameworks that move away from fixed entity IDs:

  1. NodePiece-QE (Inductive Node Representations): Instead of learning a static ID for a node, this method represents a node as a "bag of words" consisting of its incident relation types. Since the set of relations (like citizen_of or graduated_from) is usually fixed and small, the model can "tokenize" a brand-new node based on its connections and immediately generate an embedding for it. It then uses a non-parametric logic executor (CQD-Beam) to find answers.
  2. GNN-QE (Inductive Relational Structure): This method ignores node embeddings entirely. Instead, it uses a Graph Neural Network (specifically an extension of NBFNet) to track the "relational paths" between the constants in a query and potential answer nodes. It learns the shape of the logic rather than the identity of the nodes.

Datasets

Because no inductive CQA benchmarks existed, the authors created a new suite of 10 datasets based on FB15k-237. They sampled training graphs at different sizes (from 10% to 90% of the original nodes) and created inference graphs containing the remaining "unseen" nodes.

To test scalability, they also built WikiKG-QE, a massive dataset based on Wikidata with 2 million nodes and 11 million edges, specifically designed to see if these models can handle "production-scale" data.

Key Insights and Ideas

  • Logic without Identities: You don't actually need to know who an entity is to perform logical reasoning; you only need to know how it relates to other things. This shift from "entity-centric" to "relation-centric" reasoning is what enables induction.
  • The "Updatable Database" Behavior: Unlike transductive models, these inductive models behave like real databases. If you add a new "correct" answer to the graph after the model is trained, the model can actually find it.
  • The Efficiency-Effectiveness Trade-off: The authors found a clear split: GNN-based methods are much more accurate because they are trained end-to-end on complex logic, but they are computationally heavy. Tokenization-based methods (NodePiece) are slightly less accurate but incredibly fast and scalable.

Key Results

  • Generalization to Huge Graphs: Inductive models successfully performed reasoning on inference graphs up to 500% larger than their training graphs.
  • Superior Performance: GNN-QE significantly outperformed transductive baselines (which essentially failed on unseen nodes) and even beat a strong "Edge-type Heuristic" baseline by a wide margin.
  • Massive Scale: NodePiece-QE was the only model capable of running on the 2-million-node WikiKG-QE, proving that inductive reasoning isn't just a theoretical curiosity but a viable tool for large-scale systems.
  • Zero-Shot Logic: NodePiece-QE can answer complex queries even if it was only trained on simple link prediction (1-hop) tasks, demonstrating strong "inference-only" capabilities.

Limitations and Future Work

The main limitation is the computational cost of GNN-QE. Because it spawns a new GNN pass for every query constant, it struggles to scale to graphs with millions of nodes. On the other hand, while NodePiece-QE scales well, it currently lacks the "end-to-end" logical training that makes GNNs so precise.

Future work includes extending these models to handle more complex KG features like entity types, textual descriptions, and "hyper-relational" data (where edges have their own properties, like dates or locations). The authors also suggest exploring "neural graph databases" that can perform zero-shot inference on frequently updated data.

Summary updated

BibTeX
@inproceedings{galkin2022inductive,
  author = {Mikhail Galkin and Zhaocheng Zhu and Hongyu Ren and Jian Tang},
  title = {{Inductive Logical Query Answering in Knowledge Graphs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=-vXEN5rIABY},
}
Figure