From Parse-Execute to Parse-Execute-Refine: Improving Semantic Parser for Complex Question Answering over Knowledge Base

Wangzhen Guo, Linyin Luo, Hanjiang Lai, Jian Yin

Introduction

Knowledge Base Question Answering (KBQA) is the task of answering natural language questions by querying structured databases like Wikidata. While simple queries are well-handled, "Complex KBQA" remains a significant challenge. These questions require multi-step reasoning, such as "Who is the director of the movie that won the same award as Oppenheimer?".

The traditional approach follows a Parse-Execute paradigm: first, a parser translates the question into a logical form (e.g., SPARQL or KoPL); second, an execution engine runs this code against the database. However, this paradigm is notoriously "brittle." A single minor error in the parsing stage—such as a slightly incorrect relation name—leads to a total execution failure. Furthermore, the model lacks the ability to utilize intermediate data retrieved during the reasoning process.

The PER-KBQA Framework

To address these limitations, this paper introduces the Parse-Execute-Refine (PER) paradigm. This three-stage framework enhances robustness by feeding intermediate execution results back into a language model for a final "refinement" step.

The three-stage PER-KBQA framework: Parsing, Execution with Alignment, and Refinement.

1. Parsing Stage

The system uses a BART-based model to translate the natural language question into KoPL (Knowledge-oriented Programming Language). KoPL is a human-readable, step-by-step logical form that represents the reasoning chain as a series of function calls.

2. Execution Stage with Alignment

Instead of a direct execution, the framework incorporates an Alignment step. It employs Jaccard similarity to map predicted relations or attributes from the parser to the actual schema of the Knowledge Base. This heuristic helps correct "hallucinations" where the parser might use a synonym (e.g., "official name") instead of the exact database key (e.g., "nick name"). The system then executes the code to retrieve intermediate entities at every step of the reasoning chain.

3. Refinement Stage

The core innovation is the Refinement stage. The system constructs an "Execution Context"—a text string detailing the steps taken and the entities found. This context, combined with the original question, is fed into a second BART model. This allows the model to act as a "reasoner" that can interpret the path taken by the parser, even if the final result was slightly off.

To ensure the model doesn't just rely on the final execution result, the authors employ a Masking Strategy during training. By hiding the final result with a 60% probability, the model is forced to learn how to derive the answer from the entire reasoning path.

Experimental Results

The framework was evaluated on KQA Pro, a large-scale dataset of 120,000 complex question-answer pairs requiring diverse reasoning skills like multi-hop queries, qualifiers, and comparisons.

Comparison of PER-KBQA against baseline models on the KQA Pro dataset.

As shown in the results, PER-KBQA achieved a new state-of-the-art accuracy of 93.82%, significantly outperforming the previous best model, GraphQ IR (91.70%), and the standard BART-KoPL baseline (90.55%).

Ablation studies revealed that while the Alignment step in the Execution stage provided a ~2% boost, the Refinement stage added an additional ~1.2%. This confirms that the model benefits substantially from observing the intermediate data "clues" rather than just fixing the code syntax. Notably, the model also showed improved zero-shot performance, indicating better generalization to unseen relations.

Conclusion and Future Work

PER-KBQA demonstrates that treating a semantic parser as a "reasoning path retriever" rather than a final code generator leads to more robust KBQA systems. By integrating intermediate execution results into the final answer generation, the framework overcomes the inherent brittleness of the Parse-Execute paradigm.

Future work includes adapting this refinement logic to other query languages like SPARQL, which are less naturally "narrative" than KoPL, and testing the framework on other complex benchmarks like WebQSP and CWQ. While the dual-model approach increases computational cost, the gains in accuracy and robustness suggest it is a promising direction for complex information retrieval.

Summary updated

BibTeX
@inproceedings{guo2023from,
  author = {Wangzhen Guo and Linyin Luo and Hanjiang Lai and Jian Yin},
  title = {{From Parse-Execute to Parse-Execute-Refine: Improving Semantic Parser for Complex Question Answering over Knowledge Base}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.720},
}
Figure