Energy-Latency Manipulation of Multi-modal Large Language Models via Verbose Samples
Kuofeng Gao Jindong Gu Yang Bai Shu-Tao Xia Philip Torr Wei Liu Zhifeng Li

































































Gao and Gu and Bai et al.: Energy-Latency Manipulation of Multi-modal Large Language Models via Verbose Samples
Shell et al.: A Sample Article Using IEEEtran.cls for IEEE Journals











































Despite the exceptional performance of multi-modal large language models (MLLMs), their deployment requires substantial computational resources. Once malicious users induce high energy consumption and latency time (energy-latency cost), it will exhaust computational resources and harm availability of service. In this paper, we investigate this vulnerability for MLLMs, particularly image-based and video-based ones, and aim to induce high energy-latency cost during inference by crafting an imperceptible perturbation. We find that high energy-latency cost can be manipulated by maximizing the length of generated sequences, which motivates us to propose verbose samples, including verbose images and videos. Concretely, two modality non-specific losses are proposed, including a loss to delay end-of-sequence (EOS) token and an uncertainty loss to increase the uncertainty over each generated token. In addition, improving diversity is important to encourage longer responses by increasing the complexity, which inspires the following modality specific loss. For verbose images, a token diversity loss is proposed to promote diverse hidden states. For verbose videos, a frame feature diversity loss is proposed to increase the feature diversity among frames. To balance these losses, we propose a temporal weight adjustment algorithm. Experiments demonstrate that our verbose samples can largely extend the length of generated sequences. 




Energy-latency manipulation, multi-modal large language models, verbose samples.




Energy-Latency Manipulation of Multi-modal Large Language Models via Verbose Samples
    Kuofeng Gao*, Jindong Gu*, Yang Bai, Shu-Tao Xia†, Philip Torr, Senior Member, IEEE,
  Wei Liu, Fellow, IEEE, Zhifeng Li†, Senior Member, IEEE
        

* Equal contribution.
Kuofeng Gao and Shu-Tao Xia are with Tsinghua Shenzhen International Graduate School, Tsinghua University, Shenzhen, Guangdong, China and Shu-Tao Xia is also with the Peng Cheng Laboratory, Shenzhen, Guangdong, China.
(E-mail: gkf21@mails.tsinghua.edu.cn,  xiast@sz.tsinghua.edu.cn).

Jindong Gu and Philip Torr are with Torr Vision Group, University of Oxford. (E-mail: jindong.gu@eng.ox.ac.uk, philip.torr@eng.ox.ac.uk)
Yang Bai is with Tencent Technology (Beijing) Co.Ltd, Beijing, China. (E-mail: mavisbai@tencent.com)
Wei Liu and Zhifeng Li are with Tencent Data Platform, ShenZhen, China. (E-mail: wl2223@columbia.edu, michaelzfli@tencent.com)

†Corresponding authors: Shu-Tao Xia (E-mail: xiast@sz.tsinghua.edu.cn) and Zhifeng Li (E-mail: michaelzfli@tencent.com).


    April 29, 2024
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================






























§ INTRODUCTION


Multi-modal large language models (MLLMs) <cit.>, including image-based LLMs <cit.> and video-based LLMs <cit.>,  have achieved remarkable performance across various multi-modal tasks in both image and video modality, including image and video captioning, question answering, and comprehension. However, these MLLMs <cit.> often consist of billions of parameters, which require significant computational resources for deployment <cit.>. The larger scale of these models can lead to increased energy consumption and longer latency time during the inference process. Both NVIDIA and Amazon Web Services <cit.> have stated that the deployment for the inference process accounts for over 90% of machine learning demand. This high demand for computational resources not only poses challenges in terms of cost but also raises concerns about the potential security risks.



Once attackers maliciously induce high energy consumption and latency time (energy-latency cost) during the inference stage, it can exhaust computational resources and reduce the availability of MLLMs.
The energy consumption is the amount of energy used on hardware during an inference, while the latency time represents the response time taken for the inference.
Previous studies have discussed how to manipulate high energy-latency cost in other architectures and specifically proposed sponge samples <cit.> for LLMs, and NICGSlowdown <cit.> for smaller-scale models. However, when these methods are directly applied to MLLMs, there remains room for improvement, which will be further discussed in Section <ref>. Different from LLMs and smaller-scale models, MLLMs integrate the image and video modality into impressive LLMs <cit.> to enable powerful visual interaction with images and videos. This integration introduces vulnerabilities from the manipulation of visual inputs <cit.>, requiring specific methods to induce high energy-latency cost.







In this paper, we first conduct a comprehensive investigation on energy consumption, latency time, and the length of generated sequences by MLLMs during the inference stage. 
As observed in Fig. <ref>, both energy consumption and latency time exhibit an approximately positive linear relationship with the length of generated sequences.  
Hence, the high energy-latency cost of MLLMs can be maximized by increasing the length of their generated sequences. 

Consequently, we propose verbose samples, including verbose images and verbose videos, to craft an imperceptible perturbation, which can induce image-based LLMs and video-based LLMs to generate long sentences during the inference, respectively.










