MEDA: Dynamic KV Cache Allocation for Efficient Multimodal Long-Context Inference

Zhongwei Wan, Hui Shen, Xin Wang, Che Liu, Zheda Mai +1 more
2/24/2025
cs.CL

Official code: AIoT-MLSys-Lab/MEDA (22 stars, MIT, last commit 2025-06-19).

Abstract

Long-context Multimodal Large Language Models (MLLMs) that incorporate long text-image and text-video modalities, demand substantial resources as their multimodal Key-Value (KV) caches grow with increasing input lengths, challenging inference efficiency. Existing methods for KV cache compression, in both text-only and multimodal LLMs, have neglected attention density variations across layers, thus often adopting uniform or progressive reduction strategies for layer-wise cache allocation. In this work, we propose MEDA, a dynamic layer-wise KV cache allocation method for efficient multimodal long-context inference. As its core, MEDA utilizes cross-modal attention entropy to determine the KV cache size at each MLLMs layer. Given the dynamically allocated KV cache size at each layer, MEDA also employs a KV pair selection scheme to identify which KV pairs to select and a KV pair merging strategy that merges the selected and non-selected ones to preserve information from the entire context. MEDA achieves up to 72% KV cache memory reduction and 2.82 times faster decoding speed, while maintaining or enhancing performance on various multimodal tasks in long-context settings, including multi-images and long-video scenarios. Our code is released at https://github.com/AIoT-MLSys-Lab/MEDA.

View on arXivView PDF

Code Implementations(1)

MIT

[NAACL 2025🔥] MEDA: Dynamic KV Cache Allocation for Efficient Multimodal Long-Context Inference

225CSS, HTMLJan 23, 20251 years agoMIT

Similar Papers

Cite this paper

@article{wan2025meda,
  title  = {MEDA: Dynamic KV Cache Allocation for Efficient Multimodal Long-Context Inference},
  author = {Zhongwei Wan and Hui Shen and Xin Wang and Che Liu and Zheda Mai and Mi Zhang},
  year   = {2025},
  eprint = {2502.17599},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.17599v2}
}

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/2502.17599.svg)](https://codeofpaper.com/paper/2502.17599)

Discussion