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 기반 대규모 언어 모델(LLMs)은 다양한 분야에서 널리 사용되고 있으며, LLM 추론의 효율성은 실제 애플리케이션에서 중요한 주제로 부상하고 있습니다. 그러나 LLM은 일반적으로 복잡한 모델 구조와 방대한 연산을 포함하며, 자동 회귀(auto-regressive) 방식으로 추론을 수행하기 때문에 고효율 시스템 설계가 어려운 과제로 여겨집니다. 본 논문에서는 낮은 지연 시간과 높은 처리량을 갖춘 효율적인 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