# Few-shot In-context Learning for Knowledge Base Question Answering

Source: [Few-shot In-context Learning for Knowledge Base Question Answering](<https://www.sota2.com/research/paper/68fa6f4a1e209131cea44cfe>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-28T13:56:58.783Z

Authors: Tianle Li, Xueguang Ma, Alex Zhuang, Yu Gu, Yu Su, Wenhu Chen

Published: 2023-05-02T19:31:55.000Z

## Abstract

Question answering over knowledge bases is considered a difficult problem due to the challenge of generalizing to a wide variety of possible natural language questions. Additionally, the heterogeneity of knowledge base schema items between different knowledge bases often necessitates specialized training for different knowledge base question-answering (KBQA) datasets. To handle questions over diverse KBQA datasets with a unified training-free framework, we propose KB-BINDER, which for the first time enables few-shot in-context learning over KBQA tasks. Firstly, KB-BINDER leverages large language models like Codex to generate logical forms as the draft for a specific question by imitating a few demonstrations. Secondly, KB-BINDER grounds on the knowledge base to bind the generated draft to an executable one with BM25 score matching. The experimental results on four public heterogeneous KBQA datasets show that KB-BINDER can achieve a strong performance with only a few in-context demonstrations. Especially on GraphQA and 3-hop MetaQA, KB-BINDER can even outperform the state-of-the-art trained models. On GrailQA and WebQSP, our model is also on par with other fully-trained models. We believe KB-BINDER can serve as an important baseline for future research. Our code is available at https://github.com/ltl3A87/KB-BINDER.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Knowledge Base Question Answering on SPICE (test)](<https://www.sota2.com/research/sota/knowledge-base-question-answering-on-spice-test.md>): Knowledge Base Question Answering; SPICE (test); m-F1 (Logical Reasoning): 46.85.

- [Knowledge Graph Question Answering on CWQ](<https://www.sota2.com/research/sota/knowledge-graph-question-answering-on-cwq.md>): Knowledge Graph Question Answering; CWQ; Hit@1: 54.8.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2305.01750>)

[PDF](<https://arxiv.org/pdf/2305.01750.pdf>)
