[ Back to home ]
Lethe · 2026

A contract-grade verifier for LLM-generated GPU kernels, and a native Blackwell backward for the gated-linear-recurrence family.

Twelve adversarial gates, aimed outward at 2,638 machine-generated kernels a public system had already accepted, and inward at the first native tcgen05 training backward for the GDN family. The full paper is on arXiv at arXiv:2608.12700 and archived at doi.org/10.5281/zenodo.21563212.

Figure 1. The project in 73 seconds: AI-written kernels that pass KernelBench's own test yet are wrong, the 2,638-kernel audit, and the native backward.

1. Abstract

Language-model kernel generators report high correctness from one loose test: a few random inputs at one fixed shape, accepted if close to a reference. A kernel can pass and still return a finite number where the answer is NaN, change on every run, or break at a new shape. Lethe builds a contract-grade verifier of twelve adversarial gates, several tolerance-free, and aims it in two directions.

Outward, it audits 2,638 kernels a public system had already accepted. Inward, it checks the first native Blackwell tcgen05 training backward for the gated-linear-recurrence (GDN) family, whose correctness we establish independently against a double-precision oracle, so a pass shows the battery is not tuned to flatter its author.

2. Introduction

Kernel-generation benchmarks are only as trustworthy as the allclose test beneath them. Sarkar argues on twenty-four hand-built kernels that loose checks accept broken ones, but reports no rate on a real corpus. The Kernel Contracts taxonomy enumerates correctness classes; that taxonomy is theirs. Ours, to the best of our knowledge, is its first runnable, at-scale operationalization, audited on thousands of accepted, real kernels and passed by a certified native artifact.

2.1 One recurrence, five models

Five sub-quadratic sequence models (linear attention, GLA, Mamba-2, KDA, and GDN) replace attention with a fixed-size recurrent state and form one family. Their superset is the gated DeltaNet (GDN) update of a matrix state S from keys kt and values vt, read by queries qt, with log-decay gt, erase bt, and write wt gates:

St = (I − kt(bt ⊙ kt)⊤) Diag(egt) St−1 + kt(wt ⊙ vt)⊤,    ot = St⊤qt    (1)

Equation (1) adds the delta rule (store the correction to what S predicts, not the raw value) to channel-wise decay. Fixing its gates recovers the other four, and roughly 80% of the parameterization is shared, so one backward through (1) yields training gradients for all five. Each reduction is checked against its own reference.

2.2 What is new, and what is not claimed

3. The Verifier and the Rigor-Gap Audit

3.1 The twelve gates

Each gate is an adversarial contract graded against a high-precision reference that refuses to run in reduced precision.

Gate Property checked
CMP-01correct on random and adversarial inputs (zeros, 10⁶, 10⁻⁶, denormals, long L)
CMP-02correct gradients, not only outputs (autograd versus finite difference)
CMP-03correct across batch, length, and width
ORD-01reordered summation within a derived ∝ √N rounding bound
ORD-02byte-identical across five repeats, no shared-buffer aliasing
ORD-03correct on an input built to expose a bad summation order
PRC-01correct in fp32, fp16, and bf16
PRC-02fed fp16, still keeps an fp32 running total
EXC-01infinities and NaNs match the reference in position and sign
EXC-02subnormal flush-to-zero matches the reference
RES-01output on the same device as the input
RES-02compiled kernel fits hardware limits (registers, shared memory, TMEM)

Tolerances are derived, not chosen (ORD-01: atol ≈ 4ε√N · scale), inputs are seeded, and the nineteen red-team kernels each embody one trick, from cached answers to swallowed infinities.

3.2 The audit

The corpus is Dr. Kernel / KernelGYM (MIT license): 8,920 fine-tuning trajectories, each ending in a Triton kernel. Its SSM-adjacent classes yield 3,134 kernels, each run sandboxed on a B200; keeping those with a positive recorded speedup and a floating-point input, minus toolchain artifacts, leaves 2,638. Five fairness rules push every ambiguous case toward the candidate.

3.3 Four independent defenses

Is the checker just stricter? Four separately falsifiable answers:

3.4 The differential

KernelBench's paper-era check (allclose, atol=rtol=10⁻², five trials, fixed shapes) accepts 93.7% (2,472 of 2,638).

Ours: PASS Ours: FAIL
KernelBench: PASS 985 1,487 (918 tolerance-free)
KernelBench: FAIL 14 152

The checks disagree almost entirely in one direction: a systematic blind spot, not a difference in strictness. Under KernelBench's hardened fp32 tolerance of 10⁻⁴, 1,263 kernels still pass theirs and fail ours.

3.5 Robustness

A 300-kernel re-audit on torch 2.11 returns 68.6%, and the native-CUDA Sakana AI CUDA Engineer archive (213 kernels) shows a 20.2% environment-robust residual, mostly shape rigidity. The gap is neither toolchain-bound nor Triton-specific.

4. The Native tcgen05 Backward

4.1 The two hard kernels

The backward walks 64-step chunks in reverse, and two stages are hard:

4.2 Clearing the tensor-memory constraint

Blackwell's tcgen05 tensor core keeps operands in Tensor Memory (TMEM), capped at 512 columns and managed by hand. In state-spaces/mamba#904, the official Mamba-3 backward requests 544 columns at its normal performance setting, so it fails to compile and falls back to a path reported 38.7× slower on GB200; we reproduced it on our B200. Our first multi-GEMM kernels crashed by releasing TMEM per matmul, which the hardware forbids. Porting the single-reservation lifecycle of NVIDIA's mamba2_ssd.py cleared it.

4.3 Verification

4.4 Speed, stated plainly

The native backward is slower than the Triton flash-linear-attention library, roughly 8× at L = 512 and about 78× at L = 2048, because the reverse scan is sequential and fp32 glue dominates. Against our own earlier pipeline, channel-wise fusion cut the captured backward 2.75× and tensor-memory tiling cut the d_v = 128 variant 2.98×. Speed is future work.

4.5 The bridge

The gates that sink the most foreign kernels also caught our own bugs: our kernel twice produced non-finite values and propagated them, which exposed both bugs (EXC-01); CMP-03 caught the channel gap in §3.3; RES-02 detects the #904 constraint. A checker that flattered its author would not have caught the author's own bugs.

5. Supporting Results

6. Conclusion and Implications

Every reported result in GPU-kernel generation rests on a correctness test too weak to carry it. One verifier, one standard, aimed both ways, exposes the gap and passes a backward certified independently. A small set of tolerance-free contracts (non-finite propagation, determinism, shape polymorphism) would close most of it at modest cost.

The full paper is on arXiv at arXiv:2608.12700 and archived at doi.org/10.5281/zenodo.21563212.

6.1 Limitations and future work

7. Acknowledgments

Thanks to Google Cloud Singapore and E3A Healthcare for the compute, and to Rishav Shrestha for GPU access. The verifier operationalizes Cooper Veit's Kernel Contracts taxonomy (arXiv:2604.22032) and measures against KernelBench (arXiv:2502.10517) on the Dr. Kernel / KernelGYM corpus by Liu et al., ICML 2026 (arXiv:2602.05885, MIT license). The speed baseline is flash-linear-attention, the TMEM lifecycle follows NVIDIA's mamba2_ssd.py, and the bug is tracked at state-spaces/mamba#904.