KernelMosaic:用于CUDA内核生成的开放数据集与智能体框架
KernelMosaic: An Open Dataset and Agentic Framework for CUDA Kernel Generation
AI总结:
本文提出KernelMosaic开放数据集及智能体框架,经其微调的小型开源模型在KernelBench CUDA内核生成任务上正确率大幅提升,性能优于直接响应,为该领域提供了有效监督资源。
摘要:
训练大语言模型生成高效CUDA内核需要涵盖多样计算需求和迭代代码优化的监督数据,构建此类监督极具挑战性,因存在异构规范,且有用实现需通过复杂迭代测试与优化产生。本文提出KernelMosaic,这一开放数据集将多样CUDA任务与经验证的解决方案及轨迹配对;经人工引导审核和感知多样性的选择,整理出以自然语言描述、参考程序、数学规范及其交集形式呈现的任务。为构建解决方案与轨迹,本文的智能体框架借助可复用CUDA指导与执行反馈,引导强大大语言模型完成实现、正确性修复及性能优化。在KernelBench L1、L2、L3基准上,对小型开源模型在KernelMosaic上进行监督微调后,其正确率分别从4%、0%、0%提升至88%、82%、16%,且各层级内核快于PyTorch eager的任务占比均有所增加。进一步训练实验表明,经整理轨迹的监督效果显著优于直接响应,可促进持续测试与修订。这些结果证明KernelMosaic能让通用模型在CUDA内核生成任务上实现大幅提升。
英文摘要:
Training large language models to generate efficient CUDA kernels requires supervision spanning diverse computational requirements and iterative code optimization. Constructing this supervision is challenging because of heterogeneous specifications, and useful implementations emerge through iterative complicated testing and refinement. We introduce KernelMosaic, an open dataset pairing diverse CUDA tasks with verified solutions and trajectories. Human-guided review and diversity-aware selection curate tasks expressed as natural-language descriptions, reference programs, mathematical specifications, and their intersections. To build the solutions and trajectories, our agentic framework guides a strong LLM through implementation, correctness repair, and performance optimization with reusable CUDA guidance and execution feedback. Supervised fine-tuning of a small open-source model on KernelMosaic raises correctness from 4%, 0%, and 0% to 88%, 82%, and 16% on KernelBench L1, L2, and L3, respectively, while increasing the fraction of tasks with kernels faster than PyTorch eager at every level. Further training experiments show that supervision from the curated trajectories substantially outperforms direct responses and promotes sustained testing and revision. These results demonstrate that KernelMosaic enables a general-purpose model to achieve substantial gains in CUDA kernel generation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。