Reasoning Runtime Behavior of a Program with LLM: How Far Are We?

📄 arXiv: 2403.16437v3 📥 PDF

作者: Junkai Chen, Zhiyuan Pan, Xing Hu, Zhenhao Li, Ge Li, Xin Xia

分类: cs.SE, cs.CL

发布日期: 2024-03-25 (更新: 2024-09-21)

备注: Accepted by 47th IEEE/ACM International Conference on Software Engineering (ICSE 2025). Our REval leaderboard is available at https://r-eval.github.io


💡 一句话要点

提出REval框架以评估代码LLM的推理能力

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 代码推理 大型语言模型 评估框架 逻辑一致性 程序执行

📋 核心要点

  1. 现有的代码推理基准主要关注输入和输出的预测,忽视了程序执行过程中的中间行为和逻辑一致性评估。
  2. 本文提出了REval框架,旨在通过适配现有基准来全面评估代码LLM的推理能力和一致性。
  3. 大规模实证研究表明,当前大多数代码LLM在运行时行为推理和增量一致性评估上表现不佳,平均准确率仅为44.4%。

📝 摘要(中文)

大型语言模型(LLM)在代码理解和生成方面表现出色,但现有的代码推理基准不足,主要集中在输入和输出的预测上,忽视了程序执行过程中的中间行为和逻辑一致性。为了解决这些问题,本文提出了REval框架,用于评估代码LLM的推理能力和一致性。通过对现有基准的适配和大规模实证研究,发现大多数LLM在运行时行为推理和增量一致性评估上表现不佳,分别平均准确率为44.4%和IC得分为10.3,反映出加强代码推理能力的迫切需求。

🔬 方法详解

问题定义:本文旨在解决现有代码LLM推理能力评估不足的问题,特别是缺乏对程序执行中间行为和逻辑一致性的评估。现有基准主要集中在输入输出预测,未能全面反映模型的推理能力。

核心思路:提出REval框架,通过适配现有基准,增加对程序执行过程的中间行为和逻辑一致性的评估,旨在全面提升代码LLM的推理能力评估标准。

技术框架:REval框架包括多个模块,首先对现有基准进行适配,然后设计新的评估指标,最后通过大规模实验验证模型的推理能力和一致性。

关键创新:REval框架的核心创新在于引入了对程序执行中间行为的评估和逻辑一致性检查,这与传统方法的输入输出预测形成了本质区别。

关键设计:在REval框架中,采用了新的评估指标来量化运行时行为推理和增量一致性,具体参数设置和损失函数设计尚未详细披露,需进一步研究。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,当前大多数代码LLM在运行时行为推理的平均准确率仅为44.4%,而增量一致性评估的平均IC得分为10.3。这些结果表明,现有模型在推理能力上存在显著不足,亟需改进。

🎯 应用场景

该研究的潜在应用领域包括代码生成、自动化测试和软件开发工具等。通过提升代码LLM的推理能力,能够更好地支持开发者在编程过程中的决策,提高代码质量和开发效率。未来,REval框架有望成为评估代码LLM的重要标准,推动相关技术的进步。

📄 摘要(原文)

Large language models for code (i.e., code LLMs) have shown strong code understanding and generation capabilities. To evaluate the capabilities of code LLMs in various aspects, many benchmarks have been proposed (e.g., HumanEval and ClassEval). Code reasoning is one of the most essential abilities of code LLMs, but existing benchmarks for code reasoning are not sufficient. Typically, they focus on predicting the input and output of a program, ignoring the evaluation of the intermediate behavior during program execution, as well as the logical consistency (e.g., the model should not give the correct output if the prediction of execution path is wrong) when performing the reasoning. To address these problems, in this paper, we propose a framework, namely REval, for evaluating code reasoning abilities and consistency of code LLMs with program execution. We utilize existing code benchmarks and adapt them to new benchmarks within our framework. A large-scale empirical study is conducted and most LLMs show unsatisfactory performance on both Runtime Behavior Reasoning (i.e., an average accuracy of 44.4%) and Incremental Consistency Evaluation (i.e., an average IC score of 10.3). Evaluation results of current code LLMs reflect the urgent need for the community to strengthen the code reasoning capability of code LLMs. Our code, data, and \newname leaderboard are available at https://r-eval.github.io.