This is the code for the paper Are Hallucinations Bad Estimations? You can use this repo to reproduce the results in the paper.
- Clone the repository
gh repo clone MAGICS-LAB/hallucination cd hallu - Create and activate a virtual environment
conda create -n hallu python=3.11 conda activate hallu
- Install required packages
pip install -r requirements.txt
Please refer to coinflip_experiment.ipynb.
python hallucination_llm.py- Fine-tune Unet
python text_to_img_exp/fine-tune_text_to_img.py -- output_dir "./model" - Hallucination Rate Analysis with Frozen Model
python text_to_img_exp/hallucination_text_to_img_report.py --checkpoints_glob "./model/checkpoint-*/unet"
python plotting_llm.py # for plotting of Figure 4
python plotting_text_to_img.py # for plotting of Figure 5
python ablation_plotting_text_to_img.py # for ablation study plotsIf you find our work useful, please cite:
@article{liu2025hallucinations,
title={Are Hallucinations Bad Estimations?},
author={Liu, Hude and Hu, Jerry Yao-Chieh and Zhang, Jennifer Yuntong and Song, Zhao and Liu, Han},
journal={arXiv preprint arXiv:2509.21473},
year={2025}
}