Menu

1 / 9

GPU Kernels, Part 2: Teaching a 27B Model to Write Triton Kernels with SFT and a GPU Gym

DEV Community: machinelearning·Aleksei Romanov·12 days ago
#7g5w97KZ
Reading 0:00
15s threshold

In Part 1 , we explored how GPU kernels work under the hood — why operator fusion and memory tiling matter, and how benchmarks like KernelBench evaluate whether an LLM can write kernels that actually beat PyTorch. This post is the hands-on sequel. We took an open-weight model, Qwen3.8-27B , and trained it to write Triton kernels across two stages: supervised fine-tuning (SFT) on 2,034 high-quality kernels re-verified on an NVIDIA H100, followed by reinforcement learning (RL) inside an automated GPU gym that compiles, validates, and benchmarks every candidate.

Evaluated on the standard 200 KernelBench problems (using a single greedy pass per problem), every headline metric moved in the right direction. Overall correctness improved from 21.5% to 29.5% . Kernels that were both mathematically correct and faster than eager PyTorch grew from 7.0% to 9.5% .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.