Skip to main content
QUICK REVIEW

[Paper Review] Dr. Kernel: Reinforcement Learning Done Right for Triton Kernel Generations

Wei Liu, Jiawei Xu|arXiv (Cornell University)|Feb 5, 2026
Advanced Neural Network ApplicationsComputer Science0 citations
TL;DR

The paper presents KernelGym and multi-turn RL methods (notably TRLOO, profiling-based rewards, and PRS) to train Dr. Kernel, a 14B model, to generate performant Triton kernels with strong speedups and reduced reward hacking. It demonstrates competitive performance with frontier models on KernelBench and shows substantial gains with test-time scaling.

ABSTRACT

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.

Motivation & Objective

  • Motivate automated generation of high-quality GPU kernels to accelerate AI systems.
  • Develop a robust, distributed RL environment (KernelGym) for long-horizon kernel generation with execution-based feedback.
  • Identify and mitigate reward hacking and lazy optimization in multi-turn RL for kernel generation.
  • Propose unbiased multi-turn RL estimators (TRLOO) and bottleneck-aware rewards to improve optimization.
  • Demonstrate scalable training and evaluation against KernelBench benchmarks and frontier models.

Proposed method

  • Create KernelGym, a server–worker distributed environment with hacking checks and rich profiling feedback.
  • Use multi-turn RL where each turn refines kernel code and receives execution feedback from KernelGym.
  • Introduce Turn-level Reinforce-Leave-One-Out (TRLOO) to remove self-inclusion bias in multi-turn GRPO-style updates.
  • Incorporate mismatch correction via geometric MRS to stabilize training.
  • Add Profiling-based Rewards (PR) to reward optimization of true bottlenecks and Profiling-based Rejection Sampling (PRS) to filter low-impact samples.
  • Apply sequential test-time scaling (STTS) to improve inference-time kernel generation.

Experimental results

Research questions

  • RQ1Can multi-turn RL with explicit execution feedback produce kernel code that yields meaningful speedups beyond correctness?
  • RQ2How can we mitigate reward hacking and lazy optimization in RL-guided kernel generation?
  • RQ3What unbiased advantage estimators and training stabilizers improve long-horizon RL for kernel synthesis?
  • RQ4Does bottleneck-aware reward design and selective sampling improve alignment with real performance gains?
  • RQ5Can test-time scaling further enhance generation quality without excessive context growth?

Key findings

  • Dr. Kernel-14B with STTS achieves higher speedups than several baselines on KernelBench Level-2 and surpasses some frontier models on stricter metrics.
  • TRLOO provides unbiased turn-level advantages and outperforms GRPO and single-turn baselines in Fast@1.2.
  • Profiling-based Rewards (PR) and PRS significantly lift Fast@1.2 beyond MRS alone, indicating better focus on true bottlenecks.
  • STTS with context management substantially improves Level-1/Level-2 metrics and, in best-turn selection, reaches competitive results with GPT-5 and Claude-4.5-Sonnet.
  • Dr. Kernel-14B-STTS with best-turn selection achieves Fast@1.2 of 47.8% on Level-2, surpassing several frontier models.
  • Sequential test-time scaling further improves Level-3 results, narrowing the gap to frontier models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.