Hallucination Detection in Large Language Models

Fine-tuning of PhoBERT and XLM-RoBERTa for hallucination detection in LLM-generated outputs, achieving Macro-F1 of 0.77 on the Vihallu dataset.

This project investigates the problem of hallucination in large language model (LLM) outputs — instances where a model generates factually incorrect or fabricated information — and proposes a classification-based detection approach using fine-tuned pre-trained language models.

Motivation

As LLMs are increasingly deployed in high-stakes domains, ensuring the reliability and factual accuracy of generated text is of paramount importance. This work addresses hallucination detection as a supervised classification problem, leveraging domain-adapted language model representations.

Methodology

  • PhoBERT — a Vietnamese-specialised BERT model — was fine-tuned on the Vihallu benchmark dataset, a curated collection of human-annotated Vietnamese LLM outputs labelled for hallucination.
  • XLM-RoBERTa — a multilingual pre-trained transformer — was fine-tuned as a cross-lingual baseline for comparison.
  • Both models were evaluated under consistent experimental conditions using the Macro-F1 score as the primary evaluation metric.

Results

Model Macro-F1
PhoBERT (fine-tuned) 0.77
XLM-RoBERTa (fine-tuned)

The fine-tuned PhoBERT model achieved a Macro-F1 score of 0.77 on the Vihallu test set, demonstrating the effectiveness of domain-specific language model adaptation for hallucination detection in Vietnamese.

Technologies

Python · PyTorch · Hugging Face Transformers · PhoBERT · XLM-RoBERTa