For both verbose images and videos, two modality non-specific loss objectives are designed as follows. (1) Delayed EOS loss: The end-of-sequence (EOS) token is a signal to stop generating further tokens. By delaying the placement of the EOS token, MLLMs are encouraged to generate more tokens and extend the length of generated sequences. Besides, to accelerate the process of delaying EOS tokens, we propose to break output dependency, following <cit.>. With the guide of the Delayed EOS loss and diverging from the original output dependency, the generated sequence can be deviated towards the direction of a longer sequence. (2) Uncertainty Loss: By introducing more uncertainty over each generated token, it can break the original output dependency at the token level and encourage MLLMs to produce more varied outputs and generate longer sequences.

Additionally, to encourage longer generated sequences, we propose to improve diversity during inference, which can increase the complexity of the output. Based on different input modalities, the modality-specific loss objective for each modality is designed as follows. For verbose images, we propose a Token Diversity Loss that encourages token diversity among all tokens of the whole generated sequence. As a result, it can break the original output dependency at the sequence level and enable image-based LLMs to generate a diverse range of tokens in the output sequence, contributing to longer and more complex sequences. 
For verbose videos, we propose a Frame Feature Diversity Loss tailored for video-based LLMs. Typically, a video consists of a series of consecutive frames representing a scene, with adjacent frames often sharing similar semantics. Leveraging this consistent semantic relationship, video-based LLMs can aggregate different frames within a video into features to produce a coherent sequence. Hence, to promote a longer generated sequence, we propose to increase the diversity of frame features, which can induce different frames away from each other and introduce inconsistent semantics. Consequently, it can confuse video-based LLMs, making it hard to consistently comprehend the content in videos. 


Both verbose images and videos introduce three loss objectives. To balance them, we propose a temporal weight adjustment algorithm for the optimization of verbose images and videos. Extensive experiments demonstrate that our verbose images can increase the length of generated sequences of image-based LLMs by 7.87× and 8.56× compared to original images on MS-COCO and ImageNet datasets. Our verbose videos can increase the length of generated sequences of video-based LLMs by 4.04× and 4.14× compared to original videos on MSVD and TGIF datasets. 



In summary, a preliminary version of this work has been presented as the ICLR 2024 conference <cit.> and contributions in the conference version can be outlined as follows:


  * We conduct a comprehensive investigation and observe that energy consumption and latency time are approximately positively linearly correlated with the length of generated sequences for image-based LLMs. 


  * We propose verbose images to craft an imperceptible perturbation to induce high energy-latency cost for image-based LLMs, which is achieved by delaying the EOS token, enhancing output uncertainty, improving token diversity, and employing a temporal weight adjustment algorithm during the optimization process.


  * Experiments show that our verbose images can increase the maximum length of generated sequences on MS-COCO and ImageNet across four image-based LLMs. Additionally, our verbose images can generate complex sequences containing hallucinated contents and produce dispersed attention on visual input.






In the current work, we incorporate the following additional contributions:


  * For energy-latency manipulation of MLLMs, including both image-based LLMs and video-based LLMs, we find a general observation that energy consumption and latency time are approximately positively linearly correlated with the length of generated sequences. 


  * To induce high energy-latency cost for MLLMs, we propose verbose samples, including verbose images and videos, which both adopt delaying the EOS token and enhancing output uncertainty. Besides, we propose to improve token diversity for verbose images and improve frame feature diversity for verbose videos. Furthermore, a temporal weight adjustment algorithm is proposed to balance these losses. 


  * Experiments demonstrate that our verbose samples can generate the longest sequences. Besides, to highlight the necessity of verbose videos tailored for video-based LLMs, we compare and discuss the differences between verbose images and videos. Furthermore, we unify an interpretation framework for energy-latency manipulation in both image and video modality from hallucination and visual attention.


  * We supplement all discussions about the effect of both verbose images and videos, including different perturbation magnitudes, different adversary knowledge, and different multi-modal tasks.









§ RELATED WORK






 §.§ Multi-modal large language models (MLLMs)


Recently, the advanced MLLMs, including image-based LLMs and video-based LLMs, have achieved an enhanced zero-shot performance in various multi-modal tasks <cit.>. 

The integration of the image or video modality into MLLMs enables visual context-aware interaction, surpassing the capabilities of existing LLMs. However, this integration also introduces vulnerabilities arising from the manipulation of visual inputs, such as adversarial misdirection <cit.> and visual jailbreak <cit.>. With the increasing size of LLM parameters and the inclusion of vision encoders, MLLMs consist of larger parameters, which results in higher energy-latency cost during the inference stage. In our paper, we aim to uncover this security threat in energy-latency manipulation of MLLMs during deployment. To this end, we propose to generate verbose samples to induce high energy-latency cost of MLLMs.





 §.§ Energy-latency manipulation

