KernelBench
How it works
Each task provides a reference PyTorch module (forward pass). The language model generates a replacement GPU kernel for that operation. The evaluation harness first checks correctness by comparing the output against the PyTorch reference on several randomized input sets within a numerical tolerance, then times execution and computes speedup as t_baseline / t_generated (only over correct solutions). Results are aggregated with the fast_p metric: the fraction of tasks for which the kernel is correct and achieves a speedup greater than threshold p (e.g. fast_1 = correct and faster than PyTorch, fast_2 = at least 2x faster, fast_0 = correctness only). Tasks are split into three levels: Level 1 (100 single operators such as matrix multiplies, convolutions, normalizations), Level 2 (100 simple fusion patterns such as conv + bias + ReLU), and Level 3 (50 full model architectures such as MobileNet, VGG, MiniGPT).
Problem solved
Writing fast GPU kernels is hard and time-consuming, and prior evaluations of LLM code generation focused mainly on correctness while ignoring real performance. KernelBench provides a standardized, executable way to measure whether a generated kernel is not only correct but genuinely faster than optimized PyTorch.
Components
250 PyTorch operations split into Level 1 (100 single operators), Level 2 (100 fusion patterns) and Level 3 (50 full architectures). The repository also adds an aspirational Level 4 (20 tasks from HuggingFace architectures, without official baselines).
The fraction of tasks for which a kernel is both correct and achieves a speedup greater than an adjustable threshold p over the PyTorch baseline. fast_1 = correct and faster than PyTorch, fast_2 = at least 2x faster, fast_0 = correctness only. Speedup is computed as t_baseline / t_generated, over correct samples only.
The mechanism that runs the generated kernel, checks correctness on randomized inputs within a numerical tolerance (e.g. 1e-2), and times execution on a target GPU (the paper reports measurements on an NVIDIA L40S). It supports backends including cuda, triton, cute, tilelang, thunderkittens, and AMD via hip.
Implementation
Speedup values depend on the target GPU; the paper's results were measured on an NVIDIA L40S and do not transfer 1:1 to other hardware.
Speedup depends on whether the baseline is eager PyTorch or torch.compile; the same metric differs across baselines.
Correctness is verified on a finite set of randomized inputs (e.g. 5 sets) with a numerical tolerance (e.g. 1e-2), which is an empirical rather than formal guarantee – a subtly wrong kernel can pass.
Evolution
The Scaling Intelligence Lab (Stanford) publishes the benchmark with 250 PyTorch tasks and the fast_p metric.
The HuggingFace dataset update (07-2025) adds an aspirational Level 4 with 20 tasks from HuggingFace architectures, without official baselines.
Hyperparameters (configurable axes)
The adjustable speedup threshold in the fast_p metric. Raising p increases benchmark difficulty.
Task subset: Level 1 (operators), Level 2 (fusions), Level 3 (full architectures).
The hardware on which speedup is measured; results are hardware-dependent (the paper used an NVIDIA L40S).
The language/DSL of the generated kernel.
Number of attempts per task for pass@k estimation (the blog uses n=100 for pass@1,3,5,10).
Hardware requirements
The benchmark targets GPU kernels (CUDA and related DSLs) and measures their performance on NVIDIA GPUs; it also supports AMD via the hip backend.