Inférence efficace des modèles de suivi d'instructions visuelles avec un cache élastique
Efficient Inference of Vision Instruction-Following Models with Elastic Cache
July 25, 2024
Auteurs: Zuyan Liu, Benlin Liu, Jiahui Wang, Yuhao Dong, Guangyi Chen, Yongming Rao, Ranjay Krishna, Jiwen Lu
cs.AI
Résumé
Dans le domaine des grands modèles vision-langage (LVLMs) suivant des instructions, le déploiement efficace de ces modèles rencontre des défis, notamment en raison des exigences élevées en mémoire de leurs caches clé-valeur (KV). Les stratégies conventionnelles de gestion des caches pour les LLM se concentrent sur l'éviction des caches, ce qui ne répond souvent pas aux besoins spécifiques des modèles multimodaux suivant des instructions. Conscients de cette lacune, nous introduisons dans cet article Elastic Cache, une approche novatrice qui tire parti de l'application de méthodes d'accélération distinctes pour les étapes d'encodage des instructions et de génération de sortie. Nous étudions les métriques d'importance à différentes étapes et proposons une stratégie de fusion de caches basée sur l'importance pour éliminer les caches redondants. Au lieu de supprimer les caches moins importants, notre stratégie identifie les vecteurs clé/valeur importants comme points d'ancrage. Les caches moins importants environnants sont ensuite fusionnés avec ces ancres, améliorant la préservation des informations contextuelles dans les caches KV tout en offrant un ratio d'accélération arbitraire. Pour l'encodage des instructions, nous utilisons la fréquence pour évaluer l'importance des caches. Concernant la génération de sortie, nous priorisons les tokens en fonction de leur distance avec un décalage, ce qui permet de conserver à la fois les tokens initiaux et les plus récents. Les résultats sur une gamme de LVLMs démontrent qu'Elastic Cache non seulement améliore l'efficacité, mais surpasse également notablement les méthodes d'élagage existantes dans la génération de langage à travers diverses tâches. Le code est disponible à l'adresse https://github.com/liuzuyan/ElasticCache.
English
In the field of instruction-following large vision-language models (LVLMs),
the efficient deployment of these models faces challenges, notably due to the
high memory demands of their key-value (KV) caches. Conventional cache
management strategies for LLMs focus on cache eviction, which often fails to
address the specific needs of multimodal instruction-following models.
Recognizing this gap, in this paper, we introduce Elastic Cache, a novel
approach that benefits from applying distinct acceleration methods for
instruction encoding and output generation stages. We investigate the metrics
of importance in different stages and propose an importance-driven cache
merging strategy to prune redundancy caches. Instead of discarding less
important caches, our strategy identifies important key/value vectors as anchor
points. Surrounding less important caches are then merged with these anchors,
enhancing the preservation of contextual information in the KV caches while
yielding an arbitrary acceleration ratio. For instruction encoding, we utilize
the frequency to evaluate the importance of caches. Regarding output
generation, we prioritize tokens based on their distance with an offset, by
which both the initial and most recent tokens are retained. Results on a range
of LVLMs demonstrate that Elastic Cache not only boosts efficiency but also
notably outperforms existing pruning methods in language generation across
various tasks. Code is available at https://github.com/liuzuyan/ElasticCacheSummary
AI-Generated Summary