Source code for the NeurIPS 2025 paper: "GLSim: Detecting Object Hallucinations in LVLMs via Global-Local Embedding Similarity" by Seongheon Park and Sharon Li.
conda create -n glsim python=3.9
conda activate glsimpip install torch transformers Pillow tqdm scikit-learn numpy matplotlib nltk patternThe evaluation is performed on the MSCOCO dataset. You need to download the images and annotations.
- Download the 2014 validation images from the COCO website.
- Download the 2014 train/val annotations.
You will need to update the paths in evaluate.py to point to your local COCO dataset directory and annotation file.
MSCOCO_DATASET_PATH: Path to the directory containing COCO validation images (e.g.,val2014/).COCO_ANNOTATION_PATH: Path to the file containing COCO ground truthcoco_ground_truth.json.
python util/chair.py --cache chair.pklTo run the evaluation, use the evaluate.py script.
python evaluate.py --lvlm llava-1.5-7b-hf @inproceedings{
park2025glsim,
title={{GLS}im: Detecting Object Hallucinations in {LVLM}s via Global-Local Similarity},
author={Seongheon Park and Sharon Li},
booktitle={The Thirty-ninth Annual Conference on Neural Information Processing Systems},
year={2025},
url={https://openreview.net/forum?id=ZO8LyCizx9}
}