Researchers at Columbia University and CertiK say a new verification tool, TensorLean, has mathematically checked 149 instances of production GPU kernels — the low-level code behind attention and matrix multiplication in nearly every large AI model — and found 38 bugs, 23 of them in FlashAttention versions 2 through 4. The project page, dated November 20, says all of the bugs have been reported to the developers.
Why it matters: these kernels run in training and inference stacks everywhere, and they are mostly tested, not proved. A bug that silently corrupts a few values or drops a block of attention under rare conditions can degrade model output without ever crashing. TensorLean's pitch is that proofs catch what tests miss — and its most striking example is a race condition that never showed up in 17,760 test runs.
The numbers
All figures are the researchers' own, from the project page unless noted.
| Item | Figure |
|---|---|
| Kernel instances checked | 149 |
| Proved correct against spec | 83 |
| Instances containing a bug | 66 |
| Distinct bugs | 38, across six libraries (per AI Weekly and PANews) |
| FlashAttention 2–4 | 102 instances covering all 37 kernels; 23 bugs |
| DeepGEMM | 2 bugs (per AI Weekly and PANews) |
| Other libraries named | Liger Kernel, Triton's kernel library, TileOPs |
| GPUs covered | A100, H100, B200 (per AI Weekly) |
The page groups the bugs by type (a bug can fall into more than one): memory-access errors 19, numerical 13, data races 7, uninitialized memory 5, undefined behaviour 5, incorrect algorithm 3, miscompilation 2 and one deadlock. It does not give a per-library split for the 15 bugs outside FlashAttention and DeepGEMM, and it assigns no severity ratings.
Two examples
- FlashAttention 4 block sparsity. The researchers describe a data race in
compute_block_sparsitythat can drop blocks containing unmasked keys — meaning attention could silently skip tokens it should see. They link it to FlashAttention issue #3195 and say it never appeared in 17,760 test runs. - KV cache corruption. AI Weekly reports a memory-access error that silently corrupts the KV cache in
flash_attn_with_kvcachewhen non-interleaved rotary embeddings are used.
Neither source says whether these have been fixed upstream.
How it works
TensorLean checks the compiled PTX — NVIDIA's intermediate GPU assembly — rather than the CUDA or Triton source, so compiler output is covered too. That is how it can flag miscompilations. It is built on Lean 4 and Mathlib, with the Lean kernel and the cvc5 and Z3 solvers discharging proof obligations, and checks four properties per kernel. The page reports a median of about 10 minutes per kernel instance on a 16-core workstation, with FlashAttention 3's forward pass on Hopper the slowest at 50 minutes.
What isn't proven yet
- No paper or code. The page links a GitHub organisation but says the paper and open-source release are coming "soon". Until then, the bug counts cannot be independently checked. AI Weekly also notes there is no peer-reviewed paper or per-bug severity list.
- Not the same as a PTX-in-Lean paper circulating on arXiv. A separate preprint, "Formalizing PTX in Lean to Prove GPU Kernel Correctness", is by different authors, works on hand-written kernels and reports no bug counts.
- Spec quality matters. A proof only shows the kernel matches its specification, and specifications can be wrong too.
What to do
If you run FlashAttention 4 with block-sparse masks, or use flash_attn_with_kvcache with non-interleaved rotary embeddings, watch the FlashAttention issue tracker and release notes for fixes tied to these reports, and pin to a fixed version when one ships. For everyone else, the takeaway is that "passes the test suite" is weaker evidence than it looks for GPU kernels — and the reported run times, if they hold up, suggest checks like this could become routine once the tool is released.