DEV Community

Cover image for TensorLean GPU Kernel Verification Finds 38 Bugs
Shamuddin
Shamuddin

Posted on Originally published at aitecharchive.com

TensorLean GPU Kernel Verification Finds 38 Bugs

Verdict: TensorLean, announced November 20, 2026 by a Columbia University–CertiK research team (tensorlean.ai), is the first framework for formal GPU kernel verification on production kernels at the compiled PTX level — TensorLean GPU kernel verification reads as a verdict on the open-source kernel stack itself: 149 kernel instances verified, 83 proved correct, and 38 previously unknown bugs now sitting in upstream issue trackers of FlashAttention, DeepSeek's DeepGEMM, Liger Kernel, Triton, TileLang and TileOPs. If you run or train on this stack, the practical takeaway today is to check the affected configurations below and pin updates as maintainers merge fixes — TensorLean itself is not yet fully open-sourced.

Last verified: November 22, 2026.

TL;DR

  • 149 open-source kernel instances checked at the PTX assembly level; 83 proved correct (TensorLean) — the first formal TensorLean GPU kernel verification sweep of production kernel libraries.
  • A total of 38 bugs that the kernels' own tests never caught, all reported upstream; the README table currently lists 39 reports across libraries (GitHub).
  • Specs scale because math is decoupled from memory: a 15:1 code-to-spec ratio, verified at a median of about 10 minutes per instance (tensorlean.ai).
  • Full open-source release plus paper is promised soon; bug tables are live today, and fixes are already landing as upstream pull requests.

What TensorLean actually verifies

GPU kernels are the small programs — attention, matrix multiplication, softmax — that everything from PyTorch to vLLM and SGLang ultimately executes, and a single silent kernel bug can corrupt a training run or serving output without any error message. The team frames the stakes with three real incidents: ChatGPT's nonsense-text incident in February 2024, Anthropic's September 2025 miscompilation postmortem, and Google DeepMind's October 2026 fix for silent numerical bugs in stock softmax and cross-entropy (tensorlean.ai).

Classic formal verification has never reached production kernels because specifications and proofs cost multiples of the code — seL4 needed 20 person-years of proof for 8,700 lines of C. TensorLean's key idea is that a kernel's correctness is extensional: only the memory before and after execution matters, so the mathematics can be written over tensors while memory layouts are stated separately. A specification has five parts — spec_math, spec_mut, spec_layout, spec_tol and requires — and reads much like a PyTorch reference, using PyTorch-named operators on Mathlib. The team formalized 72 open-source kernels from 9 operations — 151,285 lines of source against 10,278 lines of specification — and defined all 37 FlashAttention-2 to -4 kernels with 6,242 spec lines against 55,910 lines of source (tensorlean.ai).

The verification itself targets the compiled PTX, not the source, making TensorLean the GPU kernel verification layer the ecosystem lacked. TensorLean builds a happens-before graph over the relaxed PTX memory model to prove data-race freedom and termination without enumerating thread interleavings, then symbolically executes to prove the post-state matches the lowered spec within floating-point tolerance. Machine checking is by Lean's kernel plus the Z3 and cvc5 SMT solvers. Median verification is about 10 minutes on a 16-core workstation; the largest single instance, FlashAttention-3's forward on Hopper, ran 31,402 proof goals in about 50 minutes (tensorlean.ai).

The 38 bugs, by library

Of the 102 FlashAttention instances, 56 passed all four properties (race-freedom, termination, functional correctness, floating-point tolerance) and 46 failed a proof goal on a source bug; a FlashAttention-4 data race in compute_block_sparsity never appeared in 17,760 runs of the project's own tests (tensorlean.ai). Per-library bug counts, each row linked to its upstream tracker:

Library Reports Flagship bug Where
FlashAttention-2/3/4 23 KV-cache silent corruption with non-interleaved rotary; latent Hopper deadlock; 32-bit offsets overflowing near 2^31 issues
Liger Kernel 7 Cross-entropy and GRPO log-softmax kernels returning NaN on rows whose first block of logits is all -inf issues
DeepGEMM 3 SM90 fp8 einsum silently dropping its third operand and returning the wrong product issues
TileLang 2 ThreadSync missing st.bulk, a data race and miscompilation on Blackwell sm_120 issues
TileOPs 3 Shared-memory and inter-block write races in BatchNorm and backward kernels issues
Triton 1 FP16 underflow and overflow of E8M0 scales in _upcast_from_mxfp PR

Whether this kind of deep-kernel assurance is worth building and reading about is measurable here too: in our own analysis of n=695 developer-tooling keywords (measured November 16, 2026 via DataForSEO), only 72 — 10.4% — cleared winnable search bars at all, which is why a release like this earns coverage on its facts rather than on search volume (how we work).

