A Team of Researchers from Columbia and CertiK Introduce TensorLean for Formal Verification of GPU Kernels
In one sentence
Columbia University and CertiK researchers introduced TensorLean, a Lean-based formal verification framework for GPU kernels at the PTX level that found 38 bugs across major projects.
Key points
- TensorLean uses Lean, Z3, and cvc5 to verify at the PTX level that compiled GPU kernels match a tensor-level math specification.
- The framework proves four properties: no data races, termination, output correctness within tolerance, and untouched memory elsewhere.
- The team checked 149 kernel instances, including FlashAttention-2/3/4 and DeepGEMM, proving 83 correct and uncovering 38 bugs.
- Across 6 projects, it identified bugs such as 19 memory access errors and 13 numerical bugs, including a data race missed by regular testing.
In depth
An AI-written overview of the original article, not the article itself.
Researchers from Columbia University and CertiK have introduced TensorLean, a formal verification framework for GPU kernels at the PTX level. Built on Lean, it proves compiled kernels match tensor-level math specs, verifying 83 of 149 tested instances and uncovering 38 bugs.
Verification Results and Bugs Found
According to the article, the team tested kernels compiled for A100, H100, and B200 GPUs on a 16-core workstation, covering all kernels of FlashAttention-2, -3, and -4 plus DeepGEMM. Out of 149 instances, 83 were proved correct, while the remaining 66 led to 38 correctness bugs across six projects.
All 38 bugs were reported upstream, including 23 in FlashAttention, 7 in Liger Kernel, 3 in TileOPs, 2 each in TileLang and DeepGEMM, and 1 in Triton. Notably, TensorLean caught a FlashAttention-4 data race that never appeared in 17,760 test runs.
How It Works and Scaling Techniques
Starting from unmodified source code, developers write a tensor-level spec in Lean, which is roughly 15 times smaller than the kernel source. TensorLean then proves four properties: no data races, termination, correct output within tolerance, and untouched memory elsewhere.
The pipeline compiles code to PTX, builds a happens-before graph, performs symbolic execution, and discharges proofs using Lean, Z3, and cvc5. To scale, it uses symbolic loop invariants for tiled loops and bounds round-off errors separately from algebraic errors.
Comparison with Other Verifiers
Unlike equivalence checkers such as Volta that unroll loops for one concrete setup at a time, TensorLean uses symbolic parameters for broader configuration coverage. It also supports asynchronous operations like wgmma and TMA, with a median check time of about 10 minutes and a maximum of 50 minutes.
This summary was generated by AI from the original article and may contain errors; the original is authoritative. Copyright belongs to the original author.