On November 20, 2026, five researchers published a paper titled "Formal Verification of Production GPU Kernels" on tensorlean.ai. Wei Qiang, Ganxiang Yang, Yi Rong and Xupeng Li are at Columbia. Ronghui Gu is at Columbia and co-founded CertiK. TensorLean takes an unmodified CUDA kernel, compiles it, and proves the resulting PTX matches a tensor-level specification in Lean.
THE RECEIPTS
They ran it across 149 open-source kernel instances, including all 37 kernels of FlashAttention-2, FlashAttention-3 and FlashAttention-4, plus DeepGEMM, Liger Kernel, TileLang, TileOPs and Triton. 83 proved out. The other 66 failed a proof goal, and each traced to a bug in the kernel's own source. That came to 38 correctness bugs, all reported upstream: 23 in FlashAttention, 7 in Liger Kernel, 3 in TileOPs, 2 in TileLang, 1 in Triton, and the remainder in DeepGEMM.
A failed proof goal is not automatically a bug, since it can also mean a spec gap, a precondition mismatch or a resource limit. 83 plus 66 is 149, and the counts add to 38.
The count is not uniform even in the source material. The project blog, CertiK's release and every trade writeup say 38. The GitHub README's table lists 39, three of them in DeepGEMM, and I use the press figure here.
Of the 102 FlashAttention instances checked, 56 satisfied all four properties: data-race freedom, termination, output within floating-point tolerance, and no unrelated memory written. Each of the other 46 broke on a defect in the source.
The tooling is small on purpose. The PTX parser is 1,800 lines. The team formalized 72 kernels from 9 operations totaling 151,285 lines of source, and the specifications for all of it came to 10,278 lines. For FlashAttention alone, 37 kernels and 55,910 lines of source fit into 6,242 lines of spec.
It runs on a 16-core workstation. Median verification is about ten minutes per instance. The largest, FlashAttention-3's forward kernel on Hopper, discharged 31,402 proof goals in 50 minutes. The PTX checked was compiled for the A100, H100 and B200.
Your inference stack is a pile of unproven math. The authors say TensorLean is the first to prove production kernels against their own math, and the first run says large parts of that stack were wrong. If you serve models, you ship these kernels or their descendants.
WHY TESTING CANNOT SEE THIS

