Coupling Large Language Models with Logic Programming for Robust and General Reasoning from Text

Zhun Yang, Adam Ishay, Joohyung Lee
7/15/2023
cs.CLcs.AIcs.SC

No official code found. Best implementation: azreasoners/LLM-ASP (32 stars, last commit 2025-08-09).

Abstract

While large language models (LLMs), such as GPT-3, appear to be robust and general, their reasoning ability is not at a level to compete with the best models trained for specific natural language reasoning problems. In this study, we observe that a large language model can serve as a highly effective few-shot semantic parser. It can convert natural language sentences into a logical form that serves as input for answer set programs, a logic-based declarative knowledge representation formalism. The combination results in a robust and general system that can handle multiple question-answering tasks without requiring retraining for each new task. It only needs a few examples to guide the LLM's adaptation to a specific task, along with reusable ASP knowledge modules that can be applied to multiple tasks. We demonstrate that this method achieves state-of-the-art performance on several NLP benchmarks, including bAbI, StepGame, CLUTRR, and gSCAN. Additionally, it successfully tackles robot planning tasks that an LLM alone fails to solve.

View on arXivView PDF

Code Implementations(1)

azreasoners/LLM-ASPCommunity100%
324Python, Jupyter NotebookMay 7, 20231 years ago

Similar Papers

Cite this paper

@article{yang2023coupling,
  title  = {Coupling Large Language Models with Logic Programming for Robust and General Reasoning from Text},
  author = {Zhun Yang and Adam Ishay and Joohyung Lee},
  year   = {2023},
  eprint = {2307.07696},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.07696v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2307.07696.svg)](https://codeofpaper.com/paper/2307.07696)

Discussion