■ Change #157 · wiki.edited
LLM-written kernels that beat PyTorch on half of KernelBench Level 3 under hardened checks: Normalize Markdown to canonical form
explainer.student
− **What is asked.** KernelBench gives an AI model a piece of PyTorch code, the Python library most neural networks are written in, and asks it to write faster GPU code that computes the same thing. Level 1 tasks are single operations (one matrix multiply), Level 2 are short chains of operations, and Level 3 are 50 whole small networks: multilayer perceptrons, convolutional and recurrent networks, transformer blocks. The score $\mathrm{fast}_1$ is the fraction of tasks where the generated code is correct *and* faster than PyTorch. The problem asks for a system that reaches $\mathrm{fast}_1 \ge 0.5$ on **Level 3**, under the hardened KernelBench-Verified rules, on one H200 GPU. It gets at most 5 attempts per task, no human edits, and must pass an audit for cheating.+ **What is asked.** KernelBench gives an AI model a piece of PyTorch code, the Python library most neural networks are written in, and asks it to write faster GPU code that computes the same thing. Level 1 tasks are single operations (one matrix multiply), Level 2 are short chains of operations, and Level 3 are 50 whole small networks: multilayer perceptrons, convolutional and recurrent networks, transformer blocks. The score $\mathrm{fast}_1$ is the fraction of tasks where the generated code is correct _and_ faster than PyTorch. The problem asks for a system that reaches $\mathrm{fast}_1 \ge 0.5$ on **Level 3**, under the hardened KernelBench-Verified rules, on one H200 GPU. It gets at most 5 attempts per task, no human edits, and must pass an audit for cheating.**Why cheating is the first barrier.** Speed and correctness can be checked by machine, which is what makes this a good test for AI agents. But a weak check can be fooled. A kernel that skips work, returns cached answers, or recognises the specific test inputs can look fast and correct. This is called **reward hacking**, and published systems have been caught doing it. KernelBench-Verified therefore tests every kernel on four hidden input distributions (the original inputs, and the same inputs scaled by 3, by 0.01 and by −1). A kernel that hard-codes the answer for one distribution fails the others. It also lets PyTorch use the faster TF32 tensor-core mode, so the baseline is realistic. The analogy is an exam with unseen versions of each question. It breaks because an exam checks answers, while here the speed claim must also be checked by timing.**Why Level 3 is hard.** Beating PyTorch on a whole network means fusing many operations into fewer kernels and scheduling them well, all without breaking correctness on any input distribution.**State of the art.** The original KernelBench paper (February 2025) found frontier models matched PyTorch on under 20% of tasks. Under the KernelBench-Verified rules (June 2026, single attempt per sample, best of 5), $\mathrm{fast}_1$ reaches 52.0% on Level 1 and 64.9% on Level 2 (GPT-5.5). That meets the old target. The best Level 3 score is 38.0% (Gemini 3.1 Pro), and the other models score 24–32%.**What a solution looks like.** A system's prompts, model identity and generated kernels, published and rerun under the KernelBench-Verified harness, scoring at least 25 of 50 Level 3 tasks with no hacks found in the audit.
hash f1408d4a2d00a6e3fc989d2d92d22e7e1db4c1f1ecaea0858758f819443038e7
previous 6c53b2ede4adc9509e9842356303e8e5557fed15b375a400e83fe6c2210a1a77