Yejin Bang, Ziwei Ji, Alan Schelten, Anthony Hartshorn, Tara Fowler, Cheng Zhang, Nicola Cancedda, Pascale Fung
This repo is the code release accompanying our release of HalluLens: LLM Hallucination Benchmark.
This code dynamically generates evaluation data to test textual hallucination in LLMs so that the test set is not leaked and the evaluation not gameable. This will allow researchers and developers to evaluate any existing and also future LLMs that will be released for textual hallucination.
LLM Hallucination is defined "as a model behavior where its output is found to be inconsistent with either its training corpus or the input context." Whereas the oracle for factuality can be difficult to define and even controversial at times, an oracle for hallucination can be defined internally with respect to the model.
LLM Hallucination Taxonomy
to evaluate the model’s hallucination level on short and fact-seeking queries based on the knowledge from training data. The questions are bounded to training data.
LongWiki: to evaluate the model’s hallucination level on long-form content generation based on the knowledge from training data
NonExistentRefusal: to evaluate the model’s likelihood of generating hallucinated information when prompted with knowledge beyond its training data such as non-existent instances that sound natural. We create nonexistent entity names in various domains such as animal, plant, business, brand that sound natural. It consists two sub-tasks: (i) MixedEntities (ii) GeneratedEntities
Table 1: Extrinsic hallucination evaluation results on three HalluLens tasks – PreciseWikiQA, LongWiki, and NonExistentEntities – in percentage (average of three trials of evaluation). Hallu refers to Hallucinated when not refused, a ratio of answers include incorrect answers when it did not refuse. Correct refers to total correct answer rate, where refusal is considered to be incorrect. False Accept. refers to false acceptance rate, likelihood of model fails to prevent from hallucination on nonexistent entities.
git clone https://github.com/facebookresearch/HalluLens.git
cd HalluLens
conda create --name hallulens python==3.12 #3.8.17
conda activate hallulens
pip install -r requirements.txt
We provide script to download all data needed for all three tasks. This code will download all the data that you need for HalluLens. All data will be downloded under the /data folder.
bash scripts/download_data.sh
It include as follow:
Set up your own inference method and replace it in function custom_api utils/lm.py
vllm serve meta-llama/Llama-3.1-405B-Instruct-FP8 --tensor-parallel-size 8
All scripts for each task is in scripts. There are mainly three steps for each tasks:
do_generate_prompt : It generates test prompt for each task under the folder of datado_inference: This argument enables the inference of your modeldo_eval: Evalaution for each tasks.By default, all three steps will be conducted when you run the scripts below. If you want the separate step, you can comment out the step you want to skip.
tasks/shortform/precise_wikiqa.py
bash scripts/task1_precisewikiqa.sh
tasks/longwiki/longwiki_main.py
bash scripts/task2_longwiki.sh
There are two subtasks:
(1) MixedEntities
tasks/refusal_test/nonsense_mixed_entities.py
bash scripts/task3-1_mixedentities.sh
(2) GeneratedEntities
tasks/refusal_test/round_robin_nonsene_name.py
bash scripts/task3-2_generatedentities.sh
@article{bang2025hallulens,
title={HalluLens: LLM Hallucination Benchmark},
author={Yejin Bang and Ziwei Ji and Alan Schelten and Anthony Hartshorn and Tara Fowler and Cheng Zhang and Nicola Cancedda and Pascale Fung},
year={2025},
eprint={2504.17550},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.17550},
}
The majority of HalluLens is licensed under CC-BY-NC, however portions of the project are available under separate license terms: https://github.com/shmsw25/FActScore is licensed under the MIT license; VeriScore is licensed under the Apache 2.0 license.
1 commits
Python
98.0%
Shell
2.0%
Yejin Bang, Ziwei Ji, Alan Schelten, Anthony Hartshorn, Tara Fowler, Cheng Zhang, Nicola Cancedda, Pascale Fung
This repo is the code release accompanying our release of HalluLens: LLM Hallucination Benchmark.
This code dynamically generates evaluation data to test textual hallucination in LLMs so that the test set is not leaked and the evaluation not gameable. This will allow researchers and developers to evaluate any existing and also future LLMs that will be released for textual hallucination.
LLM Hallucination is defined "as a model behavior where its output is found to be inconsistent with either its training corpus or the input context." Whereas the oracle for factuality can be difficult to define and even controversial at times, an oracle for hallucination can be defined internally with respect to the model.
LLM Hallucination Taxonomy
to evaluate the model’s hallucination level on short and fact-seeking queries based on the knowledge from training data. The questions are bounded to training data.
LongWiki: to evaluate the model’s hallucination level on long-form content generation based on the knowledge from training data
NonExistentRefusal: to evaluate the model’s likelihood of generating hallucinated information when prompted with knowledge beyond its training data such as non-existent instances that sound natural. We create nonexistent entity names in various domains such as animal, plant, business, brand that sound natural. It consists two sub-tasks: (i) MixedEntities (ii) GeneratedEntities
Table 1: Extrinsic hallucination evaluation results on three HalluLens tasks – PreciseWikiQA, LongWiki, and NonExistentEntities – in percentage (average of three trials of evaluation). Hallu refers to Hallucinated when not refused, a ratio of answers include incorrect answers when it did not refuse. Correct refers to total correct answer rate, where refusal is considered to be incorrect. False Accept. refers to false acceptance rate, likelihood of model fails to prevent from hallucination on nonexistent entities.
git clone https://github.com/facebookresearch/HalluLens.git
cd HalluLens
conda create --name hallulens python==3.12 #3.8.17
conda activate hallulens
pip install -r requirements.txt
We provide script to download all data needed for all three tasks. This code will download all the data that you need for HalluLens. All data will be downloded under the /data folder.
bash scripts/download_data.sh
It include as follow:
Set up your own inference method and replace it in function custom_api utils/lm.py
vllm serve meta-llama/Llama-3.1-405B-Instruct-FP8 --tensor-parallel-size 8
All scripts for each task is in scripts. There are mainly three steps for each tasks:
do_generate_prompt : It generates test prompt for each task under the folder of datado_inference: This argument enables the inference of your modeldo_eval: Evalaution for each tasks.By default, all three steps will be conducted when you run the scripts below. If you want the separate step, you can comment out the step you want to skip.
tasks/shortform/precise_wikiqa.py
bash scripts/task1_precisewikiqa.sh
tasks/longwiki/longwiki_main.py
bash scripts/task2_longwiki.sh
There are two subtasks:
(1) MixedEntities
tasks/refusal_test/nonsense_mixed_entities.py
bash scripts/task3-1_mixedentities.sh
(2) GeneratedEntities
tasks/refusal_test/round_robin_nonsene_name.py
bash scripts/task3-2_generatedentities.sh
@article{bang2025hallulens,
title={HalluLens: LLM Hallucination Benchmark},
author={Yejin Bang and Ziwei Ji and Alan Schelten and Anthony Hartshorn and Tara Fowler and Cheng Zhang and Nicola Cancedda and Pascale Fung},
year={2025},
eprint={2504.17550},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.17550},
}
The majority of HalluLens is licensed under CC-BY-NC, however portions of the project are available under separate license terms: https://github.com/shmsw25/FActScore is licensed under the MIT license; VeriScore is licensed under the Apache 2.0 license.
1 commits
Python
98.0%
Shell
2.0%