What causes the performance gap when running Qwen-1.5-1.8B on the NPU?
Hi, I'm trying to accelerate the llms inference on-device with an NPU.
I've run qwen-1.5-1.8B successfully on my device Xiaomi 14Pro(Snapdragon 8gen3, 16GB memory), but the prefill speed is about 170 tokens/s when I set s=256 and use the prompt in file main_qwen_npu.cpp. This is far from 564 tokens/s , the result shown in Fast On-device LLM Inference with NPUs.
I would like to know what the potential causes of poor performance are.
All the steps are as the README from https://github.com/UbiquitousLearning/mllm/tree/main/src/backends/qnn .
cc @oreomaker @liang1232018
您好,请问您直接运行run qwen qnn脚本就能跑起来吗?手机需要root然后关闭SELinux enforcing模式吗?
您好,请问您直接运行run qwen qnn脚本就能跑起来吗?手机需要root然后关闭SELinux enforcing模式吗?
当时没有root
Hi, I'm trying to accelerate the llms inference on-device with an NPU.您好,我正在尝试使用 NPU 加速设备上的 llms 推理。
I've run qwen-1.5-1.8B successfully on my device Xiaomi 14Pro(Snapdragon 8gen3, 16GB memory), but the prefill speed is about 170 tokens/s when I set
s=256and use the prompt in filemain_qwen_npu.cpp. This is far from 564 tokens/s , the result shown in Fast On-device LLM Inference with NPUs.我已在我的小米 14Pro(骁龙 8gen3,16GB 内存)设备上成功运行了 qwen-1.5-1.8B,但是当我设置s=256并使用main_qwen_npu.cpp文件中的提示符时,预填充速度约为 170 tokens/s。这与《使用 NPU 进行设备端快速 LLM 推理》 一文中显示的结果 564 tokens/s 相差甚远。I would like to know what the potential causes of poor performance are.我想知道导致绩效不佳的潜在原因是什么。 All the steps are as the
READMEfrom https://github.com/UbiquitousLearning/mllm/tree/main/src/backends/qnn .所有步骤都与 https://github.com/UbiquitousLearning/mllm/tree/main/src/backends/qnn 中的README一致。
![]()
请问您这个问题解决了吗,我在红米K70Pro (骁龙8 gen3, 24G内存)上运行demo_qwen_npu.cpp, 模型使用的是Qwen1.5-1.8B,测试了很多prompt,长度在100token到600token,预填充速度都没有超过200token/s,这与《Fast On-device LLM Inference with NPUs》(https://arxiv.org/pdf/2407.05858)论文中结果相差甚远,不知道潜在原因是什么?
只有demo_qwen_pipeline在Prefill阶段可以进行NPU+CPU的流水线推理,能达到700+tokens/s的性能
作者您好,我在红米k70 pro上尝试运行并测试了demo_qwen_pipeline,模型使用的是qwen1.5-1.8B,chunk设置为128,在token数为512左右时,prefill速度达到最大为400token/s,当增加token数为1024左右时,prefill速度降到了200token/s左右,我想请教一下,在什么情况下,prefill速度可以达到700token/s以上,甚至是论文中提到的1000token/s以上
---Original--- From: @.> Date: Tue, Nov 18, 2025 15:53 PM To: @.>; Cc: @.@.>; Subject: Re: [UbiquitousLearning/mllm] What causes the performance gap whenrunning Qwen-1.5-1.8B on the NPU? (Issue #299)
oreomaker left a comment (UbiquitousLearning/mllm#299)
只有demo_qwen_pipeline在Prefill阶段可以进行NPU+CPU的流水线推理,能达到700+tokens/s的性能
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
执行2562的pipeline时可以达到较理想的速度(700+),其中的1000token/s为2512时的最快速度
执行256_2的pipeline时可以达到较理想的速度(700+),其中的1000token/s为2_512时的最快速度
作者您好,您提到的“执行2562的pipeline”具体是什么意思?2562指的是prompt的长度还是指代什么?我尝试了长度2562左右的prompt,预填充速度也不是很理想,距离700token/s还有很大差距
256 x 2的pipeline,可以达到700+的速度
256 x 2的pipeline,可以达到700+的速度
作者您好,我尝试了chunk_size=256,chunk_num=2的pipeline,预填充速度为300+token/s,不知道为什么达不到理想速度呢?
256 x 2的pipeline,可以达到700+的速度
作者您好,我仔细拜读了pipeline的源代码之后发现,这里的流水线似乎是顺序调度子图,而不是论文中提到的启发式乱序调度算法,这会不会是没有达到理想实验结果的原因?会不会作者在上传项目的时候少上传了部分文件?
