Transformer-Lite: High-efficiency Deployment of Large Language Models on Mobile Phone GPUs

要約

大規模言語モデル(Large Language Model: LLM)は、知的アシスタント、テキスト要約、翻訳、携帯電話のマルチモダリティなどのタスクに広く採用されている。しかし、LLMをデバイス上に展開するための現在の方法は、推論速度が遅く、ユーザーエクスペリエンスの低下を引き起こしている。(a)動的な形状モデル推論をサポートするための記号式ベースのアプローチ、(b)推論速度を向上させ、携帯電話の遅延を低減するための演算子の最適化と実行優先度の設定、(c)量子化オーバーヘッドを低減するためのM0E4と呼ばれるFP4量子化手法、(d)LLM推論後にKVキャッシュをコピーする必要性をなくすためのサブテンソルベースの手法。さらに、これらの手法をQualcommとMTKの両プロセッサに対応するモバイル推論エンジンTransformer-Liteに実装した。我々は、2Bから14Bまでの様々なアーキテクチャとパラメータを持つLLMを用いて、Transformer-Liteの性能を評価した。具体的には、ChatGLM2 6Bで121トークン/秒、14トークン/秒、より小型のGemma 2Bで330トークン/秒、30トークン/秒のプリフィルとデコード速度を達成しました。CPUベースのFastLLMやGPUベースのMLC-LLMと比較して、我々のエンジンはプリフィル速度で10倍以上、デコード速度で2~3倍の高速化を達成した。

要約(オリジナル)

The Large Language Model (LLM) is widely employed for tasks such as intelligent assistants, text summarization, translation, and multi-modality on mobile phones. However, the current methods for on-device LLM deployment maintain slow inference speed, which causes poor user experience. To facilitate high-efficiency LLM deployment on device GPUs, we propose four optimization techniques: (a) a symbolic expression-based approach to support dynamic shape model inference; (b) operator optimizations and execution priority setting to enhance inference speed and reduce phone lagging; (c) an FP4 quantization method termed M0E4 to reduce dequantization overhead; (d) a sub-tensor-based technique to eliminate the need for copying KV cache after LLM inference. Furthermore, we implement these methods in our mobile inference engine, Transformer-Lite, which is compatible with both Qualcomm and MTK processors. We evaluated Transformer-Lite’s performance using LLMs with varied architectures and parameters ranging from 2B to 14B. Specifically, we achieved prefill and decoding speeds of 121 token/s and 14 token/s for ChatGLM2 6B, and 330 token/s and 30 token/s for smaller Gemma 2B, respectively. Compared with CPU-based FastLLM and GPU-based MLC-LLM, our engine attains over 10x speedup for the prefill speed and 2~3x speedup for the decoding speed.

arxiv情報

著者 Luchang Li,Sheng Qian,Jie Lu,Lunxi Yuan,Rui Wang,Qin Xie
発行日 2024-07-05 07:18:42+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, DeepL

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