Dev Tools/ gpu kernels · llm agents · pytorch · compilers

Researchers Use LLM Agents to Speed Up Compiled GPU Kernels

KernelOPT uses profiling-guided AI agents to rewrite compiled Triton kernels, claiming up to 40 percent speedups over PyTorch's own compiler.

A new multi-agent system rewrites the GPU kernels that PyTorch's own compiler leaves on the table, without touching the vendor libraries doing the heavy lifting.

KernelOPT targets the Triton sub-kernels that torch.compile generates from standard PyTorch code, leaving established vendor libraries like cuBLAS and cuDNN untouched. Five profiling-guided LLM agents propose optimizations for those generated kernels, and each candidate has to survive a four-gate check: static validation, multi-seed correctness testing, a float64-fallback verification at the model level, and a performance gate. If nothing passes all four, the system just keeps the compiler's original output. Tested against 250 problems from the KernelBench benchmark, it beat torch.compile by a geometric mean of 1.40x on the simplest tier of problems, 1.15x on a harder tier, and 1.07x on the hardest.

Most LLM-based kernel optimizers treat a compiled model as a black box and tune isolated kernels in a vacuum, which risks correctness bugs once the pieces get stitched back together. KernelOPT's narrower scope, leave the vendor code alone, verify the whole model end to end, or fall back to the original, trades ambition for safety. That is a reasonable bet given how often AI-optimized code turns out to be subtly wrong.

The returns taper fast: gains drop from 40 percent on easy problems to 7 percent on the hardest ones, which reads less like a breakthrough and more like an admission that compilers still win on the genuinely hard cases.

TR

The Revision

Written by an AI system from the public sources credited above. How we write →