arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.09086cs.LGcs.AIcs.CVcs.DCcs.PF
收藏

Inf-MLLM: 单GPU上多模态大语言模型的高效流式推理

Inf-MLLM: Efficient Streaming Inference of Multimodal Large Language Models on a Single GPU

Shanghai Jiao Tong University(上海交通大学);Fudan University(复旦大学)

Zhenyu Ning, Jieru Zhao, Qihao Jin, Wenchao Ding, Minyi Guo

AI总结:

针对MLLM长上下文推理KV缓存占用高、难在边缘部署流式推理的问题,本文提出Inf-MLLM框架,基于“注意力鞍点”模式维持受限KV缓存并引入注意力偏置捕捉长依赖,实现单GPU上无限上下文的高效流式推理,性能与速度均优于现有方法。

摘要:

多模态大语言模型(Multimodal Large Language Models, MLLMs)以其多模态综合能力著称,已在GPT-4o、自动驾驶和机器人等众多实际应用中得到广泛使用。尽管其性能表现亮眼,但多模态输入往往会带来长上下文。长上下文下的推理需要缓存大量先前token的键值状态(KV cache),这会导致高延迟和过高的内存消耗。正因如此,在边缘设备上部署MLLMs的流式推理极具挑战性,这在很大程度上限制了MLLMs在实际应用中的效能和使用场景。\n本文提出了Inf-MLLM,一种面向MLLMs的高效推理框架,可在单GPU上实现具备无限上下文的MLLM流式推理。Inf-MLLM基于我们在LLMs和MLLMs中发现的关键注意力模式——“注意力鞍点(attention saddles)”。得益于这一新发现的注意力模式,Inf-MLLM通过动态缓存近期token和相关token,维持大小受限的KV缓存。此外,Inf-MLLM提出了注意力偏置(attention bias)这一新颖方法,使MLLMs能够捕捉长程依赖关系。\n实验结果表明,Inf-MLLM可让多种LLMs和MLLMs在单GPU上,针对400万token的长文本以及包含1小时时长视频的多轮对话实现稳定性能。此外,Inf-MLLM展现出优于StreamingLLM等现有方法的流式推理质量,且推理速度是H2O的2倍。

英文摘要:

Multimodal Large Language Models (MLLMs) are distinguished by their multimodal comprehensive ability and widely used in many real-world applications including GPT-4o, autonomous driving and robotics. Despite their impressive performance, the multimodal inputs always incur long context. The inference under long context requires caching massive Key and Value states (KV cache) of previous tokens, which introduces high latency and excessive memory consumption. Due to this reason, it is challenging to deploy streaming inference of MLLMs on edge devices, which largely constrains the power and usage of MLLMs in real-world applications. In this paper, we introduce Inf-MLLM, an efficient inference framework for MLLMs, which enable streaming inference of MLLM on a single GPU with infinite context. Inf-MLLM is based on our key observation of the attention pattern in both LLMs and MLLMs called "attention saddles". Thanks to the newly discovered attention pattern, Inf-MLLM maintains a size-constrained KV cache by dynamically caching recent tokens and relevant tokens. Furthermore, Inf-MLLM proposes attention bias, a novel approach to enable MLLMs to capture long-term dependency. We show that Inf-MLLM enables multiple LLMs and MLLMs to achieve stable performance over 4M-token long texts and multi-round conversations with 1-hour-long videos on a single GPU. In addition, Inf-MLLM exhibits superior streaming reasoning quality than existing methods such as StreamingLLM and 2x speedup than H2O.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