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 Taxonomy
Extrinsic Hallucination: 학습 데이터와 일치하지 않는 생성 결과물입니다. 이는 입력된 문맥(context)에 의해 뒷받침될 수도, 반박될 수도 없습니다. 이러한 환각은 모델이 (작업 지시에 기반한 자유 형식 텍스트 등) 새로운 콘텐츠를 생성하거나 지식의 격차를 메우려 할 때 자주 발생합니다. 이는 학습 데이터로부터 지식을 흡수하는 모델의 한계와 자신의 지식 경계를 인식하지 못하는 능력이 부족함을 반영합니다.
Intrinsic Hallucination: **입력된 문맥(context)**과 일치하지 않는 생성 결과물입니다. 모델이 입력 문맥을 올바르게 이해하지 못할 때, 입력 질의(query)와 모순되거나 원본 입력 질의에 의해 뒷받침되지 않는 내용을 생성합니다. 이는 추론 시점(inference-time)에 일관성을 유지하지 못하는 모델의 능력이 부족함을 반영합니다.
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
[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:
.env 파일에 설정inference_method 파라미터를 'together'로 설정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
데이터 다운로드
donwload.sh로 데이터 다운로드 시 enwiki-20230401.db 파일이 정상적으로 받아지지 않을 수 있습니다.hallulens/data/wiki_data/.cache/enwiki-20230401.dbData Download
/data folder.bash scripts/download_data.sh
inference_method 파라미터를 'vllm'으로 변경하고, model에 허깅페이스 모델명을 입력하세요.call_together_api 함수를 call_vllm_api 또는 custom_api 함수로 hallulens 파일에서 전체 변경해야 합니다. 추후 더 유연한 설정 방법을 제공할
예정입니다.hallulens/utils/lm.py 파일의 custom_api와 generate 함수를 수정하여 구현할 수 있습니다.OpenAI api, together.ai 호스팅 사용 시 API 요청 제한(Rate Limit)이 발생하여 속도를
낮췄습니다. Max_worker 파라미터를 높이거나 지연 시간을 줄이면 Rate Limit이 발생할 수 있습니다.longwiki_qa 또는 precise_wikiqa
평가가 실패할 수 있습니다.precise_wikiqa Abstain 문제: 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:
58 commits
Python
98.5%
Shell
1.5%
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 Taxonomy
Extrinsic Hallucination: 학습 데이터와 일치하지 않는 생성 결과물입니다. 이는 입력된 문맥(context)에 의해 뒷받침될 수도, 반박될 수도 없습니다. 이러한 환각은 모델이 (작업 지시에 기반한 자유 형식 텍스트 등) 새로운 콘텐츠를 생성하거나 지식의 격차를 메우려 할 때 자주 발생합니다. 이는 학습 데이터로부터 지식을 흡수하는 모델의 한계와 자신의 지식 경계를 인식하지 못하는 능력이 부족함을 반영합니다.
Intrinsic Hallucination: **입력된 문맥(context)**과 일치하지 않는 생성 결과물입니다. 모델이 입력 문맥을 올바르게 이해하지 못할 때, 입력 질의(query)와 모순되거나 원본 입력 질의에 의해 뒷받침되지 않는 내용을 생성합니다. 이는 추론 시점(inference-time)에 일관성을 유지하지 못하는 모델의 능력이 부족함을 반영합니다.
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
[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:
.env 파일에 설정inference_method 파라미터를 'together'로 설정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
데이터 다운로드
donwload.sh로 데이터 다운로드 시 enwiki-20230401.db 파일이 정상적으로 받아지지 않을 수 있습니다.hallulens/data/wiki_data/.cache/enwiki-20230401.dbData Download
/data folder.bash scripts/download_data.sh
inference_method 파라미터를 'vllm'으로 변경하고, model에 허깅페이스 모델명을 입력하세요.call_together_api 함수를 call_vllm_api 또는 custom_api 함수로 hallulens 파일에서 전체 변경해야 합니다. 추후 더 유연한 설정 방법을 제공할
예정입니다.hallulens/utils/lm.py 파일의 custom_api와 generate 함수를 수정하여 구현할 수 있습니다.OpenAI api, together.ai 호스팅 사용 시 API 요청 제한(Rate Limit)이 발생하여 속도를
낮췄습니다. Max_worker 파라미터를 높이거나 지연 시간을 줄이면 Rate Limit이 발생할 수 있습니다.longwiki_qa 또는 precise_wikiqa
평가가 실패할 수 있습니다.precise_wikiqa Abstain 문제: 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:
58 commits
Python
98.5%
Shell
1.5%