The energy-latency manipulation <cit.> aims to slow down the models by increasing their energy computation and response time during the inference stage, a threat analogous to the denial-of-service (DoS) attacks <cit.> from the Internet. 
Concretely, sponge samples <cit.> first observe that a larger representation dimension calculation can introduce more energy-latency cost in LLMs. Hence, they propose to craft sponge samples to maximize the ℒ_2 norm of activation values across all layers, thereby introducing more representation calculation and energy-latency cost.
NICGSlowDown <cit.> proposes to increase the number of decoder calls, i.e., the length of the generated sequence, to increase the energy-latency of smaller-scale captioning models. They minimize the logits of both EOS token and output tokens to generate long sentences.



However, there is still room for improvement if these previous methods are directly applied to MLLMs for two main reasons. On one hand, they primarily focus on LLMs or smaller-scale models. Sponge samples are designed for LLMs for translations <cit.> and NICGSlowdown targets for RNNs or LSTMs combined with CNNs for image captioning <cit.>. Differently, our verbose samples are tailored for MLLMs in multi-modal tasks. On the other hand, the objective of NICGSlowdown involves logits of specific output tokens. Nevertheless, current MLLMs generate random output sequences for the same input sample, due to advanced sampling policies <cit.>, which makes it challenging to optimize objectives with specific output tokens. Therefore, it highlights the need for methods specifically designed for MLLMs to induce high energy-latency cost. 






§ METHODOLOGY



 §.§ Threat model



Goals and capabilities. The goal of our proposed verbose samples is to craft an imperceptible perturbation and induce the MLLMs to generate a sequence as long as possible, thereby increasing the energy consumption and prolonging latency during the victim model's deployment. Specifically, the involved perturbation is restricted within a predefined magnitude in l_p norm, ensuring that it is imperceptible and difficult to detect. 


Knowledge and background. 
We consider the target MLLMs which generate sequences using an auto-regressive process. As suggested in <cit.>, we assume that the victim MLLMs can be accessed in full knowledge, including architectures and parameters, in our main experiments.  Additionally, we consider a more challenging scenario where the victim MLLMs are inaccessible in discussions. In such cases, the verbose samples can only be generated on surrogate MLLMs and subsequently transferred to the victim MLLMs.












 §.§ Problem formulation



Consider an input image x for image-based LLMs and an input video with M frames X={X_1, ..., X_M} for video-based LLMs. They are accordingly with an input text c_in and a sequence of generated output tokens y={y_1, y_2, ..., y_N}, where y_i represents the i-th generated token, N is the length of the output sequence and c_in is a placeholder ∅ in image and video captioning or a question in image and video question answering. 









Based on the probability distribution over generated tokens, MLLMs generate one token at one time in an auto-regressive manner.
The probability distribution after the Softmax(·) layer over the i-th generated token can be denoted as f_i(y_1, ⋯, y_i-1; x; c_in) for image-based LLMs and F_i(y_1, ⋯, y_i-1; X; c_in) for video-based LLMs. Since we mainly focus on visual inputs of MLLMs in this paper, we abbreviate it as f_i(x) and F_i(X), where f_i(x) ∈ℝ^V, F_i(X) ∈ℝ^V, and V is the vocabulary size. Meanwhile, the hidden states across all the layers over the i-th generated token are recorded as g_i(y_1, ⋯, y_i-1; x; c_in), abbreviated as  g_i(x), where g_i(x) ∈ℝ^C and C is the dimension size of hidden states for image-based LLMs. In addition, the frame feature over the j-th frame can be extracted by h_j(X) for video-based LLMs, where h_j(X) ∈ℝ^D and D is the dimension size of frame features.









As discussed in Section <ref>, the energy consumption and latency time of an inference are approximately positively linearly related to the length of the generated sequence. Hence, inducing high energy-latency cost can be formulated as maximizing the length N of the output tokens of MLLMs by crafting verbose images x' and verbose videos X'. To ensure the imperceptibility, we impose an l_p restriction on the imperceptible perturbations, where the perturbation magnitude is denoted as ϵ, such that ||x'-x||_p≤ϵ and 1/M∑_j=1^M||X_j'-X_j||_p≤ϵ.


 


















 §.§ Overview




To increase the length of generated sequences, we propose two modality non-specific loss objectives for both verbose images and videos and the modality specific loss objective for each modality to optimize imperceptible perturbations. Two modality non-specific loss objectives are designed as follows. Firstly and straightforwardly, we propose a delayed EOS loss to hinder the occurrence of EOS token and thus force the sentence to continue.
However, the auto-regressive textual generation in MLLMs establishes an output dependency, which means that the current token is generated based on all previously generated tokens. 
Hence, when previously generated tokens remain unchanged, it is also hard to generate a longer sequence even though the probability of the EOS token has been minimized. 
To this end, we propose to break this output dependency as suggested in <cit.>.



Concretely, we propose an uncertainty loss to enhance output uncertainty over each generated token.

Subsequently, the modality specific loss objective for each modality is designed as follows. We find that it can lead to the longer generated sequences by improving diversity, which can increase the complexity of the output.
For verbose images, we propose a token diversity loss, which improves the diversity among all tokens of the whole generated sequence. 
For verbose videos, we propose a frame feature diversity loss to increase the diversity of frame features within an input video.

