Skip to content

Repository files navigation

SHIELD: Suppressing Hallucinations In LVLM Encoders via Bias and Vulnerability Defense

First to trace LVLM hallucinations to visual encoders β€” a training-free framework that fixes statistical bias, inherent bias & vulnerability without any fine-tuning.

ICLR 2026arXivPaperOpenReviewProject PageCodeLicensePythonPyTorchContributions Welcome

Key Results

SHIELD consistently outperforms existing methods across 3 LVLM families and 6 benchmarks β€” all without training.

CHAIR β€” LLaVA-1.5 7B (↓ lower is better)

MethodC_SC_I
Vanilla48.814.2
VCD46.813.2
OPERA44.612.8
SHIELD36.610.3

POPE Avg β€” LLaVA-1.5 7B (↑ higher is better)

MethodAccF1
Vanilla81.379.6
VCD84.684.4
OPERA84.785.4
SHIELD87.087.4

MME Hallucination (↑ higher is better)

MethodLLaVA-1.5Qwen-VL
Vanilla565.3587.3
VCD604.6596.6
OPERA592.3623.3
SHIELD668.3668.3

AMBER Score β€” LLaVA-1.5 7B (↑ higher is better)

MethodScoreCHAIR↓Hal.↓
Vanilla82.09.229.2
VCD82.98.128.6
OPERA86.58.331.2
SHIELD88.06.425.1

SHIELD also achieves 1810.8 on MME Full (vs. Vanilla 1632.1, OPERA 1717.2), confirming that hallucination suppression does not sacrifice general capability.

Quick Start

SHIELD works as a non-invasive wrapper β€” no source code modification of LLaVA needed.

# Run POPE evaluation in one command
bash experiments/scripts/llava1.5_pope_coco.bash
# Run CHAIR evaluation
bash experiments/scripts/llava1.5_chair.bash
# Run MME evaluation
bash experiments/scripts/llava1.5_MME_full.bash
bash experiments/scripts/llava1.5_MME_hal.bash

Python API

importshieldfromllava.model.builderimportload_pretrained_modeltokenizer, model, image_processor, _=load_pretrained_model(
"liuhaotian/llava-v1.5-7b", None, "llava-v1.5-7b"
)
# One-line setup: wrap the model with SHIELDshield.wrap(model, tokenizer,
caption_file="experiments/first_cap/llava15_coco_pope_first_caption.jsonl",
cd_alpha=2.0, cd_beta=0.35,
)
image_tensor=image_processor.preprocess(image, return_tensors="pt")["pixel_values"][0]
shield_kw=model.shield_prepare(image, image_tensor, "image.jpg", use_cd=True)
output_ids=model.generate(input_ids, **shield_kw, do_sample=True, max_new_tokens=1024)

Installation

conda create -n shield python=3.10
conda activate shield
pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

Data Preparation

The repository includes all text-based metadata. You only need to download images and COCO annotations.

Click to expand full data setup instructions

LLaVA Model

SHIELD uses LLaVA-1.5 as the base model. Model weights are automatically downloaded from Hugging Face when first used (liuhaotian/llava-v1.5-7b).

COCO Images & Annotations

COCO val2014 images are shared across POPE (COCO), CHAIR, and LLaVA-Bench evaluations.

  1. Download COCO val2014 images and extract to experiments/data/coco/val2014/.
  2. Download COCO 2014 annotations and extract to experiments/data/coco/annotations/.
cd experiments/data/coco
wget http://images.cocodataset.org/zips/val2014.zip
unzip val2014.zip
wget http://images.cocodataset.org/annotations/annotations_trainval2014.zip
unzip annotations_trainval2014.zip -d .
mv annotations_trainval2014/annotations .

A pre-built cache (experiments/eval/chair.pkl) is included so you can skip COCO annotation download if you only want to run the CHAIR metric.

POPE

POPE question files for COCO, A-OKVQA, and GQA are already included under experiments/data/POPE/. No extra download needed.