A test samples an input. A proof quantifies over every input that satisfies the preconditions, and over every thread schedule. Your CI runs a finite set of shapes, dtypes and batch sizes picked by whoever thought those were the interesting ones, and the proof does not care what they missed.
The FlashAttention-4 example makes the gap concrete. TensorLean found a data race in compute_block_sparsity, tracked as issue 3195 in the flash-attention repository, that can drop blocks containing unmasked keys. It never appeared in 17,760 runs of the library's own tests, because the schedule that triggers it never lined up.
The most common class is the 32-bit index overflow: the forward kernel's key count in a paged KV cache, the backward pass's fp32 accumulator strides, Liger's embedding row offsets. Others are uninitialized memory. One is a latent deadlock in the Hopper forward kernel from a missing syncwarp call after a producer warp's barrier wait. One is an mbarrier initialized from every lane of a warp instead of one elected lane. One is DeepSeek's fp8_einsum on SM90 silently dropping an accumulator argument and returning matrix multiply instead of the einsum that was asked for.
The index wraps because those offsets are signed 32-bit integers, and a long block table or a large-stride backward accumulator crosses 2 to the 31st silently. The mbarrier bug is subtler: init belongs to one elected thread, so every lane issuing it resets arrival state a producer warp already waits on.
None of those look like an outage. They look like a slightly wrong number in a logit, or a cache that quietly stops appending keys no query attends to, which is the failure mode that costs a training run.
Performance work and memory safety work both sit on this assumption. The Prime Intellect fused MoE kernel I wrote about on November 1 took a Qwen3-30B-A3B expert layer from 12.0 milliseconds to 3.9 and made training steps 32 to 34 percent faster. A fused kernel that is fast and wrong is a regression nobody notices. The KV cache sanitizer work I covered on November 6 found 37 memory safety bugs in vLLM and SGLang at a cost of 3 to 7 percent throughput, catching dynamic errors at runtime. TensorLean is the third leg: it asks whether the arithmetic itself is the arithmetic you specified, in any execution, on any shape inside the preconditions.
THE 15-TO-1 RATIO IS THE STORY
The reason nobody verified kernels before is cost. seL4, the verified microkernel, took 2.5 person-years to build, for 8,700 lines of C, then 20 person-years and about 200,000 lines of proof. Proofs several times larger than the code are the normal shape, which is why formal methods stayed in operating systems and flight software.
TensorLean flipped the direction. Ten thousand lines of spec against 151,000 lines of kernel is 15 to 1 the other way, because kernel correctness is extensional: only the memory before and after execution matters, so you can state the math over tensors and put the layout somewhere else.
A specification has five parts.
- spec_math is the computation as a function from inputs to outputs, written with Mathlib tensor operators carrying PyTorch names, so @ means torch.matmul and an attention spec reads like a five-line PyTorch reference.
- spec_mut is what the kernel changes in place.
- spec_layout maps tensor indices to byte offsets, which is where a paged KV cache becomes a block table index times a batch stride plus a page offset times a row stride.
- spec_tol is the floating-point tolerance.
- requires is the precondition.
The pipeline runs seven steps: unmodified source, the spec, compile to PTX and load a PTX semantics, build a happens-before graph to prove race freedom and termination without enumerating interleavings, symbolically execute to a final memory identical across schedules, lower the spec to PTX memory, then discharge the obligations with Lean, Z3 and cvc5.
PTX is the right target for one reason. It is the last stop before silicon. Bugs get introduced between the CUDA or Triton you wrote and the instructions that run: layout assumptions, index arithmetic, compiler transformations at the edges of undefined behavior. Prove the source and you prove a document. Prove the PTX and you prove the thing on the card. The cost of that choice is that the PTX semantics itself joins the trusted base, along with Lean's proof checker and the two SMT solvers.
The honest caveat is the one you repeat to anybody who quotes this at you. A proof is only as good as its spec, and a wrong spec proves the wrong thing, soundly and mechanically, forever. Verification shrinks the trust surface from the whole implementation to five parts per kernel plus the PTX semantics plus the solvers. It does not delete it. Soundness is conditional: a proof that passes holds against that spec under those preconditions and says nothing beyond them. Completeness is a separate claim, and TensorLean does not make it.
The scope limits are specific, and they are where incompleteness bites. A correct kernel can fail to verify. Specifications cannot yet express kernels that sample at random, which rules out dropout and top-p sampling. The happens-before model covers barriers, mbarriers and async copies but not the ordering that acquire and release operations establish, so kernels that synchronize through atomic flags, including NCCL and DeepEP multi-GPU communication kernels, are out of scope.
And as of today the tool is not released. The GitHub repository, created November 19, publishes the bug table and a promise that the paper, the PTX semantics, the specs and the proofs are coming, which is what its 43 stars are waiting for. Nothing here is independently reproduced, so treat the numbers as the authors' own.
WHAT THIS MEANS FOR YOUR STACK
Stop trusting a kernel because it came from a famous repository. Treat it as a dependency with no security policy. The review question changes from "did the tests pass" to: which kernels in my serving path have a published correctness argument, who wrote it, against which spec, and what happens to it when the version moves.
That last part is the operational hole. A spec is tied to a semantic contract, not a version. When upstream changes a layout or narrows an assumption, the proof does not follow along. CertiK's own framing is that a spec is reusable while the computation and its preconditions hold and must be adjusted when they do not, so a kernel bump is a change with a review. Agent loops compound it: a long rollout re-reads the same KV cache and feeds each slightly wrong number into the next step, so drift worth a token in a chat is worth a trajectory in an agent.
The physical stakes arrive next. Nvidia's Alpamayo 2 Edge puts reasoning planning inside the car: a 2.45 billion parameter backbone with a 0.2 billion parameter action expert, running on DRIVE AGX Thor at 160 to 190 milliseconds per planning step, with a measured prompt that ran 3,236 tokens and no disclosed context length. When a model plans trajectories on the same silicon that runs your kernels, a silent numerical bug stops being a wrong token in a chat and becomes a wrong steering angle.
The teams that should care first are inference platform leads, kernel authors, and anyone shipping attention variants, quantization-aware kernels, or a fused MoE router. If your differentiation is a custom kernel, the proof is your moat as much as the speedup is.
WHAT TO DO TODAY
- Inventory the kernels in your serving path.Attention, GEMM, MoE routing, normalization, and note which have any published correctness evidence at all.
- Ask your inference vendor in writingwhich kernels ship with formal specs or proofs, and which ride on benchmarks alone.
- Pin kernel versions.Treat a kernel bump like a dependency with a CVE, meaning a review, a changelog read, and a re-run of your own numerical checks.
- Re-verify on every CUDA, PTX, compiler or driver bump, diff the spec and preconditions when they move, and once the TensorLean artifacts publish, run your hot-path kernels against those specs instead of trusting shape sampling.
- Read the TensorLean write-up, then sketch the spec for one operation you own. The attention spec in the paper is five lines, and writing your version tells you whether you understand your own kernel.
- Add a correctness evidence line to your kernel review checklist.A field that stays empty forever is a finding too.
THE UNCOMFORTABLE QUESTION
Your model card says what the model does, your benchmark suite says how fast it does it, and nothing in the stack says the math underneath either one is right. If 38 bugs lived in the attention kernels that every inference stack ships, what exactly is your test suite proving?
Get More Articles Like This
Getting your AI agent setup right is just the start. I'm documenting every mistake, fix, and lesson learned as I build PhantomByte.
Subscribe to receive updates when we publish new content. No spam, just real lessons from the trenches.
Build Real AI Infrastructure
PhantomByte teaches you to build real AI infrastructure yourself: local AI stacks, autonomous agents, multi-agent orchestration, web scraping, and custom tools. Step-by-step PDF tutorials you download, follow, and deploy. No subscriptions. No fluff. Just skills that ship.