TL;DR
ChatKBQA flips the standard "retrieve-then-generate" paradigm in Knowledge Base Question Answering (KBQA) on its head with a streamlined "generate-then-retrieve" architecture. By fine-tuning open-source Large Language Models (LLMs) to first generate an abstract logical form (query skeleton + text-level entity/relation placeholders) and then grounding those components using unsupervised retrieval, ChatKBQA eliminates cascading retrieval errors and sets a new state of the art on major KBQA benchmarks.
What Problem Does This Paper Address?
Answering complex natural language questions over Knowledge Bases (KBQA) requires converting user queries into executable database queries (such as SPARQL over RDF knowledge graphs). Historically, this follows a retrieve-then-generate workflow:
- Extract candidate entity mentions and retrieve matching entities and relations from the knowledge base (KB).
- Feed the original question alongside the retrieved subgraphs or triples into a sequence-to-sequence model (e.g., T5) to generate the query or answer.
This pipeline suffers from three major flaws:
- Low efficiency and complex engineering: It relies on multi-stage pipelines requiring specialized Named Entity Recognition (NER), entity linking, and subgraph extraction models.
- Error cascade: Upfront retrieval is noisy. Erroneous triples injected into the prompt distract the generator and bloat prompt token length, hurting semantic parsing.
- Entity/relation boundary ambiguity: Identifying the precise boundaries of implicit entities and complex relations directly from unstructured natural language text is notoriously difficult.
Methods
ChatKBQA simplifies the pipeline into two decoupled stages:
[Natural Language Question]
│
▼
[Fine-Tuned LLM + Beam Search]
│
▼
[Candidate Logical Forms (S-expressions with Text Placeholders)]
│
▼
[Unsupervised Entity & Relation Retrieval (e.g., SimCSE / FACC1)]
│
▼
[Executable SPARQL Query] ──► [KB Execution] ──► [Final Answer]
-
Instruction Fine-Tuning for Logical Form Generation: Instead of forcing the LLM to memorize KB IDs (e.g.,
m.06w2sn5), the training logical forms (S-expressions) are converted to use readable surface names (e.g.,[Justin Bieber]). Open-source LLMs (such as Llama-2-7B/13B, ChatGLM2-6B, and Baichuan2-7B/13B) are fine-tuned using parameter-efficient fine-tuning (PEFT) methods like LoRA, QLoRA, P-Tuning v2, or layer freezing. -
Beam Search Generation: The model generates a candidate list of logical forms capturing the structural skeleton of the query.
-
Unsupervised Grounding / Retrieval:
- Entity Retrieval: Text entity placeholders are matched against the KB entity set using surface matching/FACC1 and ranked via dense similarity (e.g., SimCSE).
- Relation Retrieval: Relations are resolved against candidate relations found strictly within the neighborhood of the candidate entities in the graph.
- Execution & Answer Extraction: The grounded candidates are converted into SPARQL. The first candidate query that executes successfully against the KB yields the final answer and an interpretable reasoning graph.
Datasets
The authors evaluated ChatKBQA on two standard Freebase benchmarks:
- WebQuestionsSP (WebQSP): 4,737 questions paired with SPARQL queries (3,098 train / 1,639 test), covering 34 logical form skeletons, 2,461 entities, and 628 relations.
- ComplexWebQuestions (CWQ): 34,689 multi-hop questions with complex compositional queries (27,639 train / 3,519 valid / 3,531 test), covering 174 logical form skeletons, 11,422 entities, and 845 relations.
No new datasets were introduced.
Key Insights and Ideas
- LLMs excel at parsing skeletons without KB context: Fine-tuned Llama-2-7B produces the correct structural skeleton over 91% of the time without seeing any retrieved KB facts beforehand.
- Upfront retrieval actively hurts semantic parsing: Injecting retrieved triples into the LLM prompt (the standard retrieve-then-generate approach) degrades exact match performance from 63.5% down to 53.1% as prompt length balloons from 512 to 2012 tokens. Irrelevant retrieved context induces catastrophic forgetting and distracts the LLM.
- Generation makes retrieval easier: Retrieving entities and relations after generating the logical form (AG-R) is significantly more accurate than retrieving directly from the raw question (NL-R). The LLM's generated query naturally isolates the phrase boundaries of entities and implicitly referenced relations.
- Plug-and-play modularity: ChatKBQA is model-agnostic, functioning effectively across different open-source base models (Llama, ChatGLM, Baichuan), parameter-efficient tuning strategies, and dense retrievers (SimCSE, Contriever, BM25).
Key Results
ChatKBQA outperforms all previous state-of-the-art methods across both benchmarks (Table 1):
- WebQSP (without oracle entity linking):
- $F_1$ Score: 79.8% (vs. previous best 79.6% PanGu / 79.1% UniK-QA)
- Hits@1: 83.2% (vs. previous best 82.1% DECAF)
- Accuracy: 73.8% (vs. previous best 73.1% GMT-KBQA)
- ComplexWebQuestions (without oracle entity linking):
- $F_1$ Score: 77.8% (a substantial leap over previous best 77.0% GMT-KBQA / 70.0% CBR-KBQA)
- Hits@1: 82.7% (a +12.3% jump over previous best 70.4% DECAF / CBR-KBQA)
- Accuracy: 73.3% (vs. previous best 72.2% GMT-KBQA)
In ablation experiments, Entity Retrieval added ~15 $F_1$ points over ungrounded parsing, and Relation Retrieval added an additional ~5 $F_1$ points.
Limitations and Future Work
- Skeleton Generation Errors (40.1% of failures): The fine-tuned model struggles on rare or deeply nested query skeletons underrepresented in the training split.
- Multi-hop Question Complexity: Generating very long, multi-hop logical forms in a single shot remains challenging. The authors propose integrating Chain-of-Thought (CoT) prompting or agent-based decomposition to break complex questions into sub-queries.
- Training Data Dependencies: The pipeline currently relies on parallel (question, logical form) annotations. Future work plans to explore synthetic data generation via knowledge graph sampling.
- Scope of Query Languages and KGs: Experiments were limited to Freebase and SPARQL. Applying the framework to property graph databases (e.g., Cypher on Neo4j) and specialized verticals (medical, financial KGs) remains unexplored.
Summary updated