Skip to content
AI.info

Research

KBQA-R1: Reinforcing Large Language Models for Knowledge Base Question Answering

KBQA-R1: Reinforcing Large Language Models for Knowledge Base Question Answering Overview Research area: Natural Language Processing — Knowledge Base Question Answering (KBQA), large language model ag

arXiv
2512.10999
Published
2025-12-10
Authors
Xin Sun, Zhongqi Chen, Xing Zheng, Qiang Liu, Shu Wu, Bowen Song, Zilei Wang, Weiqiang Wang, Liang Wang

AI summary

KBQA-R1: Reinforcing Large Language Models for Knowledge Base Question Answering

Overview

Research area: Natural Language Processing — Knowledge Base Question Answering (KBQA), large language model agents, and reinforcement learning (RL) for tool/multi-turn reasoning.

Technical level: Advanced. The paper assumes familiarity with semantic parsing, knowledge graph schemas (SPARQL/S-Expressions), reinforcement learning objectives (GRPO, KL-regularized policy optimization, advantage estimation), and rejection-sampling data synthesis.

Scope: The paper proposes KBQA-R1, a two-stage training framework (Referenced Rejection Sampling warm-start plus GRPO reinforcement learning) that teaches a Llama-3.1-8B model to navigate a Freebase knowledge base through a compact, verifiable action space, and evaluates it on GrailQA, WebQSP, and GraphQuestions.

What This Paper Is About

Knowledge Base Question Answering asks a model to answer a question by producing an executable logical form (e.g., SPARQL or S-Expression) that queries a knowledge graph such as Freebase. Existing LLM approaches tend to fail in one of two ways: end-to-end generation produces "schema hallucinations" — queries that look executable but reference invalid or irrelevant relations — while prompting- or search-based agentic systems imitate template-like reasoning traces or spend large amounts of test-time compute without ever learning a KB-specific policy. KBQA-R1's goal is to replace static text imitation with interaction optimization: the model learns to act, observe concrete KB feedback, and refine its strategy through reinforcement learning instead of one-shot generation or in-context heuristics.

Key Contributions

  1. KBQA-R1 framework: A multi-turn reinforcement learning framework that grounds LLM reasoning in verifiable KB actions, enabling closed-loop Think-Action-Information interaction with the knowledge base using a compact typed action space (Find_relation, Merge, Order, Compare, Time_constraint, Count).
  2. Referenced Rejection Sampling (RRS): A data synthesis strategy that conditions trajectory generation on a reference sequence of ground-truth actions, filters the results by answer correctness and tag structure, then strips the reference hints before supervised fine-tuning so the model learns KB-grounded reasoning without hidden guidance at inference.
  3. Relation Retrieval and Confidence Gating (RRCG): A validation layer that scores the agent's proposed textual relation against all neighboring schema relations of the current entity and classifies the action into three tiers — Auto-Validation, Tentative Acceptance, or Rejection — to suppress hallucinated relations before execution.
  4. Empirical demonstration: State-of-the-art results on GrailQA, WebQSP, and GraphQuestions, plus the claim that RL training yields precise graph navigation — over 70% fewer LLM calls than GPT-4-based prompting methods (ToG, PoG) while achieving superior accuracy with only a Llama-3.1-8B backbone.

Main Findings

  • GrailQA (dev set): KBQA-R1 with Llama-3.1-8B reaches 90.0 EM / 91.5 F1 on I.I.D., 78.0 EM / 82.5 F1 on Compositional, 83.6 EM / 85.2 F1 on Zero-shot, and 83.9 EM / 86.1 F1 overall. Relative improvements over KBQA-o1 are +12.8% EM / +7.0% F1 (I.I.D.), +1.7% EM / +6.3% F1 (Compositional), +15.5% EM / +9.1% F1 (Zero-shot), and +12.0% EM / +7.6% F1 (Overall).
  • WebQSP (test set): KBQA-R1 achieves 83.4 F1, versus KBQA-o1 at 57.8 F1 (+25.6% relative) and the best non-KBQA-R1 entries in the table — SubgraphRAG with GPT-4o at 78.2 F1, TIARA at 78.9 F1, and MCTS-KBQA (Llama-3.1-8B) at 76.0 F1. The paper reports roughly a +7% absolute F1 improvement over MCTS-KBQA under the same backbone.
  • GraphQuestions (test set): KBQA-R1 reaches 53.8 F1, versus KBQA-o1 at 48.7 F1 (+5.1% relative), CoTKR at 47.5 F1, and ArcaneQA at 31.8 F1.
  • Ablation — architectural components matter most: Removing RRCG drops overall F1 to 64.1 (WebQSP), 37.7 (GraphQ), and 67.1 (GrailQA); the text reports an average F1 drop of about 18%, with GrailQA −19.0% and GraphQ −16.1%. Removing multi-turn interaction is the most damaging: 63.2 / 34.1 / 49.8, an average decline of about 25% and a 36.3% drop on GrailQA.
  • Ablation — training strategy: Removing RRS (using standard rejection sampling) gives 78.9 / 49.2 / 78.3, an average drop of about 5.6%. Removing the SFT warm-start (RL from scratch) gives 75.2 / 47.3 / 75.1, about a 8.6% average penalty. Removing GRPO (SFT only) gives 72.1 / 47.8 / 80.2.
  • Ablation — reward design: Setting the format reward to zero gives 81.1 / 51.6 / 84.2, a moderate but consistent average drop of about 2.1%, indicating the outcome reward is the primary learning driver and the format reward is a stabilizing auxiliary signal.
  • RRS versus standard RS (data efficiency): On GrailQA, RRS improves pre-SFT trajectory F1 from 54.2 to 70.2, acceptance from 17248/43851 (39.3%) to 29384/43851 (67.0%), and post-SFT dev F1 from 73.8 to 80.2. On WebQSP: 49.1 → 62.5 pre-SFT F1, 1120/2929 (38.3%) → 1505/2929 (51.4%) acceptance, 65.8 → 72.1 SFT-init F1. On GraphQ: 48.1 → 73.1 pre-SFT F1, 986/2332 (42.3%) → 1562/2332 (67.0%) acceptance, 41.1 → 47.8 SFT-init F1.
  • Frontier-agent comparison (500-query subset: 200 GrailQA, 200 WebQSP, 100 GraphQ): Equipping off-the-shelf frontier models with the KBQA-R1 harness improves every model over direct SPARQL ReAct, but none reaches the learned policy. Averages: GLM-5 (harness) 63.6, Kimi-K2.5 (harness) 69.5, gpt-5.3-codex (harness) 68.1, Claude 4.6 Sonnet (harness) 71.6, versus KBQA-R1 (Llama-3.1-8B) at 79.0 with 2.91 average turns and 3,994 / 328 input/output tokens.
  • Training dynamics: Top-1 relation similarity on WebQSP rises from about 0.94 at the SFT warm-start checkpoint to about 0.98 at convergence. The last-step similarity distribution has mean 0.9827 versus 0.9400 at the first step, with reduced variance.

Methodology in Plain English

The system is a ReAct-style multi-turn agent. At each turn the model writes a rationale inside <think> tags, emits one or more actions inside <action> tags, and then receives the KB's response inside <information> tags; the loop continues until it emits a final answer in <answer> tags or hits a maximum step count T.

Rather than generating a whole nested S-Expression in one shot (brittle, since one typo breaks the whole program), the model composes queries from six atomic actions — Find_relation, Merge, Order, Compare, Time_constraint, and Count — each mapping to a functional update (JOIN, AND, ARG, CMP, TC, COUNT) and an S-Expression template. These are translated to SPARQL and executed against Freebase.

Before an action executes, the RRCG module compares the model's proposed relation string against all neighboring schema relations of the current entity using dense retrieval similarity. The highest similarity score s_max is compared with two thresholds τ_high and τ_low: above τ_high the action auto-validates with the best-matching relation; between the thresholds it proceeds with top-k candidates attached to signal uncertainty; below τ_low it is rejected and a diagnostic message with neighboring relations is returned.

Training happens in two stages. Stage 1 (RRS + SFT): for each training example (question, gold answers, gold S-Expression), the pipeline extracts the ground-truth action sequence, runs a rollout where the model generates reasoning traces while being shown the next ground-truth action as a reference, keeps trajectories that reach the correct answer (F1 above a threshold τ) and maintain correct tag structure, and finally strips all reference hints so that the resulting SFT data contains no leakage. Each turn of an accepted trajectory becomes an independent training sample, with loss computed only on response tokens. RRS is run with Qwen-2.5-72B-Instruct as the trajectory generator, and the accepted data is distilled into the Llama-3.1-8B-Instruct policy. Stage 2 (GRPO): the SFT checkpoint is optimized with a composite reward — an outcome reward equal to the F1 between predicted and gold answer variants, plus a format reward for tag completeness and ordering that is applied only when the outcome reward is positive — combined as R = λ_outcome · r_outcome + λ_format · I[r_outcome > 0] · r_format. GRPO computes the advantage by centering rewards within a group of n sampled rollouts rather than using a learned value function, with a clipped importance-sampling objective and a KL penalty against a frozen reference policy. The paper states that full hyperparameters (epochs, schedules, batch sizes, KL coefficient β, clipping ratios) and infrastructure details are in Appendix B.3, and detailed dataset statistics in Appendix B.1 — these are not included in the truncated content provided.

