Abstract
Knowledge Base Question Answering (KBQA) aims to answer natural-language questions over a structured Knowledge Base (KB). Recent work improves KBQA by adopting an agentic reasoning paradigm, in which Large Language Models (LLMs) iteratively decompose a question, generate its corresponding logical queries, and interact with the KB to derive the answer. However, these methods typically fine-tune LLMs on reasoning trajectories synthesized via process supervision, which offers weak incentives for exploration and thus fails to strengthen the agentic reasoning ability. In this paper, we propose KnowCoder-A1, an LLM that can autonomously perform agentic reasoning on KBs to obtain answers. To incentivize autonomous exploration, KnowCoder-A1 trains the LLM under outcome-only supervision via a multi-stage curriculum reinforcement learning with an easy-to-hard curriculum. To establish foundational agentic capabilities, KnowCoder-A1 first fine-tunes the LLM on a small set of high-quality trajectories obtained through outcome-based rejection sampling. Then, to alleviate the reward sparsity inherent in outcome-only supervision, it applies multi-stage curriculum RL with reward schedules that progress from easy to hard. Trained with outcome-only supervision, KnowCoder-A1 exhibits powerful reasoning behaviors and consistently outperforms prior approaches across three mainstream datasets. Notably, on the zero-shot subset of GrailQA, KnowCoder-A1 achieves up to an 11.1% relative improvement while using only one-twelfth of the training data, demonstrating strong agentic reasoning capabilities.
Introduction
Knowledge Base Question Answering (KBQA) requires an agent to translate natural language into structured actions—such as entity searching or SPARQL execution—to retrieve answers from a Knowledge Base. The prevailing "agentic reasoning" paradigm involves LLMs iteratively planning and calling tools. However, most existing models rely on process supervision, where they are fine-tuned on "ideal" reasoning trajectories.
As shown in Figure 1, this approach suffers from three primary bottlenecks:
- Limited Exploration: Models are confined to the provided "gold" paths.
- Limited Robustness: Models often collapse when encountering real-world noise, such as empty tool results or syntax errors, because they never saw such failures during training.
- Limited Flexibility: Models learn to mimic specific syntax rather than understanding that multiple logical paths can lead to the same correct answer.
Methodology: KnowCoder-A1
To address these limitations, KnowCoder-A1 shifts from process supervision to outcome supervision, rewarding the agent for the correct final answer and allowing it to discover optimal reasoning paths autonomously. The training follows a two-stage framework.
Stage 1: Agentic Initialization (Cold-start)
To provide the model with a baseline understanding of tools and KB structures, it is first fine-tuned on a small, high-quality dataset (~6,700 samples). These trajectories are curated using outcome-based rejection sampling: strong models (e.g., Gemini 1.5 Flash) generate multiple paths, and only those that yield the correct answer and are strictly grounded in KB evidence are retained.
Stage 2: RL-based Exploration via GRPO
The core of KnowCoder-A1 is Group Relative Policy Optimization (GRPO). GRPO generates a group of trajectories for a single question and calculates rewards relative to the group's average, avoiding the need for a complex "critic" model. To overcome the "reward sparsity" of outcome-only supervision, a two-phase Reward Curriculum is introduced:
- Phase 1 (Precision-focused): Uses the $F_{0.5}$ score to prioritize precision, preventing "reward hacking" where an agent might output excessive entities to ensure the correct answer is included.
- Phase 2 (Balanced): Shifts to the $F_1$ score to incentivize finding the complete set of correct answers once the model's reasoning is stable.
Experimental Evaluation
KnowCoder-A1 was evaluated on three major KBQA benchmarks: WebQSP (simple 1-2 hop questions), CWQ (complex compositional questions), and GrailQA (testing generalization across I.I.D., compositional, and zero-shot settings).
Key Results
- State-of-the-Art Performance: KnowCoder-A1 achieved an F1 score of 80.5% on GrailQA, a 3.3% relative improvement over previous leaders.
- Zero-Shot Mastery: On the zero-shot subset of GrailQA, the model demonstrated an 11.1% relative improvement, indicating a deep, transferable understanding of KB navigation.
- Data Efficiency: KnowCoder-A1 achieved these results using only one-twelfth of the training data compared to the previous SOTA (KBQA-o1).
- Inference Efficiency: By using a single linear reasoning pass instead of expensive search techniques like MCTS, KnowCoder-A1 is 3.2x to 6x faster than its competitors.
Discussion: The Power of Autonomous Exploration
The shift to outcome supervision yields several emergent behaviors:
- Self-Correction: Unlike process-supervised models, KnowCoder-A1 learns to recover from errors. If a tool call fails or returns no results, the model analyzes the error and tries an alternative strategy.
- Flexibility: The model often discovers reasoning paths more efficient than the "gold" queries provided in original datasets, proving it has learned the underlying logic rather than just mimicking syntax.
Conclusion and Limitations
KnowCoder-A1 demonstrates that outcome-only supervision, paired with a curriculum-based RL approach, significantly enhances the agentic reasoning capabilities of LLMs for KBQA. While highly effective, the model still faces challenges with implicit temporal constraints and occasional hallucinations when repeatedly failing to find a path. Future work will explore more advanced reflection mechanisms to further improve error analysis and recovery.
Summary updated