ANAH: Analytical Annotation of Hallucinations in Large Language Models

Ziwei Ji, Yuzhe Gu, Wenwei Zhang, Chengqi Lyu, Dahua Lin, Kai Chen

Introduction

Large Language Models (LLMs) frequently "hallucinate," producing factually incorrect but fluent text. While detection methods exist, most current benchmarks are coarse-grained, labeling entire responses without pinpointing specific errors or providing corrections. This lack of granularity hinders the development of effective mitigation strategies and high-quality fine-tuning data.

The ANAH (Analytical Annotation of Hallucinations) framework addresses this gap by introducing a bilingual dataset for sentence-level hallucination analysis. By treating hallucination detection as a multi-step analytical task—encompassing reference retrieval, error classification, and factual correction—ANAH enables the training of specialized annotators that rival state-of-the-art models like GPT-4.

Fine-grained annotation process in ANAH, illustrating sentence-level reference retrieval, error type judgment, and correction.

Methodology

The researchers developed a human-in-the-loop pipeline to construct the ANAH dataset, consisting of four distinct stages:

  1. Topic Selection & Reference Retrieval: Over 700 topics were curated across 12 diverse domains (e.g., history, science, art). Corresponding reference documents were retrieved from trusted sources like Wikipedia and Encyclopedia Britannica.
  2. Question Generation & Selection: Using GPT-4, the team generated questions that could be answered exclusively using the provided references, ensuring objective ground truth.
  3. Answer Generation: To create a diverse pool of hallucinations, they generated both high-quality answers (using GPT-3.5 with references) and low-quality answers (using smaller models without references).
  4. Fine-grained Annotation: For every sentence in an answer, annotators identified the specific Reference Fragment, assigned a Hallucination Type (None, Contradictory, Unverifiable, or No Fact), and provided a Correction to align the text with the reference.
The four-stage pipeline for ANAH dataset construction: Topic Selection, Question Generation, Answer Generation, and Fine-grained Annotation.

Dataset Characteristics and Results

The resulting ANAH dataset is bilingual (English and Chinese) and contains approximately 12,000 sentence-level annotations across 4,300 LLM responses. Analysis of the dataset confirmed a "snowball effect": if a previous sentence is hallucinated, the probability of the current sentence also being a hallucination increases significantly (to ~58% in English).

By fine-tuning InternLM2 models (7B and 20B parameters) on ANAH, the researchers created specialized annotators. The ANAH-20B model achieved an accuracy of 81.01% and an F1 score of 80.49%, significantly outperforming GPT-3.5 (48.01% F1) and approaching GPT-4's performance (86.97% accuracy). A key finding was that "generative" annotators—those trained to explain and correct errors—were more effective at identifying hallucinations than purely "discriminative" models, especially in cases where errors are sparse.

Conclusion and Future Work

ANAH demonstrates that fine-grained, sentence-level annotation is a powerful tool for improving LLM reliability. While currently focused on Generative Question Answering (GQA), future work could extend this methodology to tasks like summarization and multi-turn dialogue. Additionally, improving models' internal knowledge and integrating more robust Retrieval-Augmented Generation (RAG) systems remain important avenues for further enhancing annotation quality.

Summary updated

BibTeX
@inproceedings{ji2024anah,
  author = {Ziwei Ji and Yuzhe Gu and Wenwei Zhang and Chengqi Lyu and Dahua Lin and Kai Chen},
  title = {{ANAH: Analytical Annotation of Hallucinations in Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.442},
}
Figure