Fact Verification on Knowledge Graph via Programmatic Graph Reasoning

Yue Hao, Desheng Wu2025

TL;DR

Researchers have developed Programmatic Graph Reasoning (PGR), a framework that turns fact-checking into a coding task. Instead of asking a Large Language Model (LLM) to "guess" if a claim is true based on a Knowledge Graph, PGR forces the model to write and execute a step-by-step program to find the answer, achieving a new state-of-the-art accuracy of 86.82%.

What Problem Does This Paper Address?

Verifying facts against a Knowledge Graph (KG)—a structured database of entities and their relationships—is surprisingly difficult. Traditional methods rely on Natural Language Inference (NLI). In this setup, a model looks at a claim (e.g., "The CEO of Apple was born in Nebraska") and a set of retrieved facts, then tries to predict if the claim is supported or refuted.

The problem? This reasoning is implicit. It’s a "black box" process that struggles with complex logic. If a claim requires multiple steps (multi-hop reasoning), involves negations ("is not the leader"), or combines multiple facts, NLI models often trip up. They lack a transparent way to manage variables and logical flow, making it hard for humans to understand why a model reached a specific verdict.

Methods

The authors introduce PGR, which shifts the paradigm from implicit inference to explicit programmatic reasoning. The process happens in two main stages:

  1. Program Generation: An LLM (like GPT-4o) acts as a programmer. Given a claim and a list of entities, it generates a structured program using three predefined functions:
  2. SEARCH: Queries the KG to find a missing piece of information (e.g., "Who is the leader of Uruguay?").
  3. MATCH: Checks if a specific relationship exists in the KG (e.g., "Is Montevideo in Uruguay?").
  4. VERIFY: A logical wrapper that takes the Boolean results of the previous steps and applies logic (AND, OR, NOT) to produce a final True/False verdict.
  5. Graph Reasoning (Execution): The generated program is executed sequentially. The SEARCH and MATCH functions interact directly with the Knowledge Graph to retrieve evidence. This ensures the reasoning follows a strict, verifiable path.

By defining this "API" for the KG, the authors leverage the LLM’s strengths in code generation and logical planning while offloading the actual "fact-finding" to a deterministic execution engine.

Datasets

The study primarily uses FactKG, a large-scale benchmark containing 108,674 claims based on DBpedia. These claims are categorized into types like one-hop, multi-hop, existence, and negation, making it a rigorous test for logical depth.

To further test the framework's modularity and multi-hop capabilities, the authors also evaluated PGR on the MetaQA dataset, specifically the 3-hop split, which requires navigating three layers of connections in a movie-related knowledge graph.

Key Insights and Ideas

  • Explicit vs. Implicit: The "aha moment" is that complex reasoning is better handled as a structured program than a text-to-text inference task. Programs naturally handle "state" (saving the result of one step to use in the next) and "logic" (negations and conjunctions) far better than standard neural classifiers.
  • Interpretability by Design: Because the output is a program, the reasoning path is entirely transparent. If the model fails, you can see exactly which step went wrong—whether it was a SEARCH that returned the wrong entity or a VERIFY step that misapplied a negation.
  • Efficiency in Few-Shot Learning: PGR performs remarkably well in "low-resource" settings. By providing just a few examples of how to write these programs, the LLM can generalize to highly complex claims without needing thousands of labeled training examples.

Key Results

  • State-of-the-Art Performance: PGR achieved 86.82% accuracy on the FactKG dataset, outperforming all previous baselines, including specialized models like GEAR and other LLM-based approaches like KG-GPT.
  • Massive Gains in Complexity: The most significant improvements were seen in multi-hop and multi-claim scenarios. For instance, PGR outperformed the previous best LLM method (KG-GPT†) by 8.27% in overall accuracy, with a staggering 16.17% lead in the multi-hop category.
  • Robustness to Negation: By using an explicit not operator in the generated code, PGR handled negation claims with 81.16% accuracy, far exceeding the 55-63% range seen in traditional transformer models.

Limitations and Future Work

Despite its success, the authors identify a few hurdles:

  • Execution Errors: A significant portion of errors (up to 63% in negation claims) occurred during the execution stage. This happens when the program logic is correct, but the KG search fails to find the exact entity or relation due to naming mismatches.
  • LLM Dependency: The system relies on the LLM's ability to interpret the claim correctly. If the LLM misinterprets a "multi-hop" claim as a "multi-claim" one, the resulting program structure will be fundamentally flawed.
  • Cost: Using high-performance LLMs for every claim involves significant token costs. Future work could explore using smaller, fine-tuned open-source models to generate these programs more cheaply.

The authors suggest that future iterations could focus on refining the entity disambiguation process to reduce execution failures and expanding the function library to handle even more diverse reasoning types.

Summary updated

BibTeX
@misc{hao2025fact,
  author = {Yue Hao and Desheng Wu},
  title = {{Fact Verification on Knowledge Graph via Programmatic Graph Reasoning}},
  year = {2025},
  doi = {10.18653/v1/2025.findings-emnlp.293},
}

Loading related content...

Figure