让手机端生成更快速,通过智能调度和预测式解码提升性能。
Accelerating Mobile Language Model via Speculative Decoding and NPU-Coordinated Execution
- 分段预填充+流水线执行,减少模型切换延迟。
- 预测解码扩展生成序列,利用空闲算力提升吞吐量。
- 实测速度提升1.06倍至3.81倍,节能1.07倍至4.71倍。
在移动设备上直接执行检索增强生成(RAG)对数据隐私和响应速度极具潜力,但受限于移动端NPU的架构约束。当前硬件难以应对RAG固有的可变负载:在处理长上下文与生成令牌之间的阶段切换因静态图限制导致显著延迟,而生成阶段内存瓶颈又造成计算资源闲置。本文提出sd.npu全栈加速框架,旨在最大化移动端NPU在本地RAG生态中的效率。为缓解阶段切换带来的延迟,引入流水线执行策略,通过并行加载解码图与分块上下文计算(chunked prefill),掩盖模型重构开销,确保持续执行流。此外,为解决生成阶段硬件利用率低的问题,设计了以NPU为中心的预测式解码机制,通过校准生成分布并扩展草稿序列,将空闲算力有效转化为实际输出吞吐。在商用智能手机上的实验表明,该框架显著优于现有基线,在多种RAG任务中实现1.06×–3.81×的加速比与1.07×–4.71×的能效提升。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。