Knowledge Base Question Answering (KBQA) aims to answer factoid questions based on knowledge bases. However, generating the most appropriate knowledge base query code based on Natural Language Questions (NLQ) poses a significant challenge in KBQA. In this work, we focus on the CCKS2023 Competition of Question Answering with Knowledge Graph Inference for Unmanned Systems. Inspired by the recent success of large language models (LLMs) like ChatGPT and GPT-3 in many QA tasks, we propose a ChatGPT-based Cypher Query Language (CQL) generation framework to generate the most appropriate CQL based on the given NLQ. Our generative framework contains six parts: an auxiliary model predicting the syntax-related information of CQL based on the given NLQ, a proper noun matcher extracting proper nouns from the given NLQ, a demonstration example selector retrieving similar examples of the input sample, a prompt constructor designing the input template of ChatGPT, a ChatGPT-based generation model generating the CQL, and an ensemble model to obtain the final answers from diversified outputs. With our ChatGPT-based CQL generation framework, we achieved the second place in the CCKS 2023 Question Answering with Knowledge Graph Inference for Unmanned Systems competition, achieving an F1-score of 0.92676.
翻译:知识库问答(KBQA)旨在基于知识库回答事实型问题。然而,基于自然语言问题(NLQ)生成最合适的知识库查询代码是KBQA中的重大挑战。本研究聚焦于CCKS2023无人系统知识图谱推理问答竞赛。受ChatGPT和GPT-3等大语言模型(LLMs)在众多问答任务中取得成功的启发,我们提出了一种基于ChatGPT的Cypher查询语言(CQL)生成框架,以根据给定NLQ生成最合适的CQL。该生成框架包含六个部分:基于给定NLQ预测CQL语法相关信息的辅助模型、从给定NLQ中提取专有名词的专有名词匹配器、检索输入样本相似示例的演示示例选择器、设计ChatGPT输入模板的提示构造器、生成CQL的基于ChatGPT的生成模型,以及从多样化输出中获取最终答案的集成模型。借助我们提出的基于ChatGPT的CQL生成框架,我们在CCKS 2023无人系统知识图谱推理问答竞赛中取得第二名,F1分数达到0.92676。