Is Your NPU Ready for LLMs? Dissecting the Hidden Efficiency Bottlenecks in Mobile LLM Inference
Summary
A comprehensive, cross-layer measurement study investigates hidden efficiency bottlenecks in mobile Large Language Model (LLM) inference, spanning five mainstream frameworks like llama.cpp and GENIE, and three hardware backends: CPU, GPU, and NPU. The study introduces PowerBench, a fine-grained profiling tool providing the first backend-specific energy attribution. Key findings reveal framework-induced performance gaps amplified up to 10x on NPUs due to divergent offloading and quantization. A distinct phase split shows NPUs excelling in compute-bound prefilling, while CPUs outperform in memory-bound decoding, driven by the NPU's preference for large, fixed-shape workloads. Furthermore, suboptimal scheduling, including uncoordinated NPU sleep latencies and CPU polling, contributes up to 40% energy waste. Leveraging these insights, an energy-oriented best-practice configuration is proposed, estimated to reduce NPU energy consumption by up to 54.8% across three datasets.
Key takeaway
For Machine Learning Engineers deploying LLMs on mobile NPUs, understanding the distinct performance characteristics of prefilling and decoding phases is crucial. You should optimize NPU workloads for compute-bound prefilling and consider CPU offloading for memory-bound decoding. Carefully configure thread settings, NPU sleep latencies, and CPU polling intervals to mitigate up to 40% energy waste, potentially reducing overall NPU energy consumption by 54.8%.
Key insights
Mobile LLM inference on NPUs is bottlenecked by framework, phase, and scheduling inefficiencies, requiring tailored optimization.
Principles
- Frameworks amplify NPU performance gaps up to 10x.
- NPUs excel at prefilling; CPUs dominate decoding.
- NPU efficiency requires large, fixed-shape workloads.
Method
PowerBench provides fine-grained, backend-specific energy attribution for mobile LLM inference. This tool dissects framework, phase, and scheduling bottlenecks to inform an energy-optimized configuration.
In practice
- Optimize NPU workloads for large, fixed-shape operations.
- Implement backend-specific scheduling for LLM phases.
- Tune thread configs and NPU sleep latencies.
Topics
- Mobile LLM Inference
- NPU Performance
- Energy Efficiency
- Hardware Bottlenecks
- PowerBench Profiling
- Quantization Strategies
Best for: Research Scientist, AI Engineer, NLP Engineer, AI Hardware Engineer, Machine Learning Engineer, AI Scientist
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Artificial Intelligence.