Cognition | Kevin-32B: Multi-Turn RL for Writing CUDA Kernels
Coding is an iterative process – you write a program, execute it, evaluate the results, and refine your code based on the feedback. Recent advances in LLM for code generation have tried to incorporate this process at inference-time, using methods like parallel sampling. While these methods are effective, they rely on search without actual learning — the model weights are frozen. We explore reinforcement learning in a multi-turn setting, using intermediate feedback from the environment, and masking model thoughts to avoid exploding context over multiple turns. Our model, Kevin-32B = K(ernel D)evin, outperforms frontier reasoning models on kernel generation. Moreover, our results show that multi-turn training makes the model more effective at self-refinement compared to single-turn training. We use KernelBench, a dataset of 250 PyTorch-based classic deep learning tasks. It measures a model’s ability to replace the PyTorch operators with optimized CUDA kernels. We focus on the first two l
Carlo Baronio*, Pietro Marsella*, Ben Pan*, Silas Alberti Stanford University, Cognition AI *equal contribution Coding is an iterative process – you write a program, execute it, evaluate the results, and refine your code based on the feedback. Recent advances in LLM for code generation have tried to incorporate this process at inference-time, using methods like parallel sampling. While these methods are effective, they rely on search without actual learning — the model weights are frozen. We explore reinforcement learning in a multi-turn setting, using intermediate feedback from the environmen
saved by
related reading
- Reinforcement Learning for Knowledge Awareness – kalomaze's kalomazing blogkalomaze.bearblog.dev
- SWE-1.7: Frontier Intelligence at a Fraction of the Costcognition.com
- KernelBench: Can LLMs Write GPU Kernels?scalingintelligence.stanford.edu
- [2510.13786] The Art of Scaling Reinforcement Learning Compute for LLMsarxiv.org
- ⭐️ Fast LLM Inference From Scratchandrewkchan.dev
- Auto-research with codex: How I achieved a 232x Faster Kernel over baseline with Codex in GPU Mode's qr_v2 problemsankalp.bearblog.dev
- Spending Inference Time - Kevin Lukevinlu.ai
- Keep the Tokens Flowing: Lessons from 16 Open-Source RL Librarieshuggingface.co
- Learning Beyond Gradientstrinkle23897.github.io
- IsoCompute Playbook: Optimally Scaling Sampling Compute for RL Training of LLMscompute-optimal-rl-llm-scaling.github.io
- karl.pdfdatabricks.com
- [2510.11696] QeRL: Beyond Efficiency -- Quantization-enhanced Reinforcement Learning for LLMsarxiv.org