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

VeriEquivBench: An Equivalence Score for Ground-Truth-Free Evaluation of Formally Verifiable Code

Lingfei Zeng, Fengdi Che, Xuhan Huang, Fei Ye, Xu Xu, Binhang Yuan, Jie Fu

As Large Language Models (LLMs) increasingly serve as our primary coding assistants, the stakes for code correctness are rising. While unit tests are the industry standard for evaluating code, they are fundamentally limited: they can prove the presence of bugs, but never their absence.

Formal verification—where a model co-generates code and a mathematical specification—is the "gold standard" for safety-critical systems. However, evaluating these systems is currently stuck in a bottleneck. Existing benchmarks (like CloverBench or DafnySynthesis) are tiny, focus on trivial tasks, and rely on human-written "ground truth" specifications. Shockingly, up to 28% of these "ground truth" specs in existing datasets actually contain errors or ambiguities.

To address this, researchers have introduced VeriEquivBench, a massive dataset of 2,389 complex algorithmic problems, alongside a novel "equivalence score" to evaluate LLM-generated code. By using formal verification to prove bidirectional alignment between code and specifications, it eliminates the need for error-prone human ground truth and reveals that even the best current models struggle with rigorous formal reasoning.

Methodology: Ground-Truth-Free Evaluation

The authors propose a paradigm shift: Ground-Truth-Free Evaluation. Instead of checking if a model's output matches a human's, they use the Dafny programming language and its automated theorem prover to check if the model's code and its own formal specification are mathematically equivalent.

Key components of this approach include:

  • The Equivalence Score: A formally grounded metric that checks for bidirectional implication. It asks two questions: 1) Does the code satisfy the specification? and 2) Does the specification tightly and unambiguously describe the code's behavior? This prevents models from "cheating" by providing overly vague specifications (e.g., a spec that only says "the function returns an integer").
  • Two-Step Validation: First, the system verifies the formal equivalence of the code and spec. Second, it translates the formal spec back into natural language so a user (or a judge LLM) can confirm it still matches the original intent.
Overview of the Ground-Truth-Free Evaluation framework, showing bidirectional equivalence checking and natural language translation.
  • Iterative Refinement: The framework uses a multi-stage pipeline where models generate, verify, and then "polish" code through up to ten rounds of feedback to eliminate syntax and logic errors.

Datasets: Introducing VeriEquivBench

The paper introduces VeriEquivBench, which is significantly larger and more difficult than previous efforts in the formal verification space.

The multi-pipeline framework used for generating and refining the VeriEquivBench dataset.

The dataset consists of:

  • Total Problems: 2,389 complex algorithmic tasks.
  • LeetCode Subset: 2,174 problems successfully transformed from the LeetCode corpus into the Dafny ecosystem.
  • TagComp: 215 entirely novel, synthetic problems generated via a "tag-composition" pipeline that combines different domains (e.g., Graph Theory), data structures (e.g., Disjoint Set Union), and algorithms (e.g., Depth-First Search).
  • Complexity: The average Cyclomatic Complexity (a measure of code paths) in VeriEquivBench is 5.63, compared to just 2.44 in previous benchmarks.

Key Insights and Results

The evaluation framework brings several critical insights to light regarding the current state of LLM code generation:

  • The Reliability Crisis in Benchmarks: The discovery that nearly a third of existing "expert-written" specifications are flawed highlights why we cannot rely on static ground truths for formal reasoning tasks.
  • Verifiability $\neq$ Correctness: A model can generate code that passes a verifier by writing a "weak" specification. The Equivalence Score is essential because it forces the model to be precise; if the spec is too loose, the bidirectional proof fails.
  • Performance Collapse on Complex Tasks: Current LLMs are "hacking the reward" on simple benchmarks. While Claude-4-sonnet solves ~75% of the simpler CloverBench, it failed on all instances of the more complex VeriEquivBench under the strict pass@4 evaluation metric.
  • Mutual Equivalence is Rare: Even when models generated syntactically correct Dafny code (which Claude-4 did ~74% of the time), they rarely achieved true mutual equivalence between code and spec. GPT achieved the highest rate at only 2.65%.
  • Translation Success: The authors validated that models like Grok-4 are highly capable (82.98% success rate) at translating formal specifications back into natural language, supporting the "human-in-the-loop" part of their pipeline.

Limitations and Future Work

While VeriEquivBench represents a major step forward, challenges remain. Dafny has a steep learning curve and strict requirements for how logic is expressed; sometimes a model's logic is correct, but the verifier rejects it because it isn't written in a specific "Dafny-friendly" way. Furthermore, while the Equivalence Score proves the code matches the spec, it doesn't perfectly prove the spec matches the user's original messy natural language intent without a final check.

Looking ahead, the authors suggest using this benchmark to train "self-evolving" agents. By using the Equivalence Score as a reinforcement learning signal, future models could iteratively improve their own formal reasoning abilities, moving us closer to truly reliable autonomous coding agents.

Summary updated

BibTeX
@inproceedings{zeng2026veriequivbench,
  author = {Lingfei Zeng and Fengdi Che and Xuhan Huang and Fei Ye and Xu Xu and Binhang Yuan and Jie Fu},
  title = {{VeriEquivBench: An Equivalence Score for Ground-Truth-Free Evaluation of Formally Verifiable Code}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=tRRHVUwP2B},
}
Figure