Skip to content

Commit 798ecfb

Browse files
committed
Update readme
1 parent 3bf80d3 commit 798ecfb

File tree

4 files changed

+69
-2
lines changed

4 files changed

+69
-2
lines changed

README.md

+69-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,69 @@
1-
# REVERIE
1+
# Reflective Instruction Tuning: Mitigating Hallucinations in Large Vision-Language Models
2+
3+
## Introduction
4+
5+
we propose reflective instruction tuning, which integrates rationale learning into visual instruction tuning. Unlike previous methods that learning from responses only, our approach entails the model predicting rationales justifying why responses are correct or incorrect. This fosters a deeper engagement with the fine-grained reasoning underlying each response, thus enhancing the models reasoning proficiency. To facilitate this approach, we propose REVERIE, the first large-scale instruction-tuning dataset with ReflEctiVE RatIonalE annotations. REVERIE comprises 115k machine-generated reasoning instructions, each meticulously annotated with a corresponding pair of correct and confusing responses, alongside comprehensive rationales elucidating the justification behind the correctness or erroneousness of each response
6+
7+
![Reflective Instruction Tuning](images/reflective_instruction_tuning.png)
8+
9+
## The REVERIE Dataset
10+
11+
### Download
12+
1. Download images:
13+
- VisualGenome: [part1](https://cs.stanford.edu/people/rak248/VG_100K_2/images.zip), [part2](https://cs.stanford.edu/people/rak248/VG_100K_2/images2.zip)
14+
- COCO: [train2017](http://images.cocodataset.org/zips/train2017.zip)
15+
- ScienceQA: [train images](https://drive.google.com/drive/folders/1w8imCXWYn2LxajmGeGH_g5DaL2rabHev)
16+
2. Download annotations from [huggingface](https://huggingface.co/datasets/zjr2000/REVERIE)
17+
18+
### Generation
19+
We provide scripts for reflective annotation generation. Follow these steps to generate the data::
20+
1. Prepare ```image_list.json```: This file should contain a list of image names and be placed under ```$TARGET_FOLDER```.
21+
2. Generate instruction and response:
22+
```
23+
python dataset_generation_pipeline/gemini_v_qa_collection.py \
24+
--image_folder $IMAGE_FOLDER \
25+
--target_folder $TARGET_FOLDER \
26+
--api_key $API_KEY \
27+
--num_tasks $NUM_TASKS
28+
```
29+
3. Generate positive and negative rationales:
30+
```
31+
python dataset_generation_pipeline/gemini_v_rationale_collection.py \
32+
--target_folder $TARGET_FOLDER \
33+
--api_key $API_KEY \
34+
--num_tasks $NUM_TASKS
35+
```
36+
4. Consistency-based data filtering:
37+
```
38+
python dataset_generation_pipeline/data_filter.py \
39+
--target_folder $TARGET_FOLDER \
40+
--api_key $API_KEY \
41+
--num_tasks $NUM_TASKS
42+
```
43+
The resulting ```rationale_instruct_data_with_judge.json``` will contain the final generated data, including instructions, responses, rationales, and flags indicating their correctness.
44+
45+
## Models
46+
47+
We perform reflective instruction tuning on several open-sourced LVLMs. Please refer to their repositories for instructions on setting up the environments and running the models:
48+
- [LLaVA](https://github.com/haotian-liu/LLaVA)
49+
- [MoE-LLaVA](https://github.com/PKU-YuanGroup/MoE-LLaVA)
50+
- [LLaVA-phi3](https://github.com/mbzuai-oryx/LLaVA-pp)
51+
52+
### Checkpoints and Results:
53+
We also provide checkpoints and prediction results to facilitate the reproduction of our results:
54+
#### Checkpoints:
55+
| Model | data | Baseline | Checkpoints |
56+
|----------|----------|----------|-------|
57+
| REVERIE-1.0-7b-lora | LLaVA-Instruct-80K + REVERIE |[LLaVA-1.0-7b-lora](https://github.com/haotian-liu/LLaVA) | [Baidu Disk Link](https://pan.baidu.com/s/1Yp5gYe5D1_VhDOTBNorHCQ?pwd=xf7e) |
58+
| REVERIE-1.5-7b-lora | LLaVA-665k + REVERIE | [LLaVA-1.5-7b-lora](https://github.com/haotian-liu/LLaVA) | [Baidu Disk Link](https://pan.baidu.com/s/1UDob1xq3dvjGpv14H7XNSg?pwd=mkzu) |
59+
| MOE-REVERIE-1.6Bx4 | LLaVA-665k + REVERIE | [MOE-LLaVA-1.6Bx4](https://github.com/PKU-YuanGroup/MoE-LLaVA) |[Baidu Disk Link](https://pan.baidu.com/s/1d4d0zXI5TVCmoBwMngWoHg?pwd=osyw)|
60+
| REVERIE-Phi3-lora | LLaVA-665k + REVERIE | [LLaVA-Phi3-lora](https://github.com/mbzuai-oryx/LLaVA-pp) |[Baidu Disk Link](https://pan.baidu.com/s/10DwB0klgmXQNpu-j3xdbJA?pwd=kcua )|
61+
#### Prediction Files:
62+
| Benchmark | Results |
63+
|----------|----------|
64+
| ScienceQA | [Baidu Disk Link](https://pan.baidu.com/s/1_rZVUi_iDNCi1Se9M63Y1A?pwd=o2ss)|
65+
| MMBench | [Baidu Disk Link](https://pan.baidu.com/s/1QYv24gNZW5M0ix88xDW3ag?pwd=527b)|
66+
| POPE | [Baidu Disk Link](https://pan.baidu.com/s/1shVTHFkshstY4CkuRvysKg?pwd=52zo)|
67+
68+
## Acknowledgements
69+
Our experiments are conducted on several awesome open-soured LVLMs: [LLaVA](https://github.com/haotian-liu/LLaVA), [MoE-LLaVA](https://github.com/PKU-YuanGroup/MoE-LLaVA) and [LLaVA-phi3](https://github.com/mbzuai-oryx/LLaVA-pp). We thank the authors for their efforts.

dataset_generation_pipeline/data_filter.py

-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def generate(qa_data, file_names, output_dir):
168168
'correct_rationale': content['correct_rationale'],
169169
'incorrect_rationale': content['incorrect_rationale'],
170170
'gemini_pro_judge': content['gemini_pro_judge'],
171-
'chatgpt_judge': content['gpt3.5_judge']
172171
}
173172
combined_contents.append(item)
174173
except Exception as e:
1.16 MB
Loading

reflective_instruction_tuning.png

1.16 MB
Loading

0 commit comments

Comments
 (0)