Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language understanding, yet they often struggle with complex reasoning over structured data, such as Knowledge Bases (KBs). To answer intricate questions like "Who is taller, LeBron James Jr. or his father?", researchers typically employ Program Induction (PI). This process requires the LLM to translate a natural language query into a multi-step executable program or database query.
Despite its potential, PI faces a significant "data wall." Traditional methods require thousands of manually labeled question-program pairs for every new KB to familiarize the model with its specific schema—the unique names of relations and concepts. Furthermore, the massive scale of modern KBs often exceeds the context window of LLMs, making it impossible to simply prompt the model with the entire database structure. KB-Plugin addresses these challenges by introducing a modular, plug-and-play architecture that enables high-performance reasoning on low-resourced KBs without requiring manual annotations for the target domain.
Methodology: Decoupling Knowledge and Reasoning
The core innovation of KB-Plugin is the separation of concerns between linguistic reasoning and schema knowledge. The framework utilizes two lightweight Low-Rank Adaptation (LoRA) plugins added to a frozen backbone LLM (specifically Llama2-7B):
- The Schema Plugin ($m_{sc}$): This module is designed to internalize the specific vocabulary and structure of a target KB. It is trained via self-supervised learning on the KB's own triples (e.g., LeBron James | instance of | human). By learning to complete these triples, the plugin encodes the KB's schema into the model's weights, bypassing the need for human-labeled questions.
- The Program Induction (PI) Plugin ($m_{PI}$): This serves as the general-purpose reasoning engine. It is trained on a single, data-rich source KB (such as Wikidata). To ensure this plugin can transfer to any unseen KB, the authors employed Alias Replacement. By generating multiple versions of the source KB where relation names are replaced with synonyms, the PI plugin is forced to learn the logic of program generation rather than memorizing specific relation strings. It learns to "look up" the correct schema arguments from the Schema Plugin during inference.
At runtime, the appropriate Schema Plugin for the target KB and the pre-trained PI Plugin are plugged into the LLM. The system then uses constrained decoding to ensure that the generated programs strictly adhere to the target KB's schema, guaranteeing executability.
Experimental Evaluation
The framework was evaluated across a diverse set of benchmarks, including large-scale KBs (WebQSP, GraphQ, and GrailQA based on Freebase) and domain-specific KBs (MetaQA for movies and SoAyBench for academic data). Crucially, the target KBs contained schema items that were entirely absent during the training of the PI Plugin, testing the model's zero-shot transfer capabilities.
Key Results and Scaling
KB-Plugin demonstrated superior performance compared to state-of-the-art low-resource methods like Pangu and KB-BINDER. Notably, the 7B-parameter Llama2 model equipped with KB-Plugin outperformed 175B-parameter models like Codex on several benchmarks. On domain-specific tasks like SoAyBench, the framework even surpassed GPT-4-based baselines.
Ablation studies confirmed the necessity of both modules. Removing the Schema Plugin led to a dramatic drop in performance (e.g., a 20% decrease on SoAyBench), proving that the PI Plugin successfully leverages the schema information injected by its counterpart. Furthermore, as shown in the scaling analysis, increasing the number of generated source KBs during training consistently improved the F1 scores across all target datasets, validating the robustness of the Alias Replacement strategy.
Conclusion and Future Work
KB-Plugin offers a scalable solution for bringing the power of LLMs to specialized, low-resourced knowledge bases. By decoupling schema memory from program reasoning, it achieves high accuracy with significantly fewer parameters and zero target-specific manual annotations.
Future research may address the "compositional gap"—the difficulty models face when a target KB requires reasoning structures entirely different from the source training data. Additionally, exploring self-training methods could allow the PI plugin to adapt to new compositional patterns autonomously, further enhancing the framework's flexibility across diverse information domains.
Summary updated