By category, memory access errors (19) and numerical bugs (13) dominate, and all eight categories have at least one instance — from data races and deadlocks to miscompilations where a correct CUDA source compiles into an incorrect executable (tensorlean.ai). The README's table (GitHub) currently lists 39 individual reports; the project blog's total is 38, a one-item spread between the two primary pages worth tracking as more fixes merge.

What to do today: update and triage steps

  • Running long-context attention? FlashAttention-4 overflowed on paged KV caches whose page-table columns times page size crosses the 32-bit limit (issue #3166); FlashAttention-3 silently corrupted KV cache with non-interleaved rotary at head dims outside 64, 96, 128, 192 and 256 (issue #3014). Watch both issues and upgrade when the fixes land.
  • Using Liger Kernel for fine-tuning? Avoid the reported edge cases — very wide softmax rows (PR #1525), row offsets near the int32 ceiling past two billion output elements (issue #1570) — and check releases for the seven fixes.
  • On Blackwell with TileLang or TileOPs? The ThreadSync data races (issue #2699) produce wrong results with no crash; upgrade as patches merge.
  • A kernel author? Write a tensor-level spec — the five-part format is documented with examples (tensorlean.ai) — and watch for the TensorLean release so you can drop your kernel in.

Open-source alternatives, and what each one verifies

Tool Verifies what Layer Availability today
TensorLean Production kernels against tensor-level specs Compiled PTX Bug tables now; full source, paper and proofs "soon" (repo)
TorchLean Tensor math, NN ops and proved gradients Model/op layer Open source (GitHub)
SuperTensor-lean Tensor-graph rewrite rules, machine-checked soundness Graph optimization Open source (GitHub)
SentryWard Warp-specialized kernels Kernel level Cited as related work (sentryward.io)

For graph-optimizer verification today, SuperTensor-lean is the genuinely usable open-source option, accepting ONNX and emitting C, Rust or CUDA. TensorLean is the only one of the four that has been exercised at this scale — 149 instances across six production libraries — and on compiled PTX; until its promised release lands, its contribution to your stack is the upstream bug reports and fixes that are already merging.

Limitations the authors state

TensorLean cannot yet verify kernels that sample at random (dropout, top-p) or synchronize through atomic flags such as NCCL and DeepEP communication kernels, and it trusts NVIDIA's PTX ISA, ptxas, and an explicit model of tensor-core rounding (tensorlean.ai). It is sound but incomplete: a correct kernel can fail verification through conservative round-off bounds or solver timeouts, so an unproven instance is a red flag, not proof of a bug — the 66 failing instances contain the bugs, but the finding that matters for operators is that proof-grade testing is now strictly stronger than the test suites these libraries already run.

FAQ

Q: Is FlashAttention unsafe to use now?
A: No — 56 of its 102 verified instances passed all four properties (tensorlean.ai), and most reported bugs trigger in edge configurations such as enormous paged KV caches, huge batches or unusual head dims. Treat those edges as unverified and update as maintainers merge fixes.

Q: Can I use TensorLean on my own kernels today?
A: Not fully — the repository so far ships the bug tables while the PTX semantics, specifications and proofs are promised in the coming release (GitHub).

Q: Why verify the compiled PTX instead of the CUDA source?
A: Because miscompilation — a correct source producing an incorrect executable — is one of the eight bug categories the tool caught at this layer (tensorlean.ai); a source-level proof cannot see what the GPU finally executes.

Sources

Coverage of this site's own methods lives at how we work; for related work read Claude's Riemann proof and what Lean checkers still await, how OpenAI rewrote RTL with AMD for chip design, LLama ModChip running DeepSeek on a CPU, MLPerf Training v6.1 on Vera Rubin vs GB300, and how post-training rewires LLM answers, not knowledge.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The number that reframes this for me is not 38 — it is 83 of 149 proved correct, with the rest unproved rather than proved wrong. That distinction matters, because a sound-but-incomplete verifier failing on a correct kernel is a very different signal from a bug, and it is honest of the authors to state that limitation.

Two things stood out. First, the DeepGEMM SM90 fp8 einsum silently dropping its third operand and returning the wrong product — a silent wrong answer, not a crash — is the scariest category here, and it fits your split, with 19 memory-access errors and 13 numerical bugs dominating. Second, you flag a one-item spread yourself: the README lists 39 reports while the project blog's total is 38. Which count is the one to trust right now, and what is the extra report?

One practical question while the full source and paper are still 'soon': can a kernel author write a spec in the five-part format today and get any value from it, or is the spec only useful once the TensorLean release lands? And of the 38, which one would you tell a team running long-context FlashAttention-4 to check first?