ChatPaper.aiChatPaper

Transformer-Lite: 모바일 폰 GPU에서의 대규모 언어 모델 고효율 배포

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

March 29, 2024
저자: Luchang Li, Sheng Qian, Jie Lu, Lunxi Yuan, Rui Wang, Qin Xie
cs.AI

초록

대형 언어 모델(LLM)은 스마트폰에서 지능형 어시스턴트, 텍스트 요약, 번역, 멀티모달리티 등 다양한 작업에 널리 활용되고 있습니다. 그러나 현재의 온디바이스 LLM 배포 방식은 느린 추론 속도로 인해 사용자 경험이 저하되는 문제가 있습니다. 이를 해결하기 위해 디바이스 GPU에서 고효율 LLM 배포를 가능하게 하는 네 가지 최적화 기법을 제안합니다: (a) 동적 형태 모델 추론을 지원하는 기호 표현 기반 접근법; (b) 추론 속도 향상과 폰 지연 현상 감소를 위한 연산자 최적화 및 실행 우선순위 설정; (c) 역양자화 오버헤드를 줄이는 FP4 양자화 기법 M0E4; (d) LLM 추론 후 KV 캐시 복사 필요성을 제거하는 서브 텐서 기반 기법. 또한, 이러한 방법들을 퀄컴과 MTK 프로세서 모두와 호환되는 모바일 추론 엔진인 Transformer-Lite에 구현했습니다. Transformer-Lite의 성능을 평가하기 위해 2B에서 14B까지 다양한 아키텍처와 파라미터를 가진 LLM을 사용했습니다. 특히, ChatGLM2 6B의 경우 프리필 및 디코딩 속도가 각각 121 토큰/초와 14 토큰/초, 더 작은 Gemma 2B의 경우 330 토큰/초와 30 토큰/초를 달성했습니다. CPU 기반 FastLLM 및 GPU 기반 MLC-LLM과 비교했을 때, 우리의 엔진은 프리필 속도에서 10배 이상, 디코딩 속도에서 2~3배의 성능 향상을 보였습니다.
English
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.

Summary

AI-Generated Summary

PDF353November 26, 2024