Why This Matters

Impact on research. The paper reframes KBQA from one-shot logical-form generation into a sequential decision problem with verifiable, executable feedback, and shows that an 8B-parameter open model can outperform much larger prompting-based and search-based systems. It also contributes a general recipe — reference-conditioned rejection sampling followed by GRPO — for cold-starting RL agents on tasks where naive sampling produces mostly malformed outputs, which is relevant beyond KBQA to any verifiable tool-use setting.

Real-world applications:

  • Enterprise or scientific question answering over maintained knowledge graphs, where answers must be traceable to structured records rather than free-form generation.
  • Conversational assistants that need to query structured databases (product catalogs, organizational directories, metadata stores) across multiple hops.
  • Auditable fact-checking or compliance workflows where each step can be executed and its intermediate results inspected.
  • Cost-constrained deployments, since the paper reports over 70% fewer LLM calls than GPT-4-based prompting methods (ToG, PoG) at higher accuracy with a small backbone.

Industry relevance. The results speak directly to the cost/latency problem of agentic reasoning: KBQA-R1 averages 2.91 turns and 3,994 / 328 input/output tokens on the 500-query subset, while harness-equipped frontier models such as Claude 4.6 Sonnet use 5.45 turns and 15,325 / 2,959 tokens for a lower average score (71.6 versus 79.0). The pattern — distill knowledge into model weights rather than paying for it at inference — is a practical argument for training small specialized agents instead of routing everything through large general-purpose ones.

Future Directions

  • Beyond Freebase. All three benchmarks are Freebase-grounded; whether the RRS-plus-GRPO recipe transfers to other schemas (the introduction mentions Wikidata) is not evaluated in the reported content.
  • Scaling the backbone. Only Llama-3.1-8B-Instruct is used as the RL policy backbone (with Qwen-2.5-72B-Instruct used only for trajectory generation), so how the method behaves at larger or smaller policy scales is left untested.
  • Threshold sensitivity. The RRCG gate depends on two manually specified thresholds, τ_high and τ_low, and the RRS filter depends on an F1 threshold τ and a format reward value of 0.1; the paper does not report a sensitivity analysis in the provided content.
  • Robustness to weak supervision. The pipeline requires a gold S-Expression and gold action sequence for every training example, so extending it to settings with only answers, or with noisy or incomplete knowledge bases, remains an open question.

Target Audience

Researchers and engineers working on knowledge graph question answering, LLM agents, tool-use reinforcement learning, and semantic parsing. It is most useful to readers who already understand RL policy optimization and SPARQL/S-Expression semantics; practitioners interested in deploying cost-efficient structured-data assistants on open-weight models will also find the empirical comparisons (including the frontier-agent harness results in Table 8) directly actionable. Readers looking for a gentle introduction to KBQA or RL would find the paper advanced, and the truncated content lacks the appendix material (dataset statistics, hyperparameters, reward curves) needed for exact reproduction.

Authors’ abstract

Knowledge Base Question Answering (KBQA) challenges models to bridge the gap between natural language and strict knowledge graph schemas by generating executable logical forms. While Large Language Models (LLMs) have advanced this field, current approaches often struggle with a dichotomy of failure: they either generate hallucinated queries without verifying schema existence or exhibit rigid, template-based reasoning that mimics synthesized traces without true comprehension of the environment. To address these limitations, we present \textbf{KBQA-R1}, a framework that shifts the paradigm from text imitation to interaction optimization via Reinforcement Learning. Treating KBQA as a multi-turn decision process, our model learns to navigate the knowledge base using a list of actions, leveraging Group Relative Policy Optimization (GRPO) to refine its strategies based on concrete execution feedback rather than static supervision. Furthermore, we introduce \textbf{Referenced Rejection Sampling (RRS)}, a data synthesis method that resolves cold-start challenges by strictly aligning reasoning traces with ground-truth action sequences. Extensive experiments on WebQSP, GrailQA, and GraphQuestions demonstrate that KBQA-R1 achieves state-of-the-art performance, effectively grounding LLM reasoning in verifiable execution.

Read the original paper