Lune

AAAI2024Top-tier venue

Code-Style In-Context Learning for Knowledge-Based Question Answering

Zhijie Nie, Richong Zhang, Zhongyuan Wang, Xudong Liu

Abstract

Current methods for Knowledge-Based Question Answering (KBQA) usually rely on complex training techniques and model frameworks, leading to many limitations in practical applications. Recently, the emergence of In-Context Learning (ICL) capabilities in Large Language Models (LLMs) provides a simple and training-free semantic parsing paradigm for KBQA: Given a small number of questions and their labeled logical forms as demo examples, LLMs can understand the task intent and generate the logic form for a new question. However, current powerful LLMs have little exposure to logic forms during pre-training, resulting in a high format error rate. To solve this problem, we propose a code-style in-context learning method for KBQA, which converts the generation process of unfamiliar logical form into the more familiar code generation process for LLMs. Experimental results on three mainstream datasets show that our method dramatically mitigated the formatting error problem in generating logic forms while realizing a new SOTA on WebQSP, GrailQA, and GraphQ under the few-shot setting. The code and supplementary files are released at https://github.com/ Arthurizijar/KB-Coder.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

16 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Enhancing Complex Question Answering over Knowledge Graphs through Evidence Pattern Retrieval cites Beyond I.I.D.: Three Levels of Generalization for Question Answering on Knowledge Bases
  • Middleware for LLMs: Tools Are Instrumental for Language Agents in Complex Environments cites Beyond I.I.D.: Three Levels of Generalization for Question Answering on Knowledge Bases
  • QueryAgent: A Reliable and Efficient Reasoning Framework with Environmental Feedback based Self-Correction cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • QueryAgent: A Reliable and Efficient Reasoning Framework with Environmental Feedback based Self-Correction cites Least-to-Most Prompting Enables Complex Reasoning in Large Language Models
  • QueryAgent: A Reliable and Efficient Reasoning Framework with Environmental Feedback based Self-Correction cites Beyond I.I.D.: Three Levels of Generalization for Question Answering on Knowledge Bases
  • QueryAgent: A Reliable and Efficient Reasoning Framework with Environmental Feedback based Self-Correction cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Self-Consistency Improves Chain of Thought Reasoning in Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Debate on Graph: A Flexible and Reliable Reasoning Framework for Large Language Models cites Beyond I.I.D.: Three Levels of Generalization for Question Answering on Knowledge Bases
  • Debate on Graph: A Flexible and Reliable Reasoning Framework for Large Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Least-to-Most Prompting Enables Complex Reasoning in Large Language Models cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Least-to-Most Prompting Enables Complex Reasoning in Large Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Privacy-protected Retrieval-Augmented Generation for Knowledge Graph Question Answering cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
  • Privacy-protected Retrieval-Augmented Generation for Knowledge Graph Question Answering cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers16

  1. Enhancing Complex Question Answering over Knowledge Graphs through Evidence Pattern RetrievalWentao Ding, Jinmao Li, Liangchuan Luo, Yuzhong QuWWW 2024 · 32 citations
  2. Middleware for LLMs: Tools Are Instrumental for Language Agents in Complex EnvironmentsYu Gu, Yiheng Shu, Hao Yu, Xiao Liu et al.EMNLP 2024 · 11 citations
  3. Debate on Graph: A Flexible and Reliable Reasoning Framework for Large Language ModelsJie Ma, Zhitao Gao, Qi Chai, Wangchun Sun et al.AAAI 2025 · 8 citations
  4. QueryAgent: A Reliable and Efficient Reasoning Framework with Environmental Feedback based Self-CorrectionXiang Huang, Sitao Cheng, Shanshan Huang, Jiayu Shen et al.ACL 2024 · 3 citations
  5. Privacy-protected Retrieval-Augmented Generation for Knowledge Graph Question AnsweringYunfeng Ning, Mayi Xu, Jintao Wen, Qiankun Pi et al.AAAI 2026 · 3 citations

Builds on14

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. SimCSE: Simple Contrastive Learning of Sentence EmbeddingsTianyu Gao, Xingcheng Yao, Danqi ChenEMNLP 2021 · 2,496 citations
  3. Self-Consistency Improves Chain of Thought Reasoning in Language ModelsXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le et al.ICLR 2023 · 681 citations
  4. Least-to-Most Prompting Enables Complex Reasoning in Large Language ModelsDenny Zhou, Nathanael Schärli, Le Hou, Jason Wei et al.ICLR 2023 · 318 citations
  5. Beyond I.I.D.: Three Levels of Generalization for Question Answering on Knowledge BasesYu Gu, Sue Kase, Michelle Vanni, Brian M. Sadler et al.WWW 2021 · 304 citations

Related papers

  1. How Proficient Are Large Language Models in Formal Languages? An In-Depth Insight for Knowledge Base Question AnsweringJinxin Liu, Shulin Cao, Jiaxin Shi, Tingjian Zhang et al.ACL Findings 2024 · 8 citations
  2. Augmenting Reasoning Capabilities of LLMs with Graph Structures in Knowledge Base Question AnsweringYuhang Tian, Dandan Song, Zhijing Wu, Changzhi Zhou et al.EMNLP Findings 2024 · 5 citations
  3. Few-shot In-context Learning on Knowledge Base Question AnsweringTianle Li, Xueguang Ma, Alex Zhuang, Yu Gu et al.ACL 2023 · 55 citations
  4. Subgraph-Guided Executable Logical Form Generation for Knowledge Base Question AnsweringYuhang Tian, Dandan Song, Zhijing Wu, Changzhi Zhou et al.ACL Findings 2026
  5. SymKGQA: Few-Shot Knowledge Graph Question Answering via Symbolic Program Generation and ExecutionPrerna Agarwal, Nishant Kumar, Srikanta BedathurACL 2024 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines