AI Kernel Verification: TensorLean Finds 38 GPU Bugs

Diagram of AI kernel verification with TensorLean proving GPU code correct

Researchers at CertiK and Columbia University have released TensorLean, a system for AI kernel verification that proves GPU code computes what it should. On November 20, the team said it had applied the method to more than 100 production kernels, including code from DeepSeek and the widely used FlashAttention library.

The results are not a clean bill of health. Across 149 compiled kernel instances, 83 were proven to meet their specifications, and the team found 38 bugs in six libraries.

Why silent numerical errors are expensive

Kernels are small programs that run on GPUs and do much of the arithmetic behind training a model and answering a prompt. When one goes wrong, nothing crashes. The system keeps running and the output quietly degrades.

The researchers point to a few examples. In late August 2025, some Claude users saw Thai characters appear in English answers and syntax errors in generated code after a TPU runtime optimization disrupted next-token computation. In October 2026, Google DeepMind researchers described two numerical bugs in core AI operations. Tiny rounding errors could wipe out the signal a model learns from, or invent a signal that isn’t there. In their experiments that was enough to push a model off target while it was learning to imitate another model.

Money is part of the argument too. If 1% of a $100 million training run had to be repeated because of errors, that would add $1 million in compute.

TensorLean 1
Image: CertiK

What formal verification adds over testing

Ordinary tests run examples, so they only cover cases someone thought to write. A bug can sit in an unusual sequence length, a rare batch size, or a particular interleaving of concurrent requests, and pass every common test.

Formal verification works differently. Researchers state the intended computation, the conditions under which it applies and the permitted numerical error as exact mathematical requirements. Then they prove the program always meets them. A finished proof covers every input and execution that satisfies those conditions, so the errors it rules out cannot occur within that scope.

TensorLean 2
Image: CertiK

Proving code that was built for speed

Production GPU code is hard to verify because it’s tuned aggressively. Programs rearrange data in memory, split work differently across threads, overlap data transfers with computation to cut waiting, and use lower-precision arithmetic for throughput. Each trick makes correctness harder to guarantee.

TensorLean works directly on the compiled GPU code, known as PTX, so the proof applies to the optimized implementation rather than a simplified model of it. All proofs are written in Lean and can be checked by machine. A foundational prover accepts only valid reasoning at each step.

TensorLean team members Wei Qiang and Ganxiang Yang said the challenge was finishing the proofs without dropping the real execution conditions that make the code fast.

TensorLean 3
Image: CertiK

What the bug count shows

  • 149 compiled kernel instances evaluated
  • 83 proven to meet their Lean specifications
  • 38 bugs found across six libraries
  • 2 bugs in DeepSeek’s DeepGEMM and 23 in FlashAttention

The takeaway is that heavily used, performance-tuned code can hide bugs that conventional testing never caught. After a fix, developers can rerun verification and get a proof for the repaired version.

Checking correctness after every optimization

Model developers keep tuning low-level code to speed up training and lower inference costs. Changing data layouts, execution settings or numeric precision can help performance, and each change can also add an error. With TensorLean, a team writes the specification once and re-checks it after each optimization. If the intended computation and its assumptions stay the same, the specification can be reused for new versions. If an optimization changes input conditions or error tolerances, the specification has to be updated.

Ronghui Gu, a co-founder of CertiK and a computer science professor at Columbia, said every performance gain for large models should come with reliable evidence of correctness. For developers, the question changes from “how much faster is it?” to “is it still correct, and how much faster is it?”

What comes next for verified AI code

TensorLean arrives shortly after Anthropic and Theorem published research in October on using Claude to construct mathematical proofs for open-source software. TensorLean points the same idea at the computations inside AI systems themselves.

The open questions are practical. Verification only covers the stated conditions, and each new optimization may need a revised specification. Whether large labs adopt it will depend on how much effort the specifications take compared with the cost of rerunning a failed training job. CertiK says it plans to extend its formal verification work to more of the computing stack under AI.

Source: CertiK

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.