TL;DR
As frontier LLMs saturate existing coding benchmarks, passing a suite of tests is no longer a reliable signal of true code correctness. This paper argues for a shift to proof-based evaluation, where models must provide machine-checkable formal proofs (in languages like Lean 4) to guarantee their code satisfies a specification for all possible inputs, not just a handful of test cases.
What Problem Does This Paper Address?
We are currently witnessing the "saturation" of test-based benchmarks. Popular evaluations like HumanEval are effectively "solved," yet the code produced by LLMs often contains subtle, "test-invisible" bugs.
The authors identify three fundamental failures of current testing regimes:
- Empirical Cascades: When a benchmark is saturated, researchers release "plus" versions with more tests, which models eventually saturate again, leading to a never-ending arms race that never reaches a universal correctness guarantee.
- Statistical Limits (Goodhart’s Law): Because models are trained to maximize test-pass rates, they learn to produce "plausible" code that satisfies the test oracle rather than semantically correct code.
- Mathematical Limits: Tests are finite. They cannot establish universal properties over infinite domains (e.g., "this works for all integers") or decide uncomputable properties like whether a program will always terminate.
Methods
The authors propose a five-way classification pipeline to evaluate LLM-generated code more rigorously:
- Typecheck: Does the code compile?
- #guard Tests: Does it pass a suite of unit tests?
- Spec Proof: Can the model produce a machine-verified proof that the code satisfies its formal specification?
- Negation Proof: If it can't prove correctness, can it prove the code is wrong by finding a counterexample?
- Prover-limited: If the code passes tests but the model can neither prove nor disprove it within a fixed budget, it falls into this "uncertainty" zone.
The researchers used Lean 4 as their formal verification language and provided LLMs with compiler feedback to allow for multiple "retries" during proof generation.
Datasets
The study evaluates frontier models (using snapshots dated into 2025/2026, such as Claude Opus 4.6 and GPT-5.1) across three primary sources:
- Verina: 189 Lean 4 tasks ranging from basic to advanced logic.
- VeriBench: 153 tasks including ports of HumanEval, Python standard library functions, and classical algorithms.
- SWE-Bench Case Studies: The authors hand-formalized six real-world bugs from major libraries (SymPy, scikit-learn, astropy) to show that formal specifications can distinguish buggy code from fixes in cases where existing repository tests fail.
Key Insights and Ideas
- The "Prover-Limited" Gap: A massive discrepancy exists between a model's ability to write code that passes tests and its ability to prove that code is correct. This suggests that LLMs are currently "guessing" correct-looking code without a deep "understanding" of the underlying logic.
- Tests are Sound but Incomplete: While unit tests caught about 40% of bugs in their experiments, they missed the "subtler bugs" that return plausible values on every test input but fail on edge cases.
- Bug-Separating Specifications: You don't need to formally verify an entire massive repository to get value. By writing small "regression specs" for specific bugs, developers can create a much stronger "oracle" than a simple unit test.
Key Results
- Saturation is Real: On recent Claude snapshots, test-pass rates reached 100% on some benchmarks, while proof-pass rates remained in the single digits.
- The Gap is Wide: For Verina, roughly 60% of Claude’s outputs fell into the "prover-limited" zone—meaning the code passed every test, but the model couldn't prove it was actually right.
- Real-World Impact: In the SWE-Bench case studies, the authors demonstrated that formal specs caught famous bugs (like the binary search overflow or SymPy's derangement generator error) that had evaded standard test suites for years.
Limitations and Future Work
- Authoring Cost: Writing formal specifications is significantly harder and more expensive than writing unit tests. The authors suggest "autoformalization-in-the-loop" (using AI to help write the specs) as a solution.
- Infrastructure Gaps: Current formal verification tools are best suited for pure mathematical functions. Extending this to "real-world" code—which involves file systems, concurrency, and complex state—is an ongoing challenge (e.g., the CSLib project).
- Gaming the System: There is a risk of "vacuous truth," where a model might try to write a specification that is technically true but meaningless (e.g.,
if P then True). This requires human-in-the-loop auditing of the specifications themselves.
Summary updated