CertiK Unveils TensorLean Framework to Bring Mathematical Proofs to Production AI Kernels
Key Takeaways
- •TensorLean is presented as the first formal verification approach applied to production AI kernels.
- •Testing uncovered 25 bugs, including two in DeepSeek kernels and 23 in FlashAttention code.
- •The framework verifies NVIDIA PTX computations with Lean proofs and defined numerical tolerances.
- •Researchers said a kernel error affecting 1% of a hypothetical $100 million training run could create $1 million in additional computing costs.

Researchers from CertiK and Columbia University have introduced a framework designed to mathematically verify that the software running on GPU-driven AI systems produces correct results, even as developers push hardware to its operating limits. The framework, TensorLean, announced November 20, applies formal verification to production GPU kernels using machine-checkable proofs developed in Lean. According to the researchers, the approach marks the first formal verification of production AI kernels and targets a persistent challenge in AI infrastructure: ensuring that performance optimizations do not introduce computational errors.
The team tested TensorLean on more than 100 production GPU kernels spanning multiple generations of GPU architectures, including code from DeepSeek and the FlashAttention library. The research uncovered 25 bugs, comprising two in DeepSeek kernels and 23 in FlashAttention.
Why AI Kernels Need Mathematical Verification
GPU kernels carry out the low-level mathematical operations that underpin AI model training and inference. As developers optimize these programs to improve performance and reduce computing costs, their implementations grow increasingly complex.
Conventional testing can identify problems in specific examples, but it cannot establish that a program meets its requirements across all inputs and execution conditions within its intended scope. Formal verification addresses this limitation by using mathematical proofs to establish that code satisfies defined specifications. The bugs found in this study illustrate what that limitation can mean in practice: errors can remain in kernels that are already in production use.
For production GPU kernels, the task is complicated by the need to account for real-world execution behavior. Programs may overlap data transfers with computation, change execution configurations depending on workload size, and rely on lower-precision arithmetic to improve efficiency.
TensorLean incorporates these conditions into its verification process. The framework examines PTX code directly, allowing researchers to verify the computations generated through NVIDIA's GPU compilation pipeline rather than relying solely on higher-level program representations. The proofs are developed in Lean, which checks the mathematical logic and produces machine-checkable evidence that the verified computations meet their requirements within defined numerical tolerances.
Keeping Verification Aligned With Ongoing AI Development
One intended application is helping developers maintain correctness as they continue optimizing their GPU code. Each time an implementation changes, teams can rerun verification to determine whether the updated version still meets its requirements. The approach also allows researchers to reuse existing specifications for related mathematical operations, potentially reducing the effort involved in extending verification to additional kernels.
Ronghui Gu, co-founder of CertiK and a computer science professor at Columbia University, said the goal is to ensure that performance improvements are accompanied by reliable evidence of correctness, reducing the possibility of errors reaching large-scale AI training and deployment.
The financial implications can be significant. The researchers offered a hypothetical example in which a $100 million training run requires 1% of its computation to be repeated because of a kernel error, resulting in an additional $1 million in computing costs.
TensorLean also arrives amid broader interest in applying mathematical proofs to software reliability. In October, Anthropic published research on using Claude to construct mathematical proofs for open-source software. While that work focused on general software, TensorLean applies formal verification to the underlying computational infrastructure used by AI models.
The researchers' findings suggest that formal verification could become an important component of AI infrastructure development, particularly as increasingly sophisticated optimization techniques make it harder to establish the correctness of production code through conventional testing alone. How widely verification of this kind will be adopted across kernel development remains an open question.