DRTriton:用大规模合成数据与强化学习训练LLM生成Triton内核
DRTriton: Large-Scale Synthetic Data Driven Reinforcement Learning for Triton Kernel Generation
DRTriton是一个可扩展的学习框架,用于训练LLM把PyTorch程序转换为高度优化的Triton内核,并在运行时编译为CUDA内核。框架包含保证算子空间全覆盖且难度可控的合成数据算法CSP-DAG、联合优化转换成功率与执行速度的解耦奖励课程强化学习,以及进一步提升生成内核执行速度的测试时搜索算法。
论文给出用合成数据与强化学习训练LLM生成Triton内核的完整框架,并附与GPT-5.2、Claude-Sonnet-4.5的KernelBench对比数据。
arXiv:2603.21465v3 Announce Type: replace Abstract: Developing efficient CUDA kernels is a fundamental yet challenging task in the generative AI industry. Recent research leverages Large Language Models (LLMs) to automatically convert PyTorch reference implementations to CUDA kernels, significantly reducing engineering effort. State-of-the-art LLMs, such as GPT-5.2 and Claude-Sonnet-4.5, still struggle with this task. To address this challenge, we propose DRTriton, a scalable learning framework for training LLMs to convert PyTorch programs into highly optimized Triton kernels, which are then compiled to CUDA kernels at runtime. DRTriton consists of three key components: (i) a data synthetic algorithm CSP-DAG that guarantees full coverage and unbiased uniform sampling over the operator space with controlled difficulty; (ii) a curriculum RL framework with decoupled rewards that jointly optimizes conversion success rate and execution speed; and (iii) a test-time search algorithm that further improves the execution speed of the generated Triton kernels. With a warmup stage of SFT on limited PyTorch-Triton pairs curated using existing LLMs, DRTriton trained by RL on synthesized PyTorch programs generalizes effectively to real-world CUDA kernels that are challenging even for human experts. Experimental results show that DRTriton-7B achieves speedup over PyTorch on 92% of KernelBench Level 2 tasks, compared to 23% for GPT-5.2 and 19% for Claude-Sonnet-4.5.
来源:arXiv (AI + Vision + Imaging) · arxiv.org