TensorLean: 66 Hidden GPU Kernel Bugs in FlashAttention, DeepGEMM, and Liger Researchers at Columbia University and CertiK formally verified 2,078 production GPU kernel instances from FlashAttention, DeepSeek DeepGEMM and LinkedIn Liger Kernel and reported 66 unique, previously unknown correctness bugs, with 57 of them capable of corrupting outputs or crashing real runs, according to CertiK's announcement. The study proved 1,180 instances correct and flagged 888 supported instances that violated at least one property, covering incorrect algorithms, numerical errors, uninitialized memory, out-of-bounds access, data races, non-termination and PTX undefined behavior, per arXiv:2612.05654. CertiK called the work the first formal verification of production AI kernels at scale; the TensorLean pipeline compiles kernels to PTX, proves data-race freedom and termination, and checks functional correctness with SMT solvers, with semantics mechanized in Lean 4 and a median proof time of 40 seconds per instance. Columbia University and CertiK researchers reported 66 unique, previously unknown correctness bugs https://arxiv.org/abs/2612.05654?ref=explainx in widely used AI GPU kernels after formally verifying 2,078 production instances from FlashAttention, DeepSeek DeepGEMM, and LinkedIn Liger Kernel. CertiK's announcement https://www.certik.com/blog/tensorlean-certik-and-columbia-university-researchers-formally-verified-production-ai-kernels-from-deepseek-and-flashattention?ref=explainx calls the work the first formal verification of production AI kernels at scale , and the TensorLean project site https://tensorlean.ai/?ref=explainx publishes supplementary material. Standard unit tests and benchmarks did not catch the defects; 57 of the bugs can corrupt outputs or crash real runs, per CertiK. If you train or serve with fused attention or DeepGEMM paths, this is not a headline about hacking prompts. It is about silent wrong math in the layer every frontier stack trusts. Answer first: what broke and where | Library | Kernel instances in study | Unique bugs reported paper | CertiK crash or corrupt class | |---|---|---|---| | FlashAttention 2–4 | 246 instances across 35 kernel types | 43 bugs spread across FA2, FA3, FA4 families | Majority of attention-path defects | | DeepSeek DeepGEMM | 70 instances across 20 kernels | 8 bugs | Includes GEMM and attention fusion paths | | LinkedIn Liger Kernel | 1,762 instances across 88 kernels | 15 bugs | Mostly loss and normalization stacks | The authors proved 1,180 instances correct and flagged 888 supported instances that violated at least one property. Bugs span incorrect algorithms , numerical errors , uninitialized memory , out-of-bounds access , data races , non-termination , and PTX undefined behavior , per arXiv:2612.05654 https://arxiv.org/abs/2612.05654?ref=explainx . How TensorLean verifies kernels TensorLean formal verification workflow for production GPU kernels in FlashAttention and DeepGEMM Image: CertiK https://www.certik.com/blog/tensorlean-certik-and-columbia-university-researchers-formally-verified-production-ai-kernels-from-deepseek-and-flashattention?ref=explainx TensorLean’s pipeline, summarized on tensorlean.ai https://tensorlean.ai/?ref=explainx and in the paper: 1. Compile to PTX and build a symbolic happens-before graph over formalized PTX semantics. 2. Prove data-race freedom and termination , shrinking concurrent schedules to finite sequential cases. 3. Push or pull memory updates and prove functional correctness against tensor specs with SMT solvers over reals. 4. Extend guarantees to floating-point PTX via inductive round-off bound inference. Semantics and soundness proofs are mechanized in Lean 4 , which matters for auditors already comfortable with proof-carrying crypto work. Median proof time is 40 seconds per instance in the evaluation, with the hardest cases taking up to 78 minutes . Proof-to-code ratios land between 0.1:1 and 0.5:1 , the authors report, meaning verification effort is no longer laughably larger than kernel size for many production tiles. Why FlashAttention and DeepGEMM matter FlashAttention-family kernels are the default way teams make long-context training affordable. NVIDIA’s own FastGen-PDD distillation work https://explainx.ai/blog/fastgen-pdd-nvidia-parallel-decoding-distillation-video-july-2026 assumes stable attention backends when comparing AnyFlow and DMD2 baselines. A fused kernel that returns slightly wrong softmax blocks does not always trip loss NaNs; it can drift weights across thousands of steps. DeepSeek DeepGEMM https://explainx.ai/blog/deepseek-deepinfer-huawei-ascend-production-code-december-2026 ships beside MIT-weight models as the performance core for matrix paths on Hopper-class hardware. LinkedIn’s Liger Kernel accelerates loss and normalization stacks in large fine-tuning jobs. These are not demo repos; they sit on the hot path for checkpoints you later expose through APIs and agents. TensorLean study bug counts across FlashAttention DeepGEMM and Liger kernel libraries Image: CertiK https://www.certik.com/blog/tensorlean-certik-and-columbia-university-researchers-formally-verified-production-ai-kernels-from-deepseek-and-flashattention?ref=explainx What developers should do this week Pin versions and read changelogs. FlashAttention, DeepGEMM, and Liger maintainers received all 66 reports , per the paper. Before you bump a minor release for speed, scan release notes for TensorLean or correctness mentions. Rerun golden tests on real shapes. Property-based tests in Python wrappers rarely explore the launch grid combinations TensorLean models. Re-log training loss , downstream eval , and checksums on a short run after any kernel upgrade. Separate agent guardrails from kernel truth. Runtime monitors like those in PrismGuard research https://explainx.ai/blog/prismguard-signals-not-verdicts-agent-runtime-protection-december-2026 stop tool misuse . They cannot detect that your attention kernel returned a wrong tile on a rare sequence length. Stack both layers: policy guards for agents , version discipline for CUDA . Watch supply-chain questionnaires. Enterprise buyers already ask about NY DFS-style agent authorization https://explainx.ai/blog/ny-dfs-agentic-ai-customer-authorization-rfi-december-2026 . Formal kernel audits are a credible follow-up question for training vendors and cloud GPU providers. Formal methods meeting AI infra CertiK built its brand on smart-contract auditing . TensorLean is the same instinct applied where billions of flops hide in hand-written CUDA. The paper’s headline number — 66 bugs — is smaller than daily CVE firehoses, but the blast radius is large because every customer shares the same fused kernels. Compared with NVIDIA attribution work on failed distributed training https://explainx.ai/blog/nvidia-attribution-open-source-distributed-training-failure-root-cause-xid-149-nccl-slurm-kueue-2026 , TensorLean catches local correctness before jobs scale out. NCCL and Slurm outages are loud; wrong attention outputs can be quiet until an eval regresses weeks later. Bug classes the authors name explicitly The arXiv paper groups failures into categories that matter differently for SREs versus ML researchers : - Algorithm implementation errors where tile math diverges from the tensor spec even when shapes look valid on common benchmarks. - Numerical bugs that violate real-number functional goals once floating-point PTX is considered. - Uninitialized memory reads that can leak stale values into attention outputs. - Out-of-bounds accesses triggered only on certain sequence lengths or head dimensions. - Data races between warps that unit tests on deterministic seeds never interleave. - Non-termination paths where kernel loops fail to meet proof obligations. - PTX undefined behavior that compilers or drivers may treat inconsistently. CertiK’s public write-up emphasizes that 57 bugs sit in the corrupt or crash bucket, meaning they are not cosmetic lint findings. That distinction matters when auditors ask whether AI security work should focus only on prompt injection while numerics stay unreviewed. Who should read the primary sources ML platform engineers maintaining forked FlashAttention should diff upstream commits against TensorLean disclosures before merging into a long-running pretrain . Inference SREs serving long-context chat should treat kernel upgrades like database migrations : snapshot golden prompts, compare logits or hidden-state norms if you have hooks, and roll back fast. Security teams already tracking fake quant models on Ollama https://explainx.ai/blog/fake-qwen3-1-7b-ollama-model-what-is-trigger-remcos-rat-slowmist-claimed-vs-verified-december-2026 should add supply-chain integrity for CUDA artifacts to the same runbooks. Malicious kernels are not what TensorLean found, but silent benign bugs teach the same lesson: trust but verify the hot path. Researchers citing FlashAttention speedups in papers should footnote kernel versions the way they footnote dataset hashes . Reproducibility failures sometimes come from non-deterministic races , not from random seeds alone. Limits the paper acknowledges TensorLean does not yet verify every kernel instance in the repos — the evaluation table marks some instances outside verification scope . Proofs assume formalized PTX semantics; driver and hardware microarchitecture gaps remain. Verification is offline ; it does not replace canary clusters or hardware ECC . Teams on local FP8 tensor parallel stacks https://explainx.ai/blog/llama-cpp-v0-9-0-ggml-0-29-0-fp8-e4m3-multi-node-tensor-parallelism-nccl-what-changed-2026 still need end-to-end tests because numerics stack across kernels, frameworks, and quant formats. Comparison to testing stacks you already run Most teams rely on pytest golden values , micro-benchmarks , and occasional cuda-memcheck sweeps. Those tools excel at smoke coverage but sample a thin slice of launch configurations . Property-based tests in Python rarely reach into PTX register layouts or warp scheduling . TensorLean is closer to formal verification in cryptography : upfront cost, high assurance on modeled properties. It does not replace integration tests ; it complements them where one wrong tile poisons a trillion-token training run. If your organization already funds Datadog-style agent testing research https://explainx.ai/blog/datadog-ephyra-agentic-property-based-testing-december-2026 , think of TensorLean as the hardware-adjacent cousin : properties are about memory and real arithmetic , not tool JSON schemas. What this is not This is not a claim that FlashAttention is permanently unsafe. It is evidence that heroic manual CUDA outran classical test coverage , and that formal tools can close part of the gap. It is also not an agent prompt injection story; do not conflate it with felony-bench agent incidents https://explainx.ai/felony-bench unless a future case ties a kernel bug to deliberate sabotage. Research context and open weights DeepSeek’s December systemic risk policy https://explainx.ai/blog/deepseek-frontier-ai-systemic-risk-policy-december-2026 argues for tiered open releases partly because channel A weights run without API guardrails . TensorLean reinforces a narrower point: even widely trusted open code paths can harbor correctness debt invisible to downstream users until someone proves properties over PTX . Chinese labs are not alone. US hyperscalers depend on the same open kernel ecosystems to ship features quickly. The responsible move is transparent fixes , not rumor-mill panic. How to protect training and inference pipelines 1. Subscribe to upstream security and release feeds for FlashAttention, DeepGEMM, and any fused loss library you vendor. 2. Freeze kernel versions across a training campaign; upgrade only on a maintenance window with reruns. 3. Log hardware and driver tuples beside checkpoints so you can bisect silent regressions. 4. Ask GPU cloud providers which commit hashes they bake into images; pin to audited builds when available. 5. Keep human review on numerics-sensitive changes even when AI coding agents ship more lines than features https://explainx.ai/blog/ai-coding-agents-more-code-not-more-software-harvard-jellyfish-review-bottleneck-2026 . For teams building agent harnesses on top of models trained with these kernels, kernel hygiene is foundational . Misaligned logits from bad attention are indistinguishable from model misbehavior in logs. FAQ-sized detail: FlashAttention version matrix When you file internal tickets, reference library branches , not only pip version strings: | FlashAttention tranche | Approximate LoC in paper table | Instances with bugs paper | |---|---|---| | FA2 6 kernel types | 3.7K LoC cited | 20 instances flagged | | FA3 6 kernel types | 10.1K LoC cited | 36 instances flagged | | FA4 23 kernel types | 43.8K LoC cited | 11 instances flagged | DeepGEMM’s attention and GEMM splits show smaller instance counts but higher severity density on some quantization kernels where three of three instances failed verification in the evaluation snippet. Liger’s loss kernels contribute the largest instance volume , which matches how often fine-tuning jobs spend cycles in cross-entropy fused paths . If you want to use this at work, not just read about it, this is the fastest path.