Performance measurement · Research feature

Study reveals widespread flaws in AI-generated GPU kernels

The study evaluates 2,638 machine-generated GPU kernels using a contract-grade verifier that checks twelve adversarial properties, including tolerance-free conditions.

Adapted from research by Rishi Shah, Rishav Shrestha.

arXiv preprint revision · 2026-08-17 · Attribution & reuse
In this article
Editorial illustration of processor die.

Editor’s introduction

The study evaluates 2,638 machine-generated GPU kernels using a contract-grade verifier that checks twelve adversarial properties, including tolerance-free conditions. It identifies 39.5% of kernels as broken beyond any threshold and 62.1% with at least one violation. The findings are validated through independent methods: a 7/7 positive control, threshold calibration, 98.5% agreement with a reference benchmark, and a hand-audit. The research also verifies a native Blackwell backward kernel for gated-linear-recurrence models, confirming its correctness against a double-precision oracle. The study underscores that tolerance-free contracts are essential to detect true correctness issues in AI-generated kernels.

Introduction

Generating GPU kernels with large language models has become an active research program, and its benchmarks report that a large fraction of outputs are correct and often faster than a reference. Those reports are only as trustworthy as the correctness signal beneath them, and that signal is almost universally a single test: draw a few random inputs at one fixed shape and accept the kernel if its output is close, in the allclose sense, to a reference. A kernel can pass this test while swallowing a non-finite, returning a different answer on each run, breaking at the next shape, or accumulating a reduction in fp16 against an fp32 reference. If the acceptance signal is this weak, an unknown share of the reported wins is illusory.

This paper is about that gap and the instrument that measures it. We build a contract-grade verifier that operationalizes the Kernel Contracts taxonomy: twelve adversarial gates, each a property a correct kernel must satisfy, graded against a slow high-precision reference. Some gates need no tolerance at all and compare by exact mask or byte equality; the rest use tolerances derived from a floating-point error model. The verifier is the spine of the paper, and we aim it in two directions.

Aimed outward, the verifier audits a public corpus of machine-generated kernels that the source system’s own harness had already accepted as correct, and measures how far those acceptances overstate correctness: 39.5% are broken in a way no tolerance can excuse. The obvious objection is that our checker is simply stricter than everyone else’s, so foreign kernels fail by construction. Section 3.3 answers it four independent ways: a positive control on a kernel we can vouch for independently, a threshold-calibration sweep, 98.5% agreement with KernelBench’s own correctness code, and a stratified hand-audit of disputed cases.

Contributions

Section 5 stress-tests these results and states their limitations. Every quantitative claim is backed by a committed artifact under a fixed software environment, and a number resting on an unreleased intermediate is marked at the point of use.

The correctness illusion, and how our work differs

The observation that loose checks accept broken kernels is not new. Sarkar argues the point on a hand-built set of twenty-four kernels, and reports no rate on any accepted corpus. A companion paper targets the threshold itself, calibrating a per-(operator, dtype) atol empirically as the 95th percentile of the error observed over passing runs of the correct kernel, scaled by a 1.5 safety factor. It is the strongest existing form of the “just tighten the tolerance” answer, and its own numbers mark that answer’s limits: detection rises from 1,805 of 2,467 (73.2%) to 2,034 of 2,467 (82.4%), false positives on correct controls rise from 0 of 1,882 to 20 of 1,882, and the evaluation runs on author-seeded variants. Three differences follow. Their threshold is fitted, so judging an operator first requires a corpus of known-correct runs of it; ours is derived analytically from how rounding error accumulates over a reduction, and is available for an operator seen once. Their gain is bought with false positives on correct kernels, a cost a tolerance-free gate cannot incur, having no threshold to miscalibrate. And a calibrated atol, however tight, still compares magnitudes, so a swallowed NaN, a nondeterministic output, and an aliased buffer all lie outside what any tolerance can express. The two lines are complementary: calibration sharpens the thresholded gates, which is why the tolerance-free ones carry the load-bearing claim here.

The nearest prior instrument is robust-kbench, which reaches the same diagnosis we do, that existing kernel benchmarks carry exploitable loopholes and too narrow a set of testing conditions, and answers it with a harder benchmark and an agentic pipeline whose correctness filtering is performed by language-model verifiers. The diagnosis is shared; the instrument is what separates us. A verifier that is itself a model returns a judgement, so its false-accept rate is a property of that model on that kernel and must be established separately. Ours is twelve fixed gates whose verdicts are exact mask, byte, or derived-bound comparisons against the reference operator, with no model in the loop and, on the tolerance-free channels, no threshold either. That is what lets us state a rate on a corpus someone else has already accepted, and lets a reader check that rate without adopting our model.

A separate strand documents performance loopholes, kernels that game the timing harness by reusing an output buffer, returning a lazily-evaluated tensor, or exploiting a fixed input, in the Sakana AI CUDA Engineer and CUDA-L1 systems, with a companion line of work hardening harnesses against such exploits; that axis is orthogonal to the numerical silent-wrongness we measure. The Kernel Contracts taxonomy enumerates correctness classes for GPU kernels; the taxonomy is theirs, and ours is the first runnable, at-scale operationalization of it that we are aware of. Three things separate this paper from the literature above: a tolerance-free correctness measure, a quantified audit on thousands of accepted, real kernels, and a certified native artifact the same verifier passes.

The gated-linear-recurrence family

Sub-quadratic sequence models replace attention’s quadratic cost with a fixed-size recurrent state. Mamba and its structured-state-space-duality successor Mamba-2/SSD, gated linear attention (GLA), DeltaNet and its gated variant, and Mamba-3 all instantiate one gated linear recurrence. Section 4 makes this precise: each is a fixed setting of that recurrence’s gates, so a single backward differentiating the general form yields the training gradients for all of them. That backward is dominated by two hard stages, a reverse-time inter-chunk state scan and a WY / triangular-inverse vector-Jacobian product, and the reference open-source implementation of both is the Triton flash-linear-attention (fla) library, which is our speed baseline.

The twelve gates

The repository ships nineteen deliberately-broken kernels, each embodying one trick: returning its input, caching an answer, accumulating in fp16, behaving nondeterministically, flipping an infinity to a finite value, working at only one shape, or silently moving data to another device. A test asserts that the verifier rejects every one and clears the correct reference. That two-sided check is what establishes the referee before it is ever aimed at foreign code.

The audit

Fairness is enforced in code by five rules, pinned by nineteen unit tests. Inputs the reference itself cannot run are marked not-applicable and never counted as candidate failures; tolerances sit at the loosest defensible point; positions where candidate and reference agree on a NaN or an infinity go uncharged, since a non-finite admits no tolerance comparison, while a swallowed non-finite is still caught by EXC-01; a candidate is charged only for its own declared compute precision; and the mixed-precision and shape conventions are fixed in advance. Every ambiguous case moves toward the candidate. One precondition cuts the other way. EXC-01 scatters non-finites into the input, so it probes behavior a kernel’s author may never have intended to support. The reference defines the contract: every kernel in this population is advertised as a drop-in replacement for one specific PyTorch module, so if that module propagates a non-finite and the replacement hands back an ordinary number, the operator’s behavior has changed, whatever case can be made that the change is an improvement.

Headline

Both figures survive aggressive re-slicing. Adding CMP-03 shape rejection to the floor raises it to 41.1%, a further 40 kernels; the floor admits only outright rejection of a shape, since a value mismatch at a new shape still carries a tolerance argument. The floor’s one run-failure channel, the 62 kernels that fail to execute for a reason the artifact filter does not catch, is not carrying it either: some of those 62 are toolchain-shaped in a way the four-prefix predicate misses, and deleting the channel outright leaves 981 of 2,576, or 38.1%. The 62.1% violation rate holds at 61.9% after stripping the entire matmul class, the worst case for the TF32 tolerance argument, and at 54.7% after stripping every gate to which a tolerance argument could be attached at all (ORD-01, PRC-01, PRC-02, EXC-02).

(1) Positive control: 7/7

Our own six Mamba-3 Triton kernels (Appendix C.1) and the native GDN backward (Section 4) run through the same battery in the same Model/ModelNew convention. All seven pass every applicable gate and are clean on every tolerance-free channel, the exact classes that sink the foreign corpus. One of the seven is independent by construction: the tolerance model was calibrated against the six Triton kernels, and the native GDN backward played no part in that calibration. The tolerance-free channels carry no threshold to calibrate at all, which makes a clean result there calibration-independent for all seven.

The control caught a gap in our own code. C5 (fused_block_forward) inferred its channel dimension from the input tensor without checking it against the convolution-weight channels, a missing input-validation guard. Commit 7f46226 adds the guard in three files: the two public ops, and the reference as well, since a depthwise convolution with mismatched channels is outside this block’s math on either side. Guarding the reference changes C5’s CMP-03 verdict from a failure to not-applicable, under the reference-applicability rule applied corpus-wide, and that is the norm here: six of the seven control kernels resolve CMP-03 as not-applicable for the same reason. The control then reads 7/7 over uneven applicability, nine gates applying to all seven kernels and passing on all seven (CMP-01, ORD-01/02/03, PRC-01/02, EXC-01/02, RES-01) while CMP-03 applies to one. What carries the load is that the gate flagged the author’s own kernel and the fix changed shipped code on both sides of the comparison.

Robustness: a second stack and a second corpus

