Abstract
Knowledge Base Question Answering (KBQA) typically follows a "retrieve-then-reason" paradigm, which is limited by the "knowledge boundary" of external retrievers. This paper introduces KBLLaMA, a "learn-then-reason" framework that fine-tunes a Large Language Model (LLaMA2) to internalize knowledge base (KB) schemas and logical reasoning paths. By shifting from external retrieval to internal parameter-based knowledge, KBLLaMA achieves state-of-the-art performance and significantly improves generalization across new, unseen domains.
Introduction: The Knowledge Boundary Problem
Most modern KBQA systems use a retriever to find relevant facts in massive databases like Freebase or Wikidata, followed by a reasoner to construct an answer. However, if the retriever has not been trained on a specific domain (e.g., specialized medical data), it fails to find the necessary evidence, causing the entire system to collapse. This creates a significant bottleneck for generalization.
The authors identify two primary generalization gaps:
- In-KB Generalization: Handling new combinations of known relations or classes within the same KB.
- Cross-KB Generalization: Adapting to entirely different KBs with unique ontologies and domain knowledge.
KBLLaMA addresses these gaps by injecting KB knowledge directly into the model's parameters, allowing it to "understand" the underlying structure of the data before processing a question.
Methodology: Knowledge Organization and Learning
The KBLLaMA framework consists of two main stages: Knowledge Organization and Knowledge Learning.
1. Knowledge Organization (Data Synthesis)
To overcome the lack of manual training data for new KBs, the authors employ a cluster-based strategy to synthesize diverse question-expression pairs using GPT-3.5.
- Relation Clustering: KB relations are embedded using BERT and grouped into clusters.
- Logical Expression Creation: S-expressions are sampled from these clusters to ensure a wide variety of logical paths (one-hop and multi-hop).
- Reverse Checking: A verification step filters out low-quality or nonsensical generated questions.
2. Knowledge Learning (Fine-tuning)
The model is fine-tuned on the synthesized data using a technique called Knowledge Refinement. Inspired by Chain-of-Thought (CoT) prompting, the model is trained to output the KB name and a natural language explanation of its reasoning logic before generating the final logical expression.
Entity Linking
Since raw KB IDs (e.g., m.027lnzs) lack semantic meaning, KBLLaMA is trained to output entity mentions. A separate, fine-tuned LLaMA2 module then acts as an entity linker to map these mentions back to specific KB IDs.
Key Results and Insights
KBLLaMA-base outperformed retrieve-based baselines and even surpassed GPT-4 on several general benchmarks.
- Generalization: On the specialized Bio-chemical benchmark, KBLLaMA achieved a 9.8% performance gain over previous state-of-the-art models.
- Diversity over Quantity: The authors found that the diversity of synthesized training data (achieved through clustering) was more critical for performance than the sheer volume of data.
- The Power of Explanation: Incorporating natural language explanations (Knowledge Refinement) during training resulted in a 4.2% boost in F1 score, helping the LLM align its linguistic knowledge with rigid database structures.
Conclusion
KBLLaMA demonstrates that internalizing KB schemas within LLM parameters is a viable and superior alternative to traditional retrieval-based methods for complex KBQA tasks. By focusing on "learning" the structure before "reasoning," the model achieves remarkable generalization across diverse domains and complex query types.
Summary updated