arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.05391cs.ARcs.AI
收藏

面向Intel GPU的高效大语言模型推理方案

Efficient LLM inference solution on Intel GPU

Hui Wu, Yi Gan, Feng Yuan, Jing Ma, Wei Zhu, Yutao Xu, Hong Zhu, Yuhua Zhu, Xiaoli Liu, Jinghui Gu, Peng Zhao

AI总结:

针对大语言模型推理效率低的问题,提出融合运算、分段KV缓存及定制注意力内核的高效推理方案,在Intel GPU上实现了最高7倍的延迟降低与27倍的吞吐量提升。

摘要:

基于Transformer的大语言模型(LLM)已在众多领域得到广泛应用,LLM的推理效率成为实际应用中的热点问题。然而,LLM通常模型结构复杂、运算量巨大,且采用自回归模式执行推理,因此设计一套高效率的系统颇具挑战。\n 本文提出了一种低延迟、高吞吐量的高效LLM推理方案。首先,我们通过融合数据搬运操作与逐元素运算来简化LLM解码器层,以此降低内存访问频率并减少系统延迟。我们还提出了分段KV缓存策略,将请求与响应令牌的键/值存储在不同的物理内存中,以实现高效的设备内存管理,助力扩大运行时批量大小并提升系统吞吐量。我们基于分段KV缓存方案,设计了适配该融合策略的定制化Scaled-Dot-Product-Attention(缩放点积注意力)内核。我们在Intel GPU上实现了该LLM推理方案并公开发布。与标准的HuggingFace实现相比,本文提出的方案在Intel GPU上运行部分主流LLM时,令牌延迟最高降低7倍,吞吐量最高提升27倍。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