HalluLens: LLM Hallucination Benchmark๋ฅผ ํ๊ตญ์ด adaptation์ ํ์ฌ ๋ชจ๋ธ์ Hallucination์ ํ๊ฐํ๋ ๊ธฐ๋ฅ์ ์ถ๊ฐํ์ต๋๋ค.
Authors:
Yejin Bang, Ziwei Ji, Alan Schelten, Anthony Hartshorn, Tara Fowler, Cheng Zhang,
Nicola Cancedda, Pascale Fung
- ๐ตโ๐ซLLM Hallucination ์ ํ
- ๐งช ์ฃผ์ ํ๊ฐํญ๋ชฉ
- ๐ ์คํ ๋ฐฉ๋ฒ (How to Run)
โ ๏ธ Notice
Extrinsic Hallucination: ํ์ต ๋ฐ์ดํฐ์ ์ผ์นํ์ง ์๋ ์์ฑ ๊ฒฐ๊ณผ๋ฌผ์ ๋๋ค. ์ด๋ ์ ๋ ฅ๋ ๋ฌธ๋งฅ(context)์ ์ํด ๋ท๋ฐ์นจ๋ ์๋, ๋ฐ๋ฐ๋ ์๋ ์์ต๋๋ค. ์ด๋ฌํ ํ๊ฐ์ ๋ชจ๋ธ์ด (์์ ์ง์์ ๊ธฐ๋ฐํ ์์ ํ์ ํ ์คํธ ๋ฑ) ์๋ก์ด ์ฝํ ์ธ ๋ฅผ ์์ฑํ๊ฑฐ๋ ์ง์์ ๊ฒฉ์ฐจ๋ฅผ ๋ฉ์ฐ๋ ค ํ ๋ ์์ฃผ ๋ฐ์ํฉ๋๋ค. ์ด๋ ํ์ต ๋ฐ์ดํฐ๋ก๋ถํฐ ์ง์์ ํก์ํ๋ ๋ชจ๋ธ์ ํ๊ณ์ ์์ ์ ์ง์ ๊ฒฝ๊ณ๋ฅผ ์ธ์ํ์ง ๋ชปํ๋ ๋ฅ๋ ฅ์ด ๋ถ์กฑํจ์ ๋ฐ์ํฉ๋๋ค.
Intrinsic Hallucination: **์ ๋ ฅ๋ ๋ฌธ๋งฅ(context)**๊ณผ ์ผ์นํ์ง ์๋ ์์ฑ ๊ฒฐ๊ณผ๋ฌผ์ ๋๋ค. ๋ชจ๋ธ์ด ์ ๋ ฅ ๋ฌธ๋งฅ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ดํดํ์ง ๋ชปํ ๋, ์ ๋ ฅ ์ง์(query)์ ๋ชจ์๋๊ฑฐ๋ ์๋ณธ ์ ๋ ฅ ์ง์์ ์ํด ๋ท๋ฐ์นจ๋์ง ์๋ ๋ด์ฉ์ ์์ฑํฉ๋๋ค. ์ด๋ ์ถ๋ก ์์ (inference-time)์ ์ผ๊ด์ฑ์ ์ ์งํ์ง ๋ชปํ๋ ๋ชจ๋ธ์ ๋ฅ๋ ฅ์ด ๋ถ์กฑํจ์ ๋ฐ์ํฉ๋๋ค.
- PreciseWikiQA: ๋ชจ๋ธ์ด trainํ ๋ฐ์ดํฐ ๋ด ์ง์์ ๊ธฐ๋ฐ์ผ๋ก, ์งง๊ณ ์ฌ์ค ํ์ธ์ ์๊ตฌํ๋ ์ง์์ ๋ํ ๋ชจ๋ธ์ ํ๊ฐ(hallucination) ์์ค์ ํ๊ฐํฉ๋๋ค. ์ง๋ฌธ์ ํ์ต ๋ฐ์ดํฐ ๋ฒ์ ๋ด๋ก ํ์ ๋ฉ๋๋ค.
- LongWiki: ๋ชจ๋ธ์ ํ์ต ๋ฐ์ดํฐ ๋ด ์ง์์ ๊ธฐ๋ฐ์ผ๋ก ์ฅ๋ฌธ(long-form) ์ฝํ ์ธ ์์ฑ์ ๋ชจ๋ธ์ ํ๊ฐ ์์ค์ ํ๊ฐํฉ๋๋ค.
- NonExistentRefusal: ๊ทธ๋ด๋ฏํ๊ฒ ๋ค๋ฆฌ์ง๋ง ์ค์ ๋ก๋ ์กด์ฌํ์ง ์๋ ์ฌ๋ก์ ๊ฐ์ด, ํ์ต ๋ฐ์ดํฐ ๋ฒ์๋ฅผ ๋ฒ์ด๋๋ ์ง์์ ๋ํ ํ๋กฌํํธ๋ฅผ ๋ฐ์์ ๋ ๋ชจ๋ธ์ด ํ๊ฐ ์ ๋ณด(์ง์ด๋ธ ์ ๋ณด)๋ฅผ ์์ฑํ ๊ฐ๋ฅ์ฑ์ ํ๊ฐํฉ๋๋ค. (์ด๋ฅผ ์ํด) ๋๋ฌผ, ์๋ฌผ, ๊ธฐ์ , ๋ธ๋๋ ๋ฑ ๋ค์ํ ์์ญ์์ ๊ทธ๋ด๋ฏํ๊ฒ ๋ค๋ฆฌ๋, ์กด์ฌํ์ง ์๋ ๊ฐ์ฒด๋ช ์ ์์ฑํ์ฌ ์ฌ์ฉํฉ๋๋ค. ์ด๋ ๋ ๊ฐ์ง ํ์ ์์ ์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค: (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.
โ ๏ธ ์ฃผ์: ๋ณธ benchmark๋ ๋ชจ๋ธ์ด Wikipedia ์ง์์ ํ์ตํ๋ค๊ณ ๊ฐ์ ํฉ๋๋ค. ๋ชจ๋ธ์ด ์ํคํผ๋์ ์ง์์ ํ์ตํ์ง ์์๋ค๋ฉด, ํ๊ฐ ๊ฒฐ๊ณผ๊ฐ ์๊ณก๋ ์ ์์ต๋๋ค.- Intrinsic Hallucination์ ํ์ฌ KoHalluLens์์ ๋ค๋ฃจ์ง ์์ต๋๋ค.
git clone https://github.com/facebookresearch/HalluLens.git
cd HalluLens
conda create --name hallulens python==3.12 #3.8.17
conda activate hallulens
[uv ์ค์น์]
pip install uv
uv sync
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.
Wikipedia dump is large (~16GB), so please make sure you have enough space. And it may not be able to download from this
codes.
์ฐธ๊ณ : en-wiki-20230401.db ํ์ผ์ ์ง์ ๋ค์ด๋ก๋ ํ ์ง์ ๊ฒฝ๋ก์ ๋ฃ์ด์ฃผ์
์ผ ํฉ๋๋ค. (์์ธ ๋ด์ฉ์ ์๋ 'ํ๊ตญ์ด ๋ฐ์ดํฐ ๋ค์ด๋ก๋' ์ฐธ๊ณ )
bash scripts/download_data.sh
It include as follow:
- Wikirank
- GoodWiki
- Processed Wikipedia dump (from FactScore)
- ITIS taxonomy
- 250k Medicines Usage, Side Effects and Substitutes
- togther ai api key
.envํ์ผ์ ์ค์ inference_methodํ๋ผ๋ฏธํฐ๋ฅผ'together'๋ก ์ค์
Set up your own inference method and replace it in function custom_api utils/lm.py
- For our experiments, we used model checkpoints from Huggingface and hosted through vLLM package -- which you can directly use the default setup call_vllm_api. Refer to VLLM blog for details. For example:
vllm serve meta-llama/Llama-3.1-405B-Instruct-FP8 --tensor-parallel-size 8
- We have set the test set prompt generators and LLM evaluator to be same as our experiment set ups. We recommend to use same set up to replicate the results.
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
- Note: We used Brave Search API for search function. You can either use it with your own access key or your preferred API.
bash scripts/task3-2_generatedentities.sh
- together ai api
- brave search api
- openai api
- Anthropic ai api
- grok api
- other api keys for custom llm hosting
-
๋ฐ์ดํฐ ๋ค์ด๋ก๋
- โญ๏ธ ์ค์!!:
donwload.sh๋ก ๋ฐ์ดํฐ ๋ค์ด๋ก๋ ์enwiki-20230401.dbํ์ผ์ด ์ ์์ ์ผ๋ก ๋ฐ์์ง์ง ์์ ์ ์์ต๋๋ค. - ์คํจ์ ์ด ๋งํฌ ์์ ์ง์ ๋ค์ด๋ก๋ํด ์ฃผ์ธ์. 20GB๋ก ๋งค์ฐ ํฝ๋๋ค.
- ๋ค์ด๋ก๋ํ ํ์ผ์ ๋ฐ๋์ ๋ค์ ๊ฒฝ๋ก(defalut path์)์ ์ ์ฅํด์ผ ํฉ๋๋ค.
- ๊ฒฝ๋ก:
hallulens/data/wiki_data/.cache/enwiki-20230401.db
- ๊ฒฝ๋ก:
- โญ๏ธ ์ค์!!:
-
Data Download
- We provide a script to download all data needed for the three tasks. This will download all necessary data into
the
/datafolder. โ ๏ธ Notice: The Wikipedia dump is large (~16GB), so please ensure you have enough space. The download may fail via the script.bash scripts/download_data.sh
- This script includes:
- Wikirank
- GoodWiki
- Processed Wikipedia dump (from FactScore)
- ITIS taxonomy
- 250k Medicines Usage, Side Effects and Substitutes
- We provide a script to download all data needed for the three tasks. This will download all necessary data into
the
- VLLM ์ฌ์ฉ ๋ฐ ๋ชจ๋ธ ๋ณ๊ฒฝ:
inference_methodํ๋ผ๋ฏธํฐ๋ฅผ'vllm'์ผ๋ก ๋ณ๊ฒฝํ๊ณ ,model์ ํ๊น ํ์ด์ค ๋ชจ๋ธ๋ช ์ ์ ๋ ฅํ์ธ์.
- LLM as Judge ๋ฐฉ์ ๋ณ๊ฒฝ (VLLM, Custom ๋ฑ):
- ์ฝ๋ ๋ด
call_together_apiํจ์๋ฅผcall_vllm_api๋๋custom_apiํจ์๋ก hallulens ํ์ผ์์ ์ ์ฒด ๋ณ๊ฒฝํด์ผ ํฉ๋๋ค. ์ถํ ๋ ์ ์ฐํ ์ค์ ๋ฐฉ๋ฒ์ ์ ๊ณตํ ์์ ์ ๋๋ค.
- ์ฝ๋ ๋ด
- ์๋ก์ด LLM ํธ์คํ
๋ฐฉ์ ์ถ๊ฐ:
hallulens/utils/lm.pyํ์ผ์custom_api์generateํจ์๋ฅผ ์์ ํ์ฌ ๊ตฌํํ ์ ์์ต๋๋ค.
- Together.ai Rate Limit or gpt Rate Limit:
OpenAI api,together.aiํธ์คํ ์ฌ์ฉ ์ API ์์ฒญ ์ ํ(Rate Limit)์ด ๋ฐ์ํ์ฌ ์๋๋ฅผ ๋ฎ์ท์ต๋๋ค.Max_workerํ๋ผ๋ฏธํฐ๋ฅผ ๋์ด๊ฑฐ๋ ์ง์ฐ ์๊ฐ์ ์ค์ด๋ฉด Rate Limit์ด ๋ฐ์ํ ์ ์์ต๋๋ค. - ๋ชจ๋ธ ์ฌ์ด์ฆ๊ฐ ์๊ฑฐ๋ ์ฑ๋ฅ ๋ฎ์ ๋ชจ๋ธ์ ํ๊ฐ ๋ถ๊ฐ๋ฅ ๊ฐ๋ฅ์ฑ: ์ฑ๋ฅ์ด ๋ฎ์ ๋ชจ๋ธ์ ํ๊ฐ ๊ฐ๋ฅํ ๋ต๋ณ ํ์(์ฌ๋ฐ๋ฅธ Json ํํ)์ ์์ฑํ์ง ๋ชปํด
longwiki_qa๋๋precise_wikiqaํ๊ฐ๊ฐ ์คํจํ ์ ์์ต๋๋ค. precise_wikiqaAbstain ๋ฌธ์ :precise_wikiqaํ์คํฌ์์ ๋ชจ๋ธ ์ถ๋ก ์คํจ๋abstain๋ฌธ์ ๊ฐ ๋ฐ๋ณต๋๋ค๋ฉด, ๋ถ์์ ํ๊ฒ ์์ฑ๋outputํด๋์ ๋์ ๋ชจ๋ธ ๊ฒฐ๊ณผ๋ฌผ(.jsonl ํ์ผ)์ ์ญ์ ํ ๋ค์ ์๋ํด ์ฃผ์ธ์. ์ด์ ์ ์๋ชป๋ ๊ฒฐ๊ณผ๋ฌผ์ ๊ณ์ ์ฐธ์กฐํ์ฌ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค.
@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:
- FActScore is licensed under the MIT license.
- VeriScore is licensed under the Apache 2.0 license.