For GQA images (only needed for POPE-GQA evaluation), download from the GQA dataset and extract to experiments/data/gqa/images/.

CHAIR

CHAIR questions are included at experiments/data/CHAIR/questions.jsonl. Images come from COCO val2014.

MME

  1. Download the MME Benchmark images and extract to experiments/data/MME/MME_Benchmark_release_version/.
  2. MME question lists and evaluation tools are already included.

LLaVA-Bench

LLaVA-Bench data (images + questions) is fully included in experiments/data/llava-bench/. No extra download needed.

Caption Files

Pre-generated first-round captions for all benchmarks are provided under experiments/first_cap/.

Expected Directory Structure

experiments/data/
β”œβ”€β”€ POPE/ # (included) question files
β”‚ β”œβ”€β”€ coco/
β”‚ β”œβ”€β”€ aokvqa/
β”‚ └── gqa/
β”œβ”€β”€ CHAIR/
β”‚ └── questions.jsonl # (included)
β”œβ”€β”€ MME/
β”‚ β”œβ”€β”€ full.json # (included) question list
β”‚ β”œβ”€β”€ hal.json # (included) question list
β”‚ └── MME_Benchmark_release_version/ # (download)
β”œβ”€β”€ llava-bench/ # (fully included)
β”œβ”€β”€ coco/
β”‚ β”œβ”€β”€ val2014/ # (download) COCO val2014 images
β”‚ └── annotations/ # (download) COCO 2014 annotations
└── gqa/
└── images/ # (download) GQA images

Inference and Evaluation

POPE

bash experiments/scripts/llava1.5_pope_coco.bash
python experiments/eval/eval_pope.py \
--gt_file experiments/data/POPE/coco/coco_pope_random.json \
--gen_file output/llava15_coco_pope_random_answers_*.jsonl

Other POPE splits (popular, adversarial) and datasets (A-OKVQA, GQA) can be run by passing arguments to the script.

CHAIR

bash experiments/scripts/llava1.5_chair.bash

The CHAIR evaluation script computes CHAIRs, CHAIRi, and Recall metrics. It requires the pattern library:

pip install git+https://github.com/clips/pattern.git

MME

bash experiments/scripts/llava1.5_MME_full.bash
bash experiments/scripts/llava1.5_MME_hal.bash

Detailed Results

POPE COCO (all splits, 3 LVLMs)
LVLMMethodRand. AccRand. F1Pop. AccPop. F1Adv. AccAdv. F1
LLaVA-1.5Vanilla83.281.381.880.078.977.5
VCD87.787.185.385.080.881.3
OPERA89.189.086.086.379.180.9
SHIELD91.391.187.487.682.583.6
InstructBLIPVanilla80.780.478.278.375.876.5
VCD84.583.681.481.079.579.5
OPERA89.889.683.484.080.781.8
SHIELD88.287.684.684.382.282.4
Qwen-VLVanilla84.782.684.182.082.280.3
VCD88.687.887.186.484.283.9
OPERA86.184.285.783.883.982.1
SHIELD89.288.687.687.184.384.2
CHAIR (3 LVLMs)
MethodLLaVA C_S↓LLaVA C_I↓IBLIP C_S↓IBLIP C_I↓Qwen C_S↓Qwen C_I↓
Vanilla48.814.254.624.849.213.1
VCD46.813.244.013.646.411.9
OPERA44.612.846.414.234.69.5
SHIELD36.610.340.410.928.99.2
MME Hallucination Subset (3 LVLMs)
LVLMMethodExistenceCountPositionColorTotal
LLaVA-1.5Vanilla175.6124.6114.0151.0565.3
VCD184.6138.3128.6153.0604.6
OPERA180.6133.3123.3155.0592.3
SHIELD195.0141.6148.3183.3668.3
InstructBLIPVanilla141.075.366.697.3380.3
VCD168.392.364.0123.0447.6
OPERA156.078.355.095.0384.3
SHIELD170.075.088.3128.3461.6
Qwen-VLVanilla155.0127.6131.6173.0587.3
VCD156.0131.0128.0181.6596.6
OPERA165.0145.0133.3180.0623.3
SHIELD180.0170.0128.3190.0668.3
GPT-4o Aided Evaluation
MethodLLaVA C↑LLaVA D↑IBLIP C↑IBLIP D↑Qwen C↑Qwen D↑
Vanilla4.95.04.24.26.24.6
VCD5.55.55.15.56.55.7
OPERA5.66.05.35.26.55.6
SHIELD6.26.15.65.36.95.8
MME Full & Efficiency

