Researchers from Columbia University and CertiK have unveiled TensorLean, a tool designed for the formal verification of GPU kernels. The system operates on unmodified source code, allowing developers to define tensor-level specifications using the Lean programming language.

TensorLean validates four critical properties: absence of data races, program termination, output accuracy within specified tolerances, and memory safety. The framework leverages Lean’s Mathlib, with tensor operators mirroring PyTorch naming conventions.

The project team identified 38 bugs in existing software, including 23 in FlashAttention, 7 in Liger Kernel, 3 in TileOPs, 2 in TileLang, 2 in DeepGEMM, and 1 in Triton. The bugs include 19 memory access errors, 13 numerical issues, and 7 data races.

In testing, 56 out of 102 FlashAttention instances successfully passed all four verification properties, while 46 failed. Unlike equivalence checkers that unroll loops for specific configurations, TensorLean utilizes symbolic parameters to improve coverage.