ChatPaper.aiChatPaper

インテルGPUにおける効率的なLLM推論ソリューション

Efficient LLM inference solution on Intel GPU

December 19, 2023
著者: Hui Wu, Yi Gan, Feng Yuan, Jing Ma, Wei Zhu, Yutao Xu, Hong Zhu, Yuhua Zhu, Xiaoli Liu, Jinghui Gu
cs.AI

要旨

Transformerベースの大規模言語モデル(LLM)は多くの分野で広く使用されており、LLM推論の効率性は実用化において重要なトピックとなっています。しかし、LLMは通常、モデル構造が複雑で膨大な演算を伴い、自己回帰モードで推論を行うため、高効率なシステム設計は困難な課題です。 本論文では、低レイテンシと高スループットを実現する効率的なLLM推論ソリューションを提案します。まず、LLMデコーダ層を簡素化するため、データ移動と要素単位の演算を融合することでメモリアクセス頻度を低減し、システムレイテンシを削減します。また、セグメントKVキャッシュポリシーを提案し、リクエストとレスポンスのトークンのキー/値を別々の物理メモリに保持することで、デバイスメモリ管理を効率化し、ランタイムバッチサイズの拡大とシステムスループットの向上を図ります。さらに、セグメントKVキャッシュソリューションに基づく融合ポリシーに適合するよう、カスタマイズされたScaled-Dot-Product-Attentionカーネルを設計します。本LLM推論ソリューションをIntel GPU上に実装し、公開しています。標準的なHuggingFace実装と比較して、提案ソリューションはIntel GPU上で一部の主要なLLMにおいて最大7倍のトークンレイテンシ低減と27倍のスループット向上を達成しました。
English
Transformer based Large Language Models (LLMs) have been widely used in many fields, and the efficiency of LLM inference becomes hot topic in real applications. However, LLMs are usually complicatedly designed in model structure with massive operations and perform inference in the auto-regressive mode, making it a challenging task to design a system with high efficiency. In this paper, we propose an efficient LLM inference solution with low latency and high throughput. Firstly, we simplify the LLM decoder layer by fusing data movement and element-wise operations to reduce the memory access frequency and lower system latency. We also propose a segment KV cache policy to keep key/value of the request and response tokens in separate physical memory for effective device memory management, helping enlarge the runtime batch size and improve system throughput. A customized Scaled-Dot-Product-Attention kernel is designed to match our fusion policy based on the segment KV cache solution. We implement our LLM inference solution on Intel GPU and publish it publicly. Compared with the standard HuggingFace implementation, the proposed solution achieves up to 7x lower token latency and 27x higher throughput for some popular LLMs on Intel GPU.
PDF111December 15, 2024