Abstract
Answering complex logical queries over Knowledge Graphs (KGs) is a fundamental challenge in artificial intelligence. While Pre-trained Language Models (PLMs) have shown promise in semantic understanding, they often struggle with the structural complexity of multi-step logical reasoning, particularly in inductive settings where entities and relations are unseen during training. This paper introduces SILR (Structure-modeled Inductive Logical Reasoning), a framework that integrates structural prompts and specialized geometric layers to enable robust, inductive logical reasoning by modeling the underlying query structure rather than just textual patterns.
Introduction
Knowledge Graphs like Wikidata and Freebase serve as the backbone for many information retrieval systems, yet they are notoriously incomplete. Complex reasoning—such as answering "Where did Canadian citizens with Turing Awards graduate?"—requires navigating multiple logical operations, including projections and intersections.
Existing approaches generally fall into two categories, both with significant limitations. Transductive models rely on fixed entity embeddings, meaning they cannot reason about new entities added to the graph after training. Conversely, PLM-based inductive models treat queries as flat sequences, often failing to distinguish between queries that share similar semantics but possess different logical structures. The SILR framework addresses these gaps by making PLMs "structure-aware," allowing them to generalize to entirely new graphs and complex logical formulas.
Methodology
SILR treats logical reasoning as a structured text-encoding task, utilizing a Siamese dual-encoder architecture and several novel components to bridge the gap between natural language and symbolic logic.
Query Linearization and Structural Prompts
To process a graph query, SILR first flattens the logical formula into a sequence of tokens. This sequence includes anchor entities and operation markers such as [projection] and [intersection]. To guide the PLM through the "order of operations," the model uses Structural Prompts. These are prepended stepwise instructions (e.g., "Five steps: [proj], then [proj]...") that act as a logical recipe, ensuring the model understands the execution flow of the query.
Geometric Operation Modeling
Standard Transformer layers are optimized for language, not set theory. SILR augments the PLM backbone with specialized modules designed to handle geometric constraints:
- Intersection Attention Layer: Specifically models the overlapping sets of entities resulting from conjunctive queries.
- Union Maxout Layer: Handles disjunctive logic ("OR" operations) within the query structure.
Contrastive Learning
The model employs a Siamese Dual Encoder to map both the structured query and potential answer entities into a shared vector space. Using the InfoNCE loss function, the model is trained to minimize the distance between a query representation and its valid answer entities while maximizing the distance from incorrect ones.
Experimental Evaluation
The researchers evaluated SILR across three distinct scenarios to test its versatility and robustness.
Inductive and Transductive Reasoning
On standard inductive benchmarks where test entities are disjoint from training data (FB15k-237-V2 and NELL-V3), SILR demonstrated significant improvements. On FB15k-237-V2, the model achieved a Hits@10 of 0.178, substantially outperforming previous state-of-the-art models like BiQE (0.158) and Q2B (0.043).
Cross-KG Generalization
A key strength of SILR is its ability to perform zero-shot reasoning across different KGs. When trained on FB15k and tested on NELL995—which features entirely different relations and entities—SILR maintained high performance. This suggests the model learns universal principles of logical structure rather than simply memorizing graph-specific shortcuts.
Discussion and Key Insights
The success of SILR highlights that while PLMs are excellent at capturing the semantics of entity names, they require explicit structural guidance to master nested logic. The inclusion of structural prompts proved critical; ablation studies showed a significant performance drop when these "instructions" were removed. By combining the semantic power of PLMs with the geometric constraints of set operations, SILR achieves a form of structural generalization that allows it to process query types (e.g., longer projection paths) that it never encountered during the training phase.
Limitations and Future Work
Despite its advancements, SILR currently focuses on existential positive first-order logic. It does not yet support negation (e.g., "Who won an award but did not graduate from X?"). Additionally, the model's performance is tied to the availability of textual labels for entities; in KGs where entities are represented only by abstract IDs, the current textual encoding approach would require modification. Future research may involve scaling the backbone to larger models like Llama or GPT-4 to further enhance reasoning depth.
Summary updated