CodeSpecBench finds LLMs struggle to turn code behavior into executable specifications
A new arXiv benchmark tests whether large language models can express what code actually does, and results show sharp drops on repository-level tasks.
In plain words
Researchers built a benchmark that asks AI models to write executable specifications, which are checks describing what a program should and should not do. The best of 15 tested models passed only about 20% of the hardest, whole-repository tasks. Writing these checks proved harder for models than writing code itself.
What was announced
The authors of CodeSpecBench say that while large language models can generate code from natural-language prompts, how well they capture intended program behavior remains unclear. The benchmark encodes specifications as executable Python functions built from real-world codebases, and evaluates them by checking whether they accept valid behaviors and reject invalid ones. It covers both function-level and repository-level tasks under an execution-based protocol.
When the researchers evaluated 15 state-of-the-art LLMs, they report a sharp performance drop on repository-level tasks, with the best model reaching only a 20.2% pass rate. They also found specification generation substantially more challenging than code generation, suggesting strong coding results do not necessarily reflect deep understanding of program semantics. The data and code are available on GitHub.
What it does not show
- The evidence is the paper's abstract, so evaluation details, task construction and model list cannot be verified beyond what the authors state.
- The reported pass rates come from the authors' own benchmark and have not been independently confirmed.
Sources
Source-support review completed 5 Dec 2026. This story was drafted with AI assistance and checked against retained source passages. Automated checking is not independent verification.
Coverage: arXiv: abstract.
Updates and corrections
No corrections so far.
First published 5 Dec 2026
New to the subject? AI from the Ground Up starts from the beginning.