Abstract
Knowledge Graph (KG) reasoning typically involves predicting missing links between entities. However, real-world queries often involve complex logical constraints and multiple variables. Traditional path-based models struggle with global context and joint inference. We present BIQE (Bidirectional Query Encoder), a Transformer-based framework that treats query graphs as sequences of paths. By leveraging bidirectional self-attention and joint prediction of missing entities, BIQE captures dependencies across the entire query structure. Evaluations on standard and new conjunctive query benchmarks demonstrate that BIQE significantly outperforms state-of-the-art models, particularly in multi-variable scenarios.
Introduction
Knowledge Graphs (KGs) serve as massive structured repositories of facts, typically represented as "subject-predicate-object" triples. While simple link prediction (e.g., predicting the object given a subject and relation) is well-studied, real-world information needs often require answering conjunctive queries. For example, finding "cities located on rivers that flow through both Germany and France" requires navigating multiple relational paths and identifying their intersection.
Existing methods, such as GQE or Query2Box, typically approach this by aggregating information along paths from a starting point. However, these models are often "blind" to the global context, struggling to model dependencies between disjoint branches of a query. Furthermore, they face challenges when a query contains multiple missing entities that must be solved simultaneously.
Methods
The proposed BIQE model leverages the Transformer architecture to process the entire query graph at once, overcoming the limitations of local, path-based aggregation.
- Query Decomposition: Since Transformers are designed for sequences, BIQE decomposes a query Directed Acyclic Graph (DAG) into a set of paths from the root to the leaves.
- Novel Positional Encoding: To preserve the graph structure within a sequence, the authors employ a unique indexing strategy. Positional IDs are assigned to elements within a path, but the counter is reset at the start of each new branch. This ensures the model is permutation invariant—the logical meaning remains the same regardless of the order in which branches are presented.
- Bidirectional Attention: Through self-attention, every element in the query—including entities, relations, and variables—can interact with every other element. This allows the model to capture complex constraints that traditional path-based models might miss.
- Joint Prediction: BIQE uses
[MASK]tokens to represent missing entities. Unlike iterative methods, it can predict multiple[MASK]tokens simultaneously, finding a globally consistent answer for all variables in a single pass.
Key Insights and Results
The core advantage of BIQE lies in its "global view." While traditional models aggregate information along edges, BIQE’s self-attention mechanism treats the query as a fully connected graph. This allows the model to find shortcuts and dependencies between distant parts of the query structure.
The researchers evaluated BIQE on standard benchmarks (BIO, FB15K-237, NELL-995) and introduced new datasets (FB15K-237-CQ and WN18RR-CQ) specifically designed to test multi-variable conjunctive queries.
- Performance: BIQE achieved an AUC of 96.91 on the BIO dataset, significantly higher than GQE's 91.0.
- Complex Reasoning: In tasks involving multiple missing entities, BIQE outperformed the best GQE versions by 5-10 percentage points in Mean Reciprocal Rank (MRR).
- Zero-Shot Generalization: The model showed a strong ability to generalize to query types not seen during training, a key indicator of robust logical reasoning.
Conclusion
BIQE demonstrates that bidirectional sequence encoders are highly effective for complex reasoning over Knowledge Graphs. By enabling joint inference and providing a global view of query constraints, it sets a new state-of-the-art for conjunctive query answering. Future research will explore extending this framework to handle cycles and more complex logical operators such as negation and disjunction.
Summary updated