Moreover, to balance three loss objectives during the optimization, a temporal weight adjustment algorithm is introduced in Section 
<ref>. Fig. <ref> shows an overview of our samples.



 §.§ Loss design



  §.§.§ Delaying EOS occurrence




For both MLLMs, the auto-regressive generation process continues until an end-of-sequence (EOS) token is generated or a predefined maximum token length is reached. To increase the length of generated sequences, one straightforward approach is to prevent the occurrence of the EOS token during the prediction process. However, considering that the auto-regressive prediction is a non-deterministic random process, it is challenging to directly determine the exact location of the EOS token occurrence. 
Therefore, we propose to minimize the probability of the EOS token at all positions. This can be achieved through the delayed EOS loss, formulated as follows for verbose images:

    ℒ_1(x')=1/N∑_i=1^N f_i^EOS(x'),

and formulated as follows for verbose videos:

    ℒ_1(X')=1/N∑_i=1^N F_i^EOS(X'),

where f_i^EOS(·) and F_i^EOS(·) are the EOS token probability of the probability distribution after the Softmax(·) layer over the i-th generated token in image-based LLMs and video-based LLMs, respectively.
When reducing the likelihood of every EOS token occurring by minimizing ℒ_1(·), MLLMs are encouraged to generate more and more tokens before reaching the EOS token.






  §.§.§ Enhancing output uncertainty



To generate a longer sequence, we propose to break output dependency. This is because guided by the delay of the EOS token, the generated sequence can deviate towards a longer generated sequence, diverging from the original auto-regressive output dependency. Then, the problem can be formulated as how to induce the generated sequence away from the original sequence. Typically, MLLMs generate each token with the highest probability, forming a generated sequence. The probability of the generated sequence can be calculated as a product of conditional probabilities of each generated token <cit.>, formulated as follows for verbose images:

    P(y_1...y_N;x;c_in)=∏_i=1^N P(y_i|y_1,...,y_i-1;x;c_in),

and formulated as follows for verbose videos:

    P(y_1...y_N;X;c_in)=∏_i=1^N P(y_i|y_1,...,y_i-1;X;c_in).

Consequently, the probability of the original generated sequence is also the highest probability. To deviate from the original generated sequence, we can reduce the probability of the generated sequence, which can be achieved by lowering the probability of each generated token. 
To this end, we propose to enhance output uncertainty over each generated token to facilitate longer and more complex output sequences. 
This objective can be implemented by maximizing the entropy of the output probability distribution for each generated token. Based on <cit.>, it can be converted to minimize the Kullback–Leibler (KL) divergence D_KL(·, ·) <cit.> between the output probability distribution and a uniform distribution 𝒰. 
Therefore, the uncertainty loss can be formulated as follows for verbose images:

    ℒ_2(x')=∑_i=1^N D_KL(f_i(x'), 𝒰),

and formulated as follows for verbose videos:

    ℒ_2(X')=∑_i=1^N D_KL(f_i(X'), 𝒰),

where f_i(·) and F_i(·) are the probability distribution after the Softmax(·) layer over the i-th generated token in image-based LLMs and video-based LLMs, respectively. The uncertainty loss can introduce more uncertainty in the prediction for each generated token, effectively breaking the original output dependency. Consequently, when the original output dependency is disrupted,  MLLMs can generate more complex sentences and longer generated sequences, guided by the delay of the EOS token. 






  §.§.§ Improving diversity for each modality


For verbose images, to increase the complexity of the output, we propose to improve the diversity of hidden states among all generated tokens, which explores a wider range of possible outputs. Specifically, the hidden state of a token is the vector representation of a word or subword in image-based LLMs. 




Let Rank(·) indicates the rank of a matrix and [g_1(x');g_2(x');⋯;g_N(x')] denotes the concatenated matrix of hidden states among all generated tokens. To induce high energy-latency cost of image-based LLMs, the token diversity is defined as the rank of hidden states among all generated tokens, i.e., Rank([g_1(x');g_2(x');⋯;g_N(x')]).


Given by Definition <ref>, increasing the rank of the concatenated matrix of hidden states among all generated tokens yields a more diverse set of hidden states of the tokens. However, based on <cit.>, the optimization of the matrix rank is an NP-hard non-convex problem.  To address this issue, we calculate the nuclear norm of a matrix to approximately measure its rank, as stated in Proposition <ref>. Consequently, by denoting the nuclear norm of a matrix as ||·||_*, we can formulate the token diversity loss as follows for verbose images: 

    ℒ_3(x')=-||[g_1(x');g_2(x');⋯;g_N(x')]||_*.

This token diversity loss can lead to more diverse and complex sequences, making it hard for image-based LLMs to converge to a coherent output. 




<cit.> For a rank minimization or maximization problem, the rank of a matrix can be heuristically measured using the nuclear norm of the matrix.







