MCPcopy Index your code
hub / github.com/KuofengGao/Verbose_Images

github.com/KuofengGao/Verbose_Images @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
4,564 symbols 13,857 edges 550 files 1,361 documented · 30%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Inducing High Energy-Latency of Large Vision-Language Models with Verbose Images

This repository provides the pytorch implementatin of our ICLR 2024 work: Inducing High Energy-Latency of Large Vision-Language Models with Verbose Images.

Abstract

Large vision-language models (VLMs) such as GPT-4 have achieved exceptional performance across various multi-modal tasks. However, the deployment of VLMs necessitates substantial energy consumption and computational resources. Once attackers maliciously induce high energy consumption and latency time (energy-latency cost) during inference of VLMs, it will exhaust computational resources. In this paper, we explore this attack surface about availability of VLMs and aim to induce high energy-latency cost during inference of VLMs. We find that high energy-latency cost during inference of VLMs can be manipulated by maximizing the length of generated sequences. To this end, we propose verbose images, with the goal of crafting an imperceptible perturbation to induce VLMs to generate long sentences during inference. Concretely, we design three loss objectives. First, a loss is proposed to delay the occurrence of end-of-sequence (EOS) token, where EOS token is a signal for VLMs to stop generating further tokens. Moreover, an uncertainty loss and a token diversity loss are proposed to increase the uncertainty over each generated token and the diversity among all tokens of the whole generated sequence, respectively, which can break output dependency at token-level and sequence-level. Furthermore, a temporal weight adjustment algorithm is proposed, which can effectively balance these losses. Extensive experiments demonstrate that our verbose images can increase the length of generated sequences by 7.87 times and 8.56 times compared to original images on MS-COCO and ImageNet datasets, which presents potential challenges for various applications.

Pipeline of ASD

Installation

This code is tested on our local environment (python=3.9.2, cuda=11.6), and we recommend you to use anaconda to create a vitural environment:

conda create -n VI python=3.9.2

Then, activate the environment:

conda activate VI

Install requirements:

pip install -e .

Data Preparation

Please download MS-COCO dataset from its official website and randomly select 1,000 images.

Verbose Images

Run the following command to generate verbose images to induce high energy-latency cost of BLIP-2.

bash scripts/run.sh

Citation

@inproceedings{gao2024inducing,
  title={Inducing High Energy-Latency of Large Vision-Language Models with Verbose Images},
  author={Gao, Kuofeng and Bai, Yang and Gu, Jindong and Xia, Shu-Tao and Torr, Philip and Li, Zhifeng and Liu, Wei},
  booktitle={ICLR},
  year={2024}
}

Acknowledgements

This respository is mainly based on LAVIS and MiniGPT-4. Thanks for their wonderful works!

Core symbols most depended-on inside this repo

size
called by 632
lavis/common/annotator/uniformer/mmcv/video/io.py
get
called by 272
lavis/models/ulip_models/utils/io.py
info
called by 192
lavis/common/vqa_tools/vqa.py
get
called by 188
lavis/common/registry.py
load
called by 164
lavis/common/annotator/midas/midas/base_model.py
print
called by 122
lavis/common/dist_utils.py
stack
called by 77
lavis/common/annotator/uniformer/mmcv/parallel/data_container.py
get
called by 70
lavis/common/annotator/uniformer/mmcv/video/io.py

Shape

Method 2,815
Class 927
Function 818
Route 4

Languages

Python100%

Modules by API surface

lavis/models/blip2_models/modeling_t5.py79 symbols
lavis/models/med.py74 symbols
lavis/common/annotator/uniformer/mmcv/fileio/file_client.py70 symbols
lavis/models/blip2_models/Qformer.py67 symbols
lavis/common/annotator/uniformer/mmseg/datasets/pipelines/transforms.py63 symbols
lavis/models/clip_models/model.py62 symbols
lavis/common/annotator/uniformer/mmcv/cnn/utils/weight_init.py56 symbols
lavis/models/blip_diffusion_models/ptp_utils.py55 symbols
lavis/models/blip_models/nlvr_encoder.py54 symbols
lavis/datasets/datasets/audio_captioning_datasets.py50 symbols
lavis/models/blip2_models/modeling_llama.py48 symbols
lavis/common/annotator/uniformer/mmcv/runner/hooks/lr_updater.py46 symbols

For agents

$ claude mcp add Verbose_Images \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page