@AnimaAnandkumar: TorchLean codebase is now available! TorchLean is a Lean 4 framework for verified neural-network software. It supports …
Summary
TorchLean is a newly released Lean 4 framework that enables formal verification of neural network software, featuring typed tensors, verified autograd, PyTorch interoperability, and GPU execution. The release expands support to modern architectures like diffusion models, GPT-style transformers, and state-space models, bridging practical ML workflows with mathematical proof checking.
View Cached Full Text
Cached at: 05/11/26, 10:46 PM
TorchLean codebase is now available! TorchLean is a Lean 4 framework for verified neural-network software. It supports typed tensors, runnable training, graph IRs, verified autograd, Float32/IEEE semantics, CROWN / IBP-style verification, certificate checking, PyTorch interop, and CUDA/GPU execution. After feedback and comments on our original post, we expanded TorchLean substantially: neural operators/FNOs, diffusion models, GPT-style text models, GPT-2-style runs, Mamba/state-space models, RL, 3D vision certificates, Bug Zoo case studies, PyTorch interop, and more. Project page: https://lean-dojo.github.io/TorchLean/ Codebase: https://github.com/lean-dojo/TorchLean… @Robertljg, Jennifer Cruden, Will Adkisson, Xiangru Zhong, @huan_zhang12 @caltech #MachineLearning #ScientificComputing #Lean #FormalVerification
TorchLean
Source: https://lean-dojo.github.io/TorchLean/ TorchLean formalizes neural network infrastructure in Lean 4, connecting typed tensor and layer specifications, runnable training examples, graph IR semantics, floating-point contracts, CUDA trust boundaries, and artifacts that Lean checkers can inspect.
The goal is a practical bridge between modern ML workflows and formal reasoning: models can be executed, lowered, inspected, imported from PyTorch-style pipelines, and checked against explicit mathematical contracts.
What TorchLean Gives You

Where It Fits
TorchLean sits between the software people already use and the proof artifacts they want to trust. The project is written inLean 4and uses a PyTorch-style surface where that makes model code easier to read. For the Python ecosystem, see the officialPyTorch documentation; for Lean itself, start with theLean documentation.
Paper / Citation
@misc{george2026torchleanformalizingneuralnetworks,
title={TorchLean: Formalizing Neural Networks in Lean},
author={Robert Joseph George and Jennifer Cruden and Xiangru Zhong and Huan Zhang and Anima Anandkumar},
year={2026},
eprint={2602.22631},
archivePrefix={arXiv},
primaryClass={cs.MS},
url={https://arxiv.org/abs/2602.22631},
}
Similar Articles
@leloykun: [WIP] Blog post on Lean4-to-TileLang Tensor Program Superoptimizer here:
A technical blog post introduces a Lean4-to-TileLang tensor program superoptimizer that automatically generates optimized GPU/TPU kernels and hyperparameter scaling laws, demonstrating performance gains over torch.compile.
@PyTorch: PyTorch 2.12 introduces major updates across compilation, export, distributed training, and accelerator support. Highli…
PyTorch 2.12 release includes major updates to compilation, export, distributed training, and accelerator support, with up to 100x faster batched linalg.eigh on CUDA and new APIs like torch.accelerator.Graph.
Lean4Agent: Formal Modeling and Verification for Agent Workflow and Trajectory
Introduces Lean4Agent, a framework using Lean4 for formal modeling and verification of agent workflows and trajectories, demonstrating improved performance on SWE-Bench and ELAIP-Bench.
Discover and Prove: An Open-source Agentic Framework for Hard Mode Automated Theorem Proving in Lean 4
This paper introduces Discover and Prove (DAP), an open-source agentic framework for automated theorem proving in Lean 4 that tackles 'Hard Mode' problems where the answer must be discovered independently before formal proof construction. The work releases new Hard Mode benchmark variants and achieves state-of-the-art results while revealing a significant gap between LLM answer accuracy (>80%) and formal prover success (<10%).
TorchKM: A GPU-Oriented Library for Kernel Learning and Model Selection
TorchKM is an open-source GPU-accelerated library for kernel machines (SVMs, kernel logistic regression, etc.) with a scikit-learn-style API. It accelerates training and model selection by reusing matrix operations, offering substantial speedups over standard baselines.