Deploying Large Language Models to data-scarce programming domains poses significant challenges, particularly for kernel synthesis on emerging Domain-Specific Architectures where a "Data Wall" limits available training data. While models excel on data-rich platforms like CUDA, they suffer catastrophic performance drops on data-scarce ecosystems such as NPU programming. To overcome this cold-start barrier without expensive fine-tuning, we introduce EvoKernel, a self-evolving agentic framework that automates the lifecycle of kernel synthesis from initial drafting to continual refining. EvoKernel addresses this by formulating the synthesis process as a memory-based reinforcement learning task. Through a novel value-driven retrieval mechanism, it learns stage-specific Q-values that prioritize experiences based on their contribution to the current objective, whether bootstrapping a feasible draft or iteratively refining latency. Furthermore, by enabling cross-task memory sharing, the agent generalizes insights from simple to complex operators. By building an NPU variant of KernelBench and evaluating on it, EvoKernel improves frontier models' correctness from 11.0% to 83.0% and achieves a median speedup of 3.60x over initial drafts through iterative refinement. This demonstrates that value-guided experience accumulation allows general-purpose models to master the kernel synthesis task on niche hardware ecosystems. Our official page is available at https://evokernel.zhuo.li.
翻译:将大型语言模型部署到数据稀缺的编程领域面临重大挑战,尤其是在新兴领域特定架构上进行内核合成时,"数据墙"限制了可用训练数据。尽管模型在CUDA等数据丰富的平台上表现出色,但在NPU编程等数据稀缺的生态系统中却遭遇性能灾难性下降。为了在不进行昂贵微调的情况下克服这一冷启动障碍,我们提出了EvoKernel——一个自进化的智能体框架,实现了从初始草拟到持续优化的内核合成全生命周期自动化。EvoKernel通过将合成过程构建为基于记忆的强化学习任务来解决此问题。通过新颖的价值驱动检索机制,它学习阶段特定的Q值,根据经验对当前目标(无论是引导可行草案还是迭代优化延迟)的贡献度来优先选择经验。此外,通过实现跨任务记忆共享,智能体能够将简单算子的洞察泛化至复杂算子。通过构建KernelBench的NPU变体并在其上评估,EvoKernel将前沿模型的正确率从11.0%提升至83.0%,并通过迭代优化实现了相对于初始草案3.60倍的中位数加速比。这表明价值引导的经验积累使得通用模型能够掌握小众硬件生态系统的内核合成任务。我们的官方页面位于 https://evokernel.zhuo.li。