For verbose videos, we propose a frame feature diversity loss tailored for video-based LLMs.
Video-based LLMs extract spatial and temporal features from video data, where different frames maintain a consistent semantic relationship over time. 
The consistent semantic over time in multiple frames within a video induces the sequence generation to converge to  a limited number of tokens. To facilitate a longer generated sequence, we propose to increase the diversity of frame features, thereby introducing inconsistent semantics into the video data. As video-based LLMs grapple with accommodating these diverse or disrupted frame features, it is compelled to explore alternative output interpretations, resulting in a longer generated sequence.





Let Rank(·) indicates the rank of a matrix and [h_1(X');h_2(X');⋯;h_M(X')] denotes the concatenated matrix of features among all frames. To induce high energy-latency cost of video-based LLMs, the diversity of frame features is defined as the rank of features among all frames, i.e., Rank([h_1(X');h_2(X');⋯;h_M(X')]).

Given by Definition <ref>, increasing the concatenated matrix of features among all frames can boost the diversity of frame features.  Combined with Proposition <ref>, we can formulate the frame feature diversity loss as follows for verbose videos:

    ℒ_3(X')=-||[h_1(X');h_2(X');⋯;h_M(X')]||_*,

where ||·||_* is the nuclear norm of a matrix. This loss can maximize the semantic distance among different frames within a video, which mislead video-based LLMs to generate a longer sequence.
In summary, due to the reduced probability of EOS occurrence by ℒ_1(·), the disruption of the original output dependency introduced by ℒ_2(·), and complexity diversity introduced by ℒ_3(·), our verbose samples can facilitate a more effective manipulation on the worst-case energy-latency cost of MLLMs.






 §.§ Optimization


To combine the three loss functions of verbose samples, ℒ_1(·), ℒ_2(·), and ℒ_3(·) into an overall objective function, we propose to assign three weights λ_1, λ_2, and λ_3 to the ℒ_1(·), ℒ_2(·), and ℒ_3(·) and sum them up to obtain the overall objective function of verbose images as follows: 

    min_x' λ_1 ×ℒ_1(x') + λ_2 ×ℒ_2(x') + λ_3 ×ℒ_3(x'),

and overall objective function of verbose videos as follows:

    min_X' λ_1 ×ℒ_1(X') + λ_2 ×ℒ_2(X') + λ_3 ×ℒ_3(X').

To optimize this objective, we adopt the projected gradient descent (PGD) algorithm, as proposed by  <cit.>.  
PGD algorithm is an iterative optimization technique that updates the solution by taking steps in the direction of the negative gradient while projecting the result back onto the feasible set. We denote verbose images at the t-th step as x'_t, verbose videos at the t-th step as X'_t, and the gradient descent step of verbose images is as follows:

    x'_t=x'_t-1    -α×sign ( ∇_x'_t-1 (λ_1  ×ℒ_1(x'_t-1) 
       + λ_2 ×ℒ_2(x'_t-1) + λ_3 ×ℒ_3(x'_t-1)) ),
        s.t. ||x'_t-x||_p≤ϵ,

and the gradient descent step of verbose videos is as follows:

    X'_t=X'_t-1    -α×sign ( ∇_X'_t-1 (λ_1  ×ℒ_1(X'_t-1) 
       + λ_2 ×ℒ_2(X'_t-1) + λ_3 ×ℒ_3(X'_t-1)) ),
        s.t. 1/M∑_j=1^M||X_tj'-X_j||_p≤ϵ,

where α is the step size and ϵ is the perturbation magnitude to ensure the imperceptibility. Since  different loss functions have different convergence rates during the iterative optimization process, we propose a temporal weight adjustment algorithm to achieve a better balance among these three loss objectives.  
Specifically, we incorporate normalization scaling and temporal decay functions, 𝒯_1(t), 𝒯_2(t), and 𝒯_3(t), into the optimization weights λ_1(t), λ_2(t), and λ_3(t) of ℒ_1(·), ℒ_2(·), and ℒ_3(·). Therefore, it can be formulated for verbose images as follows: 

    λ_k(t) = ||ℒ_2(x'_t-1)||_1 / ||ℒ_k(x'_t-1)||_1 / 𝒯_k(t),

and for verbose videos as follows:

    λ_k(t) = ||ℒ_2(X'_t-1)||_1 / ||ℒ_k(X'_t-1)||_1 / 𝒯_k(t),

where k=1,2,3 and the temporal decay functions are set as follows:

    𝒯_k(t)=a_k ×ln(t) + b_k.

Besides, a momentum value m is introduced into the update process of weights. This involves taking into account not only current weights but also previous weights when updating losses, which helps smooth out the weight updates during the optimization process. 






§ EXPERIMENTS




 §.§ Experimental setups

Models and datasets. For verbose images, we consider four open-source and advanced large image-language models as our evaluation benchmark, including BLIP <cit.>, BLIP-2 <cit.>, InstructBLIP <cit.>, and MiniGPT-4 <cit.>. 
Concretely, we adopt the BLIP with the basic multi-modal mixture of encoder-decoder model in 224M version, BLIP-2 with an OPT-2.7B LM <cit.>, InstructBLIP and MiniGPT-4 with a Vicuna-7B LM <cit.>. These models perform the captioning task for the image under their prompt templates in default and also evaluate question answering task in discussions.
We randomly choose the 1,000 images from MS-COCO <cit.> and ImageNet <cit.> dataset, respectively, as our evaluation dataset. 