MME Full (LLaVA-1.5 7B)

MethodPerception↑Cognition↑Total↑
Vanilla1279.2352.91632.1
VCD1363.9353.21717.1
OPERA1413.0304.21717.2
SHIELD1473.0337.81810.8

Efficiency (LLaVA-1.5 7B, CHAIR)

MethodC_S↓Time (s/sample)↓Memory↓
Vanilla48.82.5915.69 GB
VCD46.84.8916.52 GB
OPERA44.624.0134.88 GB
SHIELD36.67.3418.17 GB

Project Structure

SHIELD/
β”œβ”€β”€ shield/ # Core SHIELD library
β”‚ β”œβ”€β”€ __init__.py # Public API
β”‚ β”œβ”€β”€ wrapper.py # shield.wrap() β€” non-invasive model patching
β”‚ β”œβ”€β”€ attack.py # CW and PGD adversarial attacks in CLIP space
β”‚ β”œβ”€β”€ caption.py # Caption loading and preprocessing
β”‚ β”œβ”€β”€ clip_utils.py # CLIP model loading and text features
β”‚ β”œβ”€β”€ feature.py # Feature weighting, bias computation
β”‚ β”œβ”€β”€ noise.py # Diffusion noise injection
β”‚ └── sampling.py # Custom contrastive decoding sampler
β”œβ”€β”€ experiments/
β”‚ β”œβ”€β”€ eval/ # Evaluation scripts
β”‚ β”œβ”€β”€ scripts/ # Bash scripts for running experiments
β”‚ β”œβ”€β”€ data/ # Evaluation datasets
β”‚ β”œβ”€β”€ first_cap/ # Pre-generated first-round captions
β”‚ └── llava/ # LLaVA model code (vendored)
β”œβ”€β”€ logs/ # SOTA results for LLaVA, InstructBLIP, Qwen-VL
β”œβ”€β”€ figs/ # Paper figures
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ CITATION.bib
└── LICENSE

Acknowledgement

We extend our gratitude to the following projects:

  • LLaVA β€” Large Language and Vision Assistant
  • VCD β€” Visual Contrastive Decoding
  • OPERA β€” Alleviating Hallucination in Multi-Modal LLMs
  • CHAIR β€” Object Hallucination evaluation metric
  • Qwen-VL β€” Qwen Vision-Language model

Citation

If you find this work useful, please cite our paper:

@inproceedings{
huang2026shield,
title={{SHIELD}: Suppressing Hallucinations In {LVLM} Encoders via Bias and Vulnerability Defense},
author={Yiyang Huang and Liang Shi and Yitian Zhang and Yi Xu and Yun Fu},
booktitle={The Fourteenth International Conference on Learning Representations},
year={2026},
url={https://openreview.net/forum?id=yk7FFLoNcP}
}

arXiv version:

@article{huang2025shield,
title={SHIELD: Suppressing Hallucinations In LVLM Encoders via Bias and Vulnerability Defense},
author={Huang, Yiyang and Shi, Liang and Zhang, Yitian and Xu, Yi and Fu, Yun},
journal={arXiv preprint arXiv:2510.16596},
year={2025}
}

License

This project is released under the Apache 2.0 License.

About

[ICLR 2026πŸ”₯] SHIELD: Suppressing Hallucinations In LVLM Encoders via Bias and Vulnerability Defense

Topics

Resources

Stars

19 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages