yakir-yehuda / InterrogateLLM

3 stars 4 forks source link

InterrogateLLM - Hallucination Detection

arxiv

This repository contains the code implementation of the InterrogateLLM method as described in the paper "InterrogateLLM: Zero-Resource Hallucination Detection in LLM-Generated Answers". The InterrogateLLM method is designed to detect hallucinations in large language models.

InterrogateLLM Logo

Requirements

Datasets

To run the experiments, you need to download the following datasets:

Preprocess data:

run:

python run_experiments.py --dataset_name=<movies/books/world> --ans_model=<gpt/llamaV2-7/llamaV2-13> --embedding_model_name=<ada002/sbert>

Example

To run example use the following command:

python run_example.py --ans_model=<gpt/llamaV2-7/llamaV2-13> --embedding_model_name=<ada002/sbert> --reconstruction_models=<gpt,llamaV2-7,llamaV2-13> --iterations=<number>

To examine a different query, modify the query variable along with the corresponding few-shot example in the run_example.py file.

Citation

If you use this code or method in your research, please cite the original paper:

@article{yehuda2024search,
      title={In Search of Truth: An Interrogation Approach to Hallucination Detection}, 
      author={Yakir Yehuda and Itzik Malkiel and Oren Barkan and Jonathan Weill and Royi Ronen and Noam Koenigstein},
      year={2024},
      eprint={2403.02889},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}