PowerInfer-2: Inferenza Rapida di Modelli Linguistici di Grandi Dimensioni su Smartphone
PowerInfer-2: Fast Large Language Model Inference on a Smartphone
June 10, 2024
Autori: Zhenliang Xue, Yixin Song, Zeyu Mi, Le Chen, Yubin Xia, Haibo Chen
cs.AI
Abstract
Questo articolo presenta PowerInfer-2, un framework progettato per l'inferenza ad alta velocità di Large Language Models (LLM) su smartphone, particolarmente efficace per modelli le cui dimensioni superano la capacità di memoria del dispositivo. L'intuizione chiave di PowerInfer-2 è sfruttare le risorse eterogenee di calcolo, memoria e I/O negli smartphone scomponendo i tradizionali calcoli matriciali in calcoli a livello di cluster di neuroni a grana fine. Nello specifico, PowerInfer-2 include un motore di neuroni polimorfo che adatta le strategie di calcolo per le varie fasi dell'inferenza di LLM. Inoltre, introduce una cache segmentata dei neuroni e un pipelining a livello di cluster di neuroni a grana fine, che riducono e nascondono efficacemente l'overhead causato dalle operazioni di I/O. L'implementazione e la valutazione di PowerInfer-2 dimostrano la sua capacità di supportare un'ampia gamma di modelli LLM su due smartphone, raggiungendo un incremento di velocità fino a 29,2x rispetto ai framework all'avanguardia. È importante sottolineare che PowerInfer-2 è il primo sistema a servire il modello TurboSparse-Mixtral-47B con una velocità di generazione di 11,68 token al secondo su uno smartphone. Per i modelli che rientrano completamente nella memoria, PowerInfer-2 può ottenere una riduzione dell'uso della memoria di circa il 40%, mantenendo velocità di inferenza comparabili a llama.cpp e MLC-LLM. Per ulteriori dettagli, inclusa una video dimostrazione, si prega di visitare il sito del progetto all'indirizzo www.powerinfer.ai/v2.
English
This paper introduces PowerInfer-2, a framework designed for high-speed
inference of Large Language Models (LLMs) on smartphones, particularly
effective for models whose sizes exceed the device's memory capacity. The key
insight of PowerInfer-2 is to utilize the heterogeneous computation, memory,
and I/O resources in smartphones by decomposing traditional matrix computations
into fine-grained neuron cluster computations. Specifically, PowerInfer-2
features a polymorphic neuron engine that adapts computational strategies for
various stages of LLM inference. Additionally, it introduces segmented neuron
caching and fine-grained neuron-cluster-level pipelining, which effectively
minimize and conceal the overhead caused by I/O operations. The implementation
and evaluation of PowerInfer-2 demonstrate its capability to support a wide
array of LLM models on two smartphones, achieving up to a 29.2x speed increase
compared with state-of-the-art frameworks. Notably, PowerInfer-2 is the first
system to serve the TurboSparse-Mixtral-47B model with a generation rate of
11.68 tokens per second on a smartphone. For models that fit entirely within
the memory, PowerInfer-2 can achieve approximately a 40% reduction in memory
usage while maintaining inference speeds comparable to llama.cpp and MLC-LLM.
For more details, including a demonstration video, please visit the project
site at www.powerinfer.ai/v2.