Dr. Kernel: Triton 커널 생성에 적합한 강화 학습
Dr. Kernel: Reinforcement Learning Done Right for Triton Kernel Generations
고품질 커널은 확장 가능한 AI 시스템에 매우 중요하며, LLM이 이러한 코드를 생성할 수 있도록 하는 것은 AI 개발을 발전시킬 것입니다. 그러나 이 작업을 위해 LLM을 훈련하려면 충분한 데이터, 견고한 환경이 필요하며, 훈련 과정은 종종 보상 해킹 및 단순 최적화에 취약합니다. 이러한 경우, 모델은 훈련 보상을 해킹하여 의미 있는 속도 향상보다는 단순한 정확성을 우선시할 수 있습니다. 본 논문에서는 커널 생성을 위한 강화 학습(RL)을 체계적으로 연구합니다. 먼저, 보상 해킹 검사를 지원하고, 다중 상호 작용으로부터 데이터를 수집하며, 장기 RL 훈련을 가능하게 하는 견고한 분산 GPU 환경인 KernelGYM을 설계했습니다. KernelGYM을 기반으로, 효과적인 다중 상호 작용 RL 방법을 조사하고, GRPO에서 발생하는 자기 포함으로 인한 편향된 정책 그래디언트 문제를 식별했습니다. 이를 해결하기 위해, 다중 상호 작용 RL에 대한 편향되지 않은 장점 추정 기능을 제공하는 Turn-level Reinforce-Leave-One-Out (TRLOO)를 제안합니다. 단순 최적화를 완화하기 위해, 훈련 안정성을 위한 불일치 보정을 적용하고, Profiling-based Rewards (PR) 및 Profiling-based Rejection Sampling (PRS)를 도입하여 이 문제를 해결합니다. 훈련된 모델인 Dr Kernel-14B는 Kernelbench에서 Claude-4.5-Sonnet과 경쟁력 있는 성능을 보입니다. 마지막으로, Dr Kernel-14B에 대한 순차적 테스트 시간 확장을 연구했습니다. KernelBench Level-2 부분 집합에서 생성된 커널의 31.6%가 Torch 참조보다 최소 1.2배의 속도 향상을 달성했으며, 이는 Claude-4.5-Sonnet (26.7%) 및 GPT-5 (28.6%)를 능가합니다. 모든 라운드에서 최적의 후보를 선택하면 이 1.2배의 속도 향상 비율은 47.8%로 더욱 증가합니다. 환경, 훈련 코드, 모델 및 데이터 세트를 포함한 모든 리소스는 https://www.github.com/hkust-nlp/KernelGYM에서 확인할 수 있습니다.
High-quality kernel is critical for scalable AI systems, and enabling LLMs to generate such code would advance AI development. However, training LLMs for this task requires sufficient data, a robust environment, and the process is often vulnerable to reward hacking and lazy optimization. In these cases, models may hack training rewards and prioritize trivial correctness over meaningful speedup. In this paper, we systematically study reinforcement learning (RL) for kernel generation. We first design KernelGYM, a robust distributed GPU environment that supports reward hacking check, data collection from multi-turn interactions and long-term RL training. Building on KernelGYM, we investigate effective multi-turn RL methods and identify a biased policy gradient issue caused by self-inclusion in GRPO. To solve this, we propose Turn-level Reinforce-Leave-One-Out (TRLOO) to provide unbiased advantage estimation for multi-turn RL. To alleviate lazy optimization, we incorporate mismatch correction for training stability and introduce Profiling-based Rewards (PR) and Profiling-based Rejection Sampling (PRS) to overcome the issue. The trained model, Dr Kernel-14B, reaches performance competitive with Claude-4.5-Sonnet in Kernelbench. Finally, we study sequential test-time scaling for Dr Kernel-14B. On the KernelBench Level-2 subset, 31.6% of the generated kernels achieve at least a 1.2x speedup over the Torch reference, surpassing Claude-4.5-Sonnet (26.7%) and GPT-5 (28.6%). When selecting the best candidate across all turns, this 1.2x speedup rate further increases to 47.8%. All resources, including environment, training code, models, and dataset, are included in https://www.github.com/hkust-nlp/KernelGYM.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.