NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

VERINA: Benchmarking Verifiable Code Generation

Zhe Ye, Zhengxu Yan, Jingxuan He, Timothe Kasriel, Kaiyu Yang, Dawn Song

While Large Language Models (LLMs) excel at writing code, ensuring that their output is mathematically bug-free remains a massive challenge. This paper introduces VERINA (Verifiable Code Generation Arena), a comprehensive benchmark in Lean 4 that tests an LLM's ability to jointly generate code, formal specifications, and mathematical proofs. The results reveal a stark reality: while top models can write code and specs decently well, they fail spectacularly at generating proofs, highlighting a critical bottleneck in AI-automated software verification.

The Challenge of Verifiable Code Generation

LLMs are increasingly used to write software, but their probabilistic nature means they often generate subtle bugs or security vulnerabilities. Traditionally, the gold standard for software correctness is formal verification—writing mathematical proofs that code perfectly matches its intended specification. However, formal verification is notoriously expensive and requires highly specialized human experts.

The dream is to use LLMs to automate this entire pipeline: taking a natural language prompt and outputting the code, the formal specification, and the proof of correctness. This is called verifiable code generation.

Unfortunately, we lack good ways to measure if LLMs can actually do this. Existing benchmarks usually only test one isolated piece (e.g., just code generation, or just proof generation) or focus on older automated theorem provers. There is a critical need for holistic, modular benchmarks, especially for modern Interactive Theorem Provers (ITPs) like Lean 4, which are rapidly gaining traction in both mathematics and production software.

VERINA: A Holistic Evaluation Framework

To address this gap, the authors introduce VERINA, a benchmark built entirely in Lean 4 containing 189 manually curated, high-quality programming tasks. It evaluates three foundational tasks, both individually and composed together:

  1. CodeGen: Generating code from natural language (and optionally, a spec).
  2. SpecGen: Generating formal pre-conditions and post-conditions.
  3. ProofGen: Generating the Lean proof that the code satisfies the spec.
Compositional evaluation pipelines in VERINA

A Novel Specification Evaluator

A major technical contribution of VERINA is its specification evaluator. Automatically grading a generated specification is incredibly hard because there are many valid ways to write one. To check if an LLM's spec is sound and complete relative to the ground truth, VERINA uses a robust multi-stage pipeline.

The multi-stage specification evaluation pipeline

First, it prompts an LLM-based theorem prover to formally prove the equivalence. Because current LLMs often fail at this meta-proving task, the pipeline falls back to rigorous property-based testing. It runs the generated specs against VERINA's exhaustive suite of positive and negative test cases (which have 100% line coverage) to empirically verify soundness and completeness.

Key Insights and Results

The authors evaluated 12 state-of-the-art models, including general-purpose LLMs (like GPT-4o and Claude 3.7) and specialized provers (like DeepSeek Prover). The findings highlight significant hurdles in the path to fully automated verification:

  • Proof generation is the ultimate bottleneck: LLMs can write the code, and they can often guess the mathematical constraints (specs). But actually constructing the step-by-step logical proof in Lean to tie them together is currently beyond their capabilities. For example, OpenAI's o3 achieved a 72.6% pass@1 rate for CodeGen and 52.3% for SpecGen, but only a dismal 4.9% for ProofGen.
  • End-to-End failure: When asked to generate the code, spec, and proof from scratch, the best model (o3) achieved a success rate of just 3.2%.
  • Post-conditions are harder than pre-conditions: Models are relatively good at figuring out input constraints (e.g., "the array must not be empty"). They struggle significantly more with post-conditions, which require mathematically modeling the exact, complex relationship between inputs and outputs.
  • Specs help code, but code doesn't help specs: Providing an LLM with a formal specification improves its code generation. However, giving it the ground-truth code and asking for a spec actually drops performance. The verbose implementation details seem to confuse the model, causing it to over-constrain the spec.
  • Iterative refinement hits a wall: Allowing models 64 rounds of iterative feedback with the Lean compiler boosted proof success to ~20%, but at a massive increase in token cost and inference time. On complex problems, the LLM simply thrashes—more compute doesn't overcome fundamental gaps in logical reasoning.

Looking Forward

While VERINA provides a rigorous starting point, the benchmark is currently limited to 189 standalone algorithmic problems. Future work will need to scale this dataset using LLM-assisted annotation and extend the benchmark to Automated Theorem Proving (ATP) languages like Dafny or Verus. Most importantly, VERINA underscores that the community must focus on improving the underlying logical reasoning capabilities of LLMs if we are to achieve true verifiable code generation.

Summary updated

BibTeX
@inproceedings{ye2026verina,
  author = {Zhe Ye and Zhengxu Yan and Jingxuan He and Timothe Kasriel and Kaiyu Yang and Dawn Song},
  title = {{VERINA: Benchmarking Verifiable Code Generation}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=0A4Uf88pog},
}
Figure