For verbose videos, we evaluate three benchmark video-based LLMs, including VideoChat-2 <cit.>, Video-Vicuna <cit.>, and Video-LLaMA <cit.>. Specifically, we employ VideoChat-2 with a Vicuna-7B LM <cit.>, Video-Vicuna with a Vicuna-7B LM <cit.>, and Video-LLaMA a LLaMA-2-7B LM <cit.>. These models perform video captioning tasks using their standard prompt templates in default and also evaluate question answering task in discussions. For the evaluation purposes, we randomly select 500 videos from the MSVD <cit.> and TGIF <cit.> datasets, respectively.


Baselines and setups.
For the evaluation, we consider original samples, samples with random noise, sponge samples, and NICGSlowDown as baselines. For sponge samples, NICGSlowDown, and our verbose samples, we perform the projected gradient descent (PGD) <cit.> algorithm in T=1,000 iterations. 
Besides, in order to ensure the imperceptibility, the perturbation magnitude  is set as 
ϵ=8 within l_∞ restriction, following <cit.>, and the step size is set as α=1. The default maximum length of generated sequences of MLLMs is set as 512 and the sampling policy  is configured to use nucleus sampling <cit.>. For verbose images, the parameters of loss weights are a_1=10, b_1=-20, a_2=0, b_2=0, a_3=0.5, and b_3=1 and the momentum of our optimization is m=0.9. For verbose videos, the parameters of loss weights are a_1=10,000, b_1=100,000, a_2=0, b_2=0, a_3=5, and b_3=500 and the momentum of our optimization is m=0.9. Besides, a video consists of eight frames to input the video-based LLMs.







Evaluation metrics. We calculate the energy consumption (J) and the latency time (s) during  inference on one single GPU. Following <cit.>, the energy consumption and latency time are measured by the NVIDIA Management Library (NVML) and the response time cost of an inference, respectively. Besides, the length of generated sequences is also regarded as a metric. Considering the randomness of sampling modes in MLLMs, we report the average evaluation results run over three times.

























 §.§ Main results

Table <ref> and Table <ref> compare the length of generated sequences, energy consumption, and latency time of original samples, samples with random noise, sponge samples, NICGSlowdown, and our proposed verbose samples. 
The original samples serve as a baseline, providing reference values for comparison. 

When random noise is added to the samples, the generated sequences exhibit a similar length to those of the original ones. It illustrates that it is necessary to optimize a handcrafted perturbation to induce high energy-latency cost of MLLMs. The sponge samples and NICGSlowdown can generate longer sequences compared to original ones. However, the increase in length is still smaller than that of our verbose samples. This can be attributed to the reason that the additional computational cost brought by sponge samples is tailored for LLMs and the objective for longer sequences introduced by NICGSlowdown is particularly suited for smaller-scale captioning models. There is still potential improvement to induce high energy-latency cost specifically for MLLMs.










Our verbose samples can increase the maximum length of generated sequences and introduce the highest energy-latency cost among all these methods.  Specifically, our verbose images can increase the average length of generated sequences by 7.87× and 8.56× relative to original images on the MS-COCO and ImageNet datasets, respectively. Our verbose videos can increase the average length of generated sequences by 4.04× and 4.14× compared to original videos on MSVD and TGIF datasets. These results demonstrate the superiority of our verbose samples for MLLMs.
In addition, we visualize the length distribution of output sequences generated by four image-based LLMs on original images and our verbose images in Fig. <ref> and that by three video-based LLMs on original videos and our verbose videos in Fig. <ref>. Compared to original samples, the distribution peak for sequences generated using our verbose samples exhibits a shift towards the direction of the longer length, confirming the effectiveness of our methods in generating longer sequences. We conjecture that the different shift magnitudes are due to different architectures, different training policies, and different parameter quantities in these MLLMs. 












 §.§ Ablation studies

We explore the effect of the proposed three loss objectives and  the effect of the temporal weight adjustment algorithm with momentum for verbose samples.


Effect of loss objectives. Our verbose samples consist of three loss objectives: ℒ_1(·), ℒ_2(·) and ℒ_3(·), respectively. Note that ℒ_3(·) is different and modality specific for verbose images and videos. To identify the individual contributions of each loss function and their combined effects on the overall performance, we evaluate various combinations of the proposed loss functions, as presented in Table <ref>. It can be observed that optimizing each loss function individually can generate longer sequences, and the combination of all three loss functions achieves the best results in terms of sequence length. This ablation study suggests that the three loss functions in verbose images, which delay EOS occurrence, enhance output uncertainty, and improve token diversity, play a complementary role in extending the length of generated sequences. Similarly, the three loss functions in verbose videos, which delay EOS occurrence, enhance output uncertainty, and improve frame feature diversity, collaboratively contribute to extending the length of generated sequences.


