Image-Text-to-Text
zpatrick commited on
Commit
15f17da
Β·
verified Β·
1 Parent(s): ff12385

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +204 -1
README.md CHANGED
@@ -1,4 +1,207 @@
1
  ---
2
  license: apache-2.0
3
  pipeline_tag: image-text-to-text
4
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  pipeline_tag: image-text-to-text
4
+ ---
5
+ <div align="center">
6
+
7
+ # πŸš€ VisCo: Leveraging Large Language Models as Intrinsic Encoders for Visual Token Compression
8
+
9
+ ### [ACM Multimedia 2026]
10
+
11
+ <p align="center">
12
+ <a href="https://github.com/Zyvpeng">Yupeng Zheng</a><sup>*</sup>,
13
+ <a href="https://github.com/Jacky-hate">Kai Zou</a><sup>*</sup>,
14
+ <a href="https://scholar.google.com/citations?user=kReWULQAAAAJ&hl=en&oi=ao">Bin Liu</a><sup>†</sup>,
15
+ <a href="https://scholar.google.com/citations?user=7620QAMAAAAJ&hl=en&oi=ao">Nenghai Yu</a><sup>†</sup>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <sup>*</sup>Equal contribution &nbsp;&nbsp;
20
+ <sup>†</sup>Corresponding author
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="https://arxiv.org/abs/2607.12756">
25
+ <img src="https://img.shields.io/badge/arXiv-2607.12756-b31b1b.svg">
26
+ </a>
27
+ <!-- <a href="https://your-project-page.github.io">
28
+ <img src="https://img.shields.io/badge/Project-Page-blue">
29
+ </a>-->
30
+ <a href="https://huggingface.co/zpatrick/VisCo">
31
+ <img src="https://img.shields.io/badge/πŸ€—%20Model-HuggingFace-yellow">
32
+ </a>
33
+ <a href="https://github.com/Zyvpeng/VisCo/blob/main/LICENSE">
34
+ <img src="https://img.shields.io/badge/License-Apache--2.0-green">
35
+ </a>
36
+ <a href="https://github.com/Zyvpeng/VisCo">
37
+ <img src="https://img.shields.io/github/stars/Zyvpeng/VisCo?style=social">
38
+ </a>
39
+ </p>
40
+
41
+ <p align="center">
42
+ <strong>
43
+ Compress hundreds of visual tokens into only a few memory tokens while preserving multimodal understanding.
44
+ </strong>
45
+ </p>
46
+
47
+ </div>
48
+
49
+ ## πŸ”₯ Highlights
50
+
51
+ - **Intrinsic self-compression.** VisCo reuses the pretrained VLM itself as a parameter-sharing autoencoder instead of introducing a separate compression network.
52
+ - **Lightweight adaptation.** Only memory tokens and encoder-side LoRA adapters are trained; the shared pretrained backbone is kept intact for decoding.
53
+ - **Hierarchical KV passing.** Layer-wise key-value states associated with memory tokens are transferred from the encoder directly into the decoder KV cache.
54
+ - **Extreme compression.** VisCo retains 85.3% of LLaVA-1.5-7B performance with one visual token and 91.4% of Qwen2-VL-2B performance with 18 tokens.
55
+ - **Broad evaluation.** Experiments cover LLaVA-1.5-7B, Qwen2-VL-2B, and Qwen2-VL-7B on six multimodal benchmarks.
56
+
57
+
58
+ ## πŸ“Š Main Results
59
+
60
+ ### LLaVA-1.5-7B
61
+
62
+ Average is the mean percentage of performance retained relative to the original model.
63
+
64
+ | Method | Tokens | GQA | MMB | MMB-CN | MME | POPE | MMVet | Average |
65
+ |:--|--:|--:|--:|--:|--:|--:|--:|--:|
66
+ | LLaVA-1.5-7B | 576 | 62.0 | 64.3 | 58.3 | 1510.7 | 85.9 | 31.1 | 100.0% |
67
+ | FastV | 32 | 41.5 | 37.8 | 33.2 | 884.6 | 32.5 | 20.7 | 57.6% |
68
+ | SparseVLM | 32 | 48.3 | 51.4 | 40.6 | 1046.7 | 67.9 | 18.6 | 72.6% |
69
+ | PruMerge+ | 32 | 51.1 | 56.8 | 47.0 | 940.8 | 70.9 | 21.4 | 77.5% |
70
+ | DivPrune | 32 | 54.9 | 57.6 | 49.1 | **1284.9** | 81.5 | 26.3 | 87.2% |
71
+ | VisPruner | 32 | 52.2 | 58.4 | 52.7 | 1271.0 | 72.7 | **28.8** | 87.8% |
72
+ | **VisCo** | **32** | **58.5** | **62.3** | **57.2** | 1152.9 | **81.9** | 27.9 | **91.8%** |
73
+ | PruMerge+ | 1 | 26.4 | 13.7 | 13.7 | 568.9 | 40.4 | 12.5 | 35.4% |
74
+ | VisPruner | 1 | 41.8 | 22.4 | 25.8 | 764.4 | 49.0 | 12.0 | 48.8% |
75
+ | **VisCo** | **1** | **58.2** | **59.0** | **52.4** | **1191.2** | **78.2** | **20.7** | **85.3%** |
76
+
77
+ ### Qwen2-VL
78
+
79
+ | Base model | Method | Tokens | GQA | MMB | MMB-CN | MME | POPE | MMVet | Average |
80
+ |:--|:--|--:|--:|--:|--:|--:|--:|--:|--:|
81
+ | Qwen2-VL-2B | Origin | 144 | 59.8 | 67.3 | 61.8 | 1465.8 | 81.5 | 42.5 | 100.0% |
82
+ | Qwen2-VL-2B | VisionZip | 36 | 53.2 | 64.3 | 56.7 | 1372.4 | 75.3 | 35.5 | 91.0% |
83
+ | Qwen2-VL-2B | **VisCo** | **36** | **61.1** | 64.0 | **58.9** | 1368.3 | **82.9** | **35.6** | **95.2%** |
84
+ | Qwen2-VL-2B | VisionZip | 18 | 48.5 | 55.2 | 41.6 | 1300.9 | 62.7 | 25.8 | 76.1% |
85
+ | Qwen2-VL-2B | **VisCo** | **18** | **59.7** | **62.9** | **57.8** | **1358.0** | **82.4** | **28.9** | **91.4%** |
86
+ | Qwen2-VL-7B | Origin | 144 | 64.8 | 76.1 | 71.6 | 1664.8 | 82.6 | 56.1 | 100.0% |
87
+ | Qwen2-VL-7B | VisionZip | 36 | 58.3 | 72.4 | 63.4 | 1530.0 | 75.3 | 39.1 | 89.8% |
88
+ | Qwen2-VL-7B | **VisCo** | **36** | **62.6** | **74.0** | **70.0** | **1551.0** | **83.3** | **40.4** | **94.6%** |
89
+ | Qwen2-VL-7B | VisionZip | 18 | 55.3 | 66.4 | 58.3 | 1443.8 | 71.7 | 33.9 | 81.3% |
90
+ | Qwen2-VL-7B | **VisCo** | **18** | **61.8** | **70.0** | **68.8** | **1496.5** | **81.7** | **39.2** | **90.4%** |
91
+
92
+
93
+ ## πŸ› οΈ Installation
94
+
95
+ ```bash
96
+ git clone https://github.com/Zyvpeng/VisCo.git
97
+ cd VisCo
98
+
99
+ conda create -n visco python=3.10 -y
100
+ conda activate visco
101
+ pip install --upgrade pip
102
+ pip install torch transformers peft datasets safetensors qwen-vl-utils
103
+ pip install flash-attn --no-build-isolation
104
+ ```
105
+
106
+ The current implementation additionally uses `torch`, `transformers`, `peft`, `datasets`, `safetensors`, `qwen-vl-utils`, and FlashAttention for LLaVA.
107
+
108
+ ## ⚑ Quick Start
109
+
110
+ The case examples read `/home/ypzheng/VLM_ICAE/data/case/data.json`. Each item must provide `image` and `question` fields. Run commands from the repository parent so that `VisCo` is importable.
111
+
112
+ ### Qwen2-VL case inference
113
+
114
+ ```bash
115
+ cd /home/ypzheng
116
+ conda activate mmicae2
117
+
118
+ python -m VisCo.inference.case_qwen2 \
119
+ --model_name_or_path /home/ypzheng/Qwen2-VL-2B-Instruct \
120
+ --output_dir /path/to/qwen2_visco_checkpoint.pt \
121
+ --fixed_mem_size 18 \
122
+ --train false \
123
+ --per_device_train_batch_size 1
124
+ ```
125
+
126
+ ### LLaVA-1.5 case inference
127
+
128
+ ```bash
129
+ cd /home/ypzheng
130
+ conda activate mmicae2
131
+
132
+ python -m VisCo.inference.case_llava15 \
133
+ --model_name_or_path /home/ypzheng/llava15 \
134
+ --output_dir /path/to/llava_visco_checkpoint.pt \
135
+ --fixed_mem_size 32 \
136
+ --train false \
137
+ --per_device_train_batch_size 1
138
+ ```
139
+
140
+ `--output_dir` is used by the inference scripts as the checkpoint file path and is loaded with `torch.load`.
141
+
142
+ ## πŸš‚ Training
143
+
144
+ Both training scripts fine-tune for one epoch on LLaVA-665K-style JSON data. Update the dataset path near the top of the selected script before launching. Qwen2-VL trains LoRA on `q_proj` and `v_proj`; LLaVA-1.5 trains LoRA on the attention `q/k/v/o` projections. Memory-token embeddings are learned jointly, while decoding reuses the shared backbone without the encoder LoRA adapters.
145
+
146
+ ### Qwen2-VL-2B
147
+
148
+ ```bash
149
+ cd /home/ypzheng
150
+ torchrun --nproc_per_node=1 -m VisCo.train.train_qwen2 \
151
+ --model_name_or_path /home/ypzheng/Qwen2-VL-2B-Instruct \
152
+ --output_dir /path/to/output/qwen2_visco \
153
+ --fixed_mem_size 18
154
+ ```
155
+
156
+ ### LLaVA-1.5-7B
157
+
158
+ ```bash
159
+ cd /home/ypzheng
160
+ torchrun --nproc_per_node=8 -m VisCo.train.train_llava15 \
161
+ --model_name_or_path /home/ypzheng/llava15 \
162
+ --output_dir /path/to/output/llava_visco \
163
+ --fixed_mem_size 32
164
+ ```
165
+
166
+ Training uses the tokenization/mapping functions and data collators in `utils/preprocess.py`, then delegates optimization and checkpointing to `train_model` in the same module.
167
+
168
+ ## πŸ§ͺ Evaluation
169
+
170
+ The released evaluation entry points cover MME for both backbones. They load the checkpoint passed through `--output_dir`, preprocess the benchmark with the matching backbone-specific mapping function, and report MME accuracy and accuracy+ scores.
171
+
172
+ ```bash
173
+ # Qwen2-VL
174
+ python -m VisCo.inference.mme_qwen2 \
175
+ --model_name_or_path /home/ypzheng/Qwen2-VL-2B-Instruct \
176
+ --output_dir /path/to/qwen2_visco_checkpoint.pt \
177
+ --fixed_mem_size 18 \
178
+ --train false
179
+
180
+ # LLaVA-1.5
181
+ python -m VisCo.inference.mme_llava15 \
182
+ --model_name_or_path /home/ypzheng/llava15 \
183
+ --output_dir /path/to/llava_visco_checkpoint.pt \
184
+ --fixed_mem_size 32 \
185
+ --train false
186
+ ```
187
+
188
+ The paper evaluates GQA, MMBench, MMBench-CN, MME, POPE, and MMVet. Additional benchmark entry points will be added as they are cleaned for release.
189
+
190
+
191
+ ## πŸ“Œ Citation
192
+
193
+ If you find this project useful, please cite:
194
+
195
+ ```bibtex
196
+ @inproceedings{zheng2026visco,
197
+ title = {VisCo: Leveraging Large Language Models as Intrinsic Encoders for Visual Token Compression},
198
+ author = {Zheng, Yupeng and Zou, Kai and Liu, Bin and Yu, Nenghai},
199
+ booktitle = {Proceedings of the 34th ACM International Conference on Multimedia},
200
+ year = {2026}
201
+ }
202
+ ```
203
+
204
+ ## πŸ™ Acknowledgements
205
+
206
+ This project builds on [LLaVA](https://github.com/haotian-liu/LLaVA), [Qwen2-VL](https://github.com/QwenLM/Qwen2-VL), [Hugging Face Transformers](https://github.com/huggingface/transformers).
207
+