ZipVL: 動的トークンの疎な化とKVキャッシュの圧縮を用いた効率的な大規模ビジョン言語モデル
ZipVL: Efficient Large Vision-Language Models with Dynamic Token Sparsification and KV Cache Compression
October 11, 2024
著者: Yefei He, Feng Chen, Jing Liu, Wenqi Shao, Hong Zhou, Kaipeng Zhang, Bohan Zhuang
cs.AI
要旨
大規模ビジョン言語モデル(LVLMs)の効率は、特に高解像度の画像やビデオを含むシナリオにおいて、プリフィルフェーズ中のアテンションメカニズムの計算的ボトルネックとデコーディングフェーズ中のキー・バリュー(KV)キャッシュのメモリボトルネックによって制約されています。視覚コンテンツはしばしば大幅な冗長性を示し、これによりLVLMs内で非常に疎なアテンションマップが生成されます。この疎さは、さまざまなアプローチを用いてアテンション計算を加速したり、KVキャッシュを圧縮したりするために活用できます。ただし、ほとんどの研究はこれらのボトルネックのうちの1つにのみ焦点を当てており、異なるレイヤーやタスクに関する疎さの動的調整を適切にサポートしていません。本論文では、LVLMs向けの効率的な推論フレームワークであるZipVLを提案し、重要なトークンの動的比率割り当て戦略を通じて計算およびメモリのボトルネックの両方を解決します。この比率は、固定されたハイパーパラメータではなく、レイヤー固有のアテンションスコアの分布に基づいて適応的に決定されるため、より複雑なタスクに対して高いパフォーマンスを維持しながら、より簡単なタスクの効率を向上させます。次に、正規化されたアテンションスコアに基づいて重要なトークンを選択し、プリフィルフェーズで重要なトークンのみにアテンションメカニズムを実行して計算を加速します。デコーディングフェーズでのメモリボトルネックを緩和するために、重要なトークンのキャッシュには高ビット量子化を適用し、重要でないトークンのキャッシュには低ビット量子化を適用します。実験により、ZipVLがLongVA-7Bモデルに対するVideo-MMEベンチマークで、プリフィルフェーズを2.6倍加速し、GPUメモリ使用量を50.0%削減し、わずか0.2%の精度低下でLVLMsの生成効率を効果的に向上させることが示されました。
English
The efficiency of large vision-language models (LVLMs) is constrained by the
computational bottleneck of the attention mechanism during the prefill phase
and the memory bottleneck of fetching the key-value (KV) cache in the decoding
phase, particularly in scenarios involving high-resolution images or videos.
Visual content often exhibits substantial redundancy, resulting in highly
sparse attention maps within LVLMs. This sparsity can be leveraged to
accelerate attention computation or compress the KV cache through various
approaches. However, most studies focus on addressing only one of these
bottlenecks and do not adequately support dynamic adjustment of sparsity
concerning distinct layers or tasks. In this paper, we present ZipVL, an
efficient inference framework designed for LVLMs that resolves both computation
and memory bottlenecks through a dynamic ratio allocation strategy of important
tokens. This ratio is adaptively determined based on the layer-specific
distribution of attention scores, rather than fixed hyper-parameters, thereby
improving efficiency for less complex tasks while maintaining high performance
for more challenging ones. Then we select important tokens based on their
normalized attention scores and perform attention mechanism solely on those
important tokens to accelerate the prefill phase. To mitigate the memory
bottleneck in the decoding phase, we employ mixed-precision quantization to the
KV cache, where high-bit quantization is used for caches of important tokens,
while low-bit quantization is applied to those of less importance. Our
experiments demonstrate that ZipVL can accelerate the prefill phase by
2.6times and reduce GPU memory usage by 50.0%, with a minimal accuracy
reduction of only 0.2% on Video-MME benchmark over LongVA-7B model, effectively
enhancing the generation efficiency of LVLMs.