LARK: Lean-Assisted Reasoning for LLM-Generated GPU Kernels
On the map: LLM reasoning → Reasoning for agents, planning and code also fits: Test-time compute and efficient thinking
also in 1 more
Abstract (arXiv)
Efficient GPU kernels are typically low-level and hardware-specific, and LLM agents can now generate them faster than experts can verify. Existing approaches rely on testing, which provides evidence but not a guarantee of correctness. We introduce LARK, an agentic framework that automatically and formally verifies GPU kernels against their PyTorch reference implementations. LARK proves equivalence in functional and memory behavior under exact arithmetic and establishes a new trust boundary: human effort is only needed to verify operator-level Lean semantics ahead of kernel generation time, instead of checking every single line of generated code. LARK formalizes the GPU machine model and the semantics of each operation in Lean 4 once per target language, and the Lean 4 semantics of any incoming kernel is derived from these pre-built definitions. LLM agents then automate the proof in two steps. First, an agent decomposes the whole kernel semantics into smaller segments and Lean 4 verifies this segmentation, which addresses the intractability of proving equivalence for large kernels directly. Second, agents write Lean proofs that each kernel segment matches its high-level PyTorch counterpart. Together, the two steps give whole-program equivalence. We demonstrate that LARK can be used 1) to ensure correctness in existing code-generation agents and 2) to automatically verify human-written kernel libraries. On the KernelCraft GPU tasks, combined with a simple ReAct agent, LARK enables GLM 5.3 to fully verify 10 of 12 Level-1 kernels and Opus 5.5 all 5 Level-2 kernels. Moreover, over 10 production kernels randomly sampled from popular open-source LLM serving frameworks, LARK verifies 9 and identifies a new data race bug in the tenth. We believe LARK represents a significant step toward verifiable code generation in the agentic era.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 13 of its 36 references that are in the map. Submitted 1 Nov 2026.
Builds on
13 of 36 references.
References · 13
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 6,685
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,893
- 2025KernelBench: Can LLMs Write Efficient GPU Kernels?cited by 279
- 2025Kevin: Multi-Turn RL for Generating CUDA Kernelscited by 96
- 2025Evaluating Sakana's AI Scientist: Bold Claims, Mixed Results, and a Promising Future?cited by 42
- 2025TritonRL: Training LLMs to Think and Code Triton Without Cheatingcited by 28
- 2026DafnyPro: LLM-Assisted Automated Verification for Dafny Programscited by 15
- 2025ProofWright: Towards Agentic Formal Verification of CUDAcited by 13
- 2026Faults in Our Formal Benchmarking: Dataset Defects and Evaluation Failures in Lean Theorem Provingcited by 13
- 2026CAKE: Compiler-Agent Co-Design for Frontier Kernel Evolutioncited by 12
- 2025Equivalence Checking of ML GPU Kernelscited by 10
- 2026The Correctness Illusion in LLM-Generated GPU Kernelscited by 10
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026FastKernels: Benchmarking GPU Kernel Generation in Production
- 2026Formalizing PTX in Lean to Prove GPU Kernel Correctness
- 2026Improving Efficiency of GPU Kernel Optimization Agents using a Domain-Specific Language and Speed-of-Light Guidance
- 2026KernelOPT: Dispatch-Aware Agentic Search for GPU Kernel Optimization
- 2026CuTeGen: An LLM-Based Agentic Framework for Generation and Optimization of High-Performance GPU Kernels using CuTe
- 2025STARK: Strategic Team of Agents for Refining Kernels
- 2026AsmEvo: Agentic Assembly-Level Optimization of AMD GPU Kernels with Functional Equivalence Verification
- 2026KernelBenchX: A Comprehensive Benchmark for Evaluating LLM-Generated GPU Kernels