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

Authors

  • Zhijie Nie SKLSDE, School of Computer Science and Engineering, Beihang University Shen Yuan Honors College, Beihang University
  • Richong Zhang SKLSDE, School of Computer Science and Engineering, Beihang University Zhongguancun Laboratory, Beijing
  • Zhongyuan Wang SKLSDE, School of Computer Science and Engineering, Beihang University
  • Xudong Liu SKLSDE, School of Computer Science and Engineering, Beihang University

DOI:

https://doi.org/10.1609/aaai.v38i17.29848

Keywords:

NLP: Question Answering, NLP: (Large) Language Models

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.

Published

2024-03-24

How to Cite

Nie, Z., Zhang, R., Wang, Z., & Liu, X. (2024). Code-Style In-Context Learning for Knowledge-Based Question Answering. Proceedings of the AAAI Conference on Artificial Intelligence, 38(17), 18833-18841. https://doi.org/10.1609/aaai.v38i17.29848

Issue

Section

AAAI Technical Track on Natural Language Processing II