[论文解读] PowerInfer-2: Fast Large Language Model Inference on a Smartphone
PowerInfer-2 是一种框架,通过将矩阵计算分解为细粒度的神经元簇操作,利用多态神经元引擎在异构硬件(CPU、GPU、NPU)上动态调度计算,并通过分段缓存和流水线技术优化 I/O,实现了在智能手机上对高达 470亿参数的大规模语言模型(LLM)进行高速、本地化推理。其性能相比最先进系统最高提升 29.2 倍,并首次在智能手机上实现了 TurboSparse-Mixtral-47B 模型以 11.68 个 token/秒的速度运行。
Large language models (LLMs) on smartphones enable real-time AI assistance and privacy-preserving, offline operation. However, resource constraints of smartphones limit current deployments to small language models (SLMs), significantly compromising their capabilities. This paper introduces PowerInfer-2, a smartphone-based framework that enables fast inference for LLMs exceeding the memory capacity. The key insight is decomposing matrix operations into neuron clusters as the basic processing unit, which enables flexible scheduling and efficient I/O-computation pipelining. PowerInfer-2 leverages this neuron-cluster-based design in both computation and storage. For computation, neuron clusters with dense activations are processed on NPU, while sparse clusters use CPU. The storage engine provides a fine-grained pipeline mechanism that coordinates cluster-level computation and I/O operations, enhanced by a segmented neuron cache to reduce I/O activities. PowerInfer-2 achieves up to a 27.8x speed increase compared to state-of-the-art frameworks. PowerInfer-2 is the first system to serve a 47B LLM on a smartphone, achieving 11.68 tokens/s. Notably, these performance improvements preserve model quality with negligible accuracy degradation.
研究动机与目标
- 在设备内存不足以容纳模型的情况下,仍实现在智能手机上高速、本地化的大型语言模型(LLM)推理。
- 解决智能手机在模型权重读取过程中因存储带宽有限和单命令队列导致的 I/O 瓶颈问题。
- 充分利用智能手机中的异构 XPU 资源(CPU、GPU、NPU)以实现高效的 LLM 推理。
- 在保持高推理速度的同时,降低内存模型的内存占用。
- 首次在移动设备上支持极大型 MoE 模型(如 TurboSparse-Mixtral-47B)的运行。
提出的方法
- 将 LLM 推理中的粗粒度矩阵计算分解为针对智能手机硬件特性定制的细粒度神经元簇操作。
- 提出一种多态神经元引擎,可动态调整计算模式:在预填充阶段使用大簇(NPU 优化),在解码阶段使用小簇(CPU 优化)。
- 在神经元簇级别实施分段神经元缓存,采用类型特定策略以提高缓存命中率并降低 I/O 开销。
- 采用细粒度、基于神经元簇的流水线技术,将 I/O 操作与计算重叠,有效隐藏 I/O 延迟。
- 利用 LLM 中激活的稀疏性,将频繁使用的神经元缓存在内存中,将不活跃的神经元卸载至闪存存储。
- 同时支持内存外和内存内推理场景,具备动态权重卸载与内存优化能力。

实验结果
研究问题
- RQ1框架能否在模型超过设备内存容量的情况下,实现在智能手机上的高速 LLM 推理?
- RQ2如何有效利用智能手机中的异构 XPU 资源(CPU、GPU、NPU)以加速移动设备上的 LLM 推理?
- RQ3在智能手机上进行 LLM 推理时,能否显著减少或隐藏来自闪存存储的 I/O 开销?
- RQ4在不牺牲推理速度的前提下,能否显著降低内存模型的内存占用?
- RQ5在智能手机上以实时性能运行如 TurboSparse-Mixtral-47B 这类极大型 MoE 模型是否可行?
主要发现
- 在两款智能手机上进行内存外推理时,PowerInfer-2 相较于最先进框架最高实现 29.2 倍的性能提升。
- 它是首个在智能手机上支持 TurboSparse-Mixtral-47B 模型的系统,实现 11.68 个 token/秒的生成速率。
- 对于内存内模型,PowerInfer-2 在保持与 llama.cpp 和 MLC-LLM 相当性能的同时,将内存占用降低了约 40%。
- 当 50% 的 FFN 权重被卸载时,PowerInfer-2 在 TurboSparse-Mistral-7B 模型上节省了约 1.5GB 内存,而 llama.cpp 性能下降 20.8 倍,MLC-LLM 则无法运行。
- 平均每 token 的神经元缓存未命中率为 3.5%,但 P99 未命中率高达 18.9%,表明由于激活相似性差异导致的显著波动。
- TurboSparse-Mixtral-47B 的解码延迟为 99.76ms(平均值),P99 延迟为 140.56ms,显著波动主要由激活模式和缓存行为驱动。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。