HA-DPO (Hallucination-aware Direct Preference Optimization)

January 30, 2024 ยท View on GitHub

Shanghai Artificial Intelligence Laboratory

[Paper] [Data(huggingface)] [Data(opendatalab)] [Models]

Introduction

We propose HA-DPO (Hallucination-aware Direct Preference Optimization), which eliminates LVLM hallucination using GPT-4 generated positive-negative data based on DPO (Direct Preference Optimization).

overview

This repo provides:

  • High-quality positive-negative hallucination-aware data

  • DPO framework for multiple LVLM (based on TRL)

    • MiniGPT-4
    • LLaVA-1.5
    • InstructBLIP
  • SHR Evaluation (Sentence-level Hallucination Ratio)

  • Human-free positive-negative data mining pipeline

Demo

Online demo will be available soon!

https://github.com/JulioZhao97/HA-DPO-video/assets/40555727/b35879ba-ab2a-4e9e-93d8-0e3b47e8a7e9

Getting Started

  1. create a new conda environment
conda create -n hadpo python==3.9
  1. install requirements
conda activate hadpo
pip install -e .

Data Preparation

For data preparation, please refer to data preparation.

Model Training and Evaluation

For model training and evaluation, please refer to docs in following:

MiniGPT-4LLaVA-1.5InstructBLIP
docdocdoc

SHR Evaluation

For SHR Evaluation, please refer to SHR Evaluation.

Main Results

MiniGPT-4-Llama2-7B

SHR results
ModelHA-DPOSHR
MiniGPT-4-Llama2-7B:heavy_multiplication_x:47.3
MiniGPT-4-Llama2-7B:heavy_check_mark:44.4
POPE results

POPE Random

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
MiniGPT-4-Llama2-7B:heavy_multiplication_x:51.1350.5799.8067.1398.66
MiniGPT-4-Llama2-7B:heavy_check_mark:86.1392.8178.3384.9642.20

POPE Popular

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
MiniGPT-4-Llama2-7B:heavy_multiplication_x:51.4650.7499.5367.7298.06
MiniGPT-4-Llama2-7B:heavy_check_mark:79.5080.2078.3379.2548.83

POPE Adversarial

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
MiniGPT-4-Llama2-7B:heavy_multiplication_x:51.2650.6499.6667.1698.40
MiniGPT-4-Llama2-7B:heavy_check_mark:75.6674.3678.3376.2952.66

InstructBLIP-13B

SHR results
ModelHA-DPOSHR
InstructBLIP-13B:heavy_multiplication_x:51.2
InstructBLIP-13B:heavy_check_mark:49.1
POPE results

POPE Random

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
InstructBLIP-13B:heavy_multiplication_x:88.7085.0393.9389.2655.23
InstructBLIP-13B:heavy_check_mark:89.8393.0786.0689.4346.23

POPE Popular

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
InstructBLIP-13B:heavy_multiplication_x:81.3675.0693.9383.4462.56
InstructBLIP-13B:heavy_check_mark:85.7685.5586.0685.8050.03

POPE Adversarial

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
InstructBLIP-13B:heavy_multiplication_x:74.5067.6493.9378.6469.43
InstructBLIP-13B:heavy_check_mark:80.7077.7286.0681.6855.36

LLaVA-1.5-7B

SHR results
ModelHA-DPOSHR
LLaVA-1.5:heavy_multiplication_x:36.7
LLaVA-1.5:heavy_check_mark:34.0
POPE results

POPE Random

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
LLaVA-1.5:heavy_multiplication_x:89.6088.7790.6689.7051.06
LLaVA-1.5:heavy_check_mark:90.5392.9987.6690.2547.13

POPE Popular

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
LLaVA-1.5:heavy_multiplication_x:86.2083.2390.6686.7954.46
LLaVA-1.5:heavy_check_mark:87.9088.0787.6687.8149.76

POPE Adversarial

ModelHA-DPOAccuracyPrecisionRecallF1 ScoreYes Ratio (%)
LLaVA-1.5:heavy_multiplication_x:79.7674.4390.6681.7560.90
LLaVA-1.5:heavy_check_mark:81.4677.9987.6682.5456.20

Acknowledgement

  • MiniGPT-4. The MiniGPT-4 part of HA-DPO is based on the official MiniGPT-4 implementation.
  • VIGC. The InstructBLIP part of HA-DPO is built on VIGC, which is an amazing visual instruction generation and correction method.
  • LLaVA-1.5. The LLaVA-v1.5 part of HA-DPO is based on the official LLaVA-1.5 implementation, which is a great open-source work on LVLM.
  • TRL. Most model training and optimizing codes of HA-DPO are stemed from TRL, which is a great human-preference learning framework on LLM.

Paper and Citing HA-DPO

You can find more details in our paper.

If you're using HA-DPO in your research or applications, please cite using this BibTeX:

@misc{zhao2023hallucinations,
      title={Beyond Hallucinations: Enhancing LVLMs through Hallucination-Aware Direct Preference Optimization}, 
      author={Zhiyuan Zhao and Bin Wang and Linke Ouyang and Xiaoyi Dong and Jiaqi Wang and Conghui He},
      year={2023},
      eprint={2311.16839},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Contact us

If you have any questions, comments or suggestions, please do not hesitate to contact us at zhaozhiyuan@pjlab.org.cn and wangbin@pjlab.org.cn.

License

Apache License 2.0