MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention

要約

大規模言語モデル (LLM) 推論の計算上の課題は、特にプロンプ​​トの長さが増加し続ける中で、その広範な導入にとって依然として大きな障壁となっています。
アテンション計算の二次的な複雑さのため、8B LLM が単一の A100 GPU で 1M トークンのプロンプト (つまり、事前充填段階) を処理するには 30 分かかります。
事前入力を高速化するための既存の方法は、ロングコンテキスト LLM に適用すると、許容できる精度や効率を維持できないことがよくあります。
このギャップに対処するために、長いシーケンスの処理の事前充填を高速化するように設計されたスパース計算手法である MInference (Milliontokens Inference) を導入します。
具体的には、GPU での効率的なスパース計算に活用できる、ロングコンテキスト アテンション マトリックスの 3 つの固有のパターン、つまり A シェイプ、Vertical-Slash、および Block-Sparse を特定します。
各アテンションヘッドの最適なパターンをオフラインで決定し、推論中に割り当てられたパターンに基づいてスパースインデックスを動的に構築します。
パターンとスパース インデックスを使用して、最適化された GPU カーネルを介して効率的なスパース アテンション計算を実行し、ロング コンテキスト LLM のプレフィル ステージのレイテンシーを大幅に削減します。
私たちが提案した手法は、事前トレーニングのセットアップや追加の微調整を変更することなく、既存の LLM に直接適用できます。
InfiniteBench、RULER、PG-19、Needle In A Haystack などの幅広いダウンストリーム タスクと、LLaMA-3-1M、GLM4-1M、Yi-200K、Phi-3-128K、Qwen2 などのモデルを評価することによって
-128K では、MInference が精度を維持しながら、A100 での事前入力の推論レイテンシーを最大 10 分の 1 まで効果的に削減できることを実証します。
私たちのコードは https://aka.ms/MInference で入手できます。

要約(オリジナル)

The computational challenges of Large Language Model (LLM) inference remain a significant barrier to their widespread deployment, especially as prompt lengths continue to increase. Due to the quadratic complexity of the attention computation, it takes 30 minutes for an 8B LLM to process a prompt of 1M tokens (i.e., the pre-filling stage) on a single A100 GPU. Existing methods for speeding up prefilling often fail to maintain acceptable accuracy or efficiency when applied to long-context LLMs. To address this gap, we introduce MInference (Milliontokens Inference), a sparse calculation method designed to accelerate pre-filling of long-sequence processing. Specifically, we identify three unique patterns in long-context attention matrices-the A-shape, Vertical-Slash, and Block-Sparsethat can be leveraged for efficient sparse computation on GPUs. We determine the optimal pattern for each attention head offline and dynamically build sparse indices based on the assigned pattern during inference. With the pattern and sparse indices, we perform efficient sparse attention calculations via our optimized GPU kernels to significantly reduce the latency in the pre-filling stage of long-context LLMs. Our proposed technique can be directly applied to existing LLMs without any modifications to the pre-training setup or additional fine-tuning. By evaluating on a wide range of downstream tasks, including InfiniteBench, RULER, PG-19, and Needle In A Haystack, and models including LLaMA-3-1M, GLM4-1M, Yi-200K, Phi-3-128K, and Qwen2-128K, we demonstrate that MInference effectively reduces inference latency by up to 10x for pre-filling on an A100, while maintaining accuracy. Our code is available at https://aka.ms/MInference.

arxiv情報

著者 Huiqiang Jiang,Yucheng Li,Chengruidong Zhang,Qianhui Wu,Xufang Luo,Surin Ahn,Zhenhua Han,Amir H. Abdi,Dongsheng Li,Chin-Yew Lin,Yuqing Yang,Lili Qiu
発行日 2024-07-02 17:59:56+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CL, cs.LG パーマリンク