构建首个全流程代码可验证生成评测基准,推动AI写代码更可靠。
VERINA: Benchmarking Verifiable Code Generation
- 设计包含代码、规格说明与证明的联合生成评测框架
- 主流模型在证明生成上仅4.9%成功率,凸显验证瓶颈
- 适合研究可验证AI编程与形式化验证的学者使用
大型语言模型(LLMs)正深度融入软件开发,但确保其生成代码的正确性仍具挑战,常需高昂的人工审查。可验证代码生成——即同时生成代码、规格说明及代码-规格对齐的证明——为突破这一限制提供了新路径。然而当前评估存在明显缺口:多数基准仅关注单一组件,缺乏对全流程的综合评估。本文提出VERINA(Verifiable Code Generation Arena),一个高质量基准,支持对代码、规格说明和证明生成及其组合的全面、模块化评估。VERINA包含189个在Lean中手工构建的编码任务,每个任务均配有详细问题描述、参考实现、形式化规格说明和完整的测试套件。我们对先进LLMs的广泛评估发现,可验证代码生成面临显著挑战,尤其在证明生成方面,凸显了改进基于LLM的定理证明器在验证领域的重要性。最佳模型OpenAI o3在单次尝试下仅达到72.6%的代码正确率、52.3%的规格完整性与严谨性,以及4.9%的证明成功概率。我们希望VERINA能通过提供严谨全面的评测标准,推动可验证代码生成领域的进步。数据集已发布于https://huggingface.co/datasets/sunblaze-ucb/verina,评估代码开源于https://github.com/sunblaze-ucb/verina。
原文摘要 · Abstract (English)
Large language models (LLMs) are increasingly integrated in software development, but ensuring correctness in LLM-generated code remains challenging and often requires costly manual review. Verifiable code generation -- jointly generating code, specifications, and proofs of code-specification alignment -- offers a promising path to address this limitation and further unleash LLMs' benefits in coding. Yet, there exists a significant gap in evaluation: current benchmarks often focus on only individual components rather than providing a holistic evaluation framework of all tasks. In this paper, we introduce VERINA (Verifiable Code Generation Arena), a high-quality benchmark enabling a comprehensive and modular evaluation of code, specification, and proof generation as well as their compositions. VERINA consists of 189 manually curated coding tasks in Lean, with detailed problem descriptions, reference implementations, formal specifications, and extensive test suites. Our extensive evaluation of state-of-the-art LLMs reveals significant challenges in verifiable code generation, especially in proof generation, underscoring the need for improving LLM-based theorem provers in verification domains. The best model, OpenAI o3, achieves a 72.6\% code correctness rate, 52.3\% for specification soundness and completeness, and a mere 4.9\% proof success rate (based on one trial per task). We hope VERINA will catalyze progress in verifiable code generation by providing a rigorous and comprehensive benchmark. We release our dataset on https://huggingface.co/datasets/sunblaze-ucb/verina and our evaluation code on https://github.com/sunblaze-ucb/verina.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。