Skipping Computations in Multimodal LLMs

Mustafa Shukor, Matthieu Cord
10/12/2024
cs.CVcs.LG

Official code: mshukor/ima-lmms (23 stars, last commit 2024-10-15).

Abstract

Large Language Models (LLMs) have demonstrated remarkable success in both textual and multimodal domains. However, this success often comes with substantial computational costs, particularly when handling lengthy sequences of multimodal inputs. This has sparked many efforts focusing on enhancing efficiency during training and inference. In this study, we investigate the computation redundancy in Multimodal Large Language Models (MLLMs) during inference. We propose different methods to skip computations, such as skipping entire blocks, FFN or self-attention (SA) layers. Additionally, we explore parallelizing certain layers, such as FFN and SA layers. Our findings validate that (1) significant amount of computations can be avoided at inference time, especially for tasks such as Visual Question Answering (VQA). (2) Skipping computations during training can recover 97% of the original performance, even when skipping half of the blocks or removing 70% of the weights. Alternatively, (3) properly training with smaller LLMs can yield comparable performance to LLMs 2 or 3 times larger. To conclude, we extend our investigation to recent MLLMs, such as LLaVA-1.5, showing similar observations. Our work show that there is redundant computations inside MLLMs and thus the potential for significantly improving inference costs without sacrificing performance. The code is available here: https://github.com/mshukor/ima-lmms.

View on arXivView PDF

Code Implementations(1)

mshukor/ima-lmmsOfficial100%

[NeurIPS2024] Official code for (IMA) Implicit Multimodal Alignment: On the Generalization of Frozen LLMs to Multimodal Inputs

234Shell, PythonMay 20, 20242 years ago

Similar Papers

Cite this paper

@article{shukor2024skipping,
  title  = {Skipping Computations in Multimodal LLMs},
  author = {Mustafa Shukor and Matthieu Cord},
  year   = {2024},
  eprint = {2410.09454},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.09454v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.09454.svg)](https://codeofpaper.com/paper/2410.09454)

Discussion