lm-Meter:揭示端侧语言模型运行时推理延迟
lm-Meter: Unveiling Runtime Inference Latency for On-Device Language Models
AI总结:
提出lm-Meter,首个轻量级在线延迟分析器,用于端侧LLM推理,以低开销捕获阶段和内核级延迟,揭示瓶颈并促进优化。
摘要:
大型语言模型(LLMs)正日益融入日常应用,但其普遍基于云的部署引发了关于数据隐私和长期可持续性的日益增长的担忧。在移动和边缘设备上本地运行LLMs(端侧LLMs)有望增强隐私、可靠性并降低通信成本。然而,由于巨大的内存和计算需求,以及在资源受限硬件上性能-效率权衡的可见性有限,实现这一愿景仍具挑战性。我们提出lm-Meter,这是首个专为端侧LLM推理设计的轻量级在线延迟分析器。lm-Meter无需辅助设备即可在阶段(如嵌入、预填充、解码、softmax、采样)和内核级别捕获细粒度、实时的延迟。我们在商用移动平台上实现了lm-Meter,并展示了其高分析精度和极低的系统开销,例如,在最受限的Powersave调控器下,预填充吞吐量仅降低2.58%,解码仅降低0.99%。利用lm-Meter,我们进行了全面的实证研究,揭示了端侧LLM推理中阶段和内核级别的瓶颈,量化了精度-效率权衡,并识别了系统性的优化机会。lm-Meter为受限平台上LLM的运行时行为提供了前所未有的可见性,为明智的优化奠定了基础,并加速了端侧LLM系统的普及。代码和教程可在https://github.com/amai-gsu/LM-Meter获取。
英文摘要:
Large Language Models (LLMs) are increasingly integrated into everyday applications, but their prevalent cloud-based deployment raises growing concerns around data privacy and long-term sustainability. Running LLMs locally on mobile and edge devices (on-device LLMs) offers the promise of enhanced privacy, reliability, and reduced communication costs. However, realizing this vision remains challenging due to substantial memory and compute demands, as well as limited visibility into performance-efficiency trade-offs on resource-constrained hardware. We propose lm-Meter, the first lightweight, online latency profiler tailored for on-device LLM inference. lm-Meter captures fine-grained, real-time latency at both phase (e.g., embedding, prefill, decode, softmax, sampling) and kernel levels without auxiliary devices. We implement lm-Meter on commercial mobile platforms and demonstrate its high profiling accuracy with minimal system overhead, e.g., only 2.58% throughput reduction in prefill and 0.99% in decode under the most constrained Powersave governor. Leveraging lm-Meter, we conduct comprehensive empirical studies revealing phase- and kernel-level bottlenecks in on-device LLM inference, quantifying accuracy-efficiency trade-offs, and identifying systematic optimization opportunities. lm-Meter provides unprecedented visibility into the runtime behavior of LLMs on constrained platforms, laying the foundation for informed optimization and accelerating the democratization of on-device LLM systems. Code and tutorials are available at https://github.com/amai-gsu/LM-Meter.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。