Proving LLM-Generated GPU Kernels Correct and Safe: Floating-Point Verification in Lean and VerCors
Archibald Browne, Eugene Lee, Cristopher Salvi
Key points
From the paper's conclusion- Our main contribution to the formal verification of LLM- generated GPU kernels is showing that a combination of Lean automation and language-model-guided proof construction can verify a broad set of basic neural- network building blocks over floating-point values, allowing LLMs to implement semantically correct and safe kernels.
Abstract
Modern statistical model development begins with a high-level specification in an automatic differentiation framework such as PyTorch, JAX, or TensorFlow, which is then lowered to a target backend by a compiler or implemented manually by a research engineer. In this paper, we study whether frontier language models can correctly perform the latter task by generating GPU kernels from high-level benchmark specifications. We introduce a framework in which a language-model agent uses Velvet, a program verifier for imperative programs embedded in Lean, to prove semantic equivalence between a high-level specification and a generated CUDA kernel under an explicit set of assumptions. It also asks the LLM to prove thread safety and data race freedom of the generated kernel in VerCors, a deductive verifier for parallel code. Our main contribution to the formal verification of LLM- generated GPU kernels is showing that a combination of Lean automation and language-model-guided proof construction can verify a broad set of basic neural- network building blocks over floating-point values, allowing LLMs to implement semantically correct and safe kernels. In our framework, floating-point verifications never rely on compiled code and are always checked via the Lean kernel.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- LARK: Lean-Assisted Reasoning for LLM-Generated GPU KernelsarXiv · 2026
- Equivalence Checking of ML GPU KernelsProceedings of the ACM on Programming Languages · 2026
- Formalizing PTX in Lean to Prove GPU Kernel CorrectnessarXiv · 2026
- KernelAudit: Contract-Aware Auditing of Validators for LLM-Generated GPU KernelsarXiv · 2026
- KernelArmor: End-to-End Agentic System for Establishing Memory and Thread Safety for CUDAarXiv · 2026
- Learning Lean Feedback for Efficient Proof-Candidate Evaluation on GPUsarXiv · 2026