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
- Composer2.pdfcursor.com
- KernelBench: Can LLMs Write GPU Kernels?scalingintelligence.stanford.edu
- Introducing SWE-grep and SWE-grep-mini: RL for Multi-Turn, Fast Context Retrieval | Cognitioncognition.ai
- Defeating Nondeterminism in LLM Inference - Thinking Machines Labthinkingmachines.ai
- Look Ma, No Bubbles! Designing a Low-Latency Megakernel for Llama-1B · Hazy Researchhazyresearch.stanford.edu
- Coding vs thinking — Paradigm 3paradigm3.org
- KernelBench v0.1 | Scaling Intelligence Lab at Stanford Universityscalingintelligence.stanford.edu
- As Rocks May Think | Eric Jangevjang.com
- How to Land a Frontier Lab Jobvladfeinberg.com
- ⭐️ Fast LLM Inference From Scratchandrewkchan.dev
- Together AI | The AI Native Cloudtogether.ai
- Andrej Karpathy — AGI is still a decade awaydwarkesh.com