MobileKernelBench: LLMs能否为移动设备编写高效的内核?
MobileKernelBench: Can LLMs Write Efficient Kernels for Mobile Devices?
AI总结:
本文探讨LLMs能否为移动设备编写高效内核,提出MobileKernelBench框架,发现现有模型在移动框架中表现不佳,提出MoKA多智能体系统提升编译成功率和性能。
摘要:
大型语言模型(LLMs)在代码生成方面展现了显著能力,但其在生成针对移动设备的内核方面的潜力仍待探索。本文扩展了自动化内核生成的范围至移动领域,提出MobileKernelBench评估框架,包含优先考虑操作多样性和跨框架互操作性的基准,以及连接主机与设备的自动化流水线。利用该框架,我们在Mobile Neural Network(MNN)的CPU后端上进行了广泛评估,发现当前LLMs在移动框架的工程复杂性和数据稀缺性方面存在困难;标准模型和甚至微调变体的编译失败率高达54%以上,性能提升有限。为克服这些限制,我们提出了Mobile Kernel Agent(MoKA),一种具有仓库感知推理和计划-执行范式的多智能体系统。在MobileKernelBench上验证后,MoKA实现了最先进的性能,将编译成功率提升至93.7%,并使27.4%的生成内核在原生库上实现了可测量的加速。
英文摘要:
Large language models (LLMs) have demonstrated remarkable capabilities in code generation, yet their potential for generating kernels specifically for mobile devices remains largely unexplored. In this work, we extend the scope of automated kernel generation to the mobile domain to investigate the central question: Can LLMs write efficient kernels for mobile devices? To enable systematic investigation, we introduce MobileKernelBench, a comprehensive evaluation framework comprising a benchmark prioritizing operator diversity and cross-framework interoperability, coupled with an automated pipeline that bridges the host-device gap for on-device verification. Leveraging this framework, we conduct extensive evaluation on the CPU backend of Mobile Neural Network (MNN), revealing that current LLMs struggle with the engineering complexity and data scarcity inherent to mobile frameworks; standard models and even fine-tuned variants exhibit high compilation failure rates (over 54%) and negligible performance gains due to hallucinations and a lack of domain-specific grounding. To overcome these limitations, we propose the Mobile Kernel Agent (MoKA), a multi-agent system equipped with repository-aware reasoning and a plan-and-execute paradigm. Validated on MobileKernelBench, MoKA achieves state-of-the-art performance, boosting compilation success to 93.7% and enabling 27.4% of generated kernels to deliver measurable speedups over native libraries.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。