Introduction
Knowledge Base Question Answering (KBQA) systems aim to translate natural language queries into structured programs, such as SPARQL, that can be executed against large-scale databases like Freebase or Wikidata. Despite their utility, traditional KBQA models are constrained by high data requirements, necessitating thousands of manually annotated question-query pairs. This "data-hungry" nature makes them difficult to scale as knowledge bases evolve or when transitioning between different schemas. While Large Language Models (LLMs) can mitigate these issues through in-context learning (ICL), they are often limited by high inference costs and restricted context windows.
Methodology
FlexKBQA introduces a novel framework that reverses the standard training pipeline by generating structured programs first and then utilizing LLMs to translate them into natural language questions. This approach leverages the inherent strength of LLMs in natural language generation from structured data.
The framework consists of four primary components:
- Automatic Program Sampling: The system samples diverse templates from the KB and populates them with entities and relations to generate valid, executable programs.
- Low-Resource Program Translation: An LLM acts as a translator, converting these programs into synthetic questions. This dataset is used to pre-train a lightweight student model.
- Execution-Guided Self-Training (EGST): To address the distribution shift between synthetic and real-world questions, the model employs unlabeled real-world data. A teacher model predicts queries, which are filtered based on their execution success on the KB, ensuring high-quality training signals.
- Inherent Reasoning (IR) Augmentation: The framework utilizes the LLM's internal knowledge as both a validator for query results and a fallback mechanism when structured queries fail.
Results and Discussion
FlexKBQA was evaluated on three major benchmarks: GrailQA, WebQSP, and KQA Pro. The framework consistently outperformed state-of-the-art few-shot methods.
On the GrailQA dataset, FlexKBQA achieved an F1 score of 69.4 with only 25 manual annotations, significantly surpassing previous models like Pangu. The system reached 93% of the performance of fully supervised models while using a tiny fraction of the labeled data. A key driver of this success was the EGST process, which provided a boost of over 10 points in F1 score by effectively bridging the gap between synthetic and real-world question distributions. The performance scales remarkably well with the amount of synthetic data generated, eventually surpassing LLMs limited by their context window.
Conclusion
FlexKBQA provides a robust solution to the data scarcity problem in KBQA. By combining automated program sampling with LLM-based translation and execution-guided self-training, the framework enables the creation of high-performance, lightweight models that are both cost-effective and adaptable to diverse knowledge base schemas. Future work will focus on improving entity linking and automating template discovery to further enhance zero-shot capabilities.
Summary updated