The finding reproduces on a different software stack. A 300-kernel sample re-audited on torch 2.11.0+cu128, against the audit’s 2.12 and on the same B200 silicon, returns 68.6% over the 245 rows that survive the same accepted-only and artifact filters, above the 62.1% headline. Composition does not explain the gap: the high-rate reduction class is under-weighted in the re-audit (26.5% of rows against 28.7%), and standardising the re-audit to the main corpus’s class mix moves it further up, to 68.9%. The per-class rates are higher on the older stack in six of the seven classes, reduction at 84.6% against 71.8% and softmax at 59.4% against 47.4%, so the newer toolchain understates the finding if anything. The pre-registered kill criterion was a re-audit rate below 5%, and the observed 68.6% clears it by more than thirteen times.

The two hard kernels

The scan is sequential; the GPU wants parallelism. The standard resolution is chunking: split the sequence into chunks of 64 steps, do the parallelizable work inside all chunks at once, then run a short sequential carry between chunks. The backward runs this in reverse, and two of its stages are hard.

Scope of the novelty claim

As surveyed in July 2026, against pinned upstream revisions recorded with the evidence: NVIDIA ships an SSD forward but no backward in either of its two stacks; cuLA has a KDA backward that is a hybrid (one native CuTe kernel for the WY stage, but the reverse-state K#1 stage still in fla Triton); FlashKDA is forward and inference only; and tilelang has GDN/KDA backward examples with no tcgen05/TMEM in them. The contribution is therefore two firsts: a native Blackwell tcgen05/TMEM training backward for the GDN family, and a native tcgen05 reverse-state backward, the stage others still run in fla Triton. Three neighbouring claims stay outside that scope: the first native backward kernel for the family (cuLA’s WY predates ours), the first non-Triton GDN/KDA backward (tilelang exists), and bit-for-bit parity (ours is fp64-tight).

Why a tolerance-free floor is the right lens

Every prior treatment of generated-kernel correctness parameterizes acceptance by a tolerance, and a debate over the number follows. The tolerance-free floor sidesteps that debate. A kernel that returns a finite value where the reference returns a NaN, or a different answer on each run, or that aliases a shared buffer, crashes, or does not run at all, is wrong under any tolerance. That is what 39.5% of an accepted corpus does, with the 62.1% as the wider, tolerance-dependent rate above it. The modal defect fixes the character of the gap: substituting an ordinary number for a NaN or an infinity turns a detectable training-time error into undetectable data corruption, an outcome no setting of a threshold either produces or prevents. The differential says the same thing from the other side. A checker that were merely stricter would disagree with the loose check in both directions, and this one disagrees 1,487 to 14. Together with the 98.5% agreement against KernelBench’s own correctness code, that direction supports a specific claim: the gap is a property of what the standard check probes, and of where the threshold sits only secondarily.

Implications and future work

Acceptance criteria for kernel-generation benchmarks understate the correctness gap, and a small set of tolerance-free contracts (non-finite propagation, determinism, shape polymorphism) would close most of it at modest cost. We propose such contracts as a benchmark standard. On the systems side, the structural speed gap points to two specific levers: a tl.dot path on a post-#9093 Triton, and less surrounding fp32 glue.

Corpus selection and exclusions

Section 3.2 states two steps without operationalizing them. Neither involves a judgement call at audit time: the classifier is a pure function of the public corpus row, and the artifact filter is a pure function of the recorded run status.

Why the rule is weak enough to be safe

A first-match-wins cascade is a coarse instrument, used here only where coarseness cannot propagate. Three properties bound what it can affect. First, the audited population is invariant to the order of the seven patterns: membership turns on whether any of the seven matches, and a union does not depend on the order of its terms. Ordering decides only which label a row carries, so a normalization written on top of nn.Linear is labelled matmul, moving a row between two slices we report separately while adding and removing nothing from the denominator. The one boundary that can change the population is between the seventh pattern and elementwise, and it is inclusive in the conservative direction: a reference containing any reduction call is audited even when the operator is otherwise elementwise, so the rule over-admits. Second, no verdict depends on the label. Gates, references, tolerances, and applicability all derive from the reference operator’s runtime behavior, its dtypes and its shapes; the verifier never reads the class string, which exists to define the audited slice and to let a reader cut the result by operator family.

Composition of the tolerance-free floor

The 39.5% floor is the union of five channels, each of which admits no tolerance argument: EXC-01 (a non-finite is swallowed), ORD-02 (output differs across repeats), output aliasing into a shared buffer, a CUDA error raised during gating, and a non-artifact failure to run at all. Their individual counts over the 2,638 are 868, 126, 25, 16, and 62; they sum to 1,097 and their union is 1,043, so the channels overlap on 54 kernels.

EXC-02 is tolerance-free by the same standard and sits outside this union. Subnormal flush-to-zero is the one member of the tolerance-free group where a reader can reasonably answer “that is a convention, not a defect”, since production kernels enable FTZ deliberately. It is held out of the floor for that reason, and its effect is this: including EXC-02 raises the floor to 1,154 (43.7%). The reported 39.5% is the conservative reading of our own gate set.