KernelZero:协同进化的提议者与编码器,持续改进GPU内核生成

·

研究论文 · 2026/09/29

高性能 GPU 内核对现代机器学习系统至关重要,但自动生成既正确又高效的内核仍具挑战。现有基于 LLM 的方法面临两大限制:与模型当前能力匹配的高质量训练数据稀缺,以及内核正确性与性能之间的固有权衡。为此,我们提出 KernelZero,一个协同进化框架,通过两个专用模型持续改进 GPU 内核生成:Proposer 从 API 集生成 Torch 模块,Coder 将其转换为 CUDA 或 Triton 内核。KernelZero 使用前沿驱动的模块生成机制,基于 Coder 当前弱点持续产生能力匹配的训练模块。它进一步引入正确性感知组相对策略优化(CA-GRPO),仅在正确性足够可靠后才优化性能。通过交替优化 Proposer 和 Coder,KernelZero 形成自动课程,实现有针对性和训练高效的能力提升。实验上,KernelZero-7B 在 CUDA 上超越 Claude-4.5-Sonnet,在 Triton 上超越 DeepSeek-V4-Pro。在 KernelBench Level 1 和 2 上,CUDA pass@1 分数分别为 75.8% 和 69.6%,pass@10 达到 100% 和 97%。在 Triton 上,pass@1 分数分别为 77.2% 和 72.5%。

该工作提出了一种协同进化框架,通过自动课程和正确性感知优化策略,有效解决了 GPU 内核生成中训练数据稀缺和正确性-性能权衡的难题,并在多个基准上取得了超越现有先进模型的性能,对自动生成高性能 GPU 内核具有重要推动意义。

High-performance GPU kernels are essential to modern machine learning systems, yet automatically generating kernels that are both correct and efficient remains challenging. Existing LLM-based approaches face two major limitations: the scarcity of high-quality training data aligned with the model's current capabilities, and the inherent trade-off between kernel correctness and performance. To address these challenges, we propose KernelZero, a co-evolution framework that continuously improves GPU kernel generation through two specialized models: a Proposer that generates Torch modules from API sets and a Coder that translates them into CUDA or Triton kernels. KernelZero uses a frontier-driven module generation mechanism to continuously produce capability-aligned training modules based on the Coder's current weaknesses. It further introduces Correctness-Aware Group Relative Policy Optimization (CA-GRPO), which optimizes performance only after correctness becomes sufficiently reliable. By alternating the optimization of the Proposer and Coder, KernelZero forms an automatic curriculum that enables targeted and training-efficient capability improvement. Empirically, KernelZero-7B surpasses Claude-4.5-Sonnet on CUDA and DeepSeek-V4-Pro on Triton. On KernelBench Level 1 and 2, it achieves CUDA pass@1 scores of 75.8% and 69.6%, respectively, with pass@10 reaching 100% and 97%. On Triton, it achieves pass@1 scores of 77.2% and 72.5%, respectively.

阅读原文

参与讨论