Effect of temporal weight adjustment. During the optimization, we introduce two methods: a temporal decay 𝒯(t) for loss weighting and an addition of the momentum m. As shown in Table <ref>, both methods contribute to the longer length of the generated sequences. Furthermore, the longest length is obtained by combining temporal decay and momentum, which indicates that temporal decay and momentum can work synergistically to induce high energy-latency cost for MLLMs.










 §.§ Differences between verbose images and videos

To induce high energy-latency cost of video-based LLMs, we do not directly use the previously proposed verbose images. Instead, we introduce verbose videos, which are specifically tailored for video-based LLMs. To illustrate the reason behind it, we design two experiments as follows to compare differences between verbose images and videos.

(1) From the difference of loss objectives, verbose images and videos have a different modality specific L_3(·). For clearer expression, L_3(·) in verbose images and videos are abbreviated as L_3_img(·) and L_3_vid(·), respectively. Therein, L_3_vid(·) aims to destroy the diversity of frame features, targeting specific video data with multiple frames rather than image data, making it inapplicable to image-based LLMs. Conversely, L_3_img(·) in verbose images aims to improve the diversity of hidden states among all generated tokens, which can be applied to both image-based LLMs and video-based LLMs because they both employ auto-regressive token generation. Therefore, we explore the effect when replacing L_3_vid(·) with L_3_img(·) to generate verbose videos. Results in Table <ref> reveal that using L_3_vid(·) alone outperforms solely employing L_3_img(·). Correspondingly, verbose videos with L_3_vid(·) exhibit a superior length of generated sequences, indicating its effectiveness in generating better verbose videos compared with L_3_img(·).


(2) Considering various ways to utilize verbose images, we investigate the impact of using either a single verbose image or a combination of multiple verbose images to form a video, compared to the direct application of verbose videos.  
Specifically, we conduct an experiment where we randomly select a frame from a video and use it to generate a verbose image. Additionally, we randomly select eight frames, generate a corresponding verbose image for each, and then combine these to form a video, the same frame number as our verbose videos. 
As demonstrated in Table <ref>, the generated sequences of both methods are lower compared to our verbose videos. We conjecture the reason is that a single verbose image or multiple verbose images do not take into account the temporal relationship among different frames within a video. 
Our verbose videos, on the other hand, consider it using L_3_vid(·) and introduce inconsistent semantics, which is a crucial factor in the effectiveness of the energy-latency manipulation for video-based LLMs.






















 §.§ Unified interpretation

To better reveal the mechanisms behind our verbose samples, we propose a unified interpretation, which conducts two further studies, including the visual interpretation where we adopt Grad-CAM <cit.> to generate the attention maps and the textual interpretation where we evaluate the object hallucination in generated sequences by CHAIR <cit.>. 




Textual Interpretation. 

We investigate object hallucination in generated sequences using CHAIR <cit.>. 
CHAIR_i is calculated as the fraction of hallucinated object instances, while CHAIR_s represents the fraction of sentences containing a hallucinated object, with the results presented in Table <ref> and Table <ref>.

Compared to original samples, which exhibit a lower object hallucination rate, the longer sequences produced by our verbose samples contain a broader set of objects. This observation implies that our verbose samples can prompt MLLMs to generate sequences that include objects not present in the visual input, thereby leading to longer sequences and higher energy-latency cost. 







Visual Interpretation. 

We adopt GradCAM <cit.>, a gradient-based visualization technique that generates attention maps highlighting the relevant regions in the visual input for the generated sequences. From Fig. <ref> and Fig. <ref>, the attention of original images and videos primarily concentrates on a local region containing a specific object mentioned in the generated caption. In contrast, our verbose images can effectively disperse attention and cause  image-based LLMs to shift their focus from a specific object to the entire image region.  Similarly, our verbose videos are shown to distribute attention throughout the video frames in both spatial and temporal dimensions, rather than focus on specific actions or scenes. Since the attention mechanism serves as a bridge between the visual input and the output sequence of MLLMs, we conjecture that the generation of a longer sequence can be reflected in an inaccurate focus and dispersed and uniform attention from the visual input. 


In summary, our proposed verbose samples exhibit a higher hallucination rate and uniform attention distribution. Therefore, we hope that our proposed unified interpretation will serve as a valuable analytical tool for further research.








 §.§ Discussions

Different perturbation magnitudes. In our default setting, the perturbation magnitude ϵ is set as 8. To investigate the impact of different magnitudes, we vary ϵ under [2,4,8,16,32] in Table <ref> and calculate the corresponding LIPIS <cit.> between  original ones and their verbose counterpart, which quantifies the perceptual difference. It can be observed that a larger perturbation magnitude ϵ results in a longer generated sequence by MLLMs but produces more perceptible verbose samples. Consequently, this trade-off between visual perceptibility and energy-latency cost highlights the importance of choosing an appropriate perturbation magnitude during evaluation. 
















Different adversary knowledge. We explore a different adversary knowledge from main experiments, where the victim MLLMs are unknown in black-box settings <cit.>. To induce high energy-latency cost of black-box MLLMs, we can leverage the transferability property <cit.> of our verbose samples. We can first craft verbose samples on a known and accessible surrogate model and then utilize them to transfer to the target victim MLLMs. The black-box transferability results across four image-based LLMs of our verbose images are evaluated in Table <ref>, while the transferability results of our verbose videos are assessed across three video-based LLMs, presented in Table <ref>. When the source model is set as `None', it indicates that we evaluate the energy-latency cost for the target model by utilizing the original samples. The results demonstrate that our transferable verbose samples are less effective than the white-box verbose samples but still result in a longer generated sequence. 


Different multi-modal tasks. To verify the effectiveness of our methods, we induce high energy-latency cost on an additional multi-modal task: visual question answering (VQA). For verbose images, we use VQAv2 dataset <cit.> in image question answering and for verbose videos, we employ MSVD-QA dataset <cit.> in video question answering. We use BLIP-2 as the target image-based LLM and VideoChat-2 as the target video-based LLM. Unless otherwise specified, other settings remain unchanged. Table <ref> demonstrates that our verbose samples can induce the highest energy-latency cost among different multi-modal tasks.














Potential defenses. An intuitive defense to mitigate the energy-latency vulnerability is to impose a limitation on the length of generated sequences. We argue that such an intuitive defense is infeasible and the reason is as follows. 

(1) Users have diverse requirements and input data, leading to a wide range of sentence lengths and complexities. For example, the prompt text of `Describe the given image in one sentence.' and `Describe the given image in details.' can introduce different lengths of generated sentences. We visualize a case in Fig. <ref>. Consequently, service providers often consider a large token limit to accommodate these diverse requirements and ensure that the generated sentences are complete and meet users' expectations. Previous work, NICGSlowDown <cit.>, also states the same view as us. Besides, as shown in Table <ref>, the results can demonstrate that our verbose samples are adaptable for different prompt texts and can induce the length of generated sentences closer to the token limit set by the service provider. As a result, the energy-latency cost can be increased while staying within the imposed constraints.  


(2) We argue that this attack surface about availability of MLLMs becomes more important and our verbose samples can induce more serious attack consequences in the era of (multi-modal) large language models. The development of MLLMs has led to models capable of generating longer sentences with logic and coherence. Consequently, service providers have been increasing the maximum allowed length of generated sequences to ensure high-quality user experiences. For instance, gpt-3.5-turbo and gpt-4-turbo allow up to 4,096 and 8,192 tokens, respectively. Hence, we would like to uncover that while longer generated sequences can indeed improve service quality, they also introduce potential security risks about energy-latency cost, as our verbose samples demonstrate. Therefore, when MLLMs service providers consider increasing the maximum length of generated sequences for better user experience, they should not only focus on the ability of MLLMs but also take the maximum energy consumption payload into account.  

In terms of potential defenses, common data pre-processing methods, such as compressing or generative models, should be beneficial in defending our verbose samples. Furthermore, it is crucial to focus on safety-based alignment strategies, as they can significantly enhance the robustness of MLLMs against attacks. In our future work, we plan to investigate and develop defense methods to address the security threat introduced by energy-latency manipulation in a comprehensive manner.











§ CONCLUSION AND LIMITATION

In this paper, we aim to craft an imperceptible perturbation to induce high energy-latency cost of MLLMs during the inference stage. We propose verbose samples to prompt MLLMs to generate as many tokens as possible. 
Extensive experimental results demonstrate that, compared to original images, our verbose images can increase the average length of generated sequences by 7.87× and 8.56× on MS-COCO and ImageNet across four image-based LLMs. Our verbose videos can increase the average length of generated sequences by 4.04× and 4.14× compared to original videos on MSVD and TGIF datasets across three video-based LLMs. In addition, we compare and discuss differences between verbose images and videos, highlighting the significance of the proposed verbose videos for video-based LLMs instead of directly using a single verbose image or a combination of multiple verbose images.
For a deeper understanding, we propose a unified framework from hallucination and visual attention to interpret the mechanism behind the energy-latency manipulation of MLLMs.
We hope that our verbose samples can serve as a baseline to manipulate high energy-latency cost of MLLMs. 



The primary limitation of our verbose samples lies in the focus on the digital world, where input samples are directly fed into the models. As technology progresses, MLLMs are expected to be deployed in more complex, real-world scenarios, such as autonomous driving. In these situations, input samples would not be pre-recorded but captured in real-time from physical environments using cameras. Therefore, the current verbose samples may not fully address the challenges and complexities associated with energy-latency manipulation in real-world, dynamic settings. Future research should investigate the implementation and impact of energy-latency manipulation techniques in the physical world to ensure their effectiveness in practical applications.




 


Please note that we restrict all experiments in the laboratory environment and do not support our verbose samples in the real scenario. The purpose of our work is to raise the awareness of the security concern in availability of MLLMs and call for  practitioners to pay more attention to the manipulation of energy-latency cost for MLLMs and model trustworthy deployment.







































IEEEtran



















