← All papers
First page of LeanHardware: Bringing Formal Assurance to Vibe Hardware Development from Intent to RTL via Lean 4

LeanHardware: Bringing Formal Assurance to Vibe Hardware Development from Intent to RTL via Lean 4

Wenji Fang, Ziyi Yang, Peichen Xie, Xian Zhang, Ruize Tang, Tianyu Chen, Fan Yang, Jing Wang, Yao Lu, Mengming Li, Wenkai Li, Zhiyuan Yan, Hongce Zhang, Zhiyao Xie

cs.AR Dec 3, 2026 · v1
Translates LLM-generated Verilog into a Lean 4 RTL model and has LLM agents construct Lean-checked refinement proofs against executable Lean specifications.
As LLMs become increasingly capable of generating RTL, ensuring that AI-generated hardware faithfully implements designer intent remains a fundamental challenge. This requires addressing two correctness gaps: natural-language specifications may not accurately capture intended behavior, and generated RTL may not satisfy the resulting specifications. To address these challenges, we present LeanHardware, a formal-methods-based framework that brings end-to-end assurance to vibe hardware development from designer intent to RTL in two stages. In Stage 1, LeanHardware uses executable LeanSpec models to identify specification uncertainties through concrete execution and clarify intended behavior through designer feedback. In Stage 2, LeanHardware directly generates Verilog, translates it into LeanRTL using a deterministic parser, and constructs Lean-checked refinement proofs against the clarified LeanSpec reference models. Across 329 designs from four benchmarks, LeanHardware achieves 98%, 98%, 94%, and 91% functional correctness on VerilogEval, RTLLM, CVDP, and ChipBench, respectively. With the same backbone LLM, Stage 1 improves RTL correctness from 81.5% to 96.0% on corrected benchmarks, while Stage 2 establishes unbounded refinement proofs for 79.0% and 92.1% of designs against cycle-level and transaction-level specifications, respectively. Our results show that proof-guided correction further improves weaker LLMs, while for stronger LLMs, specification clarification drives most correctness gains and formal proving primarily provides certification.

LLM-generated RTL may not match designer intent. Natural-language specifications can be ambiguous, incomplete, or contradictory, and the generated RTL may not satisfy even a correct specification.

Stage 1 has an LLM formalize the specification into multiple executable LeanSpec models in Lean 4. Running these models on concrete inputs exposes ambiguity, incompleteness, and contradiction, which are resolved through clarification questions to the designer. Stage 2 generates Verilog directly, translates it with a deterministic parser into LeanRTL (a Lean 4 RTL semantics), and has an LLM agent build refinement relations, invariants, and lemmas proving that LeanRTL refines LeanSpec, checked by Lean 4.29.0.

Fig. 2: Overview of the two-stage LeanHardware workflow: (1) specification formalization and designer intent clarification, and (2) proof-guided RTL generation and certification.
Fig. 3: LeanHardware framework illustrated with a Hill cipher design from the CVDP benchmark. Stage 1 uses executable LeanSpec models and designer feedback to resolve specification ambiguity, incompleteness, and contradiction. Stage 2 generates Verilog, translates it into LeanRTL , and proves refinement against the clarified LeanSpec reference.

On 329 designs, final RTL reaches 98%, 98%, 94%, and 91% functional correctness on VerilogEval, RTLLM, CVDP, and ChipBench. Unbounded refinement proofs are fully completed for 79.0% of designs against cycle-level specifications and 92.1% against transaction-level specifications. A five-stage RISC-V CPU supporting 38 instructions was also verified against an ISA-level specification.

Fig. 4: RTL generation results before and after LeanHardware specification clarification.
Fig. 6: Ablation studies and LLM capability scaling.
MethodVerilogEvalRTLLMCVDPChipBench
Vanilla LLM (original spec)92%76%59%44%
LLM Review95%94%90%87%
SpecLens92%82%67%64%
LeanHardware98%98%94%91%
Functional correctness with clarified specifications