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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wu, Katherine, Liu, Yanhong A.
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915149717176320
author Wu, Katherine
Liu, Yanhong A.
author_facet Wu, Katherine
Liu, Yanhong A.
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2502_09212
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle LP-LM: No Hallucinations in Question Answering with Logic Programming
Wu, Katherine
Liu, Yanhong A.
Artificial Intelligence
Computation and Language
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.
title LP-LM: No Hallucinations in Question Answering with Logic Programming
topic Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2502.09212