Skip to main navigation Skip to search Skip to main content

LP-LM: No Hallucinations in Question Answering with Logic Programming

  • Cornell University

Research output: Contribution to journalConference articlepeer-review

Abstract

Large language models (LLMs) are able to generate human-like responses to user queries. However, LLMs exhibit inherent limitations, especially because they hallucinate. This paper introduces LP-LM, a system that grounds answers to questions in known facts contained in a knowledge base (KB), facilitated through semantic parsing in Prolog, and always produces answers that are reliable. LP-LM generates a most probable constituency parse tree along with a corresponding Prolog term for an input question via Prolog definite clause grammar (DCG) parsing. The term is then executed against a KB of natural language sentences also represented as Prolog terms for question answering. By leveraging DCG and tabling, LP-LM runs in linear time in the size of input sentences for sufficiently many grammar rules. Performing experiments comparing LP-LM with current well-known LLMs in accuracy, we show that LLMs hallucinate on even simple questions, unlike LP-LM.

Original languageEnglish
Pages (from-to)69-77
Number of pages9
JournalElectronic Proceedings in Theoretical Computer Science, EPTCS
Volume416
DOIs
StatePublished - Feb 13 2025
Event40th International Conference on Logic Programming, ICLP 2024 - Dallas, United States
Duration: Oct 14 2024Oct 17 2024

Fingerprint

Dive into the research topics of 'LP-LM: No Hallucinations in Question Answering with Logic Programming'. Together they form a unique fingerprint.

Cite this