Self-contradictory Hallucinations of Large Language Models: Evaluation, Detection and Mitigation

Niels Mündler, Jingxuan He, Slobodan Jenko, Martin T. Vechev
5/1/2023

No official code found. Best implementation: eth-sri/ChatProtect (38 stars, Apache-2.0, last commit 2026-04-15).

Abstract

Large language models (large LMs) are susceptible to producing text that contains hallucinated content. An important instance of this problem is self-contradiction, where the LM generates two contradictory sentences within the same context. In this work, we present a comprehensive investigation into self-contradiction for various instruction-tuned LMs, covering evaluation, detection, and mitigation. Our primary evaluation task is open-domain text generation, but we also demonstrate the applicability of our approach to shorter question answering. Our analysis reveals the prevalence of self-contradictions, e.g., in 17.7% of all sentences produced by ChatGPT. We then propose a novel prompting-based framework designed to effectively detect and mitigate self-contradictions. Our detector achieves high accuracy, e.g., around 80% F1 score when prompting ChatGPT. The mitigation algorithm iteratively refines the generated text to remove contradictory information while preserving text fluency and informativeness. Importantly, our entire framework is applicable to black-box LMs and does not require retrieval of external knowledge. Rather, our method complements retrieval-based methods, as a large portion of self-contradictions (e.g., 35.2% for ChatGPT) cannot be verified using online text. Our approach is practically effective and has been released as a push-button tool to benefit the public at https://chatprotect.ai/.

View on arXivView PDF

Code Implementations(1)

eth-sri/ChatProtectCommunity100%
Apache-2.0

This is the code for the paper "Self-contradictory Hallucinations of Large Language Models: Evaluation, Detection and Mitigation".

383CSS, HTMLSep 8, 20236 months agoApache-2.0

Similar Papers

Cite this paper

@article{mndler2023selfcontradictory,
  title  = {Self-contradictory Hallucinations of Large Language Models: Evaluation, Detection and Mitigation},
  author = {Niels Mündler and Jingxuan He and Slobodan Jenko and Martin T. Vechev},
  year   = {2023},
  eprint = {2305.15852},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2305.15852},
  journal = {ICLR 2023 2023}
}

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/2305.15852.svg)](https://codeofpaper.com/paper/2305.15852)

Discussion