arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.12466cs.LGcs.AIcs.CLcs.PLcs.SE
收藏

EquiBench:通过等价性检查基准评估大语言模型对程序语义的推理能力

EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking

Stanford University(斯坦福大学);MIT(麻省理工学院);Google(谷歌);Nanjing University(南京大学);Intel(英特尔)

Anjiang Wei, Jiannan Cao, Ran Li, Hongyu Chen, Yuhui Zhang, Ziheng Wang, Yuan Liu, Thiago S. F. X. Teixeira, Diyi Yang, Ke Wang, Alex Aiken

AI总结:

本文提出 EquiBench 基准,通过等价性检查评估大语言模型对程序语义的推理能力,发现现有模型在困难类别上仅略优于随机基线,且多依赖语法相似性而非真正的语义推理。

摘要:

随着大语言模型(LLMs)成为代码相关任务中不可或缺的一部分,一个核心问题浮现:LLMs 是否真正理解程序语义?我们引入了 EquiBench,这是一个通过等价性检查来评估 LLMs 的新基准,即判断两个程序是否对所有可能的输入产生相同的输出。与以往的代码生成基准不同,该任务直接测试模型对程序语义进行推理的能力。EquiBench 包含 2400 个程序对,涵盖四种语言和六个类别。这些程序对通过程序分析、编译器调度和超优化生成,确保了高置信度标签、非平凡的难度以及完全自动化。我们评估了 19 个最先进的 LLMs,发现在最具挑战性的类别中,最佳准确率分别为 63.8% 和 76.2%,仅略高于 50% 的随机基线。进一步分析表明,模型通常依赖语法相似性,而非展现出对程序语义的稳健推理能力,这凸显了当前的局限性。我们的代码和数据集已在 https://github.com/Anjiang-Wei/equibench 公开。

英文摘要:

As large language models (LLMs) become integral to code-related tasks, a central question emerges: Do LLMs truly understand program semantics? We introduce EquiBench, a new benchmark for evaluating LLMs through equivalence checking, i.e., determining whether two programs produce identical outputs for all possible inputs. Unlike prior code generation benchmarks, this task directly tests a model's ability to reason about program semantics. EquiBench consists of 2400 program pairs across four languages and six categories. These pairs are generated through program analysis, compiler scheduling, and superoptimization, ensuring high-confidence labels, nontrivial difficulty, and full automation. We evaluate 19 state-of-the-art LLMs and find that in the most challenging categories, the best accuracies are 63.8% and 76.2%, only modestly above the 50% random baseline. Further analysis reveals that models often rely on syntactic similarity rather than exhibiting robust reasoning about program semantics, highlighting current limitations. Our code and dataset are publicly available at https://github.com/Anjiang-Wei/equibench

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