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

arXiv: https://arxiv.org/abs/2502.09212 · HTML: https://mlsanity.com/paper/2502.09212/

## Key facts

- Cited by 1 papers in the map (data through 14 Oct 2026).
- Builds on 5 of its 17 references that are in the map.
- First posted on arXiv 13 Feb 2025.

## Builds on (most cited first, 5 of 5)

- [Retrieval-Augmented Generation for Large Language Models: A Survey](https://mlsanity.com/paper/2312.10997/) (2023)
- [Survey of Hallucination in Natural Language Generation](https://mlsanity.com/paper/2202.03629/) (2022)
- [Evaluating ChatGPT as a Question Answering System: A Comprehensive Analysis and Comparison with Existing Models](https://mlsanity.com/paper/2312.07592/) (2023)
- [Knowledge Authoring for Rules and Actions](https://mlsanity.com/paper/2305.07763/) (2023)
- [Experiences with Some Benchmarks for Deductive Databases and Implementations of Bottom-Up Evaluation](https://mlsanity.com/paper/1701.00627/) (2017)

## Built on by (most cited first, 1 of 1)

- [π-CoT: Prolog-Initialized Chain-of-Thought Prompting for Multi-Hop Question-Answering](https://mlsanity.com/paper/2506.20642/) (2025)

## Abstract (arXiv)

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.
