Large language models (LLMs), such as GPT-3 and GPT-4, have demonstrated exceptional performance in various natural language processing tasks and have shown the ability to solve certain reasoning problems. However, their reasoning capabilities are limited and relatively shallow, despite the application of various prompting techniques. In contrast, formal logic is adept at handling complex reasoning, but translating natural language descriptions into formal logic is a challenging task that non-experts struggle with. This paper proposes a neuro-symbolic method that combines the strengths of large language models and answer set programming. Specifically, we employ an LLM to transform natural language descriptions of logic puzzles into answer set programs. We carefully design prompts for an LLM to convert natural language descriptions into answer set programs in a step by step manner. Surprisingly, with just a few in-context learning examples, LLMs can generate reasonably complex answer set programs. The majority of errors made are relatively simple and can be easily corrected by humans, thus enabling LLMs to effectively assist in the creation of answer set programs.
翻译:大型语言模型(LLMs),例如GPT-3和GPT-4,已在各种自然语言处理任务中展现出卓越的性能,并显示出解决某些推理问题的能力。然而,尽管应用了多种提示技巧,其推理能力仍然有限且相对浅显。相比之下,形式逻辑擅长处理复杂推理,但将自然语言描述转化为形式逻辑是一项具有挑战性的任务,非专业人士难以胜任。本文提出了一种神经符号方法,该方法结合了大语言模型与回答集编程的优势。具体而言,我们利用一个LLM将逻辑谜题的自然语言描述转化为回答集程序。我们精心设计了提示,引导LLM以逐步方式将自然语言描述转化为回答集程序。令人惊讶的是,仅凭少量上下文学习示例,LLM就能生成相当复杂的回答集程序。大多数错误相对简单,易于人工纠正,从而使LLM能够有效辅助回答集程序的创建。