atlas

Research map / Large language models / Agents, code and math

KernelBench: Can LLMs Write Efficient GPU Kernels?

ICML 2025 · Large language models › Agents, code and math · approach: LLMs for optimization and heuristics · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Introduces KernelBench, a 250-task benchmark and framework for evaluating whether LLMs can write correct and fast GPU (CUDA) kernels for PyTorch workloads, with a new fast_p metric and analysis of one-shot, repeated sampling, and iterative refinement.

Problem

Efficient GPU kernels are needed for performant ML, but writing them requires scarce expertise. The paper asks whether language models can automatically generate correct and speedup-producing kernels for diverse PyTorch workloads.

Approach

A verifiable benchmark of 250 PyTorch tasks across three levels (single ops, operator sequences, full architectures) where models output a ModelNew class with inline CUDA kernels, scored by a new fast_p metric that counts tasks that are both correct and faster than a threshold p over PyTorch Eager.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use iterative refinement with execution and profiling feedbackDeepSeek-R1 · KernelBench Levels 1, 2, and 3fast1: 12% -> 43%, 36% -> 72%, and 12% -> 18%Helped
Provide execution and profiling feedback during iterative refinement (ablation)DeepSeek-R1 · KernelBench Level 2fast1: 36% -> 72%Helped
Provide hardware-aware in-context examples of fusion, tiling, and shared-memory management (ablation)OpenAI o1 · KernelBench overallfast1Hurt
Provide hardware specifications and hardware knowledge in context (ablation)Llama 3.1 70B and DeepSeek-V3 · KernelBenchkernel performanceNo clear effect
Use hardware-aware in-context examples (ablation)OpenAI o1 · KernelBench Level 1 GEMM variantsspeed: 77%Helped
Use repeated sampling, increasing the number of samples (ablation)DeepSeek-V3 and Llama 3.1-70B Instruct · KernelBench Levels 1, 2, and 3fast1Helped
Fuse operator computations into one kernelLM-generated kernels · GELUspeedup: 2.9xHelped
Avoid constructing the diagonal matrix and scale rows or columns directlyClaude-3.5 Sonnet kernel · KernelBench Level 1 Problem 11speedup: 13xHelped

Surprising findings

Limitations

Experimental setup

Datasets: KernelBench 250 tasks drawn from PyTorch, huggingface/transformers, and pytorch-image-models repositories

Benchmarks: KernelBench

Metrics: fast_p correctness rate speedup distribution

Baselines: PyTorch Eager torch.compile Llama 3.1-70B Instruct Llama 3.1-405B Instruct GPT-4o Claude 3.5 Sonnet DeepSeek V3

Builds on: torch.compile Triton ThunderKittens

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy