Leveraging Graph Structures to Detect Hallucinations in Large Language Models

Noa Nonkes, Sergei Agaronian, Evangelos Kanoulas, Roxana Petcu
7/5/2024
cs.CLcs.LG

No official code found. Best implementation: noanonkes/Hallucination-Detection-in-LLMs (6 stars, last commit 2024-07-04).

Abstract

Large language models are extensively applied across a wide range of tasks, such as customer support, content creation, educational tutoring, and providing financial guidance. However, a well-known drawback is their predisposition to generate hallucinations. This damages the trustworthiness of the information these models provide, impacting decision-making and user confidence. We propose a method to detect hallucinations by looking at the structure of the latent space and finding associations within hallucinated and non-hallucinated generations. We create a graph structure that connects generations that lie closely in the embedding space. Moreover, we employ a Graph Attention Network which utilizes message passing to aggregate information from neighboring nodes and assigns varying degrees of importance to each neighbor based on their relevance. Our findings show that 1) there exists a structure in the latent space that differentiates between hallucinated and non-hallucinated generations, 2) Graph Attention Networks can learn this structure and generalize it to unseen generations, and 3) the robustness of our method is enhanced when incorporating contrastive learning. When evaluated against evidence-based benchmarks, our model performs similarly without access to search-based methods.

View on arXivView PDF

Code Implementations(1)

Detecting Hallucinations in Large Language Model Generations using Graph Structures

60Shell, PythonNov 6, 20232 years ago
graph-attention-networkgraphshallucination-detectionnatural-language-processing

Similar Papers

Cite this paper

@article{nonkes2024leveraging,
  title  = {Leveraging Graph Structures to Detect Hallucinations in Large Language Models},
  author = {Noa Nonkes and Sergei Agaronian and Evangelos Kanoulas and Roxana Petcu},
  year   = {2024},
  eprint = {2407.04485},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.04485v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.04485.svg)](https://codeofpaper.com/paper/2407.04485)

Discussion