Эффективный вывод моделей следования инструкциям для зрительного восприятия с эластичным кэшем.
Efficient Inference of Vision Instruction-Following Models with Elastic Cache
July 25, 2024
Авторы: Zuyan Liu, Benlin Liu, Jiahui Wang, Yuhao Dong, Guangyi Chen, Yongming Rao, Ranjay Krishna, Jiwen Lu
cs.AI
Аннотация
В области моделей больших видео-языковых моделей (LVLM) для следования инструкциям эффективное развертывание этих моделей сталкивается с вызовами, в частности из-за высоких требований к памяти их кэшей ключ-значение (KV). Традиционные стратегии управления кэшем для LLM сосредотачиваются на вытеснении кэша, что часто не удовлетворяет специфическим потребностям мультимодальных моделей следования инструкциям. Определяя этот пробел, в данной статье мы представляем Elastic Cache, новый подход, который выигрывает от применения различных методов ускорения для этапов кодирования инструкций и генерации вывода. Мы исследуем важные метрики в различных этапах и предлагаем стратегию слияния кэша, управляемую важностью, для обрезки избыточных кэшей. Вместо того чтобы отбрасывать менее важные кэши, наша стратегия выделяет важные векторы ключей/значений как опорные точки. Окружающие менее важные кэши затем объединяются с этими опорными точками, улучшая сохранение контекстуальной информации в кэшах KV и обеспечивая произвольное соотношение ускорения. Для кодирования инструкций мы используем частоту для оценки важности кэшей. Что касается генерации вывода, мы отдаем предпочтение токенам на основе их расстояния с смещением, при котором как первоначальные, так и самые последние токены сохраняются. Результаты на ряде LVLM показывают, что Elastic Cache не только повышает эффективность, но также значительно превосходит существующие методы обрезки в генерации языка по различным задачам. Код доступен по ссылке 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