Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language processing. However, they often struggle with "hallucinations"—generating factually incorrect information—and a lack of implicit world context. These limitations stem from the models' reliance on statistical patterns in text rather than structured, factual knowledge. This paper introduces a systematic framework for "infusing" external knowledge from Knowledge Graphs (KGs) into Transformer-based architectures to address these challenges.
Methodology: A Principled Approach to Infusion
The proposed framework categorizes Transformer components into two primary mathematical building blocks: Latent Representations (word vectors and intermediate outputs) and Inductive Biases (self-attention matrices). By distinguishing between these, the authors move beyond ad hoc knowledge injection toward a modular, principled approach.
Knowledge Compression
To integrate structured KG data into neural networks, the authors utilize "Knowledge Compression." KG nodes are transformed into vector embeddings. Pair-wise inner products of these embeddings are then calculated to generate "correlation matrices," which represent the relationships between entities in a format compatible with the Transformer's attention mechanism.
Infusion Strategies
The framework evaluates three distinct strategies for knowledge injection:
- Shallow Infusion: KG vectors are added only to the input embeddings of the initial Transformer block.
- Semi-deep Infusion: KG vectors are added to embeddings, and KG correlation matrices are integrated into the self-attention mechanism, but only within the first block.
- Deep Infusion: The semi-deep process is repeated across all $N$ blocks of the Transformer, ensuring knowledge is interleaved throughout the model's entire depth.
Experimental Setup
The researchers evaluated their framework using ConceptNet (Numberbatch embeddings) and WordNet as external knowledge sources. Performance was measured on the GLUE (General Language Understanding Evaluation) benchmark, focusing on Natural Language Inference (MNLI, QNLI, WNLI), Textual Entailment (RTE), and Semantic Similarity (QQP). The infusion techniques were tested across several architectures, including BERT, XLNET, RoBERTa, ELECTRA, and Longformer.
Key Results and Insights
The experimental results consistently highlighted the superiority of the Deep Infusion strategy. By interleaving knowledge into every layer, the model can "reason" with external facts throughout its processing pipeline, rather than just at the input stage.
As shown in the table above, using XLNET as a baseline, Deep Infusion provided significant accuracy boosts. For instance, on the WNLI task, accuracy improved from a baseline of 79.9% to 90.91%. Similar trends were observed across all tested architectures, with XLNET emerging as the most robust base for these techniques.
Data Efficiency and Utility
Beyond raw accuracy, the study found that knowledge-infused models are significantly more data-efficient. A model utilizing Deep Infusion and trained on only 50% of the available data often outperformed a standard baseline trained on 100%. To verify that the models were truly utilizing the KG structure, the authors introduced the CGKA (Combined Graph Encoder and KSAT model Accuracy) metric, confirming that the improvements were not merely the result of statistical artifacts.
Conclusion and Future Directions
This research demonstrates that a systematic, deep infusion of external knowledge significantly enhances the performance and efficiency of Transformer-based models. While the current approach uses a simple summation to combine different knowledge sources, future work will explore "Hybrid Knowledge Infusion." This involves developing strategies to selectively determine which specific Transformer blocks should receive particular types of knowledge, potentially leading to even more specialized models for complex domains like medicine or law.
Summary updated