Lean Verified Transformers: human-written text, AI-written proofs of core invariants

srush_nlp · x · 2026-09-16

Srush released "Lean Verified Transformers": a project proving foundational Transformer invariants from scratch in Lean, including tensor parallelism, data parallelism, batch invariance, permutation invariance, correctness of tiling, and locality of sparse attention models.

The division of labor is notable: the text, comments, and structure are all human-written, while all the proofs are written by AI. The author argues that as proof costs decline rapidly and AI-generated code skyrockets, the value of verified code will climb; collaborating with AI to prove easy-to-understand properties is a natural middle ground. The post also serves as an advanced intro to Lean, inspired by TorchLean, Verified Deep Learning with Lean 4, and the Dex language.

Original post →

More from coding & agent

coding & agent channel →