Logic-Guided Extraction Improves LLM Fact Accuracy

Mario Alviano, Lorenzo Grillo, Nicola Leone, Fabrizio Lo Scudo· July 23, 2026 View original

Summary

This paper proposes a logic-guided data extraction framework combining LLM-based extraction with Answer Set Programming (ASP). It uses ASP for validation, inference, and consistency checking, reducing LLM calls and improving extraction quality by mitigating spurious outputs.

Large Language Models (LLMs) are increasingly used for semantic data extraction from unstructured text, generating relational facts. However, they often struggle with tasks requiring complex combinatorial reasoning and global consistency, leading to unreliable outputs. Researchers have developed a novel logic-guided data extraction framework that integrates LLM-based extraction with Answer Set Programming (ASP). In this hybrid approach, the LLM generates candidate facts, while ASP takes on the crucial roles of validation, inference, consistency checking, and control. Unlike traditional pipelines that query LLMs for all predicates independently, this framework interleaves LLM calls with ASP derivation. ASP identifies logically admissible predicates, guiding subsequent extraction queries, inferring implied facts without extra LLM calls, and detecting inconsistencies early. This method reduces LLM calls and significantly improves extraction quality by reducing spurious outputs.

Why it matters

For professionals needing highly accurate and consistent data extraction from unstructured text, this framework offers a robust solution. It combines the generative power of LLMs with the logical rigor of ASP, leading to more reliable and efficient information retrieval.

How to implement this in your domain

  1. 1Evaluate current data extraction pipelines for LLM-induced inconsistencies or inefficiencies in complex reasoning tasks.
  2. 2Integrate Answer Set Programming (ASP) as a validation and inference layer on top of existing LLM extraction modules.
  3. 3Design ASP rules to encode domain-specific logic, constraints, and relationships for the target data.
  4. 4Implement the interleaving mechanism, where ASP guides LLM queries and infers logically implied facts.
  5. 5Utilize the caching mechanism for logic-based control queries to further optimize performance and reduce LLM API costs.

Who benefits

LegalHealthcareFinanceResearchData Management

Key takeaways

  • A new framework combines LLM extraction with Answer Set Programming (ASP) for data extraction.
  • ASP validates, infers, and checks consistency, guiding LLM queries.
  • The approach reduces LLM calls and improves extraction quality by mitigating spurious outputs.
  • It offers a more reliable method for semantic data extraction from unstructured text.

Original post by Mario Alviano, Lorenzo Grillo, Nicola Leone, Fabrizio Lo Scudo

"arXiv:2607.19365v1 Announce Type: new Abstract: When Large Language Models (LLMs) are used for semantic data extraction from unstructured text, producing candidate relational facts from natural language, they may remain unreliable for tasks requiring complex combinatorial reasoni…"

View on X

Originally posted by Mario Alviano, Lorenzo Grillo, Nicola Leone, Fabrizio Lo Scudo on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses