arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.15312cs.CL
收藏

通过推测解码和NPU协同执行加速移动语言模型

Accelerating Mobile Language Model via Speculative Decoding and NPU-Coordinated Execution

Peking University(北京大学);Beijing University of Posts and Telecommunications(北京邮电大学)

Zhiyang Chen, Daliang Xu, Haiyang Shen, Chiheng Lou, Mengwei Xu, Shangguang Wang, Xin Jin, Yun Ma

AI总结:

本文提出sd.npu框架,通过推测解码和NPU协同执行,提升移动设备RAG任务的效率与能耗表现。

摘要:

在移动设备上直接执行检索增强生成(RAG)具有数据隐私和响应性优势,但受限于移动NPU的架构限制。具体而言,当前硬件难以应对RAG固有的可变负载:在处理大量上下文和生成token之间切换时,由于静态图限制导致显著开销,而内存受限的生成阶段使计算资源利用率低下。在本工作中,我们提出了一种综合加速框架sd.npu,旨在最大化移动设备RAG生态系统的NPU效率。为了解决NPU图切换导致的延迟问题,我们引入了流水线执行策略。该方法通过并行加载解码图与计算分割的上下文块(分块预填充),从而掩盖模型重新配置的开销,确保连续执行流程。此外,为缓解解码阶段的低硬件利用率,我们开发了以NPU为中心的推测解码机制。通过校准生成分布并延长草案序列,我们的方法有效将空闲NPU周期转化为有效token吞吐量。在商用智能手机上的实验表明,我们的框架显著优于现有基线,实现了1.06倍至3.81倍的速度提升和1.07倍至4.71倍的能耗节省,适用于各种RAG任务。

英文摘要:

Performing Retrieval-Augmented Generation (RAG) directly on mobile devices is promising for data privacy and responsiveness but is hindered by the architectural constraints of mobile NPUs. Specifically, current hardware struggles with the variable workloads intrinsic to RAG: the transition between processing extensive contexts and generating tokens incurs significant overhead due to static graph constraints, while the memory-bound generation phase leaves computational resources underutilized. In this work, we propose a holistic acceleration framework sd.npu, designed to maximize NPU efficiency for on-device RAG ecosystem. To address the latency caused by NPU graph switching during phase transitions, we introduce a pipelined execution strategy. This approach masks the overhead of model reconfiguration by parallelizing the loading of decoding graphs with the computation of partitioned context chunks (chunked prefill), thereby ensuring continuous execution flow. Furthermore, to mitigate low hardware utilization during the decoding phase, we develop an NPU-centric speculative decoding mechanism. By calibrating generation distributions and extending draft sequences, our method effectively converts idle NPU cycles into valid token throughput. Experiments on commercial smartphones show that our framework significantly outperforms existing baselines, delivering 1.06$\times$--3.81$\times$ speedups and 1.07$\times$--4.71$\times$ energy savings across various RAG tasks.

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

↑