# 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.

- Category: Safety & evaluation
- Readiness level: III (Open source) on Science Underway's four-step scale, as proposed
- Published: 2026-12-04
- Editor: Stefan Perdal
- URL: https://scienceunderway.com/articles/columbia-tool-finds-66-bugs-that-tests-missed-in-flashattention-and-deepgemm

## The study

TensorLean: Formal Verification of Production GPU Kernels (preprint, not peer reviewed). arXiv 2612.05654. https://arxiv.org/abs/2612.05654

## At a glance

- What it shows: A new checking tool proved that more than half of about 2,000 versions of widely used AI maths programs work correctly for every valid input. It also found 66 previously unknown bugs in the rest, most of which silently produce wrong numbers or crash.
- What it does not show: It does not show that the bugs have been fixed, or that any company uses the tool day to day. It is a preprint and has not been peer reviewed.
- Why it matters: These small programs do nearly all the computing in AI systems, and a single hidden error can quietly damage a model's training or its answers. A proof covers cases that tests never try.

## What 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 the article (what it means, limits, what to watch) is free for members: https://scienceunderway.com/articles/columbia-tool-finds-66-bugs-that-tests-missed-in-flashattention-and-deepgemm

## 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.

---
Source: Science Underway, https://scienceunderway.com/. Please link to the article when you cite it.
