GraphEval: A Knowledge-Graph Based LLM Hallucination Evaluation Framework

Hannah Joelle Sansford, Nicholas Richardson, Hermina Petric Maretic, Juba Nait SaadaKiL @ KDD 2024

TL;DR

This paper introduces GraphEval, a novel framework that uses knowledge graphs (KGs) to evaluate Large Language Model (LLM) hallucinations. By breaking down LLM outputs into KG triples, GraphEval offers more explainable and accurate hallucination detection, improving performance over standard methods. They also propose GraphCorrect, a KG-guided approach to fix identified hallucinations.

What Problem Does This Paper Address?

Large Language Models (LLMs) are powerful but prone to "hallucinations" – generating plausible-sounding but factually incorrect information. This is a major hurdle for deploying LLMs in critical applications like medical diagnosis. Existing evaluation metrics often lack explainability (they don't pinpoint where the hallucination occurred), struggle to systematically check all information, and can be computationally expensive. The paper focuses on detecting hallucinations within a closed-domain setting, where the LLM is provided with specific context it should adhere to.

Methods

The core of GraphEval is a two-stage process:

  1. KG Construction: The LLM's output is transformed into a Knowledge Graph (KG). This involves identifying entities and the relationships between them, represented as triples (e.g., ["entity1", "relation", "entity2"]). The authors leverage LLMs themselves for this stage, using a simple prompt engineering approach with chain-of-thought prompting and in-context learning.
  2. Triple-wise Evaluation: Each triple from the constructed KG is then evaluated for factual consistency against the provided grounding context. This is done using off-the-shelf Natural Language Inference (NLI) models. If any triple is flagged as inconsistent, the entire LLM output is considered to contain a hallucination.

This approach allows for pinpointing specific factual errors within the LLM's output. The paper also introduces GraphCorrect, a method that uses the identified inconsistent triples to guide an LLM in correcting the original output.

Datasets

The paper evaluates GraphEval on three established benchmarks for hallucination detection:

  • SummEval: A dataset of human evaluations on summarization model outputs.
  • QAGS-C and QAGS-X: Datasets derived from CNN/DailyMail and XSum, where human annotators assess sentence-level factual consistency.

Key Insights and Ideas

  • Explainability through KGs: Representing LLM outputs as KGs allows for a more granular understanding of where hallucinations occur, moving beyond a simple "hallucinated/not hallucinated" label.
  • KG Construction is Key: The effectiveness of GraphEval hinges on the quality of the KG construction. The authors demonstrate that even a simple LLM-based KG construction method can yield significant improvements.
  • Short Outputs are Tricky: GraphEval's benefits are most pronounced with longer LLM outputs. For very short outputs, the KG structure might not add much value, and standard NLI models can perform comparably.
  • Correction is Feasible: The KG structure not only aids detection but also provides a clear pathway for correction, enabling targeted edits to LLM outputs.

Key Results

  • Improved Accuracy: When combined with state-of-the-art NLI models, GraphEval consistently improves balanced accuracy on hallucination detection benchmarks. On average, it leads to a 6.2% improvement (SE=1.3) across datasets.
  • Targeted Correction: GraphCorrect successfully corrects a significant majority of hallucinations, outperforming a direct prompting strategy for hallucination correction. For instance, on the SummEval dataset with HHEM+GraphEval detection, GraphCorrect achieved 55.1% of believed corrected hallucinations compared to 48.6% for the direct prompt.
  • ROUGE Scores: GraphCorrect also produces corrected summaries that maintain higher similarity to the original LLM outputs, as indicated by improved ROUGE-1, ROUGE-2, and ROUGE-L scores compared to the direct prompt method.

Limitations and Future Work

  • KG Construction Quality: The paper acknowledges that information loss can occur during KG construction. While their method generally doesn't reduce accuracy, this is an area for future improvement.
  • Open-Domain Hallucinations: GraphEval is currently focused on closed-domain tasks. Extending it to open-domain hallucination detection would require integrating external knowledge retrieval mechanisms.
  • Manual Evaluation of Correction: The authors note that the effectiveness of GraphCorrect should ideally be assessed manually, as relying solely on evaluation frameworks for measuring correction can be convoluted.
  • Advancements in KG Construction: The authors anticipate that future improvements in LLM-based KG construction techniques will further enhance GraphEval's performance.

Summary updated

BibTeX
@inproceedings{sansford2024grapheval,
  author = {Hannah Joelle Sansford and Nicholas Richardson and Hermina Petric Maretic and Juba Nait Saada},
  title = {{GraphEval: A Knowledge-Graph Based LLM Hallucination Evaluation Framework}},
  booktitle = {KiL @ KDD},
  year = {2024},
  url = {https://openreview.net/forum?id=75wgprxgAl},
}
Figure