Columbia tool finds 66 bugs that tests missed in FlashAttention and DeepGEMM
A Columbia University team built a tool that mathematically checks the low-level code behind AI training and inference. It proved 1,180 kernel variants correct and found 66 bugs that the libraries' own tests had missed.
scienceunderway.com/articles/columbia-tool-finds-66-bugs-that-tests-missed-in-flashattention-and-deepgemm

AI illustrationWhat the study shows
GPU kernels are the small, heavily tuned programs that do the core maths of AI models, such as attention and matrix multiplication. They run inside PyTorch, vLLM, SGLang and DeepSeek's models. Because they are tuned so hard for speed, they are easy to get subtly wrong.
The authors built TensorLean, a tool for formal verification, meaning a mathematical proof that code is correct in every case rather than in the cases a test happens to try. It works on PTX, the low-level NVIDIA code that kernels are compiled into. It checks four things: no data races (two threads clashing over the same memory), the kernel always finishes, the output matches a written specification, and rounding errors stay within a set tolerance.
They ran it on all 143 kernels in three public libraries: FlashAttention-2, -3 and -4, DeepSeek's DeepGEMM and LinkedIn's Liger Kernel. These compile into 2,078 separate variants. The tool handled all but 10. It proved 1,180 variants correct and found 66 previously unknown bugs affecting the other 888. All 66 were reported to the developers.
The authors say 57 of the bugs corrupt outputs or crash in real runs. One example: in FlashAttention-3, when a model's attention head has 80 dimensions and all of them are rotated, a missing bounds check writes zeros into the next head's slot in the KV cache, the memory that stores earlier tokens. Every later attention step then reads damaged data, with no error shown.
On a set of 91 real kernel bugs from 16 libraries, TensorLean found 89 and missed none. The two it could not find were outside what it supports. Of seven other tools, the best found 52, and only when handed the exact inputs that trigger each bug. A median check took 40 seconds per variant on one workstation.
Our reading
In our reading, the most telling result is not the bug count but where the bugs live. Many appear only under specific shapes, such as a head size of 80, a row count that is not a multiple of 128, or a fully masked first block of inputs. The authors note that upstream tests used fixed sizes and random inputs, so they never hit these cases. Testing samples; proof covers everything that meets the stated conditions.
The approach also seems designed to be affordable. A specification of what a kernel should compute is written once and shared across hundreds of compiled variants. The authors report total manual effort of 1.5K to 5.3K lines per library, against up to about 44K lines of kernel code. That is far less than earlier proof efforts they cite.
Caution is still needed. The comparison set of 91 bugs includes the 66 that TensorLean itself found, which tilts the contest in its favour. And the guarantee is only as good as each hand-written specification and the authors' model of how NVIDIA hardware behaves.
The rest of this story is for members. Membership is free: read it at scienceunderway.com/articles/columbia-tool-finds-66-bugs-that-tests-missed-in-flashattention-and-deepgemm
Read the rest of this story
Membership is free. You get every article in full, and can save stories and follow topics.
We send a sign-in link, no password needed. Already a member? Sign inReadiness assessment
| Level | Status | Evidence |
|---|---|---|
| I Lab only | Met | A working prototype of about 80.7K lines of Lean 4, with soundness proofs of about 30.8K lines checked by machine in Lean. |
| II Benchmarked | Met | Evaluated on all 143 public kernels in FlashAttention, DeepGEMM and Liger Kernel. Also compared with seven public tools on a 91-bug set drawn from 16 open-source libraries. |
| III Open source | Met | The paper says the formalised PTX semantics and machine-checkable proofs are open-sourced at github.com/TensorLean/TensorLean. It is unclear whether the full verifier is included. |
| IV In production | Not yet | No named organisation is documented as running TensorLean in production. Reporting bugs to upstream projects is not adoption. |
What would move it up
Public evidence that a named kernel team, such as the FlashAttention, DeepSeek or LinkedIn Liger maintainers, runs TensorLean routinely, for example in continuous integration or before releases.
The study
Wei Qiang, Ganxiang Yang, Yi Rong et al. TensorLean: Formal Verification of Production GPU Kernels. arXiv, 3 December 2026. arXiv:2612.05654
Notes
- Qiang, Yang, Rong and Gu, TensorLean: Formal Verification of Production GPU Kernels, arXiv preprint 2612.05654, December 2026. Source
- Code: formalised PTX semantics and machine-checkable proofs in Lean 4, per the paper. Source
- FlashAttention GitHub issue #3014 on the KV-cache corruption bug, cited by the authors. Source
- Exact figures: 2,078 variants; 2,068 supported (99.5%); 1,180 proved correct; 888 with bugs; 10 unsupported; 66 unique bugs across 86 of 143 kernels; 57 cause corruption or crashes, 9 latent. Per-variant time: median 40 seconds, maximum 78 minutes. Proof-to-code ratio 0.1:1 to 0.5:1.
- Bug suite: 89 of 91 found by TensorLean (0 missed, 0 timeouts, 2 unsupported). Best baseline: CUDA Sanitizer with bug-triggering inputs, 52 found; best baseline on default test inputs, SentryWard, 17 found.
- Readiness: level III, open source available. Level I and II met; no documented production use by a named organisation.
Edited and signed by
Stefan PerdalFounder. Twenty-five years of building digital products.241 stories editedStefan read the study, set the readiness level and approved this story. An AI system found the paper and wrote the first draft.
How this was made
An AI model read the study and wrote this article in the structure Science Underway uses. An editor reviewed it and approved it for publication. Check the original study before you rely on the details.
No corrections to this article. Found an error? Report it.


