TensorLean:首个对生产级 GPU kernel 做形式化验证的框架
TensorLean: Formal Verification of Production GPU Kernels
GPU kernel 出个 bug 训练就可能悄悄出错,这个框架用 Lean 4 加 SMT 把 FlashAttention、DeepGEMM、Liger Kernel 全验了一遍,真找出 66 个没人知道的 bug。做底层算子优化或维护训练框架的工程师建议认真读。
TensorLean 是首个针对生产级 GPU kernel 的形式化验证框架,在 Lean 4 中机械化定义了 PTX 语义与可靠性证明。它对 kernel 编译后的 PTX 构建符号化 happens-before 图,将并发执行归约为有限顺序执行,先证明无数据竞争和终止性,再用 push/pull 模型结合 SMT solver 对照实数域上的张量级规约证明功能正确性,并通过归纳式舍入误差界推断把保证扩展到浮点 PTX。
评估覆盖 FlashAttention-2、-3、-4、DeepSeek DeepGEMM 和 LinkedIn Liger Kernel 共 143 个 kernel 的 2,078 个实例:1,180 个实例被证明正确,其余实例中发现 66 个此前未知的正确性 bug(涉及 888 个实例),全部已报告给开发者。规约可在 kernel 的数千个实例间共享,并支持自动推断 tile 循环不变量,大幅降低人工验证成本。
TensorLean: Formal Verification of Production GPU Kernels
GPU kernels are the computational core of modern AI, yet a single correctness bug can silently corrupt frontier models and ML frameworks, putting training and inference at risk. Formal verification promises correctness across all inputs, launch configurations, and schedules, but it has never reached production GPU kernels. We present TensorLean, the first framework to formally verify production GPU kernels. To reduce manual effort, TensorLean verifies the kernel's compiled PTX against tensor-level specifications that can be shared across kernels and their thousands of instances. Given the kernel's PTX, TensorLean builds a symbolic happens-before graph over formalized PTX semantics to capture all valid inputs, launch configurations, and concurrent schedules in a single run. On this graph, it first verifies data-race freedom and termination, thereby reducing concurrent executions to finite, sequential ones. It then uses a push/pull model to compute PTX memory updates and proves their functional correctness against the specification over reals with SMT solvers. Finally, TensorLean extends the correctness guarantee to the kernel's actual floating-point PTX via inductive round-off bound inference. For scalability, TensorLean further automatically infers tile-loop invariants and decomposes proof goals via user-provided assertion hints. We mechanize the PTX semantics and soundness proofs in Lean 4 and evaluate TensorLean on 2,078 kernel instances covering all 143 kernels in FlashAttention-2, -3, and -4, DeepSeek DeepGEMM, and LinkedIn Liger Kernel. It proves 1,180 instances correct and uncovers 66 unique, previously unknown correctness bugs in 888 of the remaining instances, all reported to developers.
本条情报归属 AITOP「论文」核心栏目,重点聚焦北美前沿实验室与硅谷科技巨头。在跨区域产业观察坐标中,该动态直接关联「AI 开发者工具链、Coding Agent 与工程化实践」研究主线,反映出当前技术演进与商业落地的最新风向。涉及核心实体与技术议题包括:TensorLean、Lean 4、PTX、FlashAttention,读者可通过下方标签进入对应专题页查阅历史脉络与关联对比。
信源核验说明:本文原始信息发布自一手权威信源「arXiv: DeepSeek」(Tier-1 一手发布),具备高确定性参考价值。截至目前,全网已有 2 家独立信源对该事件进行交叉印证与跟进报道(含 Together AI 等),属于近期高关注度行业信号。
- Together AI12-03 19:40原文