Abstract
Knowledge Graph Completion (KGC) requires a nuanced understanding of both linguistic context and structural relationships. While Large Language Models (LLMs) excel at processing textual information, they often struggle with the structural sparsity and semantic ambiguity inherent in incomplete knowledge graphs. This paper presents SLiNT (Structure-aware Language model with Injection and coNtrastive Training), a modular framework that enhances LLMs for KGC by injecting structural information directly into the model's reasoning process. SLiNT utilizes neighborhood enhancement, dynamic contrastive learning, and token-level injection to overcome common pitfalls such as hallucination and entity confusion.
Introduction
Knowledge Graph Completion (KGC) is the critical task of predicting missing links within a network of facts—for instance, inferring that "Wolfgang Amadeus Mozart" was born in "Salzburg" when the specific relation is absent from the database. Current research typically falls into two categories: embedding-based models and generation-based LLMs. Embedding-based models are adept at capturing graph topology but lack deep linguistic understanding. Conversely, LLMs possess vast textual knowledge but frequently ignore the underlying graph structure, leading to two primary challenges:
- Structural Sparsity: In regions where an entity has few connections, LLMs lack sufficient context and often "hallucinate" plausible but incorrect facts.
- Semantic Ambiguity: LLMs tend to prioritize surface-level text similarity. For example, a model might incorrectly predict "Joseph Haydn" instead of "Mozart" because both are composers, even if structural evidence points elsewhere.
SLiNT addresses these issues by grounding a frozen LLM backbone with structural priors and robust training objectives.
Methodology
SLiNT is built upon a frozen LLM (such as LLaMA-7B) modified via lightweight LoRA adapters. The framework consists of three core modules designed to bridge the gap between structural embeddings and textual generation.
Structure-Guided Neighborhood Enhancement (SGNE)
To combat structural sparsity, SGNE retrieves "pseudo-neighbors" from a pre-trained embedding space. Since the actual neighbors of an entity may be missing in an incomplete graph, these pseudo-neighbors provide a structural prior that acts as a safety net. SLiNT uses multi-head attention to fuse these neighbors into a rich, structure-aware representation of the entity.
Dynamic Hard Contrastive Learning (DHCL)
To resolve semantic ambiguity, SLiNT employs DHCL to sharpen the model's decision boundaries. The model is trained to distinguish between highly similar candidates by creating "synthetic" hard examples. This is achieved by interpolating between the query and "prototype" centers of positive and negative entities. This forces the model to learn to disambiguate entities that appear similar in text but occupy distinct positions in the graph.
Gradient-Decoupled Dual Injection (GDDI)
GDDI serves as the delivery mechanism for structural information. It performs a "dual injection":
- Textual Context: Adding relevant structural information to the natural language prompt.
- Token-Level Injection: Replacing specific token embeddings (such as a
[QUERY]marker) with high-dimensional structural vectors derived from SGNE.
Experimental Results
SLiNT was evaluated on two gold-standard benchmarks: FB15k-237 (real-world facts from Freebase) and WN18RR (lexical relationships from WordNet).
Performance Metrics
SLiNT achieved state-of-the-art or competitive results across both datasets:
- FB15k-237: Mean Reciprocal Rank (MRR) of 0.443.
- WN18RR: MRR of 0.691.
Compared to a vanilla LLaMA model, SLiNT improved the MRR by over 20 points on FB15k-237. This significant margin demonstrates that raw linguistic capability is insufficient for KGC without explicit structural grounding.
Robustness and Efficiency
The model demonstrated high robustness, maintaining strong performance even when 10% of the graph's edges were randomly removed. Furthermore, SLiNT is computationally efficient; by keeping the core LLM parameters frozen and only training LoRA adapters and injection layers, it achieves these gains with only a ~3% increase in training time compared to simpler generative baselines.
Discussion and Conclusion
SLiNT proves that integrating structural priors into LLMs significantly enhances their utility for knowledge graph tasks. The use of pseudo-neighbors effectively mitigates the issues of long-tail entities, while dynamic contrastive learning provides the necessary granularity to handle semantic ambiguity.
However, some limitations remain. SLiNT currently requires a "warm start" from existing KG embedding models (e.g., TransE or CoLE). Future work may explore extending the SGNE module to handle multimodal data or temporal dynamics, as well as optimizing the pseudo-neighbor retrieval process for web-scale knowledge graphs. Despite these challenges, SLiNT represents a major step forward in creating structure-aware generative models for complex relational reasoning.